When performing the following sequence :
1 - writing to Reg. at address 00h (COMMUNICATION)
2 - reading FW_VERSION
3 - reading FW_VERSION
the sensor answer in the correct way only to 1 and 3, but answer BAD CHECKSUM to message 2. Sent checksum is OK in 1,2 and 3.
I suspect that there is a problem resetting new_packet.data_length in USART_STATE_ADDRESS ( ProcessNextCharacter( ) function ).
Probably after 1 new_packet.data_length retain the old value when the state machine skip the variable update and goes to the checksum calculation that uses the data_length info.
Log in to post a comment.