AM2434: UART with RX Trigger Level Interrupt

Part Number: AM2434
Other Parts Discussed in Thread: SYSCONFIG

Hi, This question is a relevant question to this one: "AM2434: UART Reception Interrupt"
I made a new example doing nearly the same steps, and the interrupt is now enabled and working.

The problem is that I want the interrupt to be triggered every specific number of bytes received in the FIFO. I tried to change the "rxtriglvl" in the initialization configurations but it doesn't do the job.

The interrupt fires every byte received and keeps firing until I empty the FIFO.
I attached the whole project I made. For more clarification, I initialize the uart in the main function (empty_main), and I use the initialization struct with the name (mygUartInitObject) and NOT the generated one from Sysconfig.

RX_INTERRUPT_TEST.zip 

Thank you in advance

  • Hi,

    Let me check the driver for the rxTriggerLvl behaviour.

    BR Vaibhav

  • Hi,

    Could you check if the rx interrupt is getting fired based on the value 16 which you set up, or is it the character timeout interrupt getting fired, please let me know.

    The reason I am asking this is because the CTI or the Character Timeout interrupt fires for every byte.

    BR Vaibhav

  • Hi, Vaibhav,

    The interrupt is firing every byte and not after 16 at all. I attached a screenshot of the ISR, and the prints I get. It shows that the ISR fires every byte even when I send several bytes right away, it fires several times for each byte.

  • H Hatem,

    or is it the character timeout interrupt getting fired, please let me know.

    Please let me know about this one.

    I am checking at my end as well. I believe your requirement is to generate RX Interrupt per 16 bytes received.

    Regards,

    Vaibhav

  • The answer to your question:
    It is the "Character Timeout Interrupt (CTI)" that is firing, and it is every byte.

    I checked using this function "UART_getIntrIdentityStatus(baseAddr)", and it returns "0000 1100" which is the timeout interrupt as shown here from the technical reference.

    And YES, my requirement is to generate RX Interrupt per 16 bytes received, and NOT every byte.

  • Hi Hatem,

    Thanks for confirming that it is the character timeout interrupt being fired everytime.

    I got my hands as well on a AM243 TI EVM.

    Will test this out and let you know shortly.

    For me I am going to follow the following steps to test this out:

    1. Run the basic UART ECHO SDK application.
    2. When the UART_read is called then put a breakpoint inside the UART ISR routine to monitor when it gets hit.
    3. Send the data and test in both the following ways:
      1. Send data(8 bytes) one by one via the terminal.
      2. Send data(8 bytes) via a Python Script.
    4. I will report the behaviour in both the cases and see where I can help you out.

    Thanks for your patience.

    Regards,

    Vaibhav

  • Send data(8 bytes) one by one via the terminal.

    With this test, it is observed on my setup as well that the ISR triggered gets under the RX Character timeout interrupt, hence for 8 characters even though the RX Trigger Level I set is 8, I see 8 interrupts instead of 1, hence now checking with the second test case. Will keep you posted.

  • Hi Hatem,

    Send data(8 bytes) via a Python Script.

    Via this route, when I have RX Trigger level set to lets suppose 8, then after 8 bytes itself the ISR is generated.

    I will tell you the root cause.

    So basically, when you enter characters onto the terminal, and then expect the UART_read to process them into the buffer one by one, you are also expecting the fifo to fill upto(in your case 16 bytes) and then expect just one RX ISR.

    But the thing is that the UART RX expects the data to be received at the same baud rate(default 115200). The moment you start typing it on the console, this is where the issue begins.

    So a basic python script which sends data to the com port(UART PORT) at the configured baud rate(same as in SysConfig > UART) will make sure ISR is triggered every RX Tigger Level.

    Have a look at my python script, you can customize it based on your COM PORT and UART settings.

    import serial
    import time
    
    # Configuration
    COM_PORT = "COM7"  # Change this to your actual COM port
    BAUD_RATE = 115200
    DATA_BITS = 8
    PARITY = 'N'       # N = None, E = Even, O = Odd
    STOP_BITS = 1
    
    # Data to send (8 characters)
    data_to_send = "12345678"
    
    def main():
        try:
            # Open serial port
            ser = serial.Serial(
                port=COM_PORT,
                baudrate=BAUD_RATE,
                bytesize=DATA_BITS,
                parity=PARITY,
                stopbits=STOP_BITS,
                timeout=1
            )
    
            print(f"Opened {COM_PORT} at {BAUD_RATE} baud")
            print(f"Settings: {DATA_BITS} data bits, parity={PARITY}, stop bits={STOP_BITS}")
    
            # Small delay to ensure port is ready
            time.sleep(0.1)
    
            # Send data
            bytes_written = ser.write(data_to_send.encode('utf-8'))
            print(f"Sent {bytes_written} bytes: '{data_to_send}'")
    
            # Optional: Wait for and read response
            # time.sleep(0.5)
            # if ser.in_waiting > 0:
            #     response = ser.read(ser.in_waiting)
            #     print(f"Received: {response.decode('utf-8', errors='ignore')}")
    
            # Close port
            ser.close()
            print("Port closed")
    
        except serial.SerialException as e:
            print(f"Serial error: {e}")
        except Exception as e:
            print(f"Error: {e}")
    
    if __name__ == "__main__":
        main()
    

    Hopefully this resolves your issue.

    BR Vaibhav

  • Hi, Vaibhav,

    I'm not really sure what should I do from my code side.
    I'm sure that I use the right Baudrate for both sides.

    The Python script you sent is only sending 8 bytes at the same time, which is something I already tried, but the interrupt fires once the first character is in the FIFO. For more confirmation, I tried to use your script to only send 3 characters, which should not cause the interrupt to fire, but it is still firing.

  • Hi Hatem,

    For more confirmation, I tried to use your script to only send 3 characters, which should not cause the interrupt to fire, but it is still firing.

    Can you try using the UART ECHO example to begin with? It will help you proceed pretty easily, there might be some configuration mistakes in the project you made. Would you like to explore the sample example and check the behaviour on that first? Because with the sample example itself I was able to achieve what your end goal was:

    And YES, my requirement is to generate RX Interrupt per 16 bytes received, and NOT every byte.

    Regards,

    Vaibhav