DS1302 RTC not working on Mega2560 but fine on UNO

Hi

I am using a DS1302 RTC board and am trying to use it on an AT MEGA without success.

The board works fine when connected to an UNO board, using the library from

http://www.henningkarlsen.com/electronics/library.php?id=5

But on an at mega it returns garbage data and setting the clock does not work.

Same code on an UNO works fine.

The library says it is compatible with Mega 2560...

Any ideas on where to look to resolve this issue?

Chris

looks like my bad - I had the pins connected as follows

// CE pin -> Arduino Digital 11
// I/O pin -> Arduino Digital 12
// SCLK pin -> Arduino Digital 13

I removed a shield and put it onto pins 2,3,4 and it worked on the mega 2560

So I moved to

// CE pin -> Arduino Digital 43
// I/O pin -> Arduino Digital 41
// SCLK pin -> Arduino Digital 39

And it still works...

so I moved to

// CE pin -> Arduino Digital 10
// I/O pin -> Arduino Digital 12
// SCLK pin -> Arduino Digital 12

and it works, so pin 13 must be causing an issue since it is connected to the onboard led....

Chris

1 Like