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.

C6678 EVM UART Receive Interrupt



Hello all,

I configured the UART Receive interrupt (149) as shown below. I am using the C6678 evaluation board. when I use

CpIntc_postSysInt(0, 149);

to post interrupt, everything works fine, but when I disable this line and use a hyperterminal to communicate with the board (UART over mini-USB connector), NO interrupt occurs? Any idea?

Void UART_Rx_hwi(UArg arg)

{

platform_uart_write('H');

// System_printf("in event15Fxn(0x%x)\n", (Int)arg);

}



int UART_init(void)

{

Hwi_Params params;

Int hostInt, sysInt;

int eventId;

 

(void) platform_uart_init();

(void) platform_uart_set_baudrate(115200);

(void) platform_write_configure(PLATFORM_WRITE_ALL);



sysInt = 149;

hostInt = 32;

CpIntc_mapSysIntToHostInt(0, sysInt, hostInt);

CpIntc_dispatchPlug(sysInt, UART_Rx_hwi, sysInt, TRUE);

CpIntc_enableHostInt(0, hostInt);

eventId = CpIntc_getEventId(hostInt);

Hwi_Params_init(&params);

params.arg = hostInt;

params.eventId = eventId;

params.enableInt = TRUE;

params.priority = 2;

Hwi_create(5, &CpIntc_dispatch, &params, NULL);

Hwi_enableInterrupt(5);

Hwi_enable();

return 1;

}





Void idle0Fxn(Void)



{



System_printf("setting event 15 ...\n");



// CpIntc_postSysInt(0, 149);



}

 

  • Hi Murad,

    CpIntc_postSysInt(0, 149); function is used for Writes the system interrupt number to the System Interrupt Status Index Set Register.

    Without this mapping the interrupt is not initialized.

    Thanks,

  • Thank you Ganapathi for your prompt response,

    I will try to include CpIntc_postSysInt(0, 149);  in the initialization but from the sys/bios help, it says:

    Writes the system interrupt number to the System Interrupt Status Index Set Register. Used for diagnostic and test purposes only.

    I need real UART transactions, not just simulation!

    Regards,

    Murad

  • Anyone can help with this please...I read so many examples/documents but all describe what I have already...still can't get a UART receive interrupt?!?!

    Regards,

    Murad

  • Thanks Ganapathi,

    looking at your code and comparing it to the one in the platform folder void UartInit(void), I see that the following should enable the receive interrupt...but still no luck

    int UART_init(void)
    
    
    
    {
    
    
    
    short int i;
    
    
    
    Hwi_Params params;
    
    
    
    Int hostInt, sysInt;
    
    
    
    int eventId;
    
    
    
    #if 0
    
    
    
    (void) platform_uart_init();
    
    
    
    // Allows access to the receiver buffer register (RBR),
    
    
    
    // the transmitter holding register (THR), and the
    
    
    
    // interrupt enable register (IER) selected.
    
    
    
    //CSL_FINS (hUartRegs->LCR, UART_LCR_DLAB, CSL_UART_LCR_DLAB_DISABLE);
    
    
    
    // No PARITY bit is transmitted or checked
    
    
    
    CSL_FINS (hUartRegs->LCR, UART_LCR_PEN, CSL_UART_LCR_PEN_DISABLE);
    
    
    
    // Disable THR, RHR, Receiver line status interrupts
    
    
    
    CSL_FINS (hUartRegs->IER, UART_IER_ERBI, CSL_UART_IER_ERBI_ENABLE);//MQ
    
    
    
    (void) platform_uart_set_baudrate(115200);
    
    
    
    (void) platform_write_configure(PLATFORM_WRITE_ALL);
    
    
    
    
    
    
    
    /*
    
    
    
    * Map single sysInt to single hostInt and handle with a Hwi ISR.
    
    
    
    * One-to-one mapping of sysInt to hostInt is more efficient than many
    
    
    
    * to one routing since the BIOS CPINTC dispatcher keeps a table for
    
    
    
    * the one-to-one mappings so that it doesn't have to query the h/w
    
    
    
    * status registers for this information. Many-to-one interrupts have
    
    
    
    * additional overhead since they cannot use this simple table lookup.
    
    
    
    */
    
    
    
    #endif
    
    
    
    //reset UART
    
    
    
    hUartRegs->PWREMU_MGMT = 0x0;
    
    
    
    (void) platform_uart_set_baudrate(115200);
    
    
    
    hUartRegs->IER=0x03;
    
    
    
    hUartRegs->MCR = 0;
    
    
    
    hUartRegs->FCR = 0x7;
    
    
    
    hUartRegs->PWREMU_MGMT = 0x6001;
    
    
    
    
    
    
    
    sysInt = 149;
    
    
    
    hostInt = 32;
    
    
    
    
    
    
    
     
    
    
    
     
    
    
    
    /* convenience API to give GEM eventid for given host interrupt */
    
    
    
    eventId = CpIntc_getEventId(hostInt);
    
    
    
    /*
    
    
    
    * Use GEM interrupt #5 to handle the hostInt associated with eventId.
    
    
    
    */
    
    
    
    Hwi_Params_init(&params);
    
    
    
    params.arg = hostInt;
    
    
    
    params.eventId = eventId;
    
    
    
    params.enableInt = TRUE;
    
    
    
    params.priority = 2;
    
    
    
    Hwi_create(5, &CpIntc_dispatch, &params, NULL);
    
    
    
    // Hwi_enableInterrupt(5);
    
    
    
    // Hwi_enable();
    
    
    
    
    
    
    
    /*
    
    
    
    * plug CpIntc dispatch table with 'UART_Rx_hwi'.
    
    
    
    * set 'unmask' to 'TRUE' to enable the system interrupt.
    
    
    
    */
    
    
    
    CpIntc_disableHostInt(0, hostInt);
    
    
    
    CpIntc_disableSysInt(0, sysInt);
    
    
    
    CpIntc_clearSysInt(0, sysInt);
    
    
    
    
    
    
    
    CpIntc_mapSysIntToHostInt(0, sysInt, hostInt);
    
    
    
    CpIntc_dispatchPlug(sysInt, UART_Rx_hwi, sysInt, TRUE);
    
    
    
    CpIntc_enableHostInt(0, hostInt);
    
    
    
    CpIntc_enableSysInt(0, sysInt);
    
    
    
     
    
    
    
    return 1;
    
    
    
    }
    
    
    
     

  • So the problem was not in the initializations above, it was in the system interrupt number 149. I changed it to 148 (since I am not using Event) and receiver isr worked. Now I have the following questions:

    1- I used a program to send a packet to the DSP but only one character was received. if I type characters manually, ISR works fine and I get the characters. I noticed that the following code in the IDLE task caused the problem. my question: UART receive is a HWI and should be higher priority than the idle task, so why UART ISR skips interrupts?

    Void idle0Fxn(Void)

    {

          System_printf("I am idle ...\n");

    }

    2-

    What flags do I need to clear inside the ISR. I am used to clear Flags in the IFR in the microcontroller world, but here I have system and host...what do I need to clear...if any?