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:
@@ -1504,11 +1504,17 @@ uint16_t dlmstp_receive(
|
||||
if (Receive_State == MSTP_RECEIVE_STATE_IDLE) {
|
||||
transmitting = MSTP_Transmit_FSM();
|
||||
}
|
||||
/* only do receive state machine while we don't have a frame */
|
||||
if ((MSTP_Flag.ReceivedValidFrame == false) &&
|
||||
(MSTP_Flag.ReceivedValidFrameNotForUs == false) &&
|
||||
(MSTP_Flag.ReceivedInvalidFrame == false) && (transmitting == false)) {
|
||||
MSTP_Receive_Frame_FSM();
|
||||
if (transmitting == 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_byte_available(NULL)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* only do master state machine while rx is idle */
|
||||
if ((Receive_State == MSTP_RECEIVE_STATE_IDLE) && (transmitting == false)) {
|
||||
|
||||
@@ -141,7 +141,9 @@ bool rs485_byte_available(
|
||||
bool data_available = false; /* return value */
|
||||
|
||||
if (!FIFO_Empty(&Receive_Buffer)) {
|
||||
*data_register = FIFO_Get(&Receive_Buffer);
|
||||
if (data_register) {
|
||||
*data_register = FIFO_Get(&Receive_Buffer);
|
||||
}
|
||||
timer_elapsed_start(&Silence_Timer);
|
||||
data_available = true;
|
||||
led_rx_on_interval(10);
|
||||
|
||||
Reference in New Issue
Block a user