2018-01-22 07:44 AM
I have my SPI3 module configured as a master. I want it to transmit 8-bit words. Here is my setup as read from the chip while its executing. No matter what I do each time I write to SPI3->DR it transmits 16-bits what can I do? Please don't give any answers involving the HAL libraries as I am not able to use it.
Thanks
#stm32f-spiSolved! Go to Solution.
2018-01-22 09:22 AM
*((volatile uint8_t *)&SPI1->DR) = 0xAA; // volatile will be safer from the compiler folding the write
2018-01-22 08:21 AM
Write to the register with an appropriate cast so the bus transaction has the right width.
*((uint8_t *)&SPI1->DR) = 0xAA;
2018-01-22 09:22 AM
*((volatile uint8_t *)&SPI1->DR) = 0xAA; // volatile will be safer from the compiler folding the write
2018-01-22 09:29 AM
And the explanation is under Data packing subchapter in the SPI chapter of RM.
JW
2018-01-22 09:32 AM
Thanks Clive, works great now.