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.

CC3120MOD: Host behaviour to start the init sequence

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

Hello,

According to Michael Reymond in the post https://e2e.ti.com/support/wireless-connectivity/wifi/f/968/p/673781/2480241 

He stated "The Host IRQ line becoming high indicates that the CC3120 is expecting some response from the host MCU. In the case of the first Host IRQ assertion after reset, it is expecting the host to start the init sequence by sending the sync word over UART/SPI."

I couldn't find that in any of the TI documentation.  So is this the expected host behaviour? 

I have an issue with the Host IRQ staying high even after sl_Start() has returned ROLE_AP.

I have the host driver ported to a MCU that's not using an RTOS.

Thanks,

Wai

  • Hi Wai,

    The host irq line is touched upon in the CC3100 host interface guide:
    processors.wiki.ti.com/.../CC3100_Host_Interface
    This guide is still valid for the CC3120 as the low level host driver operation is the same between the CC3100 and the CC3120.

    If you are seeing that the Host IRQ is still high after sl_Start() returns, there are a few things you should check:
    1. Are you calling sl_Task() to process asynchronous events in your non-RTOS program?
    2. Do you see that the host send the appropriate sync word to the CC3120 as part of the host irq handler flow?
    3. Do you see the Host IRQ line start off low, before transitioning to high after sl_Start()? If it was high to begin with there might be a hardware problem to investigate.

    Regards,
    Michael
  • Hello Michael,

    Thanks for your quick response.

    1. Yes, its in the main loop. In the CC3100SDK_1.3.0 examples, I see calls to _SlNonOsMainLoopTask() which is the equivalent to sl_Task() in the CC3120 SDK (simplelink_sdk_wifi_plugin_2_40_00_22) as in a NORTOS implementation, sl_Task() is defined as _SlNonOsHandleSpawnTask() which performs the same functionality as _SlNonOsMainLoopTask() in CC3100. In CC3100SDK_1.3.0 examples, I see the following:

    lRetVal = sl_Start(0, 0, 0);
    ASSERT_ON_ERROR(lRetVal);

    // Check if the device is up in AP Mode
    if (ROLE_AP == lRetVal)
    {
    // If the device is in AP mode, we need to wait for this event
    // before doing anything
    while(!IS_IP_ACQUIRED(g_Status))
    {
    #ifndef SL_PLATFORM_MULTI_THREADED
    _SlNonOsMainLoopTask();
    #else
    osi_Sleep(1);
    #endif
    }
    }

    Is this where you suggest sl_Task() should be called as well? If so, what would be the equivalent to

    while(!IS_IP_ACQUIRED(g_Status))

    in CC3120 driver?

    2. No I don't see the host send the appropriate sync word to the CC3120 as part of the host irq handler flow during initialization. The host driver is using UART to communicate with the CC3120 and if I understand the Initialization flow correctly (processors.wiki.ti.com/.../CC3100_Host_Interface), sl_IfWrite() is only called if using SPI. So should the host still be sending the sync word to the CC3120 as part of initialization flow? Also considering that sl_Start returned ROLE_AP, doesn't that indicate that the initialization completed successfully?

    3. Yes, the Host IRQ line starts off low, before transitioning to high after sl_Start().

    Edit: Further to (1), if i put a break point after sl_Start() is complete, g__SlNonOsCB.SpawnEntries[].IsAllocated are all 0x00.


    Cheers,
    Wai

  • Hi Wai,

    1. The IS_IP_ACQUIRED flag is an application-level global that was used for the CC3100 example as a way for the main application to wait on the specific ip acquired async event. You could do something similar on the CC3120 by adding that global flag to your SimpleLinkNetAppEventHandler(), to be set on a SL_NETAPP_EVENT_IPV4_ACQUIRED event.
    As for sl_Task(), if you are not using an RTOS where you can spawn a low-priority thread to run sl_Task(), you will need to call it periodically in your application. In general, looking at where it is called in the no-RTOS examples in the SDK would be a good guide as to when you should be calling it.

    2. The UART host driver guide can be found here: processors.wiki.ti.com/.../CC3100_UART_Host_Interface
    sl_IfWrite() should definitely be called even if you are using UART, unless you have replaced that function with your own UART-specific function. There is also still a sync word that is used for UART, so if you are not seeing that on the UART lines then something is going wrong.

    3. Ok, this indicates that the host irq is functioning as expected and that there probably isn't a hardware explanation for why you are not handling the host irq event.

    Try running sl_Task() periodically and seeing if that helps with your issue.

    Regards,
    Michael
  • Hi Wai,

    I assume that you have resolved your issue since I have not heard back from you. If not, feel free to post a response to this thread, or open a new thread regarding this issue.

    Regards,
    Michael
  • Hello Michael,

    Thanks for the follow-up. I was able to get it to work.

    However, you stated in point 2 "sl_IfWrite() should definitely be called even if you are using UART".  Did you mean it should be called as part of the UART initialization sequence as that was the context of my question?   If that's the case, I did not see that and even in the "UART initialization sequence" diagram, it doesn't show sl_IfWrite() being used.

    If you can clarify this point, then I would be satisfied with how I've implemented the initialization.

    Cheers,

    Wai

  • Hi Wai,

    Unless you have modified the host driver files more extensively, sl_IfWrite() should be defined in user.h as some function where you implement the UART write on the UART interface between your host MCU and the CC3120. This is a function called whenever you send data to the CC3120, thus sl_IfWrite() should be used constantly as you interact with the CC3120. If you set a breakpoint at sl_IfWrite() and then run the host driver in debug mode, you'll see how that function is used for low-level communication to the CC3120.

    Regards,
    Michael