Firmware for the CommonSense project.
| .cargo | ||
| src | ||
| .gitignore | ||
| build.rs | ||
| Cargo.lock | ||
| Cargo.toml | ||
| Dockerfile | ||
| LICENSE | ||
| memory.x | ||
| README.md | ||
| s112_nrf52_7.3.0_softdevice.hex | ||
| s132_nrf52_7.3.0_softdevice.hex | ||
CommonSense
Firmware for the CommonSense project.
Compile and Run
The firmware depends on the S132 softdevice. Before running the firmware, the softdevice has to flashed to the chip.
Flashing the Softdevice
- Erase the chip
$ probe-rs erase --chip nRF52832_xxAA - Flash the softdevice
$ probe-rs download --verify --binary-format hex --chip nRF52832_xxAA s132_nrf52_7.3.0_softdevice.hex
Compile and Run
- Install the required tools. Consult
Dockerfilefor specifics - Build the firmware
$ cargo build --release - Flash / run the firmware
$ cargo fr $ # OR $ cargo run --release
Compile and Run using Docker
- Build the docker image
$ docker build . -t commonsense - Build the firmware
$ docker run --rm -v $PWD:$PWD -w $PWD -u $(id -u):$(id -g) commonsense cargo build --release - Flash / run the firmware
$ docker run --privileged -v /dev/bus/usb/:/dev/bus/usb --rm -v $PWD:$PWD -w $PWD -u $(id -u):$(id -g) commonsense cargo fr $ # OR $ docker run --privileged -v /dev/bus/usb/:/dev/bus/usb --rm -v $PWD:$PWD -w $PWD -u $(id -u):$(id -g) commonsense cargo run --release
Notes
- If flashing fails after being successful the first time, take a look at this: https://users.rust-lang.org/t/probe-rs-fails-to-work-after-first-time-use-successful/103234
- This may be useful for unit testing: https://crates.io/crates/embedded-test
- Currently this project is being developed on the nrf52-dk board with the
nrf52832 chip. When mature enough, it will be ported to the nrf52810 to run
on the actual hardware. Locations to modify:
memory.x- consult the nrf-softdevice documentation for more informationCargo.toml- change thenrf52832feature tonrf52810.cargo/config.toml- change thenrf52832chip tonrf52810
- TODO: Find out how to properly set up the license (the softdevice is proprietary)
- If the device locks up, use the nrf-recover utility
- Pinning to use nRF52DK as programmer
- For examples of how to use embassy to program nRF chips, see https://github.com/embassy-rs/embassy/tree/main/examples (and look for nrfXXX)