cancel
Showing results for 
Search instead for 
Did you mean: 

about HAL_UART_Transmit when Paired device is gone

DU2
Associate II

I am making L031K6 mcu sensor. This sensor regulary sense some adc data then send the data to Android device by BLE.

and I am using HAL_UART_Transmit() for sending message to android by BLE.

but when android is missing, my MCU runs bad. so I guess HAL_UART_Transmit() work something wrong when Paired device is missing.

I used transmit() like this:

uint8_t temp[5]="HELLO";
     HAL_UART_Transmit(&huart2,temp,5,500);

in HAL_UART_Transmit(), there is a timeout for waiting the object device

in that time out, does the program flow is blocked like HAL_Delay(ms) ?

 If so, In my code will block 500 ms when paired device is missing ?

during the waiting timeout, Will my Timer interrupt code will occur ?

1 REPLY 1
JoniS
Senior

It does only block the main program for the timeout period interrupts wI'll fire normally during that time.

Sure you could listen for bluetooth disconnection events from your bluetooth module? This way the program is not stuck on every loop for 500ms when there is no device connected.

Thought you still should use timeout to solve cases like disconnection during transmitting.