2021-12-17 02:43 PM
Hello ,
So for my project i need to send UART command every 15min
Between this my MCU need to be sleeping
And send a command if a Interrupt pin change state
But when i wrote UART_transmit fonction in a ISR : RTC , timer , interrupt pin the command isn't send
In internet people says that interrupt function can't handle UART so how solve my issue
Thanks
Solved! Go to Solution.
2021-12-18 03:29 AM
In the interrupt set a flag.
Then in your main routine check the flag and if it is set then send the UART message and reset the flag.
If your MCU is sleeping (in wfi I presume) it is awaken by an interrupt. They you have to test the flags when the MCU resume from wfi.
It is good practice to get short ISR
2021-12-18 03:29 AM
In the interrupt set a flag.
Then in your main routine check the flag and if it is set then send the UART message and reset the flag.
If your MCU is sleeping (in wfi I presume) it is awaken by an interrupt. They you have to test the flags when the MCU resume from wfi.
It is good practice to get short ISR
2021-12-18 03:45 AM
Put the data strings you want to send into a FIFO / ring buffer, and then enable the UART TXE interrupt bit, this will cause the UART interrupt to push data out at its own rate whilst letting your other interrupt finish immediately.
2021-12-18 05:45 AM
Very big thanks it worked so fine you resolved a very big problem for my project thanks .;)