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.

CC1312R: When loading from the bim into an image, std::time (RTC) doesn't seem to work?

Part Number: CC1312R

When I load my NORTOS program directly with the debugger std::time(NULL) works great, but when I load my image together with my BIM image (based on the ti reference BIM) and then jump to my firmware, std::time(NULL) gives me a garbage value for the first few times and then remains fixed at 4177066232 thereafter.  Is there something special I need to do in the beginning of my program if I jump to it from a bootloader in order for the RTC to work properly?

  • Hi Myles,

    In order to support you with this issue, I need some more information from you to understand what you are trying to do. 

    Which version of the SDK are you using? If you are not using the latest version (4.30), can you upgrade to the latest one and see if you can reproduce the issue? You can download the latest version here: https://www.ti.com/tool/download/SIMPLELINK-CC13X2-26X2-SDK 

    Which stack are you using?

    Which project are you using and have you made any modifications to the project? 

    In which order do you load the files? Are you using the OAD file that's generated by the OAD Image Tool?

    Are you using a Launchpad or a custom board? 

    Thanks, 
    Elin

  • I'm using the latest 4.30.0.54.

    Not using a stack, I am using a custom board and custom infrastructure so its going to be difficult to recreate exactly (since I am using a no-rtos setup).  I basically created a similar process to how the TI OAD image delivery works, though I did start the same BIM onchip project.  This issue can be seen by combining both the bim and my standard image into one and then loading both with the smartrf flash programmer2 (so without even preforming and OAD update I can see this issue).   The image boots into the BIM and then jumps to the program.  I can probably create something similar with example example projects.  I am just not sure what I did wrong if anything.  It doesn't look anything special happens in this process.  The Bim boots up and loads the ccfg and then jumps to the ISR vector of the second image.  Is there some critical step I am missing?

    Update maybe its related to this issue linked below?  Anyway I found a workaround by reading the time with AONRTCSecGet() instead of std::time(NULL).  That seems to work fine after jumping from the bim.

  • Hi Myles, 

    Thanks for sharing. 

    It's very difficult to know if you are missing a critical step when you both have a custom board and a custom environment and I don't know what steps you are actually performing. But I would strongly encourage you to have the BIM and application images separate. That's at least how it's supposed to be used with the examples from the SDK. Do you have the same issue when the images are separate? 

    Myles Scott said:
    Update maybe its related to this issue linked below? 

    Just checked in our system and it seems like this issue was resolved early this year. Which version of the SDK are you using? 

    Thanks, 
    Elin

  • The BIM and application images are separate, I used srecord to create a image to load at once, for production for example like the OAD document describes.  As I mentioned in my second post I am using the latest SDK.  When I load only my production image the issue does not occur, but if I load both the BIM and my production image (so the bim boots first and then jumps to production image) then I have the issue.  Unless I make the register call to get time instead of std::time.

  • Hi Myles,

    Apologies for the delay. 

    This seems strange. Have you tried to debug the BIM application to make sure that it's able to boot the application properly?

    Are you using noRTOS and the same security settings for both the BIM and the application? 

    Thanks, 
    Elin

  • Myles Scott said:
    When I load only my production image the issue does not occur, but if I load both the BIM and my production image (so the bim boots first and then jumps to production image) then I have the issue. Unless I make the register call to get time instead of std::time.

    With the TI ARM compiler std::time() uses CIO to read the time from the host PC running the debugger. This involves setting a CIO break point, and when the program calls std::time() the program will be halted while the debugger obtains the current time from the host PC, and the program is then resumed.

    If the CIO break point is not set, then the std::time() won't return a valid time.

    Customizing the clock and time Functions has some more information on this.

    Myles Scott said:
    Anyway I found a workaround by reading the time with AONRTCSecGet() instead of std::time(NULL).  

    Unless a custom time() function is created, std::time() will only return a value when the program is being run under the debugger. Therefore, using AONRTCSecGet() should be a valid fix.

  • Thanks Chester for that excellent explanation!

**Attention** This is a public forum