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.

CCS/CC3120MOD: CC3120MOD to DSP

Part Number: CC3120MOD
Other Parts Discussed in Thread: TMS320C6657, SYSBIOS

Tool/software: Code Composer Studio

Hi,

My goal is to port the Simplelink host driver to a TI's DSP platform, running with an OS, in a multithreading mode.

My Simplelink device is CC3120MOD, software development environment is CCS9.2 + simplelink_sdk_wifi_plugin_2_40_00_22, host is TMS320C6657 and host interface is UART.

On the Products page of the General option of project properties, I use "ti.targets.elf.C66" as Target and "ti.platforms.evm6657" as Platform.

In cc_pal.c, I have omitted all the Semaphore_ related functions (Semaphore_create_handle, SemaphoreP_delete, ...) and the Mutex_related functions (Mutex_create_handle, Mutex_lock, ...) and TimerGetCurrentTimestamp().

Now I can send data successfully( UDP protocol ,from DSP with func ‘sl_SendTo’ ), but can't receive data(with func 'sl_recvfrom').

I think the reason of 'sl_recvfrom' failing is just the functions omitted. In fact ,the success of other function(eg 'sl_SendTo') calls should be due to the timeout mechanism.

Is there any way to get support on this matter?
Or how can I port the DPL to my project?

Thanks in advance,

  • Why did you omit the mutex and semaphore functions? these are needed for the multi-threads solution.

  • Because compilation fails.

    How can I port DPL to my project ,Please?

    Thanks.

  • What do you mean by DPL?

  • In cc_pal.c, The mutex and semaphore functions call some other functions (include SemaphoreP_Params_init,SemaphoreP_create ,etc), these functions are found in one path,it's “C:\ti\simplelink_msp432p4_sdk_3_30_00_13\kernel\nortos\dpl”. In order to compile successfully,I should import these functions to my project.

    Now,  I have imported the three files(SemaphoreP_tirtos.c,MutexP_tirtos.c,ClockP_tirtos.c)and built successfully. But a new issue : 

    When running, the function sl_Start did not return. Trace debugging found that the program crashed in this line:

    VERIFY_RET_OK(_SlDrvWaitForInternalAsyncEvent(ObjIdx,
    INIT_COMPLETE_TIMEOUT,
    SL_OPCODE_DEVICE_INITCOMPLETE));

    Please help with the analysis.

    Sincere thanks!

  • You will need to debug the host interface lines: nReset/nHib, SPI and IRQ.

    Have you ported the DPL code? what OS are you using?

    Basically, you should have changed cc_pal to call the relevant system calls of your OS instead of using the DPL.

    then again if the porting is correct, then the problem is probably on the HW (configuration).

    Br,

    Kobi

  • Hi,

    1)I use UART as host interface. I have debuged these lines. Good.

    2)I use the OS of TI SYS/BIOS V 6.35.4.50.I have imported the three files(SemaphoreP_tirtos.c,MutexP_tirtos.c,ClockP_tirtos.c)and built successfully.

    According to your instructions:

    Basically, you should have changed cc_pal to call the relevant system calls of your OS instead of using the DPL.

    I should change   cc_pal.c.

    But according to the template of c_pal.c, I don't kow how to do.

    For example: in cc_pal.c , the function 'Semaphore_create_handle' is as:

    int Semaphore_create_handle(SemaphoreP_Handle* pSemHandle)
    {
    SemaphoreP_Params params;

    SemaphoreP_Params_init(&params);
    #ifndef SL_PLATFORM_MULTI_THREADED
    params.callback = tiDriverSpawnCallback;
    #endif
    (*(pSemHandle)) = SemaphoreP_create(1, &params);

    if(!(*(pSemHandle)))
    {
    return(-1);
    }

    return(SemaphoreP_OK);
    }

    In the function, 'SemaphoreP_create calls  'ti_sysbios_knl_Semaphore_create' . 

    Then , how should I change?

    Can you give me an instance?

    Thanks!

  • Are you using TI-RTOS?

    If not, you should call the equivalent of semaphore creation in the OS on your platform.

  • Yes, I am using TI_RTOS.

  • Then you can refer to MSP432 sdk (http://www.ti.com/tool/SIMPLELINK-MSP432-SDK) , and look for the DPL implementation for TI-RTOS (under kernel/tirtos/packages/ti/dpl).

    Br,

    Kobi

  • Yes, I have imported the three files(SemaphoreP_tirtos.c,MutexP_tirtos.c,ClockP_tirtos.c)and built successfully.''

    Then , run myproject.out and it's stunk in sl_Start. 

    Continue tracking,find that sl_Start is stunk in the function 'SemaphoreP_pend'.

    The function prototype is “SemaphoreP_Status SemaphoreP_pend(SemaphoreP_Handle handle, uint32_t timeout)”.

    The reason the function is stuck is timeout = 0xffffffff.

    Why is that? Where does it come from?

  • sl_Start activates the Network Processor, then blocks on the semaphore until the NWP issues an init complete interrupt.

    I think you should start debugging the HW lines (nReset, SPI/UART and HOST_INTR).

    Basically, the Simplelink "spawn" thread (that you need to initialize) should be invoked by the interrupt and release the semaphore.  

    You can refer to the datasheet (https://www.ti.com/lit/ds/symlink/cc3120.pdf) and the NWP Programmers Guide (http://www.ti.com/lit/ug/swru455j/swru455j.pdf) for more details.

    Br,

    Kobi

  • Thank you for your quick reply.

    What do you mean by the simplelink "spawn" thread (that you need to initialize)?

    In CC_ In the pal.c template, there is a callback function “tiDriverSpawnCallback”. Is this what you call  'the simplelink "spawn" thread'?  

    I refer to the routine ‘power_measurement_MSP_EXP432P401R_nortos_ccs ’, But  I didn't find  which program started this thread.

    Another problem is:In CC_ In the pal.c template, there is a  interrupt service routine ‘HostIrqGPIO_callback’. It calls the function "g_Host_irq_Hndlr". I can't find the prototype.

    Can I have some more guidance?

    Sincere thanks!

  • All the examples demonstrate the use of the simplelink spawn thread. It is basically a thread context that needs to be created by the application that calls sl_Task. The thread must be created before calling sl_Start.

    For example:

    /* Create the SimpleLink spawn thread */
    pthread_attr_init(&attr);
    priParam.sched_priority = 9;
    pthread_attr_setschedparam(&attr, &priParam);
    pthread_attr_setstacksize(&attr, 2048);
    pthread_create(&slSpawnThread, &attr, sl_Task, NULL);

    br,

    Kobi

  • Hi,

    Now I have debugged all the HW lines, they are all good.

    Now my problem is : when my program calls function 'sl_Start' and receive the interrupt, enter interrupt service routine ‘HostIrqGPIO_callback’, and then crash:

    [C66xx_0] A0=0x0 A1=0x8
    A2=0x0 A3=0xaa
    A4=0x80067210 A5=0x800aa16e
    A6=0x7 A7=0x20
    A8=0x0 A9=0x80
    A10=0x0 A11=0x800322d4
    A12=0x0 A13=0x0
    A14=0x0 A15=0x2
    A16=0x8004d510 A17=0x0
    A18=0x0 A19=0x0
    A20=0x859ba8 A21=0x1
    A22=0x859b9c A23=0x859b8c
    A24=0x859ba4 A25=0x859b94
    A26=0x859ba0 A27=0x859bac
    A28=0x1 A29=0x859bb4
    A30=0x859b90 A31=0x859bb0
    B0=0x859b80 B1=0x859b88
    B2=0x0 B3=0x1
    B4=0x0 B5=0x1
    B6=0x859b78 B7=0x800a79b7
    B8=0x859b28 B9=0x859b98
    B10=0x859b68 B11=0x18
    B12=0x0 B13=0x80065664
    B14=0x2 B15=0x859b30
    B16=0x859b70 B17=0x1
    B18=0x859b74 B19=0x859b7c
    B20=0x800a7a36 B21=0x859a98
    B22=0x80063ebc B23=0x0
    B24=0x858b3c B25=0xe03512a3
    B26=0x10f10000 B27=0x859ab8
    B28=0x0 B29=0x859ab8
    B30=0xffffffff B31=0xffffffff
    NTSR=0x66666666
    ITSR=0x36363636
    IRP=0x800322d4
    SSR=0x800a7adb
    AMR=0xfffffff0
    RILC=0x0
    ILC=0x2
    Exception at 0x0
    EFR=0x2 NRP=0x0
    Internal exception: IERR=0x1
    Instruction fetch exception
    ti.sysbios.family.c64p.Exception: line 255: E_exceptionMin: pc = 0x00859a98, sp = 0x800a760d.
    To see more exception detail, use ROV or set 'ti.sysbios.family.c64p.Exception.enablePrint = true;'


    xdc.runtime.Error.raise: terminating execution

    Then,track the ‘HostIrqGPIO_callback’, when step to the g_Host_irq_Hndlr(0), the above error occurred.

  • Hi,

    g_Host_irq_Hndlr should pint to "_SlDrvRxIrqHandler" - is that the value (address) that you see?

    The registration is done during sl_Start.

    Br,

    Kobi