UART COMM: Illegal use of the EPSR

Hello,

the time to ask for help has come again...

I keep hitting a crash in my BM833 code related to "Illegal use of the EPSR".

Code is fairly simple and supposed to be pretty similar to the peripheral_uart example. This is with nRF Connect SDK v2.9.1.

The BM is wired to a STM via UART and n packets of 135 bytes are received by the BM. 

For debugging purposed, there is a hardcoded delay of 1 second between any 2 packets of 135 bytes.

The uart and ble inits are done in the main() and then main() sits there and reads some pio state in an endless loop (with a delay between iteration).

The uart_cb and ble_write_thead functions are fairly similar to the ones in the peripheral_uart example.

Note that I modified the handling of the UART_RX_BUF_REQUEST event in uart_cb() in order to not have 2 buffers. 

This is for debugging as I had the crash even before doing that modification.

Note that in my case, to keep things simple, my code waits for an incoming ble connection (done with app nRF Connect on an Android phone) but there is no data being sent over bluetooth. 

So in the end, this code works for a random number of packet then crashes with that type of message: (thread context may change)

[00:00:26.103,820] <inf> pio: BUSY
[00:00:26.107,604] <inf> uart: RX_RDY
[00:00:26.107,635] <inf> uart: RX_B_RL_PUT
[00:00:26.107,635] <inf> uart: RX_DIS
[00:00:26.107,757] <inf> pio: READY
[00:00:26.107,788] <inf> uart: p#7
[00:00:27.107,330] <inf> uart: RX_BRQ
[00:00:27.107,910] <inf> pio: BUSY
[00:00:27.109,832] <err> os: ***** USAGE FAULT *****
[00:00:27.109,863] <err> os:   Illegal use of the EPSR
[00:00:27.109,863] <err> os: r0/a1:  0x20000b48  r1/a2:  0x200020d8  r2/a3:  0x00000005
[00:00:27.109,893] <err> os: r3/a4:  0x00030a3e r12/ip:  0x00000001 r14/lr:  0x0002c56d
[00:00:27.109,893] <err> os:  xpsr:  0x20000038
[00:00:27.109,924] <err> os: Faulting instruction address (r15/pc): 0x00030a3e
[00:00:27.109,954] <err> os: >>> ZEPHYR FATAL ERROR 35: Unknown error on CPU 0
[00:00:27.109,954] <err> os: Fault during interrupt handling

[00:00:27.110,015] <err> os: Current thread: 0x20003630 (sysworkq)
[00:00:27.357,147] <err> os: Halting system

UART_BUF_SIZE used in struct uart_data_t is 136 (not 135).
CONFIG_HEAP_MEM_POOL_SIZE=2048
CONFIG_MAIN_STACK_SIZE=1024

UART_WAIT_FOR_RX is 1ms.


the prj.conf as well as the rest of the code is attached to that email.

Any help on how to debug this more is welcome, I've spent way too much time on trials and erros, I'm stuck.

Best regards,
Alex

peripheral_uart_app_only (Copy).zip

Parents Reply Children
No Data
Related