gzwsc2007 / Hobby_Airplane_Control_System

A powerful control system for hobby airplanes
http://ansonproj.blogspot.com/2015/06/hobby-airplane-control-system-hacs.html
1 stars 0 forks source link

System commands are not decoded correctly sometime #2

Open gzwsc2007 opened 9 years ago

gzwsc2007 commented 9 years ago

When the plane is on the ground, with no changing control inputs, all system commands seem to be accepted correctly. However, when the plane is airborne (with changing control inputs, of course), system commands are rarely correctly accepted. The ground station fails to put HACS into system identification experiment mode.

Reproducible in ground test with changing RC inputs.

gzwsc2007 commented 9 years ago

Looks like for some reason the uplink message is corrupted, and the MAVLink parser state machine onboard is confused: It got stranded in the wrong state and kept eating subsequent valid messages without returning good parse results.

Cause for the corruption is still unknown. I don't think it's the radio, because NRF24 does hardware CRC in the packets. I guess the ground station microcontroller did not receive the message bytes correctly?

Temporary fix/Enhancement: Enabled length checking in MAVLink parser to catch such corruptions sooner

gzwsc2007 commented 9 years ago

New discovery: It is the ground station micro that's causing the message corruption. I mistakenly assumed that the serial link between the PC and the micro was full-duplex while it was not (I should have known this since I wrote the micro's program...). This means that if we happen to transmit message to the ground micro while it's transmitting to us, the message will be dropped (except for the first byte which is the MAVLink STX byte).

Need to fix the ground micro code, or add synchronization on the pc client.