Question
SPI change polarity on the fly
Posted on August 22, 2012 at 18:30
Hi, I want change polarity on the fly example
When I setting the SPI master, I setting ''SPI_CPOL_Low'' trasmit the 16 bit data, and work! But I need recive another 16bit data with polarity inverse ''SPI_CPOL_Hight'' The protocolo is this: (ADF7021 ''Serial Interface Readback Timing Diagram'') Send screen of datasheet: Send 32bit + 1bit clock + 16 bit clock with inverse polarity Send 32bit = Ok but How to send in the fly 1 bit clock and inverse polarity on the fly? /* SPI configuration -------------------------------------------------------*/ SPI_I2S_DeInit(SPI1); SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; SPI_InitStructure.SPI_DataSize = SPI_DataSize_16b; SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low; SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge; SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_32; SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; SPI_InitStructure.SPI_CRCPolynomial = 7; SPI_InitStructure.SPI_Mode = SPI_Mode_Master; SPI_Init(SPI1, &SPI_InitStructure); /* Enable the SPI peripheral */ SPI_Cmd(SPI1, ENABLE);