Modifying TLC5940 library for use with Teensy3.1

Status
Not open for further replies.

Skennedy

New member
Hi All,
I am working on a group project using TLC5940s, and 595 shift registers to drive a LOT of RGB LEDs.
Our small scale testing was done using an Arduino Uno and the TLC library found here:
http://code.google.com/p/tlc5940arduino/
This library states that it works on Teensy 2.0, Teensy++ 1.0, and Teensy++ 2.0 and I was wondering if there was any relatively simple way to modify this library to work on a Teensy 3.1. (E.g. just changing pinouts or timers and pinouts).

If there are any relevant links or suggestions on how this code can be modified, that would be awesome, or best yet if someone is willing to modify the library for supporting Teensy 3.1.
Regards.
 
Hey Skennedy,

I've started to work out the pinout changes. Can anyone comment?

#if DATA_TRANSFER_MODE == TLC_BITBANG
#error "If you want bitbang mode, insert pin defs here"
#endif

// DOUT (Teensy 3.1 pin 11) -> SIN (TLC pin 26)
#define TLC_MOSI_PIN PCR6
#define TLC_MOSI_PORT PORTC
#define TLC_MOSI_DDR PDDR

// SCK (Teensy 3.1 pin 13) -> SCLK (TLC pin 25)
#define TLC_SCK_PIN PCR5
#define TLC_SCK_PORT PORTC
#define TLC_SCK_DDR PDDR

// CS (Teensy 3.1 pin 10)
#define TLC_SS_PIN PCR4
#define TLC_SS_PORT PORTC
#define TLC_SS_DDR PDDR

// OC1A (Teensy 3.1 pin 3) -> XLAT (TLC pin 24)
#define XLAT_PIN PCR12
#define XLAT_PORT PORTA
#define XLAT_DDR PDDR

// OC1B (Teensy 3.1 pin 4) -> BLANK (TLC pin 23)
#define BLANK_PIN PCR13
#define BLANK_PORT GPIOA
#define BLANK_DDR PDDR

// OC2B (Teensy 3.1 pin 5) -> GSCLK (TLC pin 18)
#define GSCLK_PIN PCR7
#define GSCLK_PORT GPIOD
#define GSCLK_DDR PDDR

#endif
 
Did this work?

Thanks so much

Hey Skennedy,

I've started to work out the pinout changes. Can anyone comment?

#if DATA_TRANSFER_MODE == TLC_BITBANG
#error "If you want bitbang mode, insert pin defs here"
#endif

// DOUT (Teensy 3.1 pin 11) -> SIN (TLC pin 26)
#define TLC_MOSI_PIN PCR6
#define TLC_MOSI_PORT PORTC
#define TLC_MOSI_DDR PDDR

// SCK (Teensy 3.1 pin 13) -> SCLK (TLC pin 25)
#define TLC_SCK_PIN PCR5
#define TLC_SCK_PORT PORTC
#define TLC_SCK_DDR PDDR

// CS (Teensy 3.1 pin 10)
#define TLC_SS_PIN PCR4
#define TLC_SS_PORT PORTC
#define TLC_SS_DDR PDDR

// OC1A (Teensy 3.1 pin 3) -> XLAT (TLC pin 24)
#define XLAT_PIN PCR12
#define XLAT_PORT PORTA
#define XLAT_DDR PDDR

// OC1B (Teensy 3.1 pin 4) -> BLANK (TLC pin 23)
#define BLANK_PIN PCR13
#define BLANK_PORT GPIOA
#define BLANK_DDR PDDR

// OC2B (Teensy 3.1 pin 5) -> GSCLK (TLC pin 18)
#define GSCLK_PIN PCR7
#define GSCLK_PORT GPIOD
#define GSCLK_DDR PDDR

#endif
 
I ported Tlc5940 this weekend. Here's the source code:

https://github.com/PaulStoffregen/Tlc5940

I've updated the web page with pin connection info for Teensy 3.x.

http://www.pjrc.com/teensy/td_libs_Tlc5940.html

If you're still watching this old thread and still interested in using a TLC5940 chip with Teensy 3.0 or 3.1, I hope you'll give it a try. I tested here with 1 TLC5940 chip and 16 LEDs. It seems to be working well, but I didn't have time to exhaustively test the many special features of this library.

The special (slow) servo mode doesn't work on Teensy 3.1 or 3.0 or even Teensy 2.0 (it's never worked). To control a very large number of servo motors, I'd recommend the PulsePosition library, or Adafruit's servo control board.
 
I hate to revive an old thread but how come the 3.1 doesn't work with the servo mode? Is there anyway to fix it?

My project requires me to drive 24 servos and do a lot of floating point math. I thought the teensy 3.1 and TLC (had it on hand) would work better than the Pololu Maestro.

I ported Tlc5940 this weekend. Here's the source code:

https://github.com/PaulStoffregen/Tlc5940

I've updated the web page with pin connection info for Teensy 3.x.

http://www.pjrc.com/teensy/td_libs_Tlc5940.html

If you're still watching this old thread and still interested in using a TLC5940 chip with Teensy 3.0 or 3.1, I hope you'll give it a try. I tested here with 1 TLC5940 chip and 16 LEDs. It seems to be working well, but I didn't have time to exhaustively test the many special features of this library.

The special (slow) servo mode doesn't work on Teensy 3.1 or 3.0 or even Teensy 2.0 (it's never worked). To control a very large number of servo motors, I'd recommend the PulsePosition library, or Adafruit's servo control board.
 
Status
Not open for further replies.
Back
Top