Fix listening for a Start-Of-Frame byte#2
Conversation
|
@peterdmr Good catch. Thanks for reporting this bug. As I am currently unable to test the fix myself, could you please confirm that your fix is tested and works correctly before I merge it? |
|
@m3y54m The fix has been tested and works correctly. Due to availability, testing was performed on an ATmega328PB, which is the direct successor and software-compatible with the ATmega328P. The following minor adaptations were required for the test environment:
These changes are specific to the toolchain and register naming of the ATmega328PB and do not affect the core protocol logic of the fix. |
Summary
Fixes: Application update failure when binary contains Start-Of-Frame byte (0xA1)
Problem Description
The SUP frame parser (device side only) incorrectly resets the data reception state machine upon encountering any 0xA1 byte, even when it was part of the actual application data rather than an actual frame boundary.
Solution
Wait for SOF byte when parser is in the
SUP_STATE_WAIT_SOFstate only.Notes
This fix addresses the immediate issue but removes the ability to reset broken frame transmissions using SOF bytes. In my opinion, frame reset/recovery should be handled through alternative mechanisms.