HAL_UART_Transmit_IT doesn't transmit
STM32F103
Im using HAL_UART_Transmit_IT but doesnt work, if change to HAL_UART_Transmit all works fime but add delays to move in motors. Where are my error? i see all videos on youtb and cant find the problem.
I have enabled the IT on MX the priority are on 0, (try other combinations but same result)
i call the enviar4Variables_IT on the while of movement motors, for update the position without delay the motors.
Out side the while i call with out IT with no problems.
I check the debug up to return HAL_OK (not are busy, the addres of pointer its correct inside of HAL_UART_Transmit_IT )
I think must works but i dont know what happen
Thanks in advance
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
{
uartIT_free = 1;
}
void enviar4Variables_IT(uint16_t variable, uint16_t valor1, uint16_t valor2, uint16_t valor3, uint16_t valor4)
{
if(uartIT_free)
{
uartIT_free = 0;
uint8_t data[] = {0x82, (uint8_t)(variable >> 8), (uint8_t)(variable & 255), (uint8_t)(valor1 >> 8), (uint8_t)(valor1 & 255), (uint8_t)(valor2 >> 8), (uint8_t)(valor2 & 255), (uint8_t)(valor3 >> 8), (uint8_t)(valor3 & 255), (uint8_t)(valor4 >> 8), (uint8_t)(valor4 & 255)};
uint16_t crcreturn = ModRTU_CRC(data, 11);
uint8_t data_to_send[] = {0x5A,0xA5,0x0D,0x82, (uint8_t)(variable >> 8), (uint8_t)(variable & 255), (uint8_t)(valor1 >> 8), (uint8_t)(valor1 & 255), (uint8_t)(valor2 >> 8), (uint8_t)(valor2 & 255), (uint8_t)(valor3 >> 8), (uint8_t)(valor3 & 255), (uint8_t)(valor4 >> 8), (uint8_t)(valor4 & 255),(uint8_t)(crcreturn&255),(uint8_t)(crcreturn>>8)};
HAL_UART_Transmit_IT(&huart2, data_to_send, 16);
}
}
