EtherDue Hangs

The EtherDue combines a super powerful 84MHz Cortex M3 with onboard ethernet connectivity. Dual Micro USB, a MicroSD card slot, switchmode power supply. 100% Arduino Due compatible. [Product Page]
Posts: 3
Joined: Thu Oct 06, 2016 4:37 pm

EtherDue Hangs

Postby Doozer » Thu Oct 06, 2016 5:20 pm

A large application written on an EtherMega is being ported to EtherDue. Unfortunately, its being written with the Arduino IDE and is composed of 31 modules. The hardware differences between the systems are the Mega used a DS1307 RTC and hardware WDT (DOG) and the DUE will use the internal functions. For the time being the WDT code is commented out. The RTC code was replaced by TimeLib and, essentially, copied from the TimeLib example. The RTC init code is called at the start of Setup. After the lines of code where it sets the sync callback it tests if the clock is working and, if so, prints "RTC set system time". The console shows "RTC set system" and stops. Putting a delay in after the sync is set will cause fewer chars to be printed suggesting there is a timer interrupt occurring which is not/poorly handled and crashes. My code has no explicit interrupts at the present time.

When I got the EtherDue I tested the SD, Ethernet and the internal RTC each, separately, using the example code. They all worked fine.

A couple of times while writing the code using the Mega I would get an unexplained hang or failure to start. In both cases I cloned the previous version of the project - made the new changes - and it worked fine. Its as if some of the app specific Arduino files became corrupt and ruined the project. There are no errors or warnings. Is this what is happening now? I'm not even sure what to try next. Any thoughts? Thanks for reading.


Posts: 3
Joined: Thu Oct 06, 2016 4:37 pm

Re: EtherDue Hangs

Postby Doozer » Thu Oct 13, 2016 9:46 pm

So things are even weirder than I thought. The problem has no connection to the TimeLib . I have the code failing in exactly the same way but in the following:

Code: Select all

void setup() {

  for ( int i = 0; i < 50; i++ ) {
      Serial.println( i );

  Serial.println("Init variables...");

The program will print "Starting", the numbers from the loop and then "In". Whats really neat is that you can change the loop count or the delay or the baud rate with no change to the output. I'm sure that if this code were pasted into a new program with no other code it would work fine. It has to do with my large program that follows - but how that un-executed code would effect this code is beyond me.

I know its bad form to post nebulous questions of "help me fix my program" to forums by this is fairly different. Are there limits to the arduino due code space/heap space I'm not aware of? If this code works (it does) on EtherMega shouldn't it work on a Due (with appropriate modifications)?

If this were a different processor and a different compiler I'd have said far calls were not being generated where they should be (or Visa-versa).

There is an Arduino M0 available to try this on. It has the AVR debug chip. Can anyone recommend a tool chain with h/w debugger?


Posts: 3
Joined: Thu Oct 06, 2016 4:37 pm

Re: EtherDue Hangs - SOLVED

Postby Doozer » Sat Dec 03, 2016 2:26 am

I should have gotten back sooner - I solved the problem awhile ago. The problem was an improperly instantiated object. Confusing because the code compiled correctly for the EtherMega but not for the EtherDue.

What I really wanted to pass on is the debugging technique. Debugging with print statements is complicated on the Due because it has a non-blocking print. After I posted the previous message to the board it dawned on me I could just move the last successful print statement further along in the code until it stopped working altogether - that would be just after the problem. It worked.

There is a problem with using the PROGMEM macro with the Due. Memory model is completely different so you need to drop it and just use normal memory references. Oddly the F macro still works...

Hope this helps someone. The Due is a great processor and I'm loving the on-board SD and Ethernet.


Return to “EtherDue”

Who is online

Users browsing this forum: No registered users and 1 guest