- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to test simple sockect server example in Cyclone III NIOS II eval kit using NIOS IDE 8.0.
I checked this example in my old version 7.2 of Quartus and it worked fine!!! I tried to change static IP in simple_socket_server.h using # define IPADDR0 192 # define IPADDR1 168 # define IPADDR2 10 # define IPADDR3 11 and settind *use_dhcp=0 by making those changes my simple socket server application worked in 7.2. but in this 8.0 version the static IP never changes from the adress 0.10.10.11. I've debugged the code and I think htonl instruction doesn't work properly. # define IP4_ADDR(ipaddr, a,b,c,d) ipaddr = htonl(((alt_u32)(a & 0xff) << 24) | ((alt_u32)(b & 0xff) << 16) | ((alt_u32)(c & 0xff) << 8) | (alt_u32)(d & 0xff)) any suggestion??Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What about with the endianess?
try whit this code: unsigned int htonl (unsigned int x) { # if BYTE_ORDER == LITTLE_ENDIAN unsigned char *s = (unsigned char *) &x; return (unsigned int) (s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]); # else return x;# endif }- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The project now works as in EDS 7.2. Thank you for giving me this solution.
Could you explain to me why I didn't have to use this instruction in EDS 7.2??? Do you know another difference in EDS 8.0 ??- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This function , simply reorders the bytes according to the processor endianess.
The only reason I see for which it didtn't work is due to your processor endianess.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
then following your comments the difference between my 7.2 and 8.0 could be the NIOS endian configuration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is a bug in the 8.0 IP4_ADDR() macro. See this fix:
http://www.altera.com/support/kdb/solutions/rd06062008_934.html- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've modified simple socket server to be UDP instead TCP server.
I've tried to set the destination IP addres by usingUDP_sender.sin_family = AF_INET;
UDP_sender.sin_port = htons(30);
inet_atom ("192.168.10.10", UDP_sender.sin_addr);
or using UDP_sender.sin_family = AF_INET;
UDP_sender.sin_port = htons(30);
IP4_ADDR (UDP_sender.sin_addr.s_addr,192,168,10,10);
both possibilities were working in EDS 7.2 but doesn't in EDS 8.0 When running both attempts, compiler is failing because 'IP4_ADDR' or 'inet_atom' are undefined references.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page