2021-10-20 02:37 AM
Hi, I've been facing some issue using HAL_UART_TRANSMIT. The thing is that I want to send a message when I press a button. My idea is to catch the interrupt of the button and setting a flag, then in main sending the message detecting the flag.
The problem is that when the flag is detected in the main and the message is sent I can see in the logic analyzer how it has been split into 2 parts. But if I introduce the exact same code in the interruption callback it works perfectly. I have tried putting the code in the Main just before the loop and I always get the same result everywhere in main.c it only works okay in the stm32fxx_it.c file. Where stm32cubeIde generates the interruption callbacks.
This is the code I use to send:
uint8_t converted2[100] = {0b01011011, 0b01011011, 0b01011011, 0b01011011, 0b01000001, 0b01011011};
HAL_StatusTypeDef statuss;
statuss = HAL_UART_Transmit(&huart1, converted2, 6, 20);
How can I solve that?
Good transmission from callback:
Bad Transmission from main.c :
Many thanks!
Solved! Go to Solution.
2021-10-20 04:03 AM
Update2: I finally found it. It was totally my fault as my ADC was constantly capturing and generating interrupts. Now it's working flawlessly
2021-10-20 03:38 AM
Update: I have tested a new clean project and now its working. But I still have to find the solution with the other project. I think that the problem could be an interruption that is triggered and stops the execution of the sending, but I have monitored all my functions on the _it.c file and none of them has been triggered.
Is there any other way to check that other than with the debugger and breakpoints?
Thanks!
2021-10-20 04:03 AM
Update2: I finally found it. It was totally my fault as my ADC was constantly capturing and generating interrupts. Now it's working flawlessly