2024-03-28 12:40 PM - last edited on 2024-03-28 01:08 PM by Peter BENSCH
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);
}
Solved! Go to Solution.
2024-03-28 02:05 PM
2024-03-28 02:05 PM
Solved!