24 channel TLC5947 board
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- ilium007
- Posts: 54
- Joined: Tue Oct 24, 2017 3:39 am
24 channel TLC5947 board
Hi - I am looking at the Adafruit 24-Channel 12-bit PWM LED Driver - SPI Interface - TLC5947 board and would like to know if it would be appropriate to chain two together to simply control 48 LED's on or off. I dont need the PWM but I can't find any other SPI chip that does constant current sinking to that I can power all 48 LED's at the same time.
- adafruit_support_bill
- Posts: 88151
- Joined: Sat Feb 07, 2009 10:11 am
Re: 24 channel TLC5947 board
Code: Select all
would like to know if it would be appropriate to chain two together to simply control 48 LED's on or off.
Code: Select all
I dont need the PWM but I can't find any other SPI chip that does constant current sinking
- ilium007
- Posts: 54
- Joined: Tue Oct 24, 2017 3:39 am
Re: 24 channel TLC5947 board
Thanks for the reply. One other question (I haven't played with SPI before). If I had multiple Adafruit 24 channel boards communicating via SPI do I just have the common SCK, MOSI, MISO connections and then a seperate SS pin for each board ? If I were to then include MCP23S17 ICs in my project can these just have seperate SS pins as well ?
- ilium007
- Posts: 54
- Joined: Tue Oct 24, 2017 3:39 am
Re: 24 channel TLC5947 board
And the library for this, is it using 'real SPI' ie. using the devices SPI port or software-based synthesis of the SPI signals ? I have read on the Teensy forums that some of the Adafruit SPI libraries are doing this and it causes issues somehow with other SPI devices.
- adafruit_support_bill
- Posts: 88151
- Joined: Sat Feb 07, 2009 10:11 am
Re: 24 channel TLC5947 board
You can wire multiples direct to the processor. But it is simpler to just chain them: https://learn.adafruit.com/tlc5947-tlc5 ... ing-boards
SPI is not a 'real' standard, and there are many variants. The TLC5947 uses a 3-wire version as described in the tutorial: https://learn.adafruit.com/tlc5947-tlc5 ... he-arduinois it using 'real SPI'
- ilium007
- Posts: 54
- Joined: Tue Oct 24, 2017 3:39 am
Re: 24 channel TLC5947 board
Ok thanks. I just need to make sure I can run these alongside MC23S17 SPI ICs I will be using for further I/O expansion.
- adafruit_support_bill
- Posts: 88151
- Joined: Sat Feb 07, 2009 10:11 am
Re: 24 channel TLC5947 board
The MCP23S17 interface is compatible with Atmel's hardware SPI implementation on the Arduino. So that can use the hardware MISO, MOSI & SCK pins. In theory, it might be possible to share MOSI and SCK with the TLS5947, but that depends on how well-behaved the libraries are. Unless you are short of pins, separate wiring would be simpler.
- ilium007
- Posts: 54
- Joined: Tue Oct 24, 2017 3:39 am
Re: 24 channel TLC5947 board
Yes but hardware SPI ports are set on the device. I assume what you are talking about by being able to see the different SPI pins is 'software SPI' which is what I referred to in my previous response. Software SPI is evidently significantly slower.
- adafruit_support_bill
- Posts: 88151
- Joined: Sat Feb 07, 2009 10:11 am
Re: 24 channel TLC5947 board
On most Arduinos, the hardware SPI pins are also GPIO pins. You can do 'software SPI' on the hardware SPI pins too.
Hardware SPI is generally faster - assuming that it is compatible with the device you are driving. The TLC5947 implementation is not compatible with the Atmel implementation so software SPI is necessary.
Hardware SPI is generally faster - assuming that it is compatible with the device you are driving. The TLC5947 implementation is not compatible with the Atmel implementation so software SPI is necessary.
- ilium007
- Posts: 54
- Joined: Tue Oct 24, 2017 3:39 am
Re: 24 channel TLC5947 board
I am using the Teensy 3.6 with hardware SPI.adafruit_support_bill wrote:On most Arduinos, the hardware SPI pins are also GPIO pins. You can do 'software SPI' on the hardware SPI pins too.
Hardware SPI is generally faster - assuming that it is compatible with the device you are driving. The TLC5947 implementation is not compatible with the Atmel implementation so software SPI is necessary.
- adafruit_support_bill
- Posts: 88151
- Joined: Sat Feb 07, 2009 10:11 am
Re: 24 channel TLC5947 board
The Teensy 3.6 uses an M4 processor. The IO on these is more configurable than on the Atmega processors on the 'classic' Arduiinos. The standard M4 board support for the Arduino IDE is configured to be compatible with the older boards. But you can configure multiple "SERCOM" SPI ports:
http://www.atmel.com/Images/Atmel-42181 ... ummary.pdf
https://learn.adafruit.com/using-atsamd ... -a-new-spi
http://www.atmel.com/Images/Atmel-42181 ... ummary.pdf
https://learn.adafruit.com/using-atsamd ... -a-new-spi
- ilium007
- Posts: 54
- Joined: Tue Oct 24, 2017 3:39 am
Re: 24 channel TLC5947 board
Thanks, I'll do some more reading before I commit to SPI (vs. I2C) and a AUD$25 part !
- ilium007
- Posts: 54
- Joined: Tue Oct 24, 2017 3:39 am
Re: 24 channel TLC5947 board
Looking at the Adafruit tutorial page (https://learn.adafruit.com/tlc5947-tlc5 ... rogramming) it mentions an alternative constructor for hardware SPI on the TLC5911 but not the TLC5947.
Is there a reason for this ?
looking at the source code for the TLC5947 I can see that it isn't implemented:Adafruit_TLC59711(uint8_t n);
Alternate consturctor for hardware SPI. Assumes hardware SPI pins for MOSI and SCK.
Code: Select all
#include <Adafruit_TLC5947.h>
Adafruit_TLC5947::Adafruit_TLC5947(uint16_t n, uint8_t c, uint8_t d, uint8_t l) {
numdrivers = n;
_clk = c;
_dat = d;
_lat = l;
//pwmbuffer = (uint16_t *)calloc(2, 24*n);
pwmbuffer = (uint16_t *)malloc(2 * 24*n);
memset(pwmbuffer, 0, 2*24*n);
}
- ilium007
- Posts: 54
- Joined: Tue Oct 24, 2017 3:39 am
Re: 24 channel TLC5947 board
I noticed also that the TLC59711 source code has been recently updated but the TLC5947 has not been touched for a while.
The TLC59711 class file has an include for SPI.h and the following hardware constructor:
Can this simply be implemented in the TLC5947 class ?
The TLC59711 class file has an include for SPI.h and the following hardware constructor:
Code: Select all
Adafruit_TLC59711::Adafruit_TLC59711(uint8_t n) {
numdrivers = n;
_clk = -1;
_dat = -1;
SPI.setBitOrder(MSBFIRST);
#ifdef __arm__
SPI.setClockDivider(42);
#else
SPI.setClockDivider(SPI_CLOCK_DIV8);
#endif
SPI.setDataMode(SPI_MODE0);
BCr = BCg = BCb = 0x7F;
pwmbuffer = (uint16_t *)calloc(2, 12*n);
}
- adafruit_support_bill
- Posts: 88151
- Joined: Sat Feb 07, 2009 10:11 am
Re: 24 channel TLC5947 board
Yes. The SPI implementation of the TLC5947 is not compatible with the hardware SPI implementations supported by the Arduino SPI library.Is there a reason for this ?
Please be positive and constructive with your questions and comments.