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.

Repeated SPI transfer hangs RTOS

Other Parts Discussed in Thread: CC2640, CC2650

Hi,

I am working on a CC2640 4x4 package custom application that uses the UART driver in callback mode and the SPI master

driver in blocking mode. In SimpleBLEPeripheral_init, I am trying to complete a one time initialization of a set of 19 registers

in the SPI slave.

I am using CCS6.1.2, BLE stack 2.1, TIRTOS 2.13.00.06.

I am able to accomplish this initialization successfully if I do it on a UART read callback, processed from the RTOS message

queue in SimpleBLEPeripheral. If I try to complete this initialization from SimpleBLEPeripheral_init, I am unable to do so.

When I run the ROV, I see this exception message under BIOS:

Caught exception in view init code: "C:/ti/tirtos_simplelink_2_13_00_06/products/uia_2_00_02_39/packages/ti/uia/loggers/LoggerStopMode.xs", line 231: Cannot read property "enabled" from null

Under details in tasks, SimpleBLEPeripheral_taskFxn is showing up as preempted.

Can you offer pointers on what might be causing this problem?

Thanks,

Priya

  

  • Priya,

    I think that ROV error message is indicating a memory corruption has occurred.  Maybe adding initialization of the SPI slave into SimpleBLEPeriheral_init() has caused a task stack overflow?  Have you tried increasing the stack size for the task?

    In ROV, if you click on the Task Module, and the Detailed tab, how does the stackPeak compare to the stackSize?

    Thanks,
    Scott

  •  Scott,

    Thank you for your reply. I am not seeing the stack peak go beyond the stack size.

    I have attached a screenshot below.

    Thanks,

    Priya

  • I also increased SBP_TASK_STACK_SIZE from 644 to 900. The same problem exists. I need more pointers.
    Thanks,
    Priya
  • OK, thanks.

    Can you also check the Hwi stack peak?  Click on the Hwi module, and the Module tab, and look at hwiStackPeak versus hwiStackSize.

    If you click on the BIOS module, and the “Scan for errors…” tab, are there any other errors reported?

    And if you reload the program and go to main(), is the LoggerStopMode error still indicated?  Or does that only happen after you’ve tried the SPI initialization?

    Thanks,
    Scott

  • Scott,

    Thank you for your reply. I am attaching two screenshots. One is the BIOS ROV when the debugger halts in main. While I increased the task size of SBP from 644 to 900, I don't know if that created any memory overlaps among other tasks?

    The second screenshot is the ROV after the program has been halted. As you can see I am getting an exception inside the Hwi module. The stack peak for this module is within the stack size (336 and 1024).

    What does this exception mean and what to do about it?

    Thank you,

    Priya

  • I forgot to attach the screenshots. It seems to let me upload only one screenshot a post.

    Here is the BIOS ROV halted in main screenshot.

  • Here is the Hwi module exception screenshot.

    Thanks,

    Priya

  • Priya,

    OK, thanks.  I’ll be offline for a while, but in the meantime…

    Increasing the stack size should not create any overlaps.

    Just to double check… you can see the PC sitting at main() and still have the ROV errors?  I ask again because this is an important point.  Sometimes the PC will stop at the program entry point after loading, versus main().  At that point memory is not initialized, so ROV can indicate errors.  But at main() there should be no errors indicated.  

    Are you building this app within CCS and then launching the debugger?  Or are you building it outside CCS, and then running it in CCS?  If it is the later, then sometimes errors can be shown in ROV if there is a mismatch between the environment where the program was built, versus the CCS debug environment.

    The exception indicates undefined Hwi: 39.  This would correspond to a CRYPTO result available event.  Does that ring any bells?

    In ROV if you click on the Hwi module Detailed tab, can post what that shows?

    Thanks,
    Scott

  • Good morning Scott,

    I appreciate your reply. I put a breakpoint at PIN_init inside main.c and yes, I am seeing the same ROV errors. I am building and debugging from CCS6.1.2.

    I have attached a screenshot of the detailed Hwi to this post for your feedback. I don't know anything about CRYPTO result being available. Could this be something happening in SimpleBLEPeripheral?

    I went back to the default SBP task stack size of 644. I am not seeing any stack overflows for any task.

    Thank you,

    Priya

  • Priya,

    Thanks for the additional info.

    I don't think the CRYPTO interrupt is coming from SimpleBLEPeripheral.  If it was there should be an interrupt vector plugged, and it isn't shown in the screen shot you attached.

    Were you seeing ROV errors before you started modifying the example?  Usually ROV errors mean memory corruption.  Or mismatched configuration.  If that has occurred due to some modification, it is possible that this is somehow contributing to the SPI transfer issue.

    Regarding the transfer issue, and needing to do that in a UART read callback, that is really puzzling.  If it isn’t a stack overflow issue, I’ve run out of specific ideas.  

    I think there were some SPI driver issues with early releases.  I don’t know about 2.13.00.06 specifically.  But I expect there may have been some SPI driver improvements in the last year.  I don’t know if these relate to the problem with needing to call from a read callback or not.  I will talk to our SPI expert about this tomorrow to see if he has any ideas...  

    I also wonder if it would help for you to upgrade to the most recent TI-RTOS release (software-dl.ti.com/.../index.html) There are some necessary migration steps that came with the 2.15 release (processors.wiki.ti.com/.../TI-RTOS_Migration_2_15).  At this point I’m just wondering if that is a possibility for you…

    Thanks,
    Scott

  • Scott,

    Thank you for your reply. My machine was upgraded to windows 10 and additional memory was installed on it to handle CCS and windows 10.

    I also have always been seeing exclamation marks under the driver files that I have questioned (screenshots attached). I never had a problem opening any of these files inside CCS which is why I lived with it. I can go to a clean copy of SBP and see how I fare with the ROV.

    I will be awaiting your driver expert's comments.

    Thank you,

    Priya

  • One more question Scott-- when you mention memory corruption are you talking about the PC I 'm using or the CC2640 chip?
    Thanks,
    Priya
  • Hi Priya,

    If you hover the mouse over one of the exclamation points is there a pop up message?

    When I was referring to memory corruption it is for the target processor (CC2650) being debugged.  ROV will read and traverse data structures in target memory to create its data displays.  If data objects get overwritten (like with stack overflow, or out of bounds writing, …) then ROV reads corrupted data.  Sometimes there will be specific messages about data that is incorrect, other times the ROV displays get really messed up.  

    ROV can also have difficulty interpreting the data it reads if the format of some of the data objects has changed.  For example, if a program is built with a newer version of TI-RTOS and is debugged in an older TI-RTOS environment.  That is what I’d referred to as “mismatched” configuration or environment.  If you are seeing exclamation marks over some files I wonder it this might point to a configuration issue.

    I haven’t been able to talk to the SPI driver guy yet, I’ll get back when I have some suggestions…

    Regards,
    Scott

  • Scott-- there is no pop up message around the warnings.

    To justify an RTOS upgrade, can you share specific details about driver bugs related to the exception error I'm seeing?
    We were told the RTOS 2.13.00.06 was tested with BLE stack 2.1.1 and we're nervous to upgrade to a new RTOS,
    what issues might that create with the existing BLE stack?

    Thank you,
    Priya
  • Priya,

    I have to research the specific changes for SPI over the last year.  I’m pretty sure there are more recent BLE releases using the newer TI-RTOS releases.  But I’ll need to research this too.  

    Also, the SPI person I’ve been trying to contact is out of office thru this week.  I will talk to some others tomorrow to see if I can get any more info/suggestions.

    Regards,
    Scott

  • Scott-- sounds good. I will be waiting for your feedback.
    Thanks,
    Priya
  • Scott-- I began the TI RTOS 2.15 upgrade today in a leap of faith. I started over from scratch deleting all tools on my computer. When I re-installed BLE stack 2.1, the 5.4 ARM compiler did not get installed and I got a warning about that. I also ended up installing CCS 6.1.3. I had trouble choosing the latest XDC tools (32. something). It kept defaulting to the .31 version. Let me know what might fix this. I hope to get to the point of a successful clean SimpleBLEPeripheral build tomorrow (7x7 then 4x4) from where I will add the custom board edits. Did I do something not recommended in the tool chain upgrade?
    Thanks,
    Priya
  • Hi Priya,

    I checked more and even though later TI-RTOS releases are used internally to TI, the BLE team has not released updated SDKs to external customers with these later TI-RTOS releases bundled.

    I also heard that there are no known SPI driver issues in the release you have.

    I’m not sure about the installation error you are describing.  Can you please post the specific error message?  Also, I don’t know if you’ve seen this wiki page, but it describes changes for migrating to newer TI-RTOS releases: processors.wiki.ti.com/.../TI-RTOS_Support.  2.15.00 required more changes compared to other releases.

    After learning what I have, I’m wondering if it would be better to stick with the versions you had been previously using, and try to debug the SPI transfer issue you’re seeing.  (Sorry for this change.)  Maybe you can send me your project and I can try to figure out why you are seeing the ROV error from within main().  (You can send me a forum "friend request" and then you can send the project to me privately, if you prefer.)  If there is a memory corruption or misconfiguration it seems likely it may have some bad side effects, and maybe that will explain the SPI transfer issue?

    Please let me know how you want to proceed…

    Thanks,
    Scott

  • Scott,
    Yes, I am following the wiki page to upgrade to RTOS 2.15 and seeing all these issues with the compiler and XDC tools.

    I will go ahead and send you the project. It will take me some time to bring the set up back to RTOS 2.13. I will email it to you with all the added SPI and UART edits before the end of the day for me today.
    Thanks,
    Priya
  • Scott,
    Thank you for reviewing my project. Not using System_flush during SBP_init removed the Hwi 39 exception.
    I used the same callback function for UART read and write. The BIOS error at main is still there.

    It doesn't seem like the SPI peripheral needs a delay to read the SPI receive buffer as seen on the scope. I will
    keep the need for such a delay in the future. I am also aware 10 ticks is 100 us and the task sleep can't
    be any faster. There may be a need for a faster, more precise timer which I will have to add when necessary.

    The one time SPI peripheral initialization is visible on the scope. SBP task however is showing up as blocked on
    the ROV. Only the idle task is running. The peripheral is not displaying the expected measurements correctly yet.

    I am marking this thread answered, but I will likely need more questions answered on this topic. I will continue to
    them post here.

    Thanks again and have a good weekend,
    Priya