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

Part Number: CC3120MOD
Other Parts Discussed in Thread: TMS320C6657, CC3100, CC3120, CC31XXEMUBOOST, , CC3100SDK,

Tool/software: Code Composer Studio

Hi, Tim

My Host is TMS320C6657,via UART to 3120MOD.

I use the latest SDK.

I have done the following:

1. According to SWRU455.pdf, we added  "#define SL_IF_TYPE_UART"  to user.h.

2. We modified the cc_pal.c:

Fd_t spi_Open(char *ifName,
unsigned long flags)
{
CSL_GpioHandle hGpio;
Uint8 pinNum = 15;

hGpio = CSL_GPIO_open(0);

CSL_GPIO_setPinDirOutput(hGpio,pinNum);
(void)platform_delay(50);

hGpio = CSL_GPIO_open(0);

CSL_GPIO_setOutputData(hGpio,pinNum);


return (1);
}

int spi_Close(Fd_t fd)
{
CSL_GpioHandle hGpio;
Uint8 pinNum = 15;

hGpio = CSL_GPIO_open(0);

CSL_GPIO_setPinDirOutput(hGpio,pinNum);
(void)platform_delay(50);

hGpio = CSL_GPIO_open(0);

CSL_GPIO_clearOutputData(hGpio,pinNum);

return (0);
}

int spi_Read(Fd_t fd,
unsigned char *pBuff,
int len)
{
int i=0;
uint8_t buf1[1];

while(1)
{
if (platform_uart_read(&buf1[0], 100) == Platform_EOK)
{

pBuff[i]=buf1[0];
i++;
}
else
{
if(i!=0)
break;
}

}
return (i);
}

int spi_Write(Fd_t fd,
unsigned char *pBuff,
int len)
{
int i=0,write_size = 0;

write_size = len;

for(i=0;i<len;i++)
{
platform_uart_write(pBuff[i]);
}

return (write_size);
}

3. In main.c:

EVM_init();

platform_uart_init();
platform_uart_set_baudrate(115200);

RetVal = sl_Start(0,0,0);

4. In main.c ,we watched: RetVal =1

Please help us with an analysis. Where is the fault? 

Best Regards,

Thanks!

  • Hi,

    For using the CC3120's UART interface, I suggest you take a look at the MSP430 port of the CC3100 host driver. There isn't an existing port of the CC3120 host driver that uses UART, but the port mentioned above has UART support. That port can be found in the CC3100 SDK: http://www.ti.com/tool/download/CC3100SDK

    The CC3120 and CC3100 host drivers are similar enough that you should be able to use that as a guide for how to implement UART with the CC3120. Looking at what you have right now, the biggest issue is probably that you are trying to rewrite the SPI functions as UART, while the proper approach would be to make entirely new native UART functions to perform the necessary reads/writes.

    I suggest you compare that CC3100 UART driver port with what you currently have, as getting ROLE_UNKNOWN from sl_Start() is usually due to a bug in your porting code.

    Let me know if you need more clarification or have further questions on porting the CC3120 host driver.

    Regards,

    Michael

  • Hi,

    First, thank you for your reply. 

    Today ,we have purchased CC31XXEMUBOOST,and  power up, we can receive the WIFI sig,  but for our own board, we can't get the Sig.

    We'd like to know that CC3120MOD requires us to initialize? How to do?

    Thank you sincerely.

  • Hi,

    1) That port   you mentioned  is in 

    C:\ti\CC3100SDK_1.3.0\cc3100-sdk\platform\msp430f5529lp\uart.c?

    2) Now,We're just trying to get through the path .  We use only 3-wires,and use query without interrupting. Then,Can UART functions be written simply?

    Regards!

  • Hi,

    Yes, the UART interface functions are at the C:\ti\CC3100SDK_1.3.0\cc3100-sdk\platform\msp430f5529lp\uart.c path of the SDK.

    It is recommended that you implement the full 5 wire topology, as that will reduce the chance of issues arising in the future. Resources on porting the host driver can be found in Jan's post here:

    https://e2e.ti.com/support/wireless-connectivity/wifi/f/968/p/869418/3216110#3216110

    Some useful recent discussion on porting the CC3120 host driver can be found here as well:

    https://e2e.ti.com/support/wireless-connectivity/wifi/f/968/t/860385

    Regards,

    Michael

  • Hi,

    Now I use CC31XXEMUBOOST+BOOSTXL-CC3120MOD ,and UART(Board_UART1) as Host Interface.

    I have done as below:

    1. In main.c, I initialized Board_UART1 and enabled it, then send  {0xff,0xee,0xdd,0xbb,0x21,0x43,0x34,0x12}, I can receive a reply beginning with "0xba,0xdc,0xcd,0xab......". I think the UART to CC3120MOD is good.

    int main(void)
    {
    int32_t RetVal;
    unsigned char outbuf[8] = {0xff,0xee,0xdd,0xbb,0x21,0x43,0x34,0x12};
    unsigned char inbuf[28] = {0};
    unsigned char inbuf1[28] = {0};
    int i = 0;
    int ret = 0;
    char cChar;
    /* Call driver init functions */
    Board_initGeneral();

    /* Start NoRTOS */
    NoRTOS_start();

    GPIO_init();

    UART_init();

    WiFi_init();

    InitTerm();

    sl_DeviceEnable();

    for(i=0;i<8;i++)
    {
    UART_writePolling(uartHandle, &outbuf[i], 1);
    }


    for(i=0;i<28;i++)
    {
    UART_readPolling(uartHandle, &cChar, 1);


    inbuf[i] = cChar;

    }

    ......

    }

    2, Then , I edit main.c as:

    ......

    GPIO_init();

    UART_init();

    WiFi_init();

    //InitTerm();

    //sl_DeviceEnable();

    RetVal =sl_Start(NULL, NULL, NULL);

    ......

    Function sl_Start()  did not return , then step debug, to device.c line 183:

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

    Please give me some directiona.

    Thank you very much

    Regards,

    wcy

  • Hi,

    Some  Additional issues of 

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

    Trace As below:

    sl_Start() 

    _SlDrvWaitForInternalAsyncEvent()

    _SlDrvSyncObjWaitForever

    SemaphoreP_pend

    Thank you sincerely!

  • Hi,

    Are you still using the TMS320C6657 as your platform? I am not sure what change you made when you mention that you are now using the CC31XXEMUBOOST in addition to the Board_UART1 interface.

    As for sl_Start() getting stuck, it appears that the driver is waiting for an async response from the CC3120. When you issue the sl_Start() command, the device will init and then respond back with a success or error code once init is complete.

    If the driver is stuck on the async response, one of a few things could be happening:

    1. Your sync objects are not implemented correctly. I would double-check to see if your semaphore and mutex functions are correctly implemented.

    2. The h_irq line and its interrupt is not being handled by the host MCU correctly. I would use a logic analyzer or oscilloscope to ensure that the CC31xx is asserting the irq line, and that your device is correctly getting triggered off of that.

    There might be another cause of sl_Start() not working, but those two causes are most typical. Please check those possible causes and let me know what you find.

    Regards,
    Michael

  • HI,

    I'm sorry to reply so late!

    First,  now  I am not  using TMS320C6657.

    As a test, now I am  using  CC31XXEMUBOOST+BOOSTXL-CC3120MOD ,and use the serial port(defined as Board_UART1) on the board(CC31XXEMUBOOST) as Host Interface.

    I will check the things above as soon as possible.

    A question,please:

     If my sync objects are not implemented correctly.how  should  I determine if my semaphore and mutex functions are correctly implemented?

  • Hi,

    How are you testing the CC3120? The CC31XXEMUBOOST does not have an MCU and only provides a COM port interface to your PC for programming, test and debug. What are you running on your PC to test the device?

    I suggest you use radiotool to test out that connection. It should work with your setup out of the box: http://www.ti.com/tool/CC3XXXRADIOTEST

    To determine whether your sync objects are implemented, I suggest comparing your implementation against that of the implementation provided within the SDK. You can also step through your program and see if the sync objects function as expected.

    Regards,

    Michael

  • Hi,

    Very sorry.Mistake in writing.

    I have two boards: 

    1. MSP432P401R LaunchPad. It has a MCU(MSP432). As shown:

    2.  BOOSTXL-CC3120MOD, CC3120MOD is here.

    These two boards can be inserted in pairs。

    Thank you very much!

    wcy

  • Hi,

    If you are using the MSP432P4 launchpad and the CC3120MOD boosterpack together, this is a supported combination that should be able to run out of the box from the SDK + plugin.

    So if you download the cc3120 plugin: http://www.ti.com/tool/SIMPLELINK-WIFI-CC3120-SDK-PLUGIN

    You should find many MSP432P4 examples that you can directly import and build in CCS. Have you tried running those examples yet?

    Regards,
    Michael

  • Hi,

    Yes, I have tried running some examples. All succeeded.

    Based on these examples,  I am trying to change  SPI Interface to UART Interface.

    But failed, as mentioned above.

    Best Regards,

  • Hi,

    Base on the example "/trigger_mode_MSP_EXP432P401R_nortos_ccs", I am trying to change  SPI Interface to UART Interface.

    I do :

    1) Add "#define SL_IF_TYPE_UART" in user.h;

    2) Modify user.h , as below:

        #define sl_IfOpen                           uart_Open  

        #define sl_IfClose                          uart_Close

        #define sl_IfRead                           uart_Read

         #define sl_IfWrite                          uart_Write

    3) In cc_pal.c, add the 4 functions above:

        

    Fd_t uart_Open(char *ifName,
    unsigned long flags)
    {


    UART_Params uartParams;

    /* Initialize the WiFi driver */
    WiFi_init();

    /* If we could not initialize the device bail out with an error code */
    if(curDeviceConfiguration == NULL)
    {
    return (-1);
    }

    UART_Params_init(&uartParams);

    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readEcho = UART_ECHO_OFF;
    uartParams.baudRate = 115200;

    uartHandle = UART_open(Board_UART1, &uartParams);
    if(uartHandle == NULL)
    {
    // UART_open failed
    while(1)
    {
    ;
    }
    }

    UART_control(uartHandle, UART_CMD_RXDISABLE, NULL);


    if(NULL == uartHandle)
    {
    return (-1);
    }
    else
    {

    return ((Fd_t) uartHandle);
    }
    }

    int uart_Close(Fd_t fd)
    {

    UART_close(uartHandle);
    return (0);
    }

    int uart_Read(Fd_t fd,
    unsigned char *pBuff,
    int len)
    {

    int i=0;
    char ch;
    int ret = 0;

    //__disable_interrupt();

    while(i<len)
    {
    #ifdef UART_NONPOLLING
    ret = UART_read(uartHandle, &ch, 1);
    #else
    ret = UART_readPolling(uartHandle, &ch, 1);
    #endif
    if (ret != UART_STATUS_ERROR)
    {

    pBuff[i]=ch;
    i++;
    }
    else
    {
    if(i!=0)
    break;
    }

    }
    //__enable_interrupt();
    return (i);


    }

    int uart_Write(Fd_t fd,
    unsigned char *pBuff,
    int len)
    {
    int i=0,write_size = 0;

    write_size = len;

    for(i=0;i<len;i++)
    {
    #ifdef UART_NONPOLLING
    UART_write(uartHandle, &pBuff[i], 1);
    #else
    UART_writePolling(uartHandle, &pBuff[i], 1);
    #endif

    }

    return (write_size);
    }

    4) Then run,the result is as described above Jan 17, 2020 2:56 AM

    Please,
    Thank you very much!