I am working on a small project and I am finding it difficult to have a good spot for reprogramming headers. As a result, I was looking at the leonardo as a middleman for me to learn how to use the Atmega32U4.
Does anybody know if the library for the TLC5940 works properly with the leonardo?
The Leonardo implements SPI different from the Uno.
You might have to change the TLC5940 library to use "bit-bang" mode instead of SPI until a pin mapping for the 32u4 is created. Look at the tlc_config.h file to see how to change the mode and setup the 2 pins to use.
So I emailed the guy who made the previous libraries for the TLC5940 work with the arduino and here it is
Hi Shannon,
I haven't played around with a Leonardo yet, so the library won't be updated anytime soon. Hopefully someone will contribute code to get it working :-). The library uses two timers and the hardware SPI module. If you want to try updating it, try comparing the timer section/SPI section in the Atmega168 datasheet with the 32U4 datasheet.
Alex
I'm thinking it would be nifty to try to do it although I have absolutely no idea what I'd be doing.
I've been trying to get the TLC5940 to work with a Leonardo for 2 days now. One problem is that the hardware SPI is now only available on the ICSP header rather than pins 10-13. The other is that the pin mappings in the Teensy pinout file don't seem to line up with the datasheet for the chip on the Leonardo.
If anyone has had success modifying this library, or if you might have ideas on how to get it going, myself as well as others would appreciate it.
I should have mentioned that I tried connecting directly to the ICSP but didn't have any luck. I think the problem lays in my attempt at rewriting the pin layouts. The Atmega_xx8 file uses pin designations like PB0 and PD5 whereas the Teensy_XXuh file uses numbered pins such as 16, 17, etc..
I've tried both methods of mapping but still have the same blank result. Mind you I'm a complete newbie when it comes to this so I'm sure I'm missing something simple.
Hello I'm a beginner with Arduino and I got same problem.
I've to clear the solution but it works and it's something.
You have to backup and then edit.../arduinoIDEfolder/libraries/TLC5940/pinouts/chip_includes.h
after the abbrevation port definitions (many sentences like '#define PB0 PORTB0') delete all and left it like this:
You must advise that the pin numbers are different to the Teensy, even more, you must use the SCK and MOSI signals from the ICSP connector (not mapped to digital pins in Leonardo) and the SS signal from the RX LED board). See the next images for more help (the first is for the ICSP detail algthou is not Leonardo board, and the second is for the board conection to the SS signal)
Be sure too that in .../arduinoIDEfolder/libraries/TLC5940/tlc_config.h you have correctly the numbers of TLC you're using '#define NUM_TLCS 2' (for 2 TLC5940's) at Line55
I hope this helps anyone new with Arduino Leonardo board and the TLC5940 chip.
Sorry for my english.
However, admittedly I do not fully understand which pin/part of the leonardo to connect exactly to which pin of TLC. Could someone be so kind to clearify this? Maybe in the form as it is done explained in the BasicUse example of the TLC library?
Okay so I noticed last night while building a circuitboard that the TLC5940 Grayscale clock (for the PWM function) is connected to the INT1 pin when set-up with an ATmega328p. When connecting it up like that on the 32U4, I noticeced the INT1 pin is also the SDA pin (for I2C/TWI). Unfortunatly my project requires the I2C bus for a different IC.
Can I change the grayscale pin for this to another pin and will still work?