lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Device crashes while connected via TCP and Serial simul


From: Julio Cesar Aguilar Zerpa
Subject: Re: [lwip-users] Device crashes while connected via TCP and Serial simultaneously
Date: Mon, 30 Jan 2017 09:52:02 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

Hi Sergio,

thanks for answering.


> You have to check on your vendor's forums for the intricacies of debugging your particular device

> You are seeing a data fetch exception, try to get exactly why is that and who is fetching where. Do you have some MPU in there ?

I am trying to find out why on the TI forums as well. It's not easy finding out who is fetching where. I am using an ARM microntroller on this board.


> What GUI ? Please properly describe your scenario.

Sorry, I thought I had explained it properly. That's why my email was so long. The data I sent over TCP is received by a GUI (the GUI is the client) that displays the data. It's a debug tool.


> You must start working with small and manageable pieces, if you don't know if your port is OK, you need to run applications you know they work.

I did that as well. I tried pieces of code where I only ran the TCP server with a constant dummy buffer (it was sending the same buffer every 60ms). I also ran the test where I copied some dummy values (that change every 60ms) to the server (just to test if the copying was the problem). Since the problem also involves the serial interface of the board, I also tried tests where only the serial interface was running (Just receiving data from the sensor and processing that data, not sending it via TCP). In none of this isolated tests, the program crashed. None.

The program crashes whenever I run both the TCP and the serial interfaces simultaneously, even when I am not copying data from the serial interface to the TCP interface (which is the intended use of my program).


> Your driver might be trashing memory, your port might be reentring non-reentrable functions, your serial handler might be trashing memory, your app copying from serial to tcp buffer might be trashing memory.

Yes, that is what I want to know. But I honestly don't know how. Well I did the test "receiving from serial and sending dummy values through tcp (no copying)" to find out if the problem was caused by my copy function but the program still crashed.

I'd like to know how to check the other things. I am also posting this on the TI forums, as you said this is not the right place for that, but I hope you can give some tips xD


> What API are you using ? What functions do you use in your app ?

The RAW API. I found the "tcpecho_raw" example under "contrib/apps". I am using all those functions exept the one for sending. For the sending I am using the function below, which is called from the main loop by calling "sys_check_timeouts()". If you want, I can send you the code of the app. It's not much.

static void tcpServer_sendRawBuffer(struct tcp_pcb *tpcb)
{
    err_t err = tcp_write(tpcb, raw_data_current->buffer, buffer_size, 0); // raw_data_current->buffer is a pointer of type uint8*

    if (err == ERR_OK)
    {
        // ask the TCP stack to send data now.
        err = tcp_output(tpcb);

        if (err != ERR_OK)
        {
            debugSerial_displayInt("tcp output ERROR %d", err); // this is another serial interface that I use for debug
        }
    }
    else
    {
        debugSerial_displayInt("tcp write ERROR %d", err);

          if (err != ERR_MEM)
          {
              tcpServer_close(tpcb, NULL);
          }
    }

    sys_timeout(60, (sys_timeout_handler)tcpServer_sendRawBuffer, tpcb);
}


Thanks again.

Best regards,

Julio


reply via email to

[Prev in Thread] Current Thread [Next in Thread]