-
Notifications
You must be signed in to change notification settings - Fork 165
Description
Hello,
I work on a project using PPP driver on netXduo 6.4.3 and I observe that sometime the received messages have delay.
After investigation, I understand that:
- In the _nx_ppp_thread_entry function, when a NX_PPP_EVENT_PACKET_RECEIVE event occurs, the application read the data in ppp_ptr -> nx_ppp_serial_buffer until a 0x7e character or buffer empty, then process the data.
- The _nx_ppp_byte_receive function set event NX_PPP_EVENT_PACKET_RECEIVE flag when a character 0x7e is received or data length in ppp_ptr -> nx_ppp_serial_buffer is higher than NX_PPP_SERIAL_BUFFER_ALERT_THRESHOLD
But if the _nx_ppp_byte_receive function is called with a priority higher than PPP thread (per example, an uart interrupt), more than one PPP frame may have been added in ppp_ptr -> nx_ppp_serial_buffer before _nx_ppp_thread_entry catch the NX_PPP_EVENT_PACKET_RECEIVE event.
As a result, only the first PPP frame is processed, the others stay in the buffer until next _nx_ppp_byte_receive call (if we meet the condition ppp_ptr -> nx_ppp_serial_buffer_byte_count >= NX_PPP_SERIAL_BUFFER_ALERT_THRESHOLD)
In my project, I use an USART with DMA and idle detection, and sometime I receive 4 or 5 consecutive PPP frames then nothing during several seconds.
Theses frames stay in the PPP reception buffer and lead to TCP deconnection.
This workaround seems handle this issue: in _nx_ppp_thread_entry function, when we catch NX_PPP_EVENT_PACKET_RECEIVE event, I add an iteration on the _nx_ppp_receive_packet_get / _nx_ppp_receive_packet_process sequence
Regards
Metadata
Metadata
Assignees
Labels
Type
Projects
Status