2022-12-06 06:08 AM
I am using 2 Uart with interrupt function. I have enabled two interrupts at the same time. But I can access only one Uart at a time. Another Uart interrupt is no response.
Kindly support for rectify this issue.
2022-12-06 07:12 AM
It might be helpful to show us what you've done, so we might spot mistakes or "gotchas".
Do the UART interrupts end up calling the same function? If so, how do you know which UART has a fresh character to process?
A common "mistake" within an ISR is to try to echo the incoming character out to another UART. The problem with this is that the sending will take one character-time to send, by which time you might have missed the next incoming character. I strongly recommend putting incoming characters into a buffer that you can examine with a debugger at your leisure, rather than in the time-critical interrupt-service-routine.
I would also add that I regard the stm32-supplied HAL code somewhat restrictive - it's fine for experimenting and learning how to do things, but it takes a lot of effort to make it do more than one thing at a time.
Regards,
Danish
2022-12-06 09:41 AM
@Danish
Hi ,
Thanks for replying
Currently I am working in Uart interrupt in along with LoRaWAN in RAK3172 module(STM32WLE5JC MCU).
I had worked with 2 UART interrupt without LoRa its working fine which was generated in STM32CubeIDE.
while trying to integrate one Uart interrupt with another LPUART interrupt which was used for AT commands configuration in LoRa its not working.
Below I have attached the Configuration Screenshot step by step
Kindly support for rectify this issue.
Thank you!
2022-12-06 09:56 AM
Step 1: LPUART init function
Step 2 : UART1 init function
Step 3: Uart Msp init
STEP 4 : UART MSP Deinit
2022-12-06 10:01 AM
Step 5: Calling UART
Step 6:Uart Callback function
uint8_t UART1_rxBuffer[1]={0};
uint8_t a[1]={0x00};
2022-12-06 10:06 AM
Don't put Blocking functions in callbacks, they are done under interrupt context, and will stop other interrupts of same/low priority from executing.
Do whatever work you need to do and leave, quickly.
2022-12-07 01:09 AM
@Community member
I have changed the NVIC priority in LPUART1 (PreemptPriority, sub Priority-->(1,0)) and UART1 (PreemptPriority, sub Priority-->(2,1)) still now I have facing same issue
Kindly guide me to rectify this issue
2022-12-07 11:20 PM
Kindly guide me!
2022-12-08 12:06 PM
The only thing a uart interrupt should do is move the data from the UART to memory (in the case of a RX interrupt) or move data from memory to the UART in the case of TX interrupt. You can add 1 or subtract 1 from a counter and set a flag, but beyond that nothing else should be in the interrupt. "
Do not process the data you received. That should be done in the main program.
Do not have anything in the interrupt that needs to wait for something else to happen. That is what they mean by no blocking functions.
If you go in and out of interrupts as fast as possible you are doing it right. If you are doing more, then you are doing it wrong.
2022-12-09 07:18 PM
Was the default lora sw define an uart interrupt handler and yours is not used? Test by trying to put breakpoint in yours.
Interrupts as said before should be very brief as they replace hw.... header byte screening, push byte in a sw fifo to queue them up for other slower non interrupt sw to manage.
You should put both uart interrupt same prio.
Put breakpoint in each isr to check you *** there. Even stop the code, check the hw registers values to make sure all is well configured, manually adjust amd let the code continue untill you get the interrupt breakpoint. You are in code debug mode, dig...