Question
I always getting 0xff in my SPI RX Buffer
I used the STM32F401 discovery board which has an L3GD20H gyroscope sensor communicated with the MCU via SPI1, I made the necessary configuration by Cube MX
I tried to read the device ID of the gyroscope but each time I received 0xff,
can someone help me to resolve this problem to continue my work
*/
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_SPI1_Init();
/* USER CODE BEGIN 2 */
SpiTxBuff[0]=0x0f;
HAL_GPIO_WritePin(GPIOE,GPIO_PIN_3,GPIO_PIN_RESET);
HAL_SPI_Transmit(&hspi1,&SpiTxBuff[0],1,50);
HAL_SPI_Receive(&hspi1,&SpiRxBuff[0],1,50);
HAL_GPIO_WritePin(GPIOE,GPIO_PIN_3,GPIO_PIN_SET);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}