ESP32 Uart ISRs and misinformation

JL1946
Posts: 11
Joined: Mon Feb 25, 2019 3:46 pm

ESP32 Uart ISRs and misinformation

Postby JL1946 » Sat Mar 23, 2019 4:06 pm

It seems to me that ISR (Interrupt Service Routine aka interrupt handler) code which is intended to capture uart data is not all-that-it-can-be. Some people claiming to be "embedded developers" post code to these forums and even write blogs to demonstrate their expertise, but end up confusing the folks that need the help to get their projects running. The net result is more confusion and little transfer of knowledge. Code is posted with very few or questionable comments, structs or other code that have no business being there, code that does nothing, etc.
So, after spending hours debugging examples, I have decided to write this blurb just to clear up a few things about the Uart ISRs that I have looked at
For example:
1. The ISR intro should be checking the status register to determine what caused the interrupt. If a Parity Error (UART0/1/2.int_st.val = 4) caused the interrupt, there is no point to capturing the data because it would be invalid. The code should clear the register and move on.

2. Clearing only 1 or 2 bits of the Reset Register when there are at least 6 different interrupt-enable-bits set in the configuration register makes NO sense. If the the condition that caused the interrupt is not reset, the ISR will continually be re-entered as soon as the function completes. The code then finds itself in an endless loop and the user has no idea why his code is "not working" --> Back to the forum...

3. Newbie developers should understand that you don't need Freetos libraries to make the ISR function fulfill its task. One such piece of code floating around in this forum imports the libraries to create a task that just blinks an LED. This might lead a person to think that the libraries are required when they are not!!! I believe that the KISS principle should be followed when developing code.

There are more things that I could comment on, but, I think that some of the people reading this rant will understand my frustration with some "developers" that just copy code from somewhere else and pass it on as their own without explanation, either because they don't understand "their" code, or are too lazy to provide the comments that would help those of us that need the help!!!

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot], joglz8 and 143 guests