hardfault issue with modified ble_app_uart_c example

Greetings!

I have modified the "ble_app_uart_c" example from SDK v17.1.0 to be used to scan for and control our BLE-enabled devices via a terminal emulator. When we use the nRF52-DK as a simple UART-to-BLE bridge, we don't have any issues, but we also use the DK to send a firmware file over-the-air to upgrade our devices, and that's when I discovered this issue. Here's a brief overview of the update procedure:

A custom PC application reads 32-bit words from a text file and sends them one at a time to the nRF52-DK. The DK stores these values in a buffer until one page of data (264 bytes) is received. At that point the DK divides the page into 17 BLE packets, each containing 3 bytes of header data and 4 words of firmware data (except for the 17th one, which contains 2 words), and sends each packet to the device. The device then writes the page to flash and sends an acknowledgement, after which the process begins again until the entire firmware file is transferred. 

I am experiencing a hardfault during the OTA update at a consistent point (it gets ~20% of the way through the transfer, maybe 100 pages of data), and I am having trouble determining the root cause. Attached is a stack dump of when the fault occurs. If I am understanding this post  correctly, then the offending line of code is at 0x2'BB48, which, when cross-referencing the map file, is within nrf_queue_generic_pop(). I also attached the top-level application (see link below). I am using gcc, so the map file is under ble_app_uart_c/pca10040/s132/armgcc/_build/. I'm assuming this will eventually end up being my application code mishandling Nordic's libraries in some manner, but I was hoping that someone else might be able to take a look and offer some guidance for debugging this further. I tried to follow the hardfault handling instruction on the SDK InfoCenter page, but I don't think it made a difference. 

Any help would be greatly appreciated, at this point I'm out of ideas.

Thanks in advance,

Max

8863.ble_app_uart_c.zip

Parents Reply Children
No Data
Related