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.

usb_dev_bulk.c Starterware and SYSBIOS

Other Parts Discussed in Thread: SYSBIOS

Hi all,

I try to create a USB communication (Bulk), i use ccs 5.1, Starterware 1.10.02.02 and SYSBIOS 6.

I joint my USB.c file, its mostly the same as the usb_dev_bulk.c but without the LCD code.

6180.USB.zip

I want to create a task with SYSBIOS that will be run my function : void USB(void) (see in my USB.c) This task will manage all the traffic on the USB. The problem is when i create my task and associate the function void USB(void) to the task, i got this error:

undefined               first referenced
symbol in file
--------- ----------------
USBBufferDataWritten ./USB.obj
USBBufferFlush ./USB.obj
USBBufferInfoGet ./USB.obj
USBBufferInit ./USB.obj
USBBufferSpaceAvailable ./USB.obj
USBDBulkInit ./USB.obj
g_pucUSBRxBuffer ./USB.obj
g_pucUSBTxBuffer ./USB.obj
g_sBulkDevice ./USB.obj
g_sRxBuffer ./USB.obj
g_sTxBuffer ./USB.obj

error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "Plasma_Detek_DSP.out" not
built

Does SYSBIOS support the Starterware function?

  • you should use:
    usb_bulk_structs.c
    usb_bulk_structs.h
    usbbuffer.c
    usbringbuf.c 

     and link to usblib.lib

  • I'm still have the same problem...

    look like the usblib.lib can load correctly. Can some one tell my the difference with the cgt and cgt_ccs directory? And do i use debug or release version??? I try de different version but it wont compile... I pretty sure that I do something wrong but i cant find it.

    as you can see i got the file in my project and all the path in the project options

    It's possible that the usblib.lib as something wrong about it?

  • Ok, I finaly find what im doing wrong and i need to include all those lib:

    drivers.lib, ipclite.lib, platform.lib, system_config.lib, usblib.lib, utils.lib

    Now that I can compile my software I got a question, do I need to setup the interrupt with the SYSBIOS? or with this code its all configure:

     /* Initialize the DSP interrupt controller */
    IntDSPINTCInit();

    /* Enable DSP maskable interrupt */
    IntEnable(C674X_MASK_INT5);

    /* Enable DSP interrupts */
    IntGlobalEnable();

    /* Setup the DSP INTC */
    IntDSPINTCInit();
    IntGlobalEnable();

    IntRegister(4, USB0DeviceIntHandler);
    IntEventMap(4, SYS_INT_USB0_INT);
    IntEnable(4);

    //Delay timer setup
    DelayTimerSetup();

    // Initialize the transmit and receive buffers.
    USBBufferInit((tUSBBuffer *)&g_sTxBuffer);
    USBBufferInit((tUSBBuffer *)&g_sRxBuffer);

    // Pass our device information to the USB library and place the device on the bus.
    USBDBulkInit(0, (tUSBDBulkDevice *)&g_sBulkDevice);
    
    
    I want to know if i need to manage the USB interrupt. Or I just need to create a task that verify the communication flag (g_ulFlags) and verify if I receive data?
    
    
    thanks
  • 1. SYS/BIOS manages interrupts, you need only register usb isr, like this:
    	#ifdef _TMS320C6X
    const int irq_event = SYS_INT_USB0_INT;
    #else
    const int irq_event = SYS_INT_USB0;
    #endif
    m_Hwi.Create(irq_event, (HWI_FXN)USB0DeviceIntHandler, (Arg)0);
    2. RX and TX handlers are registered in file "usb_bulk_structs.cpp"
    const tUSBDBulkDevice g_sBulkDevice =
    {
    USB_VID,
    USB_PID,
    500,
    USB_CONF_ATTR_BUS_PWR,
    RxHandler,
    (void *)0,
    TxHandler,
    (void *)0,
    g_pStringDescriptors,
    NUM_STRING_DESCRIPTORS,
    &g_sBulkInstance
    };
  • First ty for the answer.

    Slava Bogulmintsev said:
    1. SYS/BIOS manages interrupts, you need only register usb isr, like this:
    	#ifdef _TMS320C6X
    const int irq_event = SYS_INT_USB0_INT;
    #else
    const int irq_event = SYS_INT_USB0;
    #endif
    m_Hwi.Create(irq_event, (HWI_FXN)USB0DeviceIntHandler, (Arg)0);

    I add this code in my .cfg but i got this error "that interrupt index is out of range (19)". SYS_INT_USB0_INT define to be 19...

    What i read form the documentation is that the interrupt can be 4 to 15. I thing i need to configure a MUX but I cant find any documentation on that...

  • 1) i don't create hwi in script file, only from code
    2) if you have number of ISR in the system less 12, you can do it like this:

    unsigned int INT_ISR = 4; //global
    {

    	Hwi_Params hwiParams;
    Hwi_Params_init(&hwiParams);
    hwiParams.arg = (UArg)0;
    hwiParams.enableInt = TRUE;
    hwiParams.eventId = SYS_INT_USB0_INT;
    Hwi_Handle hHwi = Hwi_create(INT_ISR, (Hwi_FuncPtr)USB0DeviceHandler, &hwiParams, NULL);
     INT_ISR++;
    ASSERT(INT_ISR<16);
    }
    3) if number of ISR more 12, you need to programm interrupt combiner: see sprufk5a.pdf chapter7
    4) i am programming on C++ and my examples is not accurate, rather pseudo code 
  • Ok but do i realy need to setup the interrupt for the USB0 in the .cfg file if i use this:

    IntRegister(4, USB0DeviceIntHandler);
    IntEventMap(4, SYS_INT_USB0_INT);
    IntEnable(4);
  • in the .cfg have i have only one line related interrupts:
    var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');

    and if you use SYS/BIOS you should use Hwi module to configure and enable interrupts.

  • My HWI work but now my task stop running on task_sleep...

    I think that when i create my HWI for the USB, its disable the HWI for the clock_tick (use for the task_sleep). I try to activate it after i create the HWI of the USB but with no succes.