rustphone/README.md

137 lines
3.4 KiB
Markdown
Raw Normal View History

2023-08-20 09:31:46 +00:00
# Rustphone
(temporary name) (early development)
OS for a dumbphone based on Maduino Zero 4G LTE board.
2023-09-16 22:15:48 +00:00
## Goals
GSM will be shutting down in France in a few years so if you have an old cellphone and don't want to buy a fancy, spying, expensive smartphone, making your own 4G cellphone is an interesting option.
* Low cost
* Privacy
* Long battery life (this one will be complicated)
* Low-consumption components
* Use less CPU cycles
* Update display less often
* Use less wireless RX/TX
* Usable for basic things (call, messages, agenda, contacts, notepad)
* Customizable (smartphones don't do exactly what I want)
* (long term) Mesh networking and other cool stuff
2023-08-20 09:31:46 +00:00
## Install tools
```bash
2023-10-07 11:33:14 +00:00
# Choose one line depending on your distro
2023-08-20 09:31:46 +00:00
sudo pacman -S arm-none-eabi-gcc
2023-10-07 11:33:14 +00:00
sudo apt install gcc-arm-none-eabi
# Install Rust target
2023-08-20 09:31:46 +00:00
rustup target add thumbv6m-none-eabi
```
## Run simulator
```bash
2023-09-11 20:22:20 +00:00
cargo run --features simulator
2023-08-20 09:31:46 +00:00
```
## Build
```bash
2023-08-21 21:27:37 +00:00
cargo build --release --target thumbv6m-none-eabi
2023-08-20 09:31:46 +00:00
```
2023-10-07 11:33:14 +00:00
Read usb:
```bash
cat /dev/serial/by-id/usb-2222_3333-if00
```
2023-08-20 09:31:46 +00:00
## Pins
* D2
* D3
* D4
* D5 (internally assigned): modem power
* D6 (internally assigned): modem reset
* D7 (internally assigned): flightmode
* D8
* D9
* D10
* D11
* D12
* D13
* A0
* A1 (internally assigned): vbat
* A2 (internally assigned): vsys
* A3
* A4
* A5
* SDA: I2C
* SCL: I2C
2023-08-21 21:27:37 +00:00
Used pins:
* display SPI: 3 pins
* keypad: 6 pins (74HC565+75HC165), maybe 5 if the same clock is used
* display LED: 1 pin
* torch LED: 1 pin
* ESP UART: 2 pins (I2C still possible if not enough pins)
Note: at most 5 outputs of the 74HC565 may be used as GPO.
2023-08-20 09:31:46 +00:00
## components
2023-09-16 22:15:48 +00:00
* https://www.makerfabs.com/maduino-zero-4g-lte-sim7600.html
* https://www.waveshare.com/1.54inch-e-Paper-Module.htm1
* https://bulkmemorycards.com/shop/microsd-cards/microsd-32gb/sd-32gb-class-10/32gb-microsd-ultra-sandisk-memory-card-2/
* Maybe an ESP for WIFI and Bluetooth: https://www.sparkfun.com/products/18034
2023-08-20 09:31:46 +00:00
## crates
2023-09-16 22:15:48 +00:00
* bitmap-font ?
* https://lib.rs/crates/at-commands OR https://lib.rs/crates/atat
* https://crates.io/crates/embedded-menu
2023-08-20 09:31:46 +00:00
## Apps
* Calculator
* Config
* Contacts
* Journal
* Play audio
* Send call
* Send message
* Show bitmap
## Keypad
Optimized to reduce the number of consecutive presses on the same key in French.
2023-09-16 22:15:48 +00:00
For example, the letters _m_, _o_, _n_ are on the same key `MNO6` but they frequently appear consecutively in French, so you have to wait between each letter. Having them on three different keys solves this problem.
```
2023-08-20 09:31:46 +00:00
ncb1 upz2 tdk3
eow4 lqh5 age6
sfx7 rmj8 ivy9
2023-09-16 22:15:48 +00:00
```
2023-10-07 11:33:14 +00:00
## OS
In case we switch to some more powerful MCU like ESP32.
Using an RTOS would be better than creating a monolithical horror. It would also make it easier to split the software into modular programs and store some programs in different memories (e.g. store kernel in internal flash and user programs in SPI flash).
Rusty embedded RTOS's:
* https://bern-rtos.org/
* does not support Xtensa
* supports Cortex-M
* does not seem to support dynamic programs
* https://www.drone-os.com/
* does not support Xtensa
* supports Cortex-M
* explicitly does not support dynamic programs
Needs:
* Kernel writes user programs to SPI flash (can it be done via chip programming or has it do be done by kernel? then USB, SD, debug probe, UART??)
* Handle hardware-specific work (provide high level interfaces for GPIO, SD, screen, modem, wifi, bluetooth...)
* Dynamic threads