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: call sl_Stop followed by sl_Start sometimes return [-2005] Error Code?

Part Number: CC3120MOD
Other Parts Discussed in Thread: CC3120

Hi,

I am interfacing CC3120 to stm32 for non rtos environment using simplelink_sdk_wifi_plugin_2_30_00_10 drivers. Every thing is working fine but I faced one problem regrading reset (call sl_Stop followed by sl_Start) the device. When I reset the device then sometime it generate error code [-2005] "/* API has been aborted due to an error detected by host driver */", then same error repeats.

I have to generate this error what I did , I called reset device every 5 second, till some time it reset properly, but after some time (after few minutes) it start throwing the error [-2005], then it never again reset once error came and same error repeat if I continue to reset the device after 5 second.

Please explain why it happening and suggest some solution to resolve this error.

Regards,

Shubham

  • Hi Shubham,

    Can you clarify the situation a bit for me?

    1) The error is generated on the call to sl_Start(), correct?

    2) If the error occurs once, does the following call to sl_Stop() appear to clear the g_SlDeviceStatus value in the host driver?

    When you are performing a the stop-start action to reset the device, please make sure you are allowing for the minimum required hibernate time for the device. Please refer to table 4-5 of section 4.13.3.3 in the CC3120 datasheet.

    www.ti.com/.../cc3120.pdf

    Best,

    Ben M

  • Hi Ben,
    I am testing with negative test case. If my system gets this type of error by any means like wifi module gets reset due to power but not host then it should not hang there.

    What I am doing to generate this error I just reset wifi module by doing on-off the power supply of CC3120 without disturbing host micrcontroller (STM32). Then it start throwing error "-2005". But once again wifi module gets power then it should reset properly with the sl_stop/sl_start command. But is not happening. That is what I want to know.

    What should program to do come out from this error?


    1) Error is generated while calling sl_start or sl_stop and error is same "-2005".
    2) And I found that sl_stop is not able to clear the g_SlDeviceStatus flag, once error came. Flag value is 0x0700, not changing.

    I tried with giving time between sl_stop and sl_start as you mentioned for hibernate but problem is same.

    Regards,

    Shubham Kant Dubey
  • Hi Shubham,

    Thank you for clarifying that this is a test case where the Wi-Fi power is removed and the host is allowed to continue to run in order to simulate the error condition.

    You are correct that once the Wi-Fi device gets power cycled with sl_Start/sl_Stop that it should reset properly. I believe the network processor is resetting/will reset correctly. I am thinking that the error is coming from the state of the host driver not being cleaned-up.

    What should happen is that when you call sl_Stop, the "RESTART_REQUIRED" bit of the global status variable should be cleared. That would be bit 8 (0x0100) in the status variable. It looks like this is not being cleared based on the value you are seeing and so subsequent calls to sl_Start fail because the host driver thinks a restart is still required to recover from the error.

    Please step through the sl_Stop() routine (and into _SlDrvDriverCBDeinit()) to make sure that all these macros work as expected to clear the g_SlDeviceStatus value back to "0" before you call sl_Start() again -

    • SL_UNSET_RESTART_REQUIRED
    • SL_UNSET_DEVICE_STOP_IN_PROGRESS
    • SL_UNSET_DEVICE_STARTED

    Best,
    Ben M

  • Hi Ben,

    I step through sl_Stop and found that it is not clearing these flag . And it is not even calling this _SlDrvDriverCBDeinit() and sl_stop returning before calling this function. It return after calling this SL_DRV_LOCK_GLOBAL_LOCK_FOREVER(GLOBAL_LOCK_FLAGS_NONE). That is why it is not able clear these flag. Please see below NOTE in program.

    Is there any way to achieve reset with this condition which I am facing?


    sl_stop()
    {

    /* Lock during stopping the interface */
    SL_DRV_LOCK_GLOBAL_LOCK_FOREVER(GLOBAL_LOCK_FLAGS_NONE); /*****NOTE: Return from Here only******/

    /***********************NOTE: Programm not comming here After error it return from upper routine*******************/
    sl_IfRegIntHdlr(NULL, NULL);
    sl_DeviceDisable();
    RetVal = sl_IfClose(g_pCB->FD);

    (void)_SlDrvDriverCBDeinit();

    /* clear the stop-in-progress flag */
    SL_UNSET_DEVICE_STOP_IN_PROGRESS;

    /* clear the device started flag */
    SL_UNSET_DEVICE_STARTED;

    SL_DRV_LOCK_GLOBAL_UNLOCK(FALSE);

    return(RetVal);
    }


    Regards,

    Shubham
  • Hi Shubham,

    I believe I see the cause of the issue now. SL_DRV_LOCK_GLOBAL_LOCK_FOREVER() will never succeed if SL_IS_RESTART_REQUIRED.

    Can you try testing if it will reset properly if you call SL_UNSET_RESTART_REQUIRED outside of the host driver prior to calling sl_Stop()? This is simply to test if the rest of the reset will work correctly and it should not be used as a permanent workaround.

    Best,
    Ben M
  • Hi Shubham,

    I haven't heard back from you in a while so I'm going to close this thread. If you have not resolved your issue, please post a reply here and the thread will reopen. If the thread locks before you can post again, please press the "Ask a related question" button up top to open a new post that links to this one.

    Best,
    Ben M
  • Hi Ben,

    Sorry for Late reply

    I tried what you suggest it is not working same problem is there. Now I am facing a similar issue like this when any FATAL error came then I tried to reset (sl_stop then sl_start as mentioned in programming guide) the device returning same error [-2005]. Is there any solution for that because there is probability on site that device generate fatal error sometime then how to reset the device CC3120 without reset the host?

    Now it become a bottleneck for our product development. Please try to resolve as soon as possible.

    Thanking You
    Regards,

    Shubham Kant Dubey
  • Hi Ben,

    I am waiting for the reply of this problem, could you please just help me out. Is there any way to resolve it. Because we are at prototype phase of product development.

    Regards,

    Shubham Kant Dubey
  • Hi Shubham,

    What do you mean by same problem is there? Can you see in a watch window that the bit in the status variable is successfully cleared prior to the sl_Stop call? If so, where is the sl_Stop() call returning the error code now?

    Thanks,
    Ben M
  • Hi Ben,

    I just want to know that whenever my device got error which is -2005 ( API has been aborted due to an error detected by host driver), then how to come out from this error. Because in my case I follow reset sequence it does not reset and throw similar error, means it got stuck as I checked flag are not able to clear by sl_stop (As you asked to check some flag in above thread). I just want to know is there any way to resolve this error without resetting the host microcontroller.

    Regards,

    Shubham
  • Hi Shubham,

    I identified this as a bug in the host driver. That is what I meant by this statement a while ago:
    "I believe I see the cause of the issue now. SL_DRV_LOCK_GLOBAL_LOCK_FOREVER() will never succeed if SL_IS_RESTART_REQUIRED."

    The issue has been reported and will be fixed with a new host driver release. Until that release is available (which will update the sl_Stop() call to make sure it clears the flags and resets the device as expected), a workaround will have to be implemented.

    I need your help confirming that the workaround I suggested will work as expected so that you don't have to just reset the host microcontroller when this happens.

    Best Regards,
    Ben M
  • Hi Ben, 

    Thanks for your response!

    I need method to resolve this issue till the new release come. Please tell me step for reset the device in this condition, then I will implement and will confirm you after testing it.

    I am waiting for your response, because as soon as possible I have to finalize my product code and go for production.

    Regards,

    Shubham

  • Hi Ben,

    Please give me step of workaround for this problem as soon as possible.

    Regards,
    Shubham
  • Hi Shubham,

    The workaround should be to unset the restart required bit in the status variable (as is done in SL_UNSET_RESTART_REQUIRED) in your application prior to calling sl_Stop().

    If that is not working (as your post suggests), please provide an explanation of why the sl_Stop() function doesn't seem to be working. Where does it return the error code from inside the function? What is the value of the status variable after it is called?

    Thanks,
    Ben M
  • Hi Ben,

    Thanks for reply!

    My Problem is got resolved, in only condition If I call all three reset Macro (Mention below) bit before sl_Stop().

    SL_UNSET_RESTART_REQUIRED
    SL_UNSET_DEVICE_STOP_IN_PROGRESS
    SL_UNSET_DEVICE_STARTED

    Please just confirm is there any problem to calling these macro before sl_stop()?

    Regards,

    Shubham

  • Hi Shubham,

    Are you certain that all three are required?

    I agree that SL_UNSET_RESTART_REQUIRED and SL_UNSET_DEVICE_STOP_IN_PROGRESS should influence the behavior of sl_Stop(), but the device should be started before sl_Stop() is called so SL_UNSET_DEVICE_STARTED should not be needed for this test.

    That being said, none of these should be required and this is strictly a workaround. I don't expect there to be an issue with calling these only before sl_Stop() when a recovery needs to occur. However, it isn't something that has been officially tested by our team. The actual fix is intended to be included in our next SDK release. Please test this scenario again when that is available without the workaround.

    Best Regards,
    Ben M