2016-01-28 08:07 PM
I am writing an application bootloader for stm32f4xx. What is the best way to detect end of transmission over serial line?
#!stm32f4-!stm32f4012016-01-28 09:49 PM
hi,
You can use YModem File transfer protocol. It takes care of all. ST provides this boot loader example.2016-01-28 09:58 PM
2016-01-29 12:12 AM
You send a terminal packet or symbol to indicate completion?
2016-01-29 06:13 AM
You send a terminal packet or symbol to indicate completion?
What if this terminal packet or symbol could also appear in the payload ? I had similar problem while trying to parse the Firmware binary file that I was receiving over UART. In my case, the HTTP server responded with the payload size, which could be used for parsing the data, however, in a continuous stream of data over UART, there is no such guarantee that in __every__ scenario, the particular symbol will never be part of actual data.As a side note, it would be interesting to see, how the networking protocol stack handles this.
2016-01-29 01:34 PM
You're writing your own bootloader and not using the built-in STM32 bootloader, correct?
If so, you're going to want to define some sort of protocol, not just for the purpose of data boundary detection (your ''end of transmission'' question), but also to guarantee error-free delivery of the data. You're not trying to simply stream a full firmware image, are you? That's what it sounds like, given the concern you expressed (i.e., having some ''end of transmission'' marker byte that could appear in the firmware image data).Packetize your data and add some flavor of consistency checking, like a CRC-8 or CRC-16. Serial communication can be noisy. User kk above mentioned YModem - that's a fine idea, though you still may want to roll your own depending on what your bootloader feature set is going to be.You might want to read through ST's AN3155 for inspiration.-Cyg(BTW, this sort of thing is precisely what ''networking protocol stack[s]'' do, though in a much more complex fashion due to the nature of the problem something like TCP/IP was built to address.)2016-01-29 02:22 PM
What if this terminal packet or symbol could also appear in the payload ?
You have a packet format that infers length, or if purely stream based you could use escape sequences. For context, what was your degree in? Mine was an EE, and I was doing serial data transfers as a teenager.