cancel
Showing results for 
Search instead for 
Did you mean: 

An SPI problem on NUCLEO-U575

Skfir
Associate III

Hello everybody!

Running into a weird problem with SPI. A super simple code, which runs once a second and sends a 16-bit number over SPI. If I leave the TSIZE field in CR2 at zero - everything is okay. However, if I write any number in the TSIZE, then SPI outputs data only once - the first time, after that nothing goes out - the logic analyzer doesn't get any output. Any idea? Again, if I don't write the TSIZE, then everything runs okay. 

Here is the code:

 

 

SPI1->CR1 &= ~(SPI_CR1_SPE); //SPI must be disabled before writing into CR2 
SPI1->CR2 = 0;
SPI1->CR2 = 1;

SPI1->CR1 |= SPI_CR1_SPE; //Enable SPI
SPI1->TXDR = 0x5555;
SPI1->CR1 |= SPI_CR1_CSTART; //Start SPI transmission.
//The first time 0x5555 goes out just fine, but when the function is called again, nothing goes out
//If the two lines, writing into the CR2 register are removed - then everything is fine
}

 

1 REPLY 1
TDK
Guru

When TSIZE is reached, transmission stops until you clear the EOT flag and re-start it. Additional info in the reference manual.

 

If you feel a post has answered your question, please click "Accept as Solution".