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: UART Interrupt using SYSBIOS

Other Parts Discussed in Thread: SYSBIOS

I am trying to get UART interrupt through SYSBIOS,But after building the project i am getting following errors. I am unable to find the cause of these errors, even I have Included all the relevent libraries in the project,,

Errors:

1) Unresolved symbol ti_sysbios_family_c66_tci66xx_CpIntc_eventId__C in file C:\ti\bios_6_34_02_18\packages\ti\sysbios\lib\sysbios\instrumented\sysbios.ae66<BIOS.obj>

2) Unresolved symbol ti_sysbios_family_c66_tci66xx_CpIntc_hostIntToEventId__C in file C:\ti\bios_6_34_02_18\packages\ti\sysbios\lib\sysbios\instrumented\sysbios.ae66<BIOS.obj>

3) Unresolved symbol ti_sysbios_family_c66_tci66xx_CpIntc_Module__state__V in file C:\ti\bios_6_34_02_18\packages\ti\sysbios\lib\sysbios\instrumented\sysbios.ae66<BIOS.obj>

4) Unresolved symbol ti_sysbios_family_c66_tci66xx_CpIntc_numEvents__C in file C:\ti\bios_6_34_02_18\packages\ti\sysbios\lib\sysbios\instrumented\sysbios.ae66<BIOS.obj>

This is the code i am using for UART Interrupt. I am also attaching the Project, Please find attached.
Thanks in Advance.

1) main file

#include <c6x.h>

/* CSL Includes */
#include <ti/csl/csl_chip.h>
#include <ti/csl/csl_cacheAux.h>
/* BIOS includes */
#include <ti/sysbios/family/c64p/Hwi.h>
#include <ti/sysbios/family/c66/tci66xx/CpIntc.h>
#include <ti/sysbios/family/c66/Cache.h>
#include <ti/sysbios/family/c64p/EventCombiner.h>
#include <xdc/runtime/System.h>
#include <ti/sysbios/BIOS.h>

#include <xdc/runtime/Assert.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/Memory.h>
#include <xdc/std.h>
#include <ti/sysbios/family/c66/tci66xx/package/internal/CpIntc.xdc.h>
#include <xdc/cfg/global.h>

#define GPIO_CFG_BASE (0x02320000)
#define GPIO_REG_BINTEN (0x8)
#define GPIO_REG_DIR (0x10)
#define GPIO_REG_OUT_DATA (0x14)
#define GPIO_REG_SET_DATA (0x18)
#define GPIO_REG_CLR_DATA (0x1C)
#define GPIO_REG_IN_DATA (0x20)
#define GPIO_REG_SET_RIS_TRIG (0x24)
#define GPIO_REG_CLR_RIS_TRIG (0x28)
#define GPIO_REG_SET_FAL_TRIG (0x2C)
#define GPIO_REG_CLR_FAL_TRIG (0x30)


#define CSL_UART_REGS 0x02540000


typedef struct {
volatile Uint32 RBR;
volatile Uint32 IER;
volatile Uint32 IIR;
volatile Uint32 LCR;
volatile Uint32 MCR;
volatile Uint32 LSR;
volatile Uint32 MSR;
volatile Uint32 SCR;
volatile Uint32 DLL;
volatile Uint32 DLH;
volatile Uint32 REVID1;
volatile Uint32 REVID2;
volatile Uint32 PWREMU_MGMT;
volatile Uint32 MDR;
} CSL_UartRegs;


#define hUartRegs ((CSL_UartRegs*) CSL_UART_REGS)

unsigned int Uart_Interrupt_Received_Flag = 0;


Void UART_HWI_Function(UArg arg)
{
Uart_Interrupt_Received_Flag = 1;
}

Void myIdleFunc()
{

}

Void main()
{
int eventId=0;

CpIntc_mapSysIntToHostInt(0,148,32);
CpIntc_dispatchPlug(148, &UART_HWI_Function,0, TRUE);
CpIntc_enableHostInt(0,32);
eventId = CpIntc_getEventId(32);
BIOS_start();
}


2) .cfg file

var ti_sysbios_hal_Hwi = xdc.useModule('ti.sysbios.hal.Hwi');

var Idle = xdc.useModule('ti.sysbios.knl.Idle');
Idle.addFunc('&myIdleFunc')
var ti_sysbios_hal_Hwi0Params = new ti_sysbios_hal_Hwi.Params();
ti_sysbios_hal_Hwi0Params.instance.name = "null";
ti_sysbios_hal_Hwi0Params.priority = 5;
ti_sysbios_hal_Hwi0Params.eventId = 21;
var ti_sysbios_hal_Hwi0 = ti_sysbios_hal_Hwi.create(5, "&UART_HWI_Function", ti_sysbios_hal_Hwi0Params);

  • Hi Arun,

    I think you may be missing the following configuration in your .cfg:

    var CpIntc = xdc.useModule('ti.sysbios.family.c66.tci66xx.CpIntc');

    Adding this configuration will pull in the library containing the unresolved symbols.

    Vikram
  • Hi Vikram,

    Thanks for the early reply, after adding this configuration now i am getting UART interrupt.
    but now i am facing new problem, i got interrupt only once even after clearing the system interrupt register.
    You please take a look on my updated code, and point out the mistake i am doing.

    Thanks


    #include <xdc/std.h>
    #include <xdc/runtime/System.h>

    /* CSL Includes */
    #include <ti/csl/csl_chip.h>
    #include <ti/csl/csl_cacheAux.h>
    #include "ti/csl/soc.h"
    /* Intrinsic Includes */
    #include <c6x.h>

    #include <stdio.h>
    #include <stdint.h>


    #include "ti/csl/cslr_uart.h"
    #include "ti\platform\platform.h"
    #include "ti\platform\resource_mgr.h"
    #include "ti\platform\evmc6678l\platform_lib\include\evmc66x_uart.h"
    /* BIOS includes */
    #include <ti/sysbios/family/c64p/Hwi.h>
    #include <ti/sysbios/family/c66/tci66xx/CpIntc.h>
    #include <ti/sysbios/family/c66/Cache.h>
    #include <ti/sysbios/family/c64p/EventCombiner.h>

    #include <ti/sysbios/BIOS.h>

    #include <xdc/runtime/Assert.h>
    #include <xdc/runtime/Error.h>
    #include <xdc/runtime/Memory.h>

    #include <ti/sysbios/family/c66/tci66xx/package/internal/CpIntc.xdc.h>
    #include <xdc/cfg/global.h>



    #define GPIO_CFG_BASE (0x02320000)
    #define GPIO_REG_BINTEN (0x8)
    #define GPIO_REG_DIR (0x10)
    #define GPIO_REG_OUT_DATA (0x14)
    #define GPIO_REG_SET_DATA (0x18)
    #define GPIO_REG_CLR_DATA (0x1C)
    #define GPIO_REG_IN_DATA (0x20)
    #define GPIO_REG_SET_RIS_TRIG (0x24)
    #define GPIO_REG_CLR_RIS_TRIG (0x28)
    #define GPIO_REG_SET_FAL_TRIG (0x2C)
    #define GPIO_REG_CLR_FAL_TRIG (0x30)


    #define CSL_UART_REGS 0x02540000

    #define hUartRegs ((CSL_UartRegs*) CSL_UART_REGS)

    unsigned int Uart_Interrupt_Received_Flag = 0;


    void Configure_Platform(void);
    void Configure_UART(void);
    void UartWriteMessage(uint8_t *uchByte);
    Void UART_HWI_Function(UArg arg)
    {
    Uart_Interrupt_Received_Flag = 1;

    }

    Void myIdleFunc()
    {
    if(Uart_Interrupt_Received_Flag)
    {
    Uart_Interrupt_Received_Flag = 0;
    CpIntc_clearSysInt(0,148);


    }

    }
    /* OSAL functions for Platform Library */
    uint8_t *Osal_platformMalloc (uint32_t num_bytes, uint32_t alignment)
    {
    return malloc(num_bytes);
    }
    void Osal_platformFree (uint8_t *dataPtr, uint32_t num_bytes) {
    /* Free up the memory */
    if (dataPtr)
    {
    free(dataPtr);
    }
    }
    void Osal_platformSpiCsEnter(void) {
    /* Get the hardware semaphore.
    *
    * Acquire Multi core CPPI synchronization lock
    */
    while ((CSL_semAcquireDirect (PLATFORM_SPI_HW_SEM)) == 0);
    return;
    }
    void Osal_platformSpiCsExit (void) {
    /* Release the hardware semaphore
    *
    * Release multi-core lock.
    */
    CSL_semReleaseSemaphore (PLATFORM_SPI_HW_SEM);
    return;
    }
    void UartWriteMessage(uint8_t *uchByte)
    {
    while(*uchByte)
    {
    platform_uart_write(*uchByte++);
    }



    }

    Void main()
    {
    Hwi_Params params;
    int eventId=0;

    Configure_Platform();
    Configure_UART();

    CpIntc_mapSysIntToHostInt(0,148,32);
    CpIntc_dispatchPlug(148, &UART_HWI_Function,0, TRUE);
    CpIntc_enableHostInt(0,32);
    CpIntc_clearSysInt(0,148);
    eventId = CpIntc_getEventId(32);


    Hwi_Params_init(&params);
    params.arg = 148;
    params.eventId = eventId;
    params.enableInt = TRUE;
    Hwi_create(4, &UART_HWI_Function, &params, NULL);
    Hwi_enableInterrupt(4);

    BIOS_start();
    }

    void Configure_UART(void)
    {
    uint8_t *message1 ="\n\rUART Ready";
    UartInit();
    //CSL_FINS (hUartRegs->IER, UART_IER_ERBI, CSL_UART_IER_ERBI_ENABLE);
    hUartRegs->IER= 0x000000005;
    platform_uart_set_baudrate(115200);
    UartWriteMessage(message1);
    }

    void Configure_Platform(void)
    {

    /***************** INITIALIZATION*******************************************/
    platform_init_flags init_flags;
    platform_init_config init_config;
    uint8_t Recvbuf=0;

    memset(&init_flags, 0x01, sizeof(platform_init_flags));
    init_flags.phy = 0;
    init_flags.ddr = 0;
    init_config.pllm = 0;

    if (platform_init(&init_flags, &init_config) != Platform_EOK){
    printf("Platform failed to initialize, errno = 0x%x \n",
    platform_errno);
    }
    /***************** INITIALIZATION*******************************************/



    }
  • Hey there,
    Now I am getting multiple UART interrupt , but for that I have to clear the system interrupt again and again.
    I want to know is it necessary to clear this interrupt ?
    Check my main and Idle function.

    Void main()
    {
    Hwi_Params params;
    int eventId=0;

    Configure_Platform();
    Configure_UART();

    CpIntc_mapSysIntToHostInt(0,148,32);
    CpIntc_dispatchPlug(148, &UART_HWI_Function,0, TRUE);
    CpIntc_enableHostInt(0,32);
    CpIntc_clearSysInt(0,148);
    eventId = CpIntc_getEventId(32);


    Hwi_Params_init(&params);
    params.arg = 148;
    params.eventId = eventId;
    params.enableInt = TRUE;
    Hwi_create(4, &UART_HWI_Function, &params, NULL);
    Hwi_enableInterrupt(4);
    BIOS_start();
    }

    Void myIdleFunc()
    {
    if(Uart_Interrupt_Received_Flag)
    {
    Uart_Interrupt_Received_Flag = 0;
    CpIntc_clearSysInt(0,148);

    UART_Byte_Recv=UartReadData();
    platform_uart_write(UART_Byte_Recv);
    }
    }
  • Hi Arun,

    Sorry for the delay. 

    Looking at your code, I noticed that you are plugging in the same function for CpIntc_dispatchPlug() and Hwi_create(). From the example provided in the docs , the CpIntc_dispatch() function should be plugged into the Hwi_create() which will take care of the issue.

    In your code replace Hwi_create with the following statement:

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

    Vikram