Sending byte by byte when using PPP seems to be too slow

25890715 30 Reputation points
2024-01-19T12:07:50.4366667+00:00

Hi, I'm working on getting PPPoS working with an NXP MIMXRT1040-EVK and a Quectel EG800Q modem. After putting the modem in data mode I try initializing the network stack in ThreadX. When calling nx_ppp_create I supply it with my implementation of ppp_byte_send, which sends one byte over UART to the modem. For this I use NXP's SDK:

void ppp_byte_send(UCHAR byte)
{
	LPUART_WriteBlocking(MODEM_REG_BASE, byte, 1);
}

My issue is that the modem doesn't respond to the first message, and the PPP driver is stuck in the NX_PPP_STATUS_IPCP_IN_PROGRESS state. To test what might cause this I logged all the bytes that were sent as part of the first message, and modified my ppp_byte_send to instead look like this:

void ppp_byte_send(UCHAR byte)
{
	uint8_t cmd[] = { 0x7E, 0xFF, 0x7D, 0x23, 0xC0, 0x21, 0x7D, 0x21, 0xC3, 0x7D, 0x20, 0x7D, 0x28, 0x7D, 0x21, 0x7D, 0x24, 0x7D, 0x25, 0xDC, 0xF1, 0xB7, 0x7E };
	LPUART_WriteBlocking(MODEM_REG_BASE, cmd, sizeof(cmd));
}

This works, and the modem responds.

Next, I tried unrolling the single write by writing byte by byte instead in a loop, which also doesn't work. This leads me to think that writing byte by byte is too slow. If so, the way the PPP driver works won't work with this modem.

For reference

  • the UART speed is configured to 115200bps
  • I've tested the same MCU+modem combo in Zephyr and FreeRTOS+LwIP, and there it works, so I know it can work

Any comments on this would be greatly appreciated :)

Thanks,
Daniel

Azure RTOS
Azure RTOS
An Azure embedded development suite including a small but powerful operating system for resource-constrained devices.
314 questions
{count} votes

Accepted answer
  1. LeelaRajeshSayana-MSFT 12,116 Reputation points
    2024-01-19T19:28:39.1833333+00:00

    Hi @Daniel Fedai Larsen Greetings! Welcome to Microsoft Q&A forum. Thank you for posting this question here. I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to accept the answer .

    Issue:

    Modem doesn't respond to the first message, and the PPP driver is stuck in the NX_PPP_STATUS_IPCP_IN_PROGRESS state

    Solution:

    LPUART_WriteBlocking takes in a pointer to the data, not a single byte, so it should be:

    
    void ppp_byte_send(UCHAR byte)
    {
        LPUART_WriteBlocking(MODEM_REG_BASE, &byte, 1);
    }
    

    If I missed anything please let me know and I'd be happy to add it to my answer, or feel free to comment below with any additional information.

    I hope this helps!

    If you have any other questions, please let me know. Thank you again for your time and patience throughout this issue.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. 25890715 30 Reputation points
    2024-01-19T13:59:51.1166667+00:00

    I'll blame this on it being Friday afternoon. LPUART_WriteBlocking takes in a pointer to the data, not a single byte, so it should be:

    void ppp_byte_send(UCHAR byte)
    {
        LPUART_WriteBlocking(MODEM_REG_BASE, &byte, 1);
    }
    

    Now it works...!

    2 people found this answer helpful.
    0 comments No comments