cancel
Showing results for 
Search instead for 
Did you mean: 

Problem SPI STM32F405 for TLC5971

ignasi
Associate II
Posted on August 31, 2017 at 21:12

Hi everyone,

I'm trying to program a

http://www.ti.com/product/TLC5971

, with the SPI1 of STM32f405. Unfortunatly the PWM of the

http://www.ti.com/product/TLC5971

is not working. It is a LED driver0690X000006085mQAA.png

I 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 the

http://www.ti.com/product/TLC5971

. It is even propagated to SCKO  and SDTO. To be honest, the signal SCKI is perfect on the input

In 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 example

    HAL_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

5 REPLIES 5
Posted on August 31, 2017 at 21:23

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

Posted on August 31, 2017 at 21:51

hello!

>>>> SPI : ( slow baud rate; 125Kbits/s; CPOL Polarity Low; Phase CPHA: 1 Edge)

TLC5971 manual

0690X000006085xQAA.png

RM for MCU

0690X000006085wQAA.png

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

Posted on September 01, 2017 at 10:06

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

ignasi
Associate II
Posted on September 01, 2017 at 12:15

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

Posted on September 01, 2017 at 11:40

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