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

Extend Serial DFU

Hi,

as i mention in https://devzone.nordicsemi.com/f/nordic-q-a/44924/dfu-serial-failed i have f ramming error now and then when i do DFU over serial.

My idea was to write some code in nrf_dfu_serial_uart.c to make a better validation of data that was received, request a replay if the data was corrupted or send CRC back to the master and when the data is OK send it to the application. So in the uart_event_handler i would collect data and when the data is OK i would pass it to on_rx_complete.

That works fine. The issue i am having is:

  • on_rx_complete expects nrf_dfu_serial_t *p_transport which i don't have any more if i collect and validate the data in another part of the code. A workaround would be to save the last context in a global variable and send it to the function when the data is ready. Is this OK?
  • if the data is corrupted i would want to report this to the master but i could not send the message from uart_event_handler, i got error 17 from nrf_drv_uart_tx
  • I tried to implement UART driver with FIFO but then i have no UART context to send to on_rx_complete and nrf_dfu_serial_on_packet_received
  • if i would want to report the error from the main context i don't know where the application is at the point of the UART interrupt to send the message
  • if i use nrf_drv_uart_tx with buffer bigger then 1 and don't use nrf_delay_ms in between i get wrong bytes on the other end.

Do you have any suggestions?

I'm using nrf52840 with sdk15.2 and uart without HWFC.

Thanks

.

Related