Hi,
I'm using the TMS5701224 for uart communication with a DSP. I am trying to run the comms in polling mode, and it works, but only for a bit before I get an over run error.
Basically I wait and want to read 2 bytes of a message from the DSP, if they are #J, then I read 4 more bytes, a message length and a checksum. Then I read the number of bytes the length indicates.
This works for a while, but eventually I get an overrun error. If I understand it correctly, that means that there is data in the receive buffer I haven't read yet that is going to be over written with new data. Does it mean that I am just not reading the receive buffer quick enough? We have another program that doesn't seem to have this issue, but it uses interrupt mode. Is there an advantage over interrupt mode over polling from a speed point of view? The program I am writing doesn't have an RTOS, so I thought polling mode would be simpler and work OK.
I have also had a check on sciIsRxReady, but it doesn't have an affect (although I should probably check anyway).
Does it sound like I am doing something wrong? or any suggestions on how to overcome the overrun error?
My program flow is something like this:
while(1) { sciError = sciRxError(sciREG); if(sciError == 0) { length = 2; sciReceive(sciREG, length, bytes); if (((bytes[0] & 0xFF) == '#') && ((bytes[1] & 0xFF) == 'J')) { msgOK = readMessage((uint32 *)&dspCmd, NUM_PARAMS_MAX + 3); } else { msgOK = FALSE; } if (msgOK) { // act on msg parseStatus = parseMsg(&dspCmd, &dspRsp); //format and send response back to DSP sendResponse(&dspRsp); msgOK = FALSE; } } }
Thanks,
David