lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] LWIP Raw API receive issue


From: Sergio R. Caprile
Subject: Re: [lwip-users] LWIP Raw API receive issue
Date: Fri, 12 Jan 2018 14:56:13 -0300
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

>> Did youcheck your driver and port are OK
> Yes I have checked that, I am able to receive and transmit without any
> problem if the size is less (approximately less than 100 bytes, could
> be upto 200). As for the driver is concerned I have run the http
> server using this driver, it is able to send upto 512 bytes to the
> client without any problem.

That is not a proof.
You are _SENDING_ 512 but you are receiving "upto" 200, what does that mean ??? You have to receive everything you send to the device, be it in one or several pbufs, being each pbuf one contiguous block of memory, or many (chained).

Are you correctly "traveling" your received pbufs ? They might be chained, you can't memcpy(somewhere, p, p->tot_len), you need to go pbuf by pbuf copying p->len and checking p->next until you extract tot_len bytes; or just use the pbuf handling functions like pbuf_copy_partial()

AFAIK, it is either that or your driver/port is broken.

Being that you are running on bare metal, and you didn't say if you are respecting the threading rules, you should have a means for the Ethernet controller to say there are frames available, that will a) be remembered or b)trigger the extraction of the frame to be put "somewhere" (e.g.: a queue).
in the main loop:
In case a) you will call the input which will call the driver and extract the frame and give it to lwIP. In case b) you will extract those frames from "somewhere" and call the input to deliver to lwIP. NO CALLING lwIP LOW-LEVEL FUNCTIONS FROM DIFFERENT CONTEXTS, either all main or all interrupt.
Check the wiki and the docs if in doubt.

Being that you are running on bare metal, use your debugger and put a breakpoint in those places to see whether you are trashing your data before entering lwIP or you need to check your app again.

Unless you have DMA which you did not say, and I cant help you there.



reply via email to

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