MSPM33C321A: UART receive interrupt won't fire

Part Number: MSPM33C321A
Other Parts Discussed in Thread: SYSCONFIG

As a continuation of my previous discussion about the lack of a .syscfg file in the LVGL demo, I am trying to add a UART to the demo.

I started with the UART echo demo, and changed the clock to 80 MHz and changed the UART pins. It works fine there.

I copied all the "UART_0" code from the SysConfig generated code in that example and moved it to the LVGL example.

The echo did not work.

By adding a 

DL_UART_transmitData(UART_0_INST, 'X');
 
to periodically fire, I found out that the Baud rate was twice as high as it should be, but the UART is transmitting.
 
I have tried to put a breakpoint in the receive interrupt, none of the lines of code will "accept" a breakpoint, saying that there is no code there. When I go back to my echo example code, I can put breakpoints in the interrupt service routine.
 
I also tried just doing a 
gEchoData = DL_UART_receiveData(UART_0_INST);
 
in my main loop, but that does not seem to be working either.
 
  • I don't know if this means anything, but I found that UC1_0 - the name of the UART I am using - shows up three places in the .xml and .map files of the echo example, but only one place in my LVGL code with the bolted on UART.

  • Misspelling the name of an ISR is an easy way to make the ISR "disappear". Without a reference from the Vector Table, the linker will (quietly) garbage-collect that code section.

    What name(s) do you see in the .map file?

  • I think one of the problems is that they hide the "real" name behind a #define.

    For the Echo file that works:

    The ISR:

    void UART_0_INST_IRQHandler(void)
    {
    switch (DL_UART_getPendingInterrupt(UART_0_INST)) {
    case DL_UART_IIDX_RX:
    gEchoData = DL_UART_receiveData(UART_0_INST);
    DL_UART_transmitData(UART_0_INST, gEchoData);

    break;
    default:
    break;
    }
    }

    The #define:

    #define UART_0_INST_IRQHandler UC1_0_IRQHandler
    #define UART_0_INST_INT_IRQN UC1_0_INT_IRQn

    In the Map file with a search for "UC1_0"

    There are two of these, indexed differently

    Here are the other two references:

    For the non working LVGL code:

    void UART_0_INST_IRQHandler(void) {
    switch (DL_UART_getPendingInterrupt(UART_0_INST)) {
    case DL_UART_IIDX_RX:
    gEchoData = DL_UART_receiveData(UART_0_INST);
    DL_UART_transmitData(UART_0_INST, gEchoData);

    break;
    default:
    break;
    }
    }

    The defines (which I copied from the working config.h file)

    void UART_0_INST_IRQHandler(void) {
    switch (DL_UART_getPendingInterrupt(UART_0_INST)) {
    case DL_UART_IIDX_RX:
    gEchoData = DL_UART_receiveData(UART_0_INST);
    DL_UART_transmitData(UART_0_INST, gEchoData);

    break;
    default:
    break;
    }
    }

    and the map file - only one entry

  • I don't see the

    > #define UART_0_INST_IRQHandler UC1_0_IRQHandler

    for your LVGL version. Do you see "UART_0_INST_IRQHandler" in your .map?

    More generally: What symbols do you see in .text for the .o file you patched the ISR into?

  • Sorry, I pasted the wrong thing! I will correct it tomorrow. I copied the #define over to the LVGL project

    I would not expect to see a UART_0_INST_IRQHandler in the map since the #define obfuscates it.

  • Which version of the example are you using?

    That example has a private copy of the startup file (in the ticlang folder). 

    The 1.05 version refers to UC1_0_IRQHandler, but in the 1.03 version that entry (vector 25, following TIMG12_0_IRQHandler) reads "UC0_IRQHandler".

    If you're using the 1.03 version, try changing your transplanted #define to use that name instead.

  • Here is where it gets complicated.

    The version 3 example builds and runs fine on the touch screen

    versions 4 and 5 have I2C issues and get hung up waiting for I2C data - something I intend to investigate.

    So, I loaded the version 3 example and switched it to the version 5 sdk.

    At your implied suggestion I just switched example 3 back to the version 3 SDK and changed the #define to:

    #define UART_0_INST_IRQHandler        UC1_IRQHandler

    Now the code is there, but it is still not getting fired. The system does not hang, so it is not getting stuck in the default handler...

  • The startup file (vector table) is part of the example, not part of the SDK, so what matters is where you imported the example from.

    What I see in the vector table (ticlang/startup_mspm33c321x_ticlang.c) for

    V1.03

            TIMG12_0_IRQHandler,   /* TIMG12_0 interrupt handler */
            UC0_IRQHandler,        /* UC0 interrupt handler */
            UC1_IRQHandler,        /* UC1 interrupt handler */
    

    V1.05

            TIMG12_0_IRQHandler,   /* TIMG12_0 interrupt handler */
            UC1_0_IRQHandler,      /* UC1_0 interrupt handler   */
            UC1_1_IRQHandler,      /* UC1_1 interrupt handler   */
    

    so I think the name corresponding to UC1_0_IRQHandler would be UC0_IRQHandler (not UC1_IRQHandler).

    Why you're not ending up in Default_Handler is a separable question. Where/how are you enabling the UART IRQ? I think the DL_init function doesn't do that.

  • I do it in main, in the same place that the example turns on the Timer interrupt

    NVIC_EnableIRQ(TIMER_0_INST_INT_IRQN);

    //NVIC_ClearPendingIRQ(UART_0_INST_INT_IRQN);
    //NVIC_EnableIRQ(UART_0_INST_INT_IRQN);

    (They are commented out for the moment to just test that I am actually receiving data, and I am, so the UART RX is working.)

    I will try this and get back to you.

    (It is also interesting that they use the MSPM33C321.h file from the sdk, rather than using their own.)

  • Thanks! That did it!