RFM69 and TLC5940
I want to controll 9 led with sensebender micro. I want to use the tlc5940. But they use both the SCK and Mosi pin of the atmega328. Is it possible to use the tlc5940 when I sent the RFM69 to sleep? Or is there another change to use both things.
@Grave they should be able to share SCK and MOSI. Only the (N)SS pins need to be different. See https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus#Independent_slave_configuration for details.
The SPI bus is, well, a bus. So it is designed to support multiple devices.
Some devices have trouble sharing the same SPI bus though. So if you run into problems, you might need to look at setting up a separate SPI bus (using soft SPI). How to do this is described at https://www.mysensors.org/build/ethernet_gateway#wiring-things-up
But try sharing the SPI first.
I got wrong. They use both D9-D11 and D13.
These are the pins the TLC5940 use:
digital 3 -> TLC pin 18 (GSCLK)
- digital 9 -> TLC pin 24 (XLAT)
- digital 10 -> TLC pin 23 (BLANK)
- digital 11 -> TLC pin 26 (SIN)
- digital 13 -> TLC pin 25 (SCLK)
I think it´s not a SPI device, so I can´t use them when the RFM69 is connected.
@Grave which library are you using to control the TLC5940?
If that library supports changing pins, change the pins using the instructions provided by the library.
If the library does not support changing pins, use soft SPI as mentioned earlier to change the pins used for the RFM69.
Or find a library for the TLC5940 that does support changing pins.
This library https://github.com/PaulStoffregen/Tlc5940/blob/d765d114e0487577de2fc0eade24f59b9c944291/tlc_config.h#L44 does use SPI, which suggests the TLC6940 is in fact a SPI device. And that library supports using soft SPI. So you should be able to use any of the following solutions:
- Share the hardware SPI, as mentioned in my first post.
- Use software SPI for RFM69 and hardware SPI for TLC5940, as mentioned in my first post
- Use hardware SPI for RFM69 and software SPI for TLC5940 by changing the TLC5940 configuration.
But what is with Blank and Xlat on D9 and D10.
@Grave it depends on the method you choose and the library you use. If the library allows change of Blank and Xlat pins, change the configuration according to the instructions provided by the library.
I think, Blank and Xlat can´t be changed. I noticed that sensebender micro doesn´t use D9. So it´s only Blank wich is double used by tlc5940 and rfm69.
dbemowsk last edited by
Would using shift registers work?