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.

Create HWI for UART2 on DSP

Other Parts Discussed in Thread: OMAP-L138, SYSBIOS

Hi all,

I try to create HWI for the UART2 on my OMAP-L138, I use SYSBIOS 6.33.04.39 and CCS 5.1. I want to create a interrupt on the DSP when I receive data on the UART2. In the http://www.ti.com/lit/ug/spruh77a/spruh77a.pdf they said in the table 3-1, the event for the UART2 is the 69.

Here is my code:

void main(void)
{
uint32_t rtn;

rtn = UART_init(DEBUG_PORT, 115200);
if (rtn != ERR_NO_ERROR)
{
puts("error initializing uart!\r\n");
}

UART_txString(DEBUG_PORT, "Start test!!\r\n\r\n");

Hwi_Params hwiParams;
Hwi_Handle myHwi;

Hwi_Params_init(&hwiParams);
hwiParams.eventId = 69;
hwiParams.enableInt = true;
myHwi = Hwi_create(2, (ti_sysbios_interfaces_IHwi_FuncPtr)UART_interrupt, &hwiParams, NULL);
if (myHwi == NULL)
puts("Hwi create failed");

UART_txString(DEBUG_PORT, "HWI Configurer\r\n\r\n");

BIOS_start(); // start the sysBIOS
}

void UART_interrupt(void)
{

UART_txString(DEBUG_PORT, "TEST REUSSI!!!\r\n\r\n");

}

I can see in the ROV that the HWI is create and I can send string to the PC, so I know the UART communication work. I sure that i miss something but i cant figure it out.

Thanks

  • Vincent,

    You cannot do a Hwi_create(2, ....).  Interrupt 2 is a reserved interrupt on the DSP.  You can only create something between 4-15.

    You could try doing the same thing but replacing the 2 with 4.

    Judah

  • Hi Judah,

    Yeah I see it after I post it... but it doesn't work...

    In the ROV i see the the intNum =4, the eventId=69 and the fxn=UART_interrupt. So all look to be correct but i cant get interrupt...

    When I check the register for the UART, I see the IER is all disable I dont think its normal... And when i look the RBR register a can see some data, so i dont understand why the interrupt not activate if a receive data.

    Vincent

  • Vincent,

    I'm not familiar with the UART so I can't speak to whether that is setup correctly or not.

    There's a couple of things you can check to make sure your interrupt is setup.
    There's a CPU register called IER.  Make sure the correct bit in the IER is set that corresponds to your interrupt (#4 in your case).
    Next, check to see if any flags in the IFR register (interupt flag register) is set.

    If those look okay, then you should double check to make sure event 69 is correct.

    Judah

     

     

  • Hi Judah,

    Ok if you can't help me with the UART config, can you tell to your friend from TI Employee to help me?

    here is my IER and IFR register:

    I try to use the ARM UART2_int event (61) and the DSP UART2_int event (69) it's doesn't change nothing.

    I try to create the the interrupt in the .cfg like this:

    var hwi0Params = new Hwi.Params();
    hwi0Params.instance.name = "UART";
    hwi0Params.eventId = 69;
    hwi0Params.priority = 2;
    hwi0Params.enableInt = true;
    Program.global.hwi0 = Hwi.create(4, "&UART_interrupt", hwi0Params);

    And is not better then create the HWI in my main:

    Hwi_Params hwiParams;
    Hwi_Handle myHwi;
    Hwi_Params_init(&hwiParams);
    hwiParams.eventId = 69;
    hwiParams.enableInt = true;
    myHwi = Hwi_create(4, (ti_sysbios_hal_Hwi_FuncPtr)UART_interrupt, &hwiParams, NULL);
    if (myHwi == NULL)
    puts("Hwi create failed");

    Like you can see i try a lot of thing and is not working.

    I see on this forum http://e2e.ti.com/support/embedded/bios/f/355/p/182769/664741.aspx#664741 tell that when changing the IFR with a breakpoint we can see if the interrupt activated and then enter in the HWI function. So I set the ISR (IS4) to 1 to generate a interrupt, the IF4 came to 1 and this is working!!!!

    Thanks

    Vincent


  • Vincent,

    So it looks to me like the interrupt handler has been plugged correctly by BIOS.  The event Id 69 is correct according to the specs.
    So the problem looks to me like the UART is not generating the interrupt.  Most likely the UART is not getting initialized correctly.

    I will see if anyone on my end can help.

    Judah

  • Hi Judah,

    I use the LogicPD lib and .h for the UART communication, here is the file.

    2068.evmomapl138_uart.c

    Thanks

    Vincent

  • Hi Judah,

    I just find this in the function UART_init() from evmomapl138_uart.c file:

    // disable interrupts, flow control, and loop back.
    uart->IER = 0;
    uart->MCR = 0;
    uart->MDR = 0;

    So I just the create my own evmomapl138_uart.c and change value: uart->IER = 1;

    And this work!!!!!!

    So i think by default LogicPD configure the UART to never use the interrupt, this is quite annoying. I will contact to know why they do that.

    Thanks a lot for your help

    Vincent