cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F0 - The second HAL_SPI_Transmit() call hang the program

void BSP_SPI_Write(uint8_t ValueL, uint8_t ValueR)
{
  char txData[2];
  char rxData[2];

  txData[0] = 0b10101011;
  txData[1] = (uint8_t *)&ValueL;

  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_2, GPIO_PIN_RESET);
  TIM6delay_us(10);
  HAL_SPI_Transmit(&hspi1, (uint8_t *)&txData, 2, HAL_MAX_DELAY);
  TIM6delay_us(10);
  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_2, GPIO_PIN_SET);

  TIM6delay_ms(100);

  txData[0] = 0b10110011;
  txData[1] = (uint8_t *)&ValueR;

  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_2, GPIO_PIN_RESET);
  TIM6delay_us(10);
  HAL_SPI_Transmit(&hspi1, (uint8_t *)&txData, 2, HAL_MAX_DELAY); // <<< this hang the program
  TIM6delay_us(10);
  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_2, GPIO_PIN_SET);
}
1 ACCEPTED SOLUTION

Accepted Solutions
1 REPLY 1

Solved!