An SPI problem on NUCLEO-U575
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-07-05 11:04 PM
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
}
- Labels:
-
Documentation
-
SPI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-07-06 6:58 AM
When TSIZE is reached, transmission stops until you clear the EOT flag and re-start it. Additional info in the reference manual.
