2017-08-31 12:12 PM
Hi everyone,
I'm trying to program a
http://www.ti.com/product/TLC5971
, with the SPI1 of STM32f405. Unfortunatly the PWM of thehttp://www.ti.com/product/TLC5971
is not working. It is a LED driverI have checked the inpunt of the
http://www.ti.com/product/TLC5971
, Vcc= Vreg=3.3V, GND is also good. And the data and clock of the spi arrives ok to thehttp://www.ti.com/product/TLC5971
. It is even propagated to SCKO and SDTO. To be honest, the signal SCKI is perfect on the inputIn order to give the right parameters, I have to send the 224 bits register, with the first 6 MSB being 0x25. This is the write instruction who actionates the latch.
I feel maybe the SPI1 of my STM32f4 is not doing the job, because I don't have pwm. At the end 8 cicles scki should be down for the tlc5971 to produce the latch and register the parameters.
The code of programming is the following :
uint8_t PWM_buffer[28] = {0x94, 0x5F, 0x0F, 0xFF, 0xFF,0xFF, 0x03, 0x03,0x03,0x03,0xFF, 0xFF,0xFF,0xFF, 0xFF, 0xFF, 0xFF,
0xFF,0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,0x5,0x5, 0x5, 0x5}; /// Commands to program
http://www.ti.com/product/TLC5971
+ data of colors for an exampleHAL_SPI_Transmit(&hspi1, PWM_buffer,28,1); /// I send all the commands + data to the
http://www.ti.com/product/TLC5971
HAL_GPIO_WritePin(MCU_SCKI_GPIO_Port,MCU_SCKI_Pin,GPIO_PIN_SET); /// I set the SCKI High so
http://www.ti.com/product/TLC5971
creates the latch and register.
while(HAL_GetTick()<150){}; /// Delay
SPI : ( slow baud rate; 328.125Kbits/s; CPOL Polarity Low; Phase CPHA: 1 Edge)
Any idea what I'm doing wrong?
Thank you in advance
ip
2017-08-31 12:23 PM
Without latching, send a bunch of data, like 2x224 bits or more. Observe the data on SDTO with a LA and compare whether they match the input delayed by 224 clocks.
JW
2017-08-31 12:51 PM
hello!
>>>> SPI : ( slow baud rate; 125Kbits/s; CPOL Polarity Low; Phase CPHA: 1 Edge)
TLC5971 manual
RM for MCU
so CPHA must be 0
>>>> HAL_GPIO_WritePin(MCU_SCKI_GPIO_Port,MCU_SCKI_Pin,GPIO_PIN_SET); /// I set the SCKI High so
/external-link.jspa?url=http%3A%2F%2Fwww.ti.com%2Fproduct%2FTLC5971
creates the latch and register.Is your intention to use a GPIO set function when your pin is configured allready as AF (SPI SCK)?
Actualy there is no need to pull SCKat HI state.
The above figure from TLC5971 manual, shows to keep the SCK at low state for a tD6 time. (introduce some delay tD6 after finish transmission)
Note : with CPOL =0 , the SCK polarity after finish the transmission, is allready low.
Regards
vf
2017-09-01 03:06 AM
Hello Vangelis,
Thank you for your answer.
As far I understood, you agree with the configuration I have on the SPI?
I have removed the forcing GPIO, but still is not working.
Any other idea why the register is not well programmed?
Thank you for your time.
Best Regards
ip
2017-09-01 03:15 AM
Hi Vangelis!
I use
Phase CPHA: 1 Edge; which means CPHA=0;
Maybe I'm wrong, but usually 1 Edge -> CPHA= 0
2 Edges -> CPHA =1
Best Regards
2017-09-01 04:40 AM
Hi again.
I wrote ' so CPHA must be 0' You use CPHA=1. I do not agree
In all cases you must double check everything. From power supplies to the consisteny of data you send.
In case you have a Logic Analyser , Follow the suggestion of
Waclawek.Jan
.Regards
vf