Question
SPI timing
Posted on August 14, 2014 at 23:44
I am writing an SPI interface where after 4 messages are sent I toggle a pin. My issue is my pin is toggling before the transmission is complete(I can see my pin go high after the 3rd message). I am monitoring the bsy and the tx flags but not getting the results I was expecting. Any help is appreciated. I am using an STM32F103.
LCD_Write_Command(0x60 | tmp);LCD_Write_Command(0x70 | tmp);LCD_Write_Command(0x00 | tmp);LCD_Write_Command(0x10 | tmp);GPIO_WriteBit(GPIOB,LCD_CD,Bit_SET);voidLCD_Write_Command(unsigned char dat){ while ((SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_BSY) == 1)); SPI_I2S_SendData(SPI1, dat); while ((SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_TXE) == 0));} #spi #stm32103