Pages: [1]   Go Down
Author Topic: TLC5940 change frequency to 20kHz  (Read 217 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I need to raise the frequency of my two daisy chained TLC5940. I am using this library https://code.google.com/p/arduino-due-tlc5940/ and it works fine, but it outputs only about 513Hz. There are components in my circiut that will make noise (hdd voice coils for example), so a PWM frequency of about 20kHz would be great, but I don't know how to modify the library. I guess at 20kHz it will not be possible to drive the TLC5940 with 12bit, but 10 or 8 bit are also fine.
I know, the PWM on pins 3,4,5 and 6 6,7,8 and 9 can be modified with the pwm01 library (https://github.com/it-workshop/pwm01.h_by_randomvibe), I just need the same thing on the TLC5940's.

Thanks in advance!
« Last Edit: September 08, 2014, 05:40:51 pm by vile » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the links, but I've read them already. The problem is that I am using another library written for the DUE.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks kd7eir, but it isn't about the pwm01 library, because it only affects the pins on the DUE 3,4,5 and 6 6,7,8 and 9 (the library works well).
I want the outputs on the TLC5940 to work at 20kHz, and the pwm01 library can't do that.
« Last Edit: September 08, 2014, 05:41:46 pm by vile » Logged

0
Online Online
Shannon Member
****
Karma: 215
Posts: 12446
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Currently the pwm frequency is set in variants.h using the #defines
Code:
#define PWM_FREQUENCY 1000

#define TC_FREQUENCY        1000
You could change these, each variable affects some of the pins.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I see, but willI  a different PWM frequency also affect the frequency of the TLC5940s outputs? don't think so...

In the library, there are used timers, dividers and other things like SPI frequency to communicate with the TLC5940. Also the 4096 PWM steps are set up.

The half of the core clock (84MHz) is divided by 20 to get 2,1MHz which creates with 4096 steps a 512,7Hz PWM frequency on the output. But I want it to be 20kHz. That means I have to lower the frequency divider and lower the steps. But how? This is the question.
Logged

0
Offline Offline
God Member
*****
Karma: 26
Posts: 621
Always making something...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I believe the TLC5940 PWM is always 1/4096th of the GSCLK input, and the maximum GSCLK speed is approx 31 MHz.

No amount of wishing a thing to be more than it actually is can make it so.
Logged

Pages: [1]   Go Up
Jump to: