SPI SD Card shield together with RTC

Stuck? We'll be happy to help!
Post Reply
Maggo
Posts: 8
Joined: Tue Jan 08, 2019 6:35 am

SPI SD Card shield together with RTC

Post by Maggo » Tue Jan 08, 2019 6:55 am

Hello,

I am using Controllino Maxi equiped with SPI SD Shield. If I use only SD shield to Log data ist works fine. But if I use it together with onboard RTC, the RTC delivers wrong values. I think one need to switch between the SPI slaves? Any example Code available?

Thanks
best regards

User avatar
Lukas
Posts: 13
Joined: Tue Dec 18, 2018 3:44 pm

Re: SPI SD Card shield together with RTC

Post by Lukas » Wed Jan 09, 2019 2:53 pm

Hello, yes, you have to handle the Chip Select signals properly. It seems that the SD card stays enabled even if there is a communication with RTC. Then of course the data are corrupted.

Example for the RTC is available in the CONTROLLINO library. In the Arduino IDE File->Examples->CONTROLLINO->Common->DemoRTC

Or at GitHub https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/blob/master/Common/DemoRTC/DemoRTC.ino

Maggo
Posts: 8
Joined: Tue Jan 08, 2019 6:35 am

Re: SPI SD Card shield together with RTC

Post by Maggo » Thu Jan 10, 2019 8:00 pm

Thanks Lukas,

as I have to switch between the SPI Clients (RTC,SD,Ethernet) in the software I would need the PIN's for chipSelect. I think the PIN for SD shall be 53. But in the PIN description there is no PIN Number for RTC/SS and ETH/SS??. Please help.

regards
Maggo

P.S. To run only the RTC+Ethernet togehter is not a problem it works fine, without switching the SPI Clients

Maggo
Posts: 8
Joined: Tue Jan 08, 2019 6:35 am

Re: SPI SD Card shield together with RTC

Post by Maggo » Sun Jan 13, 2019 2:58 pm

Meanwhile I found the PIN numbers for SS RTC = 72 and SS ETH= 70, but I am still not able to switch between the SPI Clients. Also I have tried the functions: Controllino_SetRTCSS and Controllino_RTCSSInit without success. Can somebody provide a demo code?

User avatar
Lukas
Posts: 13
Joined: Tue Dec 18, 2018 3:44 pm

Re: SPI SD Card shield together with RTC

Post by Lukas » Tue Jan 15, 2019 11:07 am

Hello Maggo,

when you are using our CONTROLLINO library to access RTC and standard Ethernet library then the chipselect signals are handled automatically by the libraries. So you do not need to take care about them in your code.

Maybe we can go one step back - which SD card shield are you using, please? Which signals are connected to CONTROLLINO?
Could you provide us part of the code where you initialize and access the SD card?

Thanks,
Lukas

Maggo
Posts: 8
Joined: Tue Jan 08, 2019 6:35 am

Re: SPI SD Card shield together with RTC

Post by Maggo » Tue Jan 15, 2019 8:01 pm

Hello Lukas,

I got another hint from one expert telling me that the SD Module is not working for multiple SPI Clients. So I will change the module and I will let you know the results.

regards

Post Reply