This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LWIP UDP echo problem with big packet



Hi

I am using a custom board based on Beaglebone and I am developing a software by Starterware_02_00_01_01. I made some codes to echo packet in UDP protocol.

Everything was OK and the all packets were echoed correctly. But, when I increased the packet size to about 130 bytes, not only the packets was not echoed, but also I observed the program crashed so that the PC(Program counter) went to an unknown place.

Could anyone please help me to overcome the problem.

thanks,

Mohsen

  • Hi

     

    First I want to mention is a classical -- memory corruption. Since there is no information about helpers and technics you use in lwIP callback functions (or you use polling?), I guess in some of your packet intake functions a memory corruption occurs (maybe due to incorrect pointer operations -- most often case).

    So I see 2 methods of going further

    -- turn off echoes at all in order to reduce error impact

    -- very carefully recheck entire pointer management + validate usage of lwIP-supplied ones

  • Hi Feu

    Thanks for your advice.

    I turned off echo packet in receive callback function. Instead, I made echo mechanism using global buffer and  a flag in the main loop. It worked perfect until I increased the packet size to more than 700 byte. After that the old story happened, program crashing.

    I think you are right about memory corruption, but as the memory management of lwip is not under my control I can not solve the problem.

    It is currently enough for me to echo 512 byte, so I put this problem off to later time.

    thanks

    Amin