This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

PPP using TCP client socket

Hello,

I'm having trouble using TCP client socket on a PPP link.

I'm using Keil RTX 4.74.0 and MDK-Pro 5.0.4

PPP is established using a GPRS modem (I have updated the Modem_Standard.c to deal with network registration and so on)

In my main loop, once ppp_is_up() == true, I create a tcp_socket using :
tcp_soc = tcp_get_socket (TCP_TYPE_CLIENT|TCP_TYPE_FLOW_CTRL, 0, 30, tcp_callback);

and then connect it using :
tcp_connect (tcp_soc, rem_ip, 9301, 0);

The server is a http server.

Once the connection is established, the callback is then called from the Core Network with event == tcpEventEstablished. When this event is called, the main loop gets a flag indicating that it's time to write the request to the socket.

The write part is working and I receive a tcpEventACK in the callback.

The server on the other side well receive the request and sends the answer, but, the callback never gets called with the tcpEventData. In the end, the socket is closed and finaly aborted.

I have a serial spy where I can see the PPP dialog and I can see both the request and the answer.

Where do you think I go wrong ?

Thanks,

Alain.

Parents
  • You using UART to communicate with the modem? Have you verified the baudrate?

    Note that the modem might be able to accept a larger baudrate error when receiving data from you, than what your side is able to handle when receiving data from the modem.

    Next thing - is the UART using DMA or FIFO or similar that helps avoiding character loss in case you get a bit of interrupt latency because of some other interrupt handler consuming too much time or some part of your code turning off interrupts in critical sections?

Reply
  • You using UART to communicate with the modem? Have you verified the baudrate?

    Note that the modem might be able to accept a larger baudrate error when receiving data from you, than what your side is able to handle when receiving data from the modem.

    Next thing - is the UART using DMA or FIFO or similar that helps avoiding character loss in case you get a bit of interrupt latency because of some other interrupt handler consuming too much time or some part of your code turning off interrupts in critical sections?

Children
  • Hello,

    Got good and bad news :
    - It's working
    - Keil's Driver or Keil RLNet gots bug at some points

    After digging deep in the source code of the Keil UART Driver :
    - The UART initialisation is done using a callback that should be called on ARM_UART_EVENT_RX_NOT_EMPTY event. But ARM_UART_EVENT_RX_NOT_EMPTY is never fired in the UART IRQ Processing.
    - The RLNet PPP is contantly pooling the UART using UART_DataAvailable and UART_ReadData accordingly to the returned available number of data returned.

    At some point (don't know when / don't want to spend more time on that issue) the UART_ReadData is called using a 64 byte size request whereas only 1 byteis available in the UART cyclic buufer.

    This result in FCS check error (I this RLNet process 64 Bytes where only 1 has been filled ...)

    I have solved the problem changing the UART_DataAvailable core function to return 1 whenever ptr_uart->info->rx.empty equal false.

    Many thanks for having pointing me in the UART direction.

    Alain.