Added MS/TP tweak to improve byte reception and processing at higher baud rates and larger packet sizes. Thank you Peter Mc Shane!
This commit is contained in:
@@ -1255,11 +1255,15 @@ uint16_t dlmstp_receive(
|
||||
InputBuffer = pdu;
|
||||
InputBufferSize = max_pdu;
|
||||
}
|
||||
/* only do receive state machine while we don't have a frame */
|
||||
if ((MSTP_Flag.ReceivedValidFrame == false) &&
|
||||
while ((MSTP_Flag.ReceivedValidFrame == false) &&
|
||||
(MSTP_Flag.ReceivedValidFrameNotForUs == false) &&
|
||||
(MSTP_Flag.ReceivedInvalidFrame == false)) {
|
||||
/* only do receive state machine while we don't have a frame */
|
||||
MSTP_Receive_Frame_FSM();
|
||||
/* process another byte, if available */
|
||||
if (!RS485_DataAvailable(NULL)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (MSTP_Flag.ReceivedValidFrameNotForUs) {
|
||||
MSTP_Flag.ReceivedValidFrameNotForUs = false;
|
||||
|
||||
@@ -255,7 +255,9 @@ bool RS485_DataAvailable(
|
||||
|
||||
if (RS485_Interface->US_CSR & AT91C_US_RXRDY) {
|
||||
/* data is available */
|
||||
*DataRegister = RS485_Interface->US_RHR;
|
||||
if (DataRegister) {
|
||||
*DataRegister = RS485_Interface->US_RHR;
|
||||
}
|
||||
DataAvailable = true;
|
||||
/* LED ON */
|
||||
pPIO->PIO_CODR = LED2;
|
||||
|
||||
Reference in New Issue
Block a user