Why is my GPIO used as NSS toggles randomly during SPI data transfer
Hello I'm using SPI to interface my STM32F7 with the SX1262 radio.
I got a weird behavior, I'm using a GPIO to toggle the NSS pin. But sometimes it toggles randomly during the data transfer. You can see on the following screenshot of my logic analyzer:
Here's the code for it:
void WriteBuffer(SPI_HandleTypeDef hspiX)
{
while(HAL_GPIO_ReadPin(GPIOF, GPIO_PIN_13) == 1)
{
}
uint16_t WriteBufferSize = 6;
uint8_t WriteBufferCmd[] = {0x0E, 0x00, 0x33, 0x65, 0x67, 0x67}; // !ACC
//uint8_t WriteBufferAnswer[6];
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_RESET);
HAL_SPI_Transmit(&hspiX,(uint8_t *)WriteBufferCmd,WriteBufferSize,100);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_SET);
}Here's the SPI setup: