Add troubleshooting note about fixing locked up core
This commit is contained in:
parent
c8b684dd90
commit
629396e404
57
README.md
57
README.md
@ -68,3 +68,60 @@ softdevice has to flashed to the chip.
|
||||
[nrf-recover](https://docs.rs/crate/nrf-recover/latest) utility
|
||||
- [Pinning to use nRF52DK as programmer](https://devzone.nordicsemi.com/f/nordic-q-a/14058/external-programming-using-nrf52-dk)
|
||||
- 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)
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Core locking up
|
||||
|
||||
One possible cause for the core to lock up is to have a flash memory
|
||||
configuration that doesn't match the selected softdevice.
|
||||
|
||||
#### Background
|
||||
|
||||
When the device powers up, it looks for certain things at certain positions
|
||||
in memory, namely the interrupt vector table and the program entrypoint.
|
||||
The interrupt vector table and entrypoint it finds are from the softdevice.
|
||||
After initialization, the softdevice then attempts to hand over control to the
|
||||
user program. The user program again has an interrupt vector table and an
|
||||
entrypoint that are expected to be at a certain position in memory.
|
||||
Specifically, they are expected to be right after the softdevice. If they are
|
||||
not there, the device enters a hard fault state and locks up the core.
|
||||
|
||||
This means that the flash memory configuration in `memory.x` has to be correct
|
||||
for the program to start up properly:
|
||||
|
||||
```
|
||||
MEMORY
|
||||
{
|
||||
FLASH : ORIGIN = 0x00000000 + <softdevice size>, LENGTH = <flash memory size> - <softdevice size>
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
The softdevice size can be found in the release notes of the softdevice. This
|
||||
is a pdf that is downloaded along with the hex file from the nordic website.
|
||||
The flash memory size depends on the model of microcontroller used.
|
||||
|
||||
#### Solution
|
||||
|
||||
1. Make sure `memory.x` is configured correctly for the selected softdevice. E.g., for `S112` running on an `nRF52832` chip:
|
||||
```
|
||||
MEMORY
|
||||
{
|
||||
FLASH : ORIGIN = 0x00000000 + 100K, LENGTH = 512K - 100K
|
||||
RAM : ORIGIN = 0x20000000 + 30K, LENGTH = 64K - 30K
|
||||
}
|
||||
```
|
||||
2. Recover the device from it's locked state. This erases the flash memory:
|
||||
```
|
||||
$ probe-rs erase --chip nRF52832_xxAA --allow-erase-all
|
||||
```
|
||||
4. Compile and flash the program:
|
||||
```
|
||||
$ cargo run --bin blinky --release
|
||||
```
|
||||
The program will not run successfully at this time, as it requires the softdevice to be flashed as well.
|
||||
2. Flash the desired softdevice, e.g., `S112`:
|
||||
```
|
||||
$ probe-rs download --verify --binary-format hex --chip nRF52832_xxAA s112_nrf52_7.3.0_softdevice.hex
|
||||
```
|
||||
|
||||
Loading…
Reference in New Issue
Block a user