netxduo icon indicating copy to clipboard operation
netxduo copied to clipboard

[PPP] Delay on PPP reception

Open Coueron opened this issue 4 months ago • 3 comments

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

Image

Regards

Coueron avatar Sep 26 '25 06:09 Coueron

Congratulation !

EdouardMALOT avatar Oct 01 '25 21:10 EdouardMALOT

Thank you for filing this issue, @Coueron. I will ask a team member to look into it. Thank you for your patience. We did not notice theis issue due to our focus on our recent 202503 release.

fdesbiens avatar Oct 14 '25 16:10 fdesbiens

Thank you Florian @Coueron for reporting this bug !

On a PPP / 4G link I experienced the following symptoms:

  • when a packet was lost, we started to see retries
  • these retries piled up more and more (because some packets were stuck in the netxduo / PPP stack).

Once the patch was applied the problem disappeared. :white_check_mark: Note: I also use a DMA for PPP frame reception and the modem sometimes concatenate several frames.

@fdesbiens : it seems essential to include this fix in upcoming releases.

EdouardMALOT avatar Dec 05 '25 16:12 EdouardMALOT