Works on Nano, not on Due!

I have written a sketch which uses the DCF77 library from Thijs Elenbaas to decode a DCF77 encoded pulse train carrying time signals and take some action with the resulting time value. The code works very well and does exactly what I need when compiled for the Arduino Nano. I have been using the Nano as the target as I have several and it is convenient, but the actual target processor is a Due which is built in to some hard to access equipment.

However when I move to compiling for the Due, though the code compiles and uploads fine it does not work! I am using exactly the same input pins, the same code and libraries, just compiling for a different board. I am at a loss to know what to do to make progress.

So my question, are there particular programming aspects or details of libraries that are different between Nano and Due please? I am using DCF77 and TimeLib.

Yes.
The timers and interrupt structure are totally different on the two processors. I would be surprised if it did work. Either contact the writers of this library to see if they have a Due compatible version or look for another library.

One word of caution, The Due is a 3V3 processor so make sure your input DCF77 encoded pulse train, is not at the 5V level or you will damage the Due.

1 Like

Thanks Mike, so not compatible across boards then! I'm aware of the logic level difference, thanks.

Hmmm.

Just to close this off, the library code uses what I understand is now a deprecated way to define interrupts:

#define DCF_INTERRUPT 0

...which works on the Uno for an input on pin 2.

On the DUE however the interrupt numbers should be made to equal the pin numbers, so the above line should be:

#define DCF_INTERRUPT 3

...which works fine

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.