09-26-2014 12:51 PM
I've taught myself the command structure of the 85xx loads and figured out the communication patterns. There are still some issues with some features I'm trying to employ, but I'll figure them out eventually. One thing I and others witnessed was comm failures between the program and the load. I was sometimes getting locked out of comm sync and had to write a reset into the program to force the load into a known state. Then I happened to catch some frame misalignments on some return packets from the load. Sometimes the load doesn't send a full 26 byte packet. I don't know if it's because the program was reading the serial port before the load finished transmitting, but instead of increasing the Rx delay I started analyzing the packets.
When you receive a packet from the load, first check to make sure there was 26 bytes received. If not, throw the packet away and retransmit the command. Once you receive all 26 bytes, check to make sure the "0xAA" header byte is actually byte 0 of the packet. If not, search the packet for the index of the header byte, strip the bytes from that index to the end of the packet, concatenate them to the beginning of the packet, verify the checksum is correct, then continue processing the response. This eliminated all the intermittent errors I was receiving from the load.