cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Participant
Participant
4,095 Views
Registered: ‎07-06-2013

LwIP ethernet sending numerical data

Jump to solution

Hi,

 

I am trying to send numerical data(large matrices) via ethernet to a  Zynq7020. I have looked at the LwIP Echo Server demo and tried to implement a method to read the payload into a float. For now I want to use TCP, although I guess UDP maybe more efficent for data transfers.

 

What is the best way to convert the p->payload into a float. I have tried casting to char *, using unions, but I keep getting nonsensical results. 

And on the client side what is the best way to send a float via TCP socket? As at the moment i am again trying to cast to char * and then send that buffer.

 

Many thanks

Sam

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Participant
Participant
5,239 Views
Registered: ‎07-06-2013
0 Kudos
2 Replies
Highlighted
Participant
Participant
5,240 Views
Registered: ‎07-06-2013
0 Kudos
Highlighted
Observer
Observer
3,665 Views
Registered: ‎05-18-2009

I ran into a similar sounding problem recently.  I am running the lwip echo server on a VC707 using Microblaze.  I made some edits to transfer and parse unsigned words to and from the eval board.

 

I casted the pointer to the payload as a uint32 pointer, and found that the word being read didn't make sense.  For example, if in memory the pointer was pointing to 0x00000006 (in memory 00 00 00 06 00 00 FF FF, pointer location in bold) it would read it as 0x00060000. 

 

While debugging I noticed that the payload was pointing to address 0xc00b0176, which isn't word aligned. The process reads out 0x00060000(code:  Command = DataArrayIn[0]; where DataArrayIn is pointing to the address of the payload).  Which seems to me like the compiler/processor is reading from the wrong address, presumably 0xc00b0174.

 

I have a temporary workaround where I memcpy the payload to a word aligned memory location.

0 Kudos