Question
Why F030C8 SPI performes like this? ''Data packing“ problem
Posted on January 08, 2016 at 17:15
Is the sentence ''SPI1->DR = 0XFF;'' a kind of ''16-bit access of SPIx_DR''?When I replaced 0XFF with a uint8_t variable the waveform didn't change at all.I also changed the optimization level to -O0, but it had no effect.''Data packing'' is too inconvenient to communicate with some devices,like nRF24L01. Can anyone tell me how to read/write SPIx_DR in a 8-bit way like it is in F1xx series? Thanks.
IDE environment: KEIL v5.14 + CubeMX v4.12 + CubeF0 v1.4
Chip type:F030C8T6Debugger:ST-LINK VIIWhen I use SPI in polling mode, i found a weird thing. I have never met this before when I were using F1xx series chips.The date size is set to 8-bit long and MSB first (SPIx_CR1=0x36C,SPIx_CR2=0x1700).Here is the main code.while(1){ SPI1->DR = 0XFF; while(SPI1->SR & SPI_SR_BSY); while(!(SPI1->SR & SPI_SR_RXNE)); temp = SPI1->DR;}This is the corresponding waveform.
Is the sentence ''SPI1->DR = 0XFF;'' a kind of ''16-bit access of SPIx_DR''?When I replaced 0XFF with a uint8_t variable the waveform didn't change at all.I also changed the optimization level to -O0, but it had no effect.''Data packing'' is too inconvenient to communicate with some devices,like nRF24L01. Can anyone tell me how to read/write SPIx_DR in a 8-bit way like it is in F1xx series? Thanks.