This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to send firmware to SMT32 over UART?

Hi team, there is nRF52840 connected to STM32 via UART, the goal is to receive STM32 firmware over BLE (using nRF52840) and send the firmware to STM32 via UART.

My goal is the following: receive the portion of the STM32 firmware and send it to STM32 via UART WITHOUT accumulation it in nRF flash (bank1).

I have been trying to do this for a while and managed to achive some results. So far result is the following:

1. if .bin file (STM32 firmware) is less than 4096 bytes (page size of nRF52840) it sends correctly to STM32,

2. if .bin file is > 4096 it is devided on 2 parts (the first is 4096 and the second is the rest), so the first part sends correctly while the second not. The problem is related to CRC calculation. After the first part has been send nRF calculates CRC and sends either notification to nRFConnect or the CRC itself in order to get the rest of the firmware (I'm not sure of this, please correct me if I'm wrong). So I see 2 possible scenarios how to achive the goal:

1. Skip CRC calculation step and force nRF request nRFConnect to send the rest of the firmware (if it is possible, please clarify how to do this) this idea is preferrable!!!;

2. Use only ONE flash page in nRF (4096), so receive the first part->calculate CRC->send it to STM32->erase first page (i guess this idea is not good, because erasing can take for a while);

I would appriciate any help on this issue. Thanks

Related