10 years, 2 months ago.

Howto hookup DS1302 (RTC), 3 wire synchronous serial communication to KL25Z

Hi there,

Can someone educate me howto connect the DS1302 3-wire serial real time clock to a KL25Z. There are 3 wires CE (Chip Enable), SCLK (serial clock) and I/O (bi-directional data line).

There is a library on the DS1302 but without any hardware explanation. Any help is appreciated.

Thanks,

Gerrit

1 Answer

10 years, 2 months ago.

I got it myself, and the library is also lacking in some departments, or even incorrect. But basic timekeeping works. Maybe I will make an updated version later and put it in the components page.

Anyway, for the constructor:

ds1302(PinName pinSCLK,PinName pinIO,PinName pinRST);

//Example constructor:
ds1302 clk(PTA1, PTA2, PTA3);

That maps fairly easily on your pins :). RST = CE. You may use any regular GPIO pin, it doesn't use for example SPI, so there are no special requirements.

Accepted Answer