I guess the arduino pin cannot source enough current for the RTC. Try use a transistor to command the power for the RTC. Use npn one, connect emitor to +5V of the arduino, base to arduino pin and collector to +5V of the RTC.
SD Card access is a fair bit more complicated because of the need to consider the FAT file system etc. So if I were you I would concentrate on getting the LED driver working first; at least then you know your SPI bus is working.
To answer a few of your questions:
- The voltage at the output of any LED output pin will be the voltage that is required to achieve the programmed constant current. It should not be 0V unless the outputs are set for maximum current. And it should not be the supply voltage unless the LED is supposed to be off.
- The fact that the LED driver has an internal 30Mhz clock should not be of concern to you. Your device is the master, it controls the clock, and the slave should clock in the data based on the clock your master provides to it. The 30Mhz info is just useful in terms of appreciating the maximum speed you can push data through the device.
A few things to check:
You mention pulsing LE high, but you don't mention holding OE low to enable the LED outputs?
You need to make sure you've configured the master clock and data pins properly. I am not familiar with Arduino stuff so I can't help you with the specifics here, but there are various modes of SPI operation and you'll need to set up your device to match. You need to make sure you have the correct mode set up to output the data on the rising edge of the clock, with data sampled in the middle (for the LED driver - maybe it's different for the SD!).
Where is the chip-select pin on this device? Surely it has one? Couldn't see it on the supplied diagram.
If there is no chip-select, how will you switch between data provided to the SD card and data provided to the LED driver? You'll need two SPI peripherals? Unless perhaps the LED driver is happy to just sit there receiving data, even if it isn't the intended recipient, and it's up to you to control the LE and OE pins when it is the intended recipient. It's worth just looking into this to clarify everything.
I'm not sure what is supposed to come out of the LED driver SDO pin? Are you using it?
How is SDI supposed to relate to LED outputs? I notice in the timing diagram SDI is high for bits 0, 2, 5, 10, 11, 12, and 15. But outputs 0, 3 and 15 are shown to respond with an 'ON' condition. Maybe this is explained elsewhere in the datasheet, because it doesn't seem to make any obvious sense from the timing diagram...
Good luck!
Best Answer
Full RAM is almost certainly your problem. You want to keep an extra 200-400 bytes for the stack, depending on your program complexity. I tend to have a large stack, so I keep at least 400 open all the time. If it gets less than that free, it is time to optimize something.
Here is an example to show you how much you have left:
Arduino release 0022 has been quite problematic for me. I instead use 0021 and grab fat16lib which is lighter and serves my data logging needs. If you can do without directories, use 8.3 filenames, and SD cards <= 2 GB, it's very helpful and works!
Finally, if you have a lot of string data in your program (like println debugging statements or other long strings, consider accessing those directly from the ATmega328's flash memory, which will also save RAM. I use a convenient library for this purpose, called Flash incidentally. See Flash. I also highly recommend Mikal's Streaming and PString library. The gent writes some really well-thought-out libraries IMHO.
Example using Flash lib: