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/CC2640R2F: Bluetooth® forum

Part Number: CC2640R2F

Tool/software: Code Composer Studio

Hi Everyone,

I'm trying to discover my problem for 3 days and the problems are going deep, so i need external help here.

I have 2 working projects with CC2640R2F chip with a custom hardware:

1) BLE5 with my services, based on hello Simple_Peripheral example with 2 tasks (SimplePeripheral_taskFxn and ICall_taskEntry)

2) A project, based on hello example, that read external sensors with SPI (with DMA) to grab information. Sensor Controller code is also included to acquire ADC data, but it's not being started/used yet.

I've already customized Board files, GPIO pins, so everything works well... alone.

When i tried to merge projects (BLE prj received extra files) after a hard work to compile, the BLE Tasks worked well, alone again. However, if i try to start any of other tasks that access SPI, the ICall_taskEntry task stops to work after the exactly moment that i opened the BLE Scanner App. The SimplePeripheral name appears at the BLE Scanner App, than disappear after few seconds. It is important to note that when i instantiate and start another Task that doesn't access SPI hardware, for testing purposes, this behavior is not displayed. It is also important to say that the project is disabling cache with CACHE_AS_RAM directive and all other instructions provided by TI documentation. POWER_SAVING is also disabled and NO_OSAL_SNV and DISPLAY are used to save flash.

I started to debug what was causing the problem with CCS RTOS Object View (ROV) and verified that the ICall task was blocked and there are no Stack Overflow:

Then, after pausing the debug, i've checked that the void AssertHandler( uint8 assertCause, uint8 assertSubcause) was at a HAL_ASSERT_SPINLOCK. So, i've checked the code at your defines and discovered a HAL_ASSERT_CAUSE_HARDWARE_ERROR (0x08 code) as displayed:

PS: This code is mine... The initial problem was spinning at the "Default:" switch case. 

After reading a document from TI SDK: http://dev.ti.com/tirex/content/simplelink_cc2640r2_sdk_2_20_00_49/docs/blestack/ble_user_guide/html/debugging/ble-index.html#decoding-hardware-error-reason 

saying how to decode this hardware error, i've got a hardCode with hdr event 0x91 (145) and hardwareCode 0x84 (132) and status 0x10 (16) as displayed:

as said by this document: "A breakpoint can be set in this function to determine the error code. This code should be reported to a TI engineer when experiencing a HCI hardware assert. These error codes are defined in ll_common.h and hci.h."

I've also checked those files to see what's hapening, but i found (0x84) as UNKOWN_RF_STATUS (?!?):

and for status (0x10) timeout exceeded. The code 0x91 is not listed at those files - i really don't know if this is correct. I'm confused about how to check this out.

So, please... i want a help to try to figure out what is going on and how to solve this. 

Code Composer Studio

Version: 9.0.0.00018
Compiler TI v18.12.1.LTS
Simplelink SDK CC2640R2 2.40.0.32
XDCtools version 3.55.0.11_core
HEAPMGR_CONFIG = 0x81;  (also tried with 0x01 a 0x11EC size - given by heapStart and headEnd from CMD file) - i've also checked the addresses and are correct.


From .map:
200040e8 heapEnd
20002efc heapStart

No use of GPRAM for program...  

STACK Options:
Optimization level -> 4
Speed / Size -> size (0)

APP options:
Optimization level -> 3
Speed / Size -> size (0)


ble5_app_FlashROM_StackLibrary.opt options:

-DDisplay_DISABLE_ALL
-DBOARD_DISPLAY_USE_LCD=0
-DBOARD_DISPLAY_USE_UART=0
-DBOARD_DISPLAY_USE_UART_ANSI=0
-DCC2640R2_LAUNCHXL
-DCC26XX
-DCC26XX_R2
-DDeviceFamily_CC26X0R2
-DICALL_EVENTS
-DICALL_JT
-DICALL_LITE
-DICALL_MAX_NUM_ENTITIES=6
-DICALL_MAX_NUM_TASKS=2
-DICALL_STACK0_ADDR
-DMAX_NUM_BLE_CONNS=1
-DxPOWER_SAVING
-DRF_SINGLEMODE
-DSTACK_LIBRARY
-DTBM_ACTIVE_ITEMS_ONLY
-DUSE_ICALL
-Dxdc_runtime_Assert_DISABLE_ALL
-Dxdc_runtime_Log_DISABLE_ALL
-DMAX_PDU_SIZE=255
-DMAX_NUM_PDU=1
-DxOSAL_SNV=2
-DNO_OSAL_SNV


At the stack GAP Bond is disabled:

/* Include GAP Bond Manager */
/* -DGAP_BOND_MGR */

Thanks in advance for your help. 

  • Hi Juliano,

    Thanks for posting so much information! Can you also post the call stack when this happens?

    Are you using SPI in blocking mode or doing long operations?
  • Hi Marie,

    Thank you so much for your support!

    I'm using:

    spiParams.transferMode = SPI_MODE_CALLBACK;
    with 2 bytes transfer per SPI_Transaction. ( The original sensor code transfers 512bytes for microSD but i'm not using it yet, only transactions with low byte count). 
    The  SPI bit rate is 10Mhz:

    #define SPI_SENSORS_BIT_RATE 10000000
    #define SPI_SENSORS_FRAME_FORMAT SPI_POL0_PHA0

    and i'm using SPI0:

    #define Board_SPI0              CC2640R2_LAUNCHXL_SPI0 //which is 0

    As you asked, the Call Stack at the HAL_ASSERT_SPINLOCK is:

    It looks like it was using a ROM function. 

    At the ROV the callstack looks strange (i can't see the Icall or SimplePeripheral task):

    even when, at the BASIC tab, the functions are displayed:

    We discovered here more things that i would like to share... maybe those things help to understand what is happening. 

    The HWI shows the UDMA and SPI and also the GPIO ISR (we are using it for a input button isr), and the encryption is disable at this time:

    The GateHWI displayed an exception, but i don't know if it is relevant:

    And the Event shows that the ICall entered in a WAIT_FOREVER timeout:

     

    The heapmem looks clear at that moment, and without an overflow:

    and the SWI:

    As an extra information, if i press CPU RESET and then RESTART, the programs stucks at another point:

    Another curious thing is that at this point, even the SPI code stops to work with the mode Ready (not Running anymore)... 

    I really don't know what to do anymore.
    I've also tried to change from Differential to Single ended Antenna setup, but all configs stuck at the same SPINLOCK. 

    Waiting for your divine help! 

    Thank you so much!

  • Hi Marrie,

    After an insane search for the error, we found that CC26X0ROM was = 1 (to save RAM) but it only works with = 2 for the CC2640-R2F chip.
    Now it's totally clear that = 1 is for ROM version 1, and = 2 is for ROM version 2 (CC2640-R2F) but there is no mention, at any place of the documentation that this define is used for that.

    Curiously, if you use only BLE5 (no other tasks with timeout/timer/isr) in the project, the CC2640-R2F works perfectly with CC26X0ROM = 1. Unfortunately there is no mention for the CC26X0ROM define inside BLE5 SDK Guide. So, it's an opportunity to add this topic to guarantee that users will use the correct version of the ROM.

    Thank you very much. 

  • Hi Juliano,

    I'm happy you figured it out!

    If you're using the BLE5-Stack, the BLE5-Stack is actually stored in flash (so the ROM define has less impact). I would still recommend you to use CC26X0ROM = 2.