chipKIT® Development Platform

Inspired by Arduino™

UDP NTP example not working on network shield

Created Mon, 15 Oct 2012 05:41:04 +0000 by Ian Billing


Ian Billing

Mon, 15 Oct 2012 05:41:04 +0000

Hello All

I have got the network shield working with Max32 and could only get it to work ie. ping and get a response when I set the MAC to all zero's. As soon as I set the MAC to the address printed on the board I could not ping the board at all - strange, but at least it works now.

What does not work is the Chipkit UDP NTP example. It compiles and runs okay, but does not work in receiving any data back.

Not sure if the MAC issue has anything to do with it, but I doubt it because the TCP/IP functionality works fine - just the UDP not.

Any advice / assitance is greatly appreciated.

Thanks

Ian


JordanR

Tue, 16 Oct 2012 21:16:55 +0000

Hello Ian,

I was looking in to this yesterday for someone working on chipKITUDPSendReceive() demo. I am not sure yet if this is affecting all the UDP demos, but it must be. It seems (to me) that in chipKITEthernetAPI.c, UDPBegin() is actually failing, because a malloc() call within the function is returning a null pointer, indicating there is not enough space to initialize a new UDP socket. If I find anything more today, I will report on it.

Best Regards,

Jordan R


JordanR

Tue, 16 Oct 2012 22:58:09 +0000

Hello Ian,

As a fix, try KeithV's suggestion from this thread: http://www.chipkit.org/forum/viewtopic.php?f=19&t=1565

In summary, adding the lines:

#define CHANGE_HEAP_SIZE(size) asm volatile ("\t.globl _min_heap_size\n\t.equ _min_heap_size, " #size "\n") CHANGE_HEAP_SIZE(0x5000);

to the top of the demo sketch should allow the UDP socket to be created. I was able to get the chipKITUDPSendReceiveString() demo to work when I did this. I suspect you will have similar success with the UdpNtp demo. Let me know how it goes.

Best Regards,

Jordan R


Ian Billing

Wed, 17 Oct 2012 10:39:28 +0000

That worked perfectly.

With the lines added the UdpNtp example works and the Telnet client, which was also not working, now works.

Thank you for the help.

Ian


dgudorf

Thu, 20 Dec 2012 22:04:28 +0000

Thanks a million for the answer. I've been trying to get my UDP project working for days before finding this post!