This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

UART Intermitent OE

Guru 56418 points

Part Number: EK-TM4C1294XL

Original question: https://e2e.ti.com/support/microcontrollers/other/f/908/t/852472

Last thread ended with possibility Baudrate clock divisor fraction (BRDF) lost remainder might cause Receiver holding register to intermittently fail to detect next start bit (after byte 15) is read from FIFO when TMIC bit is not auto cleared. Again the TMIC bit can not be auto cleared when receiver is not empty relative to byte 15 where it often aborts to OE (overrun) and there is no pause in the senders data stream. Yet receiver FIFO appears to fall behind senders transmission leading to FALSE positive, e.g. OE condition being incorrectly flagged for HW under run (UE) handing of serial data. 

UART2 was changed to UART3 and same intermittent UE condition occurs. It would seem this issue is an UE anomaly incorrectly perceived by HW as OE error. Review of UARTprintf() code reveals a char by char Blocked read into unsigned char BUFFER, insanely checks the EMPTY flag each RX character TWICE not once. Relying on UARTprintf() as being a test of HW functionality would lead to misdiagnoses of UART issues and configuration via Tivaware thus masking over underlying issues.

Our code differs reading receiver UARTDR in circular burst of 16 data + 6 command bytes, 24 bytes total at most. This 24 byte burst read of FIFO reveals odd silicon issues perhaps in UART_FR_RXFE flag and TMIC interrupt auto bit clearing being out of sequence with SW back to back (B2B) reads of UARTDR register. As a result SW must force clear TMIC or FIFO receiver HALTS, locks up. That is abnormal behavior for NO logical reason datasheet describes or reveals. Where is the flowchart indicating how these 2 flags are to be posting results, or not in this case? Why are there no UART errata notes and post obviously would be more of a HW configuration related issue then?  

The Baudrate 115200 BPS is very slow comparatively to UART capability 15MBPS, HSE bit cleared x16 divisor configures UART for low speed mode < 7.5MBPS. Might that divisor be where intermittent OE originates and what can be done to RX handler other than BUFFER the B2B reads of UARTDR? Is there a WA that can fix the sequence of TMIC relative to RXFE empty detection? has anyone ever reported in this forum such issues as being described?

uint32_t ui32RxErrorStatus;
/* Load the RX error status bits */
ui32RxErrorStatus = (UART_RXERROR_FRAMING | UART_RXERROR_PARITY
			|UART_RXERROR_BREAK | UART_RXERROR_OVERRUN);

  • Feel your (long & on-going) pain.

    Might the following assist your, 'Request for Help?'

    BP101 said:
    16 data + 6 command bytes, 24 bytes total at most.

       

    • Have not, 2 Bytes gone AWOL?   (Only 22 shown here)   If not - what are they?
    • All forums request that, 'Potential API or Code Issues be submitted as the, "Shortest & most direct 'Code Listing which effectively (Demonstrates the Issue.)"    This so that others may 'quickly/easily' Run your Code - to see 'If & How' they can 'repeat your issues.'    Such proves 'IDEAL for you' - does it not?

    Easing the pathway of your 'helpers' - rather than (your) ease - is most likely to achieve your desired response...    (Wading thru the 'swamp' is (unlikely) to yield, 'high desire' - for (even) those most motivated to assist...)

  • Point being UARTprtinf() checks for RXFE inside the interrupt handler that UART just called and every other time there after. Obviously there was a byte put into the receiver FIFO holding register or the UART interrupt would not have occurred.

    So why UARTprintf() redundant check of FIFO empty flag (RXFE) after interrupt if the UART has no such errata relative to C tool chain B2B reads of UARTDR?

  • cb1_mobile said:
    Easing the pathway of your 'helpers' - rather than (your) ease - is most likely to achieve your desired response...    (Wading thru the 'swamp' is (unlikely) to yield, 'high desire' - for (even) those most motivated to assist...)

    No matter 22-44 < 32 being B2B read. This is a related follow question post of listed test code twice via link at top of this post, why you not see this link.

    cb1_mobile said:
    Easing the pathway of your 'helpers' - rather than (your) ease - is most likely to achieve your desired response...    (Wading thru the 'swamp' is (unlikely) to yield, 'high desire' - for (even) those most motivated to assist...)

    This post is beyond outside helpers assistance when suspected errata appears the cause. Vendor and only vendor must step in update errata PDF after they too have taken time to confirm entire UART Block has such noted failures. UARTprintf() attempting to bamboozle the community UART has no such errata issues is a false narrative a major US corporation should not divert from.

  • BP101 said:
    UARTprintf() attempting to bamboozle the community

    Young staff believes, 'Adding BP101 w/in 'word definition' (above, as a 'prime user') w/in Wikipedia' - makes great sense...

    And - might, 'Refusing to provide the 'normal/customary CODE LISTING' - 'Fall Within' - your (near) favorite 'behavioral description?'

    Vendor & only vendor is believed 'unlikely' to 'Employ Waders - and enter (further) into the 'bp' swamp'...

  • Poster below was referring to the UARTFR register and not UARTDR which indeed is read (pop) sensitive. So reading the FR for receiver 1 byte deep should toggle this RXFE bit.

    I too noted not ever seeing RXFE toggle via CCS debug even with a watch point being set and continuous 100ms refresh. 

    https://e2e.ti.com/support/microcontrollers/other/f/908/t/671597?tisearch=e2e-quicksearch&keymatch=uart%20rxfe

  • Tivaware code used in UARTprintf() receive function is a redundant check for 1 byte deep RXFE flag set when or with RXIM/RTIM bit also set UARTIM.

    Tivaware calls must assume FIFO level deep only (16x8) being an UNBUFFERED operation. Thus UARTprintf() example skirts over said flag errata issues (RT/RXFE), receive timeout 1 byte deep and after 15-16 bytes RT flag is not being auto cleared. Force clearing RT flag during RX interrupts must be performed, it is not an auto function after byte 15-16 is received. During SW B2B reads of HW (UARTDR) a random race condition seems to occur and both flags become late. Hence intermittent OE errors occur when the FIFO is being read by SW at byte 15-16.  Hard to know for sure but more often byte 15 is present and 16-32 intermittently go missing with false OE.

    /* Enable the receive and 1 byte deep interrupt flags */
    MAP_UARTIntEnable(UART3_BASE, (UART_INT_RX | UART_INT_RT));
    
  • Patch code 

  • Thank you - both staff & this reporter (now) believe that:

    • Vendor & only Vendor Staff should find their response, 'Eased & Speeded'
    • Same for those 'here/interested - & (exceedingly) Non-Vendor'

    To (further) aid clarity kindly advise, 'IF & WHERE' the code you've presented 'DIFFERS' from 'vendor's standard code.'   (simple red highlight of 'any/all' differing code elements would be beneficial to ALL!

    Staff has several items (of our own tech biz) to 'final test/verify' - then will load, run,  (your code!) & report their findings.    We will create a '64 byte'  UART_RX circular, buffer - and fill it via 'several' means - should your code (as above) produce the 'unwanted' effects that you've noted...

    Presenting your requests in such, 'Small Gulps' - which include a clear statement of 'end goal' and/or 'failures noted' - should prove to your, Vendor's, even (outsider's) advantage...

  • BP101,

    Between your verbose description and acronyms I am having a hard time following this issue. Can you provide a code example that I can look at? What is the TMIC bit? I cannot find a bit of that name in the UART section of the datasheet.

  • Whoops - sometimes it (just may) prove useful for those responding to read/review (slightly earlier arriving) posts...

  • Sorry, I spent a lot of time trying to understand the original post and did not refresh my browser to see that additional information was provided before I made my request. 

  • Hi Bob CB1,

    I also reduced the baud rate to 57600 and the same intermittent read OE error occur. Sometimes even when FIFO under runs the OE bit is not being tripped, printed error. Lower speed issue leads me to believe Baudrate divisor may be suspect for RXFE and  RTIM/C flags not being auto cleared in both FIFO states. Oddly adding an abort (return) test top of receive function to monitor RXFF or RXFE flag events produced no buffer data and perpetual OE each RX interrupt cycle. Seemingly OE should only occur for RXFF/~RXFE events but some FIFO data should have been captured and was missing.

    You can assemble the UART test code from your IDE, virtual serial terminal monitor for debug is required.

  • Example of OE failure: Note this issue involves a 64 byte read, 32 bytes shown. Two 32 byte passes upon FIFO are due to input command argument array checks via C++ string compare. The input string is being byte compared against an existing null terminated lookup command table. The full command this case (3 bytes) and table match compare occurs during the second 32 byte, right side.   

  • Thank you - indeed the Code Listing you've supplied should, 'Raise Understanding & far better enable the ability of 'others' - to, Run, Check & Evaluate - that much to your benefit.

    Earlier today I had the good fortune to (be on the road) thus, 'Escape today's, 'Chicago's Record Cold for Date' (7°F !)     Alas no more - icy & scary landing - and crack staff, 'Escaped Early' to avoid, 'Freezing, Rush Hour commute.'

    We did note your code (again thank you) as a 'Mix' of  'API Calls & Unique BP101 creations' - and will, 'Load & Attempt to Run various code elements' (as dictated by KISS) tomorrow.    Kindly note that we've (never) 'been a fan of '129' - we will (instead) make suitable conversions to, Run your code on our '123 MCUs.    (in parallel - several  young staffers have 'volunteered')   We will attempt to 'Duplicate your findings' - it is doubted that 'significant differences' w/in and/or around the UART - should compromise our efforts.

    It 'has already' been noted - that multiple 'BP comments' have not 'kept up' w/your migration from UART2 to UART3.    Even beyond that - the presence of a, 'Multi-Eyed, Motivated, Skilled & Youthful staff' - is expected to, 'Work their (usual) Magic!'    ('One and only one' code review - defies the 'laws of nature' - does it not?)    (i.e. Troubleshooting 'Heathkits' & later home-brew Ham Gear - long ago - 'Buddies would find my screw-ups - and I (theirs) - almost like 'clockwork!'    Yet we'd 'Stare for hours by ourselves' (almost never noting our own mistakes) - perhaps you'd 'be wise' - to adopt such 'multi-person' methods...)

  • cb1_mobile said:
    'Buddies would find my screw-ups - and I (theirs) - almost like 'clockwork!' 

    I too was the one locals rushed to asking joint venture to debug their machine code. One person in particular was desperate after months struggling with macro assembler bug. I quickly discovered duplicate interrupt code mistake <5 minutes. The gratitude was never measured via $$ though just after malicious corporate takeover a recent sale of personal stock was the only life boat to be had. Just like icy take off's & landings, history repeats only this time the life boat is more of an boat anchor taking it all to the bottom next to the Titanic. 

    The layout of code above was not debugged and assembled via forum code tool, check again for later added changes updates. BTW your requested code colors missing objection can not be added and blows up the inside the code tool creating long attribute strings when saved. 

    cb1_mobile said:
    we will (instead) make suitable conversions to, Run your code on our '123 MCUs.   

     

    Note the added forum link (page back) CB1/Bob aided issue TMC123 with very same UART_FR_RXFE flag bit complaint. Poster splashed green on his noted find RXFE was NOT read sensitive. Yet CB1 raised issue register UARTDR is read sensitive but my find is CCS debug does not seem to trigger FIFO pop via SWD reads. Check "after the fact" debug registers refresh and bytes being placed into global buffer via FIFO read loop code posted above.  

  • Thank you - appreciated.    While 'ancient history' (yours & mine) proves of (some) interest - the illustration of, 'Multiple-Person Reviews' - WAS (instead) our Central Thrust...

    BP101 said:
    The layout of code above was not debugged and assembled via forum code tool, check again for later added changes updates.

    Never/Ever Would staff/I employ a (severely) limited, 'Single Vendor Tool!'    (as long stated - Investors & Key  Clients 'demand' our selection of devices via a, 'Properly Wide Net' - which, 'No single vendor can, "hope to provide!')    Thus we will employ our far superior, 'normal/multi-vendor accommodating IAR IDE' not any, 'forum code tool.'

    We're fearful (staff has arrived @ 06:00) by your direction, "Check again for later added changes/updates!"    As 'YOU' are most knowledgeable of the 'ins & outs' of your Code - kindly, 'Free us from such 'unproductive Searches!'    (we ARE 'Profit Seekers' - and must invest our (limited) time here w/some efficiency...)

  • BP101,

    I copied the code you posted above and tried to compile it. I had 17 errors. It looks like just copy paste errors such as missing { and missing global definitions. Would you please export your working example project to a .zip file. That way I can help other user's instead of trying to correct the copy paste errors.

  • Hi Bob,

    Bob Crosby said:
    I copied the code you posted above and tried to compile it.

    It was the production project guts and not a debugged project. Then will remove copy above and try to squeeze it into a TM4C1294 project to PM you. We are busy here too being delayed by this issue wasted weeks + many more hours and still moving forward.

  • Note to this forum, parts of previous posted code were deemed proprietary and time consuming to produce. It was not to be easily shared as completed project for others to claim freely the several derived complicated configurations and procedures. That excludes those who directly participate via posting ideas relating to posted failure and relative diagnostics.

    Datasheet review TM4C1294 is also required to understand the workings of the UART peripheral registers and posted claim of dysfunctional behavior.

  • Young skilled staff here has (perhaps) achieved better results.    (see attached screen-cap - under 'PRO IDE - IAR.')    Note we employ 'blinky' merely as a place-holder - as it 'brings in' all necessary/exotic IDE enabling elements - so we escape becoming 'IDE Mavens.'    (such pays no bills!)

    The IAR project this vendor provides differs from their CCS version - we've 'found/massaged' already (banged most over the head) into submission - all but 'locating one wayward file' remains.     

    *** We now note that you seek to 'PM' ONLY to Bob.    Does that signal that we should, Cease our efforts?    (We have plenty of work to do - yet staff/I believed, 'Assisting you' may 'earn a mitzvah' - and enhance staff's learning.    (We are 'Non-Denominational' - that 'phrase' denotes a 'Special Grace or Benefit.')

    [EDIT]:   Staff have resolved all path differences between IAR & CCS - Compile attempt yields:  (abbreviated error/warning list to screen cap)

    Kindly note - our request was for the, 'Minimum Working Code which (well) illustrates your, 'Report of Code and/or MCU Error!'     That's NOT been forthcoming  - thus our task has been greatly increased!    Unless & until you can,  'Meet our (simple) request' (even via PM) - we must pass on, 'Group Code Run/Test & Analysis' - in your behalf.     Staff here has 'Proved Willing' to 'DO their PART' - might you, 'Do the Same?'    No matter the outcome - we continue to 'Wish you well' as you, 'Reach for Project Success'...

  • You got mail! Famous to all AOL users, Prodigy could never copy that coined phrase.

    So miss those simpler days of strange water sounds squeals from under the desk. Constant ringing in ears - swear started right after G3 network. What's next loss of vision G5 hits the air waves before the FCC does more testing on broadband affects on humans. 

  • HI Bob, CB1

    Seems my gut feeling was spot on, Baudrate clock incorrect frequency was causing mayhem. Senders frame start bit into FIFO holding register odd timing leads to FR-RXFE & TMIC bits being late after byte 15. 

    Oddly due to MOSC after removing PUP interrupt wait loop prior to asserting SysCtrlFrequencySet() locked the DAP , required unlock procedure. Unbelieving simple add on code being removed would ever lock the DAP not once but both times it was removed, put it back into main.c. 

    Oddly this launch pad (TM4C1294i3) MOSC will not run without the added patch prior to driver lib 21171 SysCtrlFrequencySet(). Unlocking the DAP cleared the Baudrate clock issue and intermittent OE errors are gone. The short delay is still required after byte 15 but the buffer is being filled each and every time. Now and oddly my hex to decimal conversion code is messing up but the serial hex into buffer is correct. 

    	 /* Set the MOSC for High frequency oscillator */
    	 HWREG(SYSCTL_MOSCCTL) |= SYSCTL_MOSC_HIGHFREQ;
    	 /* Clear Crystal PWRDWN bit in MOSCTL register*/
    	 HWREG(SYSCTL_MOSCCTL) &= ~(SYSCTL_MOSC_PWR_DIS);
    	 /* Wait until the MOSC indicates RIS fully powered up */
    	 while(HWREG(SYSCTL_RIS) & ~SYSCTL_INT_MOSC_PUP)
    	 {
    	 }
    	 /* Source OSCSRC[23:20] POR defaults PIOSC. */
    	 HWREG(SYSCTL_RSCLKCFG) |= SYSCTL_RSCLKCFG_OSCSRC_MOSC;
    
    	 /* MPU uses MOSC driven PLL 480mHz/4 produce 120 MHz SYSCLK:
    	    Y1 = 25mHz XTAL HIGHFREQ. */
    	 g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
    	                                          SYSCTL_OSC_MAIN |
    	                                           SYSCTL_USE_PLL |
    	                                            SYSCTL_CFG_VCO_480), 120000000);
    

  • Well - as always we are 'hopeful' that this issue, 'Has been resolved.'

    That said - 'Jury & Judge are advised - not to venture/stray 'too far' ... from the courthouse'...

    In the event that the issue (really) was (& remains) resolved - should  you  not, 'Edit/Correct the Thread's Subject Line?'     (Intermittent)