STM32F407 Discovery board and TLC5947
Hi
I'm new to using STM Microcontrollers and I have the Discovery board as my development board, I have used Arduino religiously and thought I should learn something new.
I have learnt how to modify data registers, for example, turn the 4 LEDs on and off, also get an input from the push button to get the Leds to turn on.
Am now looking at PWM, which I did get to work. I had a previous project which uses these TLC5947 to turn some LEDs on, I used Arduino and it worked fine, since it used PWM I thought I could practice with these. Unfortunately, trying to get it to work with the discovery board isn't working out the way that I want and was wondering if someone can help me.
I know the Arduino has a 16Mhz clock and PWM frequency is 490hz and I know the discovery board is way higher. I just generally don't know where to begin
adfruit has a libaray file which modifys the pwm high and low using the code below
void Adafruit_TLC5947::write() {
digitalWrite(_lat, LOW);
// 24 channels per TLC5974
for (int16_t c = 24 * numdrivers - 1; c >= 0; c--) {
// 12 bits per channel, send MSB first
for (int8_t b = 11; b >= 0; b--) {
digitalWrite(_clk, LOW);
if (pwmbuffer[c] & (1 << b))
digitalWrite(_dat, HIGH);
else
digitalWrite(_dat, LOW);
digitalWrite(_clk, HIGH);
}
}
digitalWrite(_clk, LOW);
digitalWrite(_lat, HIGH);
digitalWrite(_lat, LOW);
}Of course, I thought that I could just use the pins on the dsicvoery board to do the same thing, high and low however that doesn't work, don't even know why I thought it would. It uses the Arduino PWM pins and this is where I was stuck.
I even thought maybe logic level shifters would work, but that didn't work either I even used delays, however nothing.
I know the discovery board can use 16Mhz (however if I do that I fell like I should just stick with the Arduino) by modifying the HSI but not 100% sure how to go about that, I would even need to change the pre scale value to make the frequency to 490Hz and change the counter period to 255, again not 100% sure how to go about that I have tried and I think I'm doing something wrong.
any help would be great or am i just wasting my time and to just stick with arduino
Thank you
