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.

EK-TM4C1294XL: UART get read data ignores array size

Guru 56073 points
Part Number: EK-TM4C1294XL


Seemingly our multidimensional C++ array ends up being a serial C array x 2  rather than (I x d) as in char[257][9]. Below FIFO behavior (Early return from 7/8 full interrupt) even though there should be 128, 256, 1024 byte levels to store external RX data prior to a return from RX interrupt call processing.  Capture below indicates the multi dimensional array of 256 BYTES is not being filled and UARTCharAvail() thinks there is no more space in the array. Perhaps incorrectly returns from interrupt handler in the middle of incoming data streams to FIFO 16x8 storage area.

A continuous RX data stream broken up by either FIFO interrupt issues and faster/slower baud rates do not correct mid cycle returns random loss of data from occurring. The interrupt should pend again 7/8 full even after being cleared prior to entry but note the several returns to INT caller below. The while loop UARTCharAvail() obviously thinks no more serial data is being sent into the FIFO when in fact it never stopped. Why would the 7/8 interrupt ever inflict handler re-entrance when the while loop should have never ended to being with?  Also test disable UART2 interrupt inside INT hander and perhaps the Index pointer is still being corrupted claimed to correct (uartstdio.c) via UART_BUFFER? The UART2 appears to Stall no matter how the FIFO interrupt has been configured.

   

  • Hi BP101,

      Honestly, I'm totally unclear as to what you are trying to accomplish. Perhaps you can show your UART ISR. 

  • Hi Charles,

    I think this issue of RX FIFIO is due to the RXFE flag firing multiple times for the same character in blocking or non-blocking modes via RX INT 7/8 auto cleared or forced makes no difference. I had to move Tivaware HWREG calls code into the RX INT handler or the FIFO would omit serial data being loaded into any single wide char array. The UART example is blocking single character and the same TX char (!) so you would not be aware of issues such as when external device transfers data into the TM4C in asynchronous time and expects an immediate return on TX, UARTPrintf() BUFFERED would mask over this issue, perhaps a race condition thus disables RX interrupt seemingly for the reason RXFE is firing more than it should in non blocking writes.  

    As the above capture indicates far more than 16 bytes can be buffered via 7/8 INT with a multi level dim array but 25 characters seems to be the HW limit. So 15 bytes all that can be (error free) buffered in 7/8 full, even with INT disabled in the handler the auto INT clear forces the handler early return no matter amount of free space in the multi dim array buffer. 

    It seems UART2 RXFE bit is causing issues with TX interrupt processing, produces incorrect or no output of immediate echo back char being printed on UART0. Partly find it Odd there is only a single UARTDR register for both TX/RX FIFO complicating round robin timing between two interrupt loop handlers. The HW can not handle a round robin character wrap on the data side (UARTDR) I/O from both FIFO's using UARTDR as the port. Even if enable (uartstdio.c) Echo the console characters are not echoed back to terminal, perhaps very same reason reported here. The WA is below:

    void 
    IntHandler (void)
    {
       static char[1];
    uint8_t d; /* Enable RX FIFO blocking during TX events */ while(HWREG(UART2_BASE + UART_O_FR) & UART_FR_BUSY) { } GetRxData(char):
    // Rx callback PutTxData(char[d]) }

    Var is the character in the RX array being printed on UART0 via UARTprintf(). The 0x70 is preamble byte, the others (FC) are rogue RXFE toggles, perhaps during blocking.  Other than that I need these variables to do application functions which GUI composer now does via SWD loading symbols via ICDI on JTAG port. Have to get the variable name to be recognized as symbols or load each as a command. Not yet sure how the call back was supposed to do that alone. CAN port commands already exist in this project so that may be the alternative for UART2 to follow up on. 

    Var:u                                                                           
    RXFE=1 p   (0x70)                                                                     
    RXFE=1 ü   (FC)                                                                     
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    Var:l                                                                           
    RXFE=1 p                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    Var:T                                                                           
    RXFE=1 p                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    Var:a                                                                           
    RXFE=1 p                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    Var:r                                                                           
    RXFE=1 p                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    Var:g                                                                           
    RXFE=1 p                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    Var:e                                                                           
    RXFE=1 p                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    Var:t                                                                           
    RXFE=1 p                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    Var:S                                                                           
    RXFE=1 p                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    Var:p                                                                           
    RXFE=1 p                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    Var:e                                                                           
    RXFE=1 p                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    Var:e                                                                           
    RXFE=1 p                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    Var:d                                                                           
    RXFE=1 p                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    RXFE=1 ü                                                                        
    Var:ÿ      
    

     

  • UART2 Busy signal did not correct RXFE flagging auto returns from RX_INT but did allow TX_INT after RX of 3 (0xff) break point.

    Still believe we should be able to buffer up to 256 characters prior RXFE 7/8 auto INT returns. The RXFE flag 7/8 full is stated in datasheet as INT Auto Clear, not POP INT handler from the call stack when processing (for, while) loops. That's what seems to occur RXFE 7/8 INT flag forces call stack POP in the middle of buffering array data.

    So a multi dimensional array MDA (char[256][8];) should produce 256 Byte (2048 bits) FIFO buffer.  256 row indexes, 8 columns indirect addressable by two incremented integers, e.g. char[i] for the  index,  char[d] for the 8 columns data. The MDA seems to fill only via the first defined array index and skip the rows.

    That part may be C language related CCS compiler as C++ calls to MDA are being ignored.

    A perfect storm!

     

  • The bigger problem TI written (cmdline.c) must be greatly modified. Designers must code char padding for 14 bit command buffer strings <14 bits LEN relative to RXFE flag. Designers must also identify the start of each new character command string by adding a unique character to the head.

    This is a command interpreter requirement that (cmdline.c) boasts to support but fails to produce upon. Only does it work using UARTGets() as it has been written to WA the defective RXFE flag issue. The alternative for rapid high speed preemptive command line argument handling must omit calls to UARTGets() and UARTPeak() since there are No CRLF (\r\n) in a HW command interpreter. 

    All the UART code calls above were seemingly written for HID keyboard commands. Not so much for interfacing serial devices into the typedef structures of (commands.c). Yet another can of RXFE worms requires each command string be prefixed & padded down for the entire 14 bits as no passed character Length was part of (cmdline.c) input void. Consequently the maximum length command is also <14 bits with ID header and padding.

  • Hi,

    BP101 said:
    The bigger problem TI written (cmdline.c) must be greatly modified. Designers must code char padding for 14 bit command buffer strings <14 bits LEN relative to RXFE flag. Designers must also identify the start of each new character command string by adding a unique character to the head.

    The cmdline.c is a high level utility. It doesn't deal with the UART directly. The function is merely passed a string to it and perform some string processing such as breaking the string into a command and arguments. 

    Please note the CmdLineProcess() in cmdline.c is only a C utility, it is independent of the MCU architecture and any peripherals. If it doesn't perform to what you desire, I will suggest you modify or create your function.  

  • Hi Charles,

    Charles Tsai said:
    The cmdline.c is a high level utility. It doesn't deal with the UART directly. The function is merely passed a string to it and perform some string processing such as breaking the string into a command and arguments. 

    Yet it states from the "command line obtained by an application by some means" is useless without with out calls first to UARTPeak() which only works with BUFFER enabled. So the RXFE Popping the call stack every 15-16 bytes directly effects the ability of (cmdline.c) to work by some means other than single stoke keyboard entries.

    Had to rewrite (cmdline.c) to detect preamble/postamble character ID's since there are no CRLF being sent in high speed RX commands sequences. Debug output indicates there are times of FIFO array Index corruption by one or two characters likely due to sudden array[16] death by RXFE call pops. Yea single index array depth of 15 bytes is being randomly truncated seemingly result of RXFE flag.

    You early confirmed 7/8 full requires 14 interrupts but it should only require 1 interrupt to call RX handler while loop UARTGetChar() for 256 bytes array size popping read sensitive UARTDR. The problem being any command sequence or variable data over 14 bytes length gets broken in several parts at the FIFO level.

    Why would RXFE popping the call stack most exactly every 16 bytes not be listed in errata sheet? My view it's ok for RXFE to indicate RX interrupts relative to FIFO level setting but not pop the call stack in the middle while/for loop processing RX array buffering. The only thing that comes to my mind is RXFE bit gets out of sync with either method of buffering loop as the array is popping the FIFO. This issue with RXFE seems to occur via HSE bit 7.5Mbps would RXFE be any better at 15Mbps? 

     

  • Charles Tsai said:
    The cmdline.c is a high level utility. It doesn't deal with the UART directly.

    Hi Charles,

    The problem with RXFE call stack pop was being caused by calling the RX data function via the UART interrupt handler. Oddly (cmdline.c) would only point to the first buffered command and mangle the index upon INT handler re-entry after a break at the end of last RX data.

    The fix required calling RX function via another loop handler such as Systick or GPTM in 5ms intervals. It seems the application (CPU) could not process array buffered[] commands from the command struct list after the argument matched command was returned.

                if(!strcmp(g_ppcArgv[0], psCmdEntry->pcCmd)) 
                {
                	/* Indicate the command search string */
                	UARTprintf("NextCmd: %s\n", g_ppcArgv[0]);
    
                	return(psCmdEntry->pfnCmd(ui8Argc, g_ppcArgv));
    
                }