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: HWI thrown in hal_flash_read.c while starting

Part Number: CC2640R2F
Other Parts Discussed in Thread: SYSBIOS, UNIFLASH

Tool/software: Code Composer Studio

We are slowly narrowing down the causes of bricking in our devices, but have hit an issue I don't quite know how to resolve.

During the startup process, a device which presents as a brick is actually heading into our main() function, but proceeding no further than ICall_init(); (but - it gets weirder).

Allowed to run, the devices always end up caught in a loop caused by a HWI - the stack trace out of ROV is below.

Single stepping through it is very confusing (it jumps around a bit) but it seems like, maybe, the GAP role init is trying to read bonded device information from the flash but fails.

The application never gets to our task init, always fails around the ICall_init();

Is it possible that, in a low battery condition, the GAP role is corrupting the flash area where bonding information is stored, then is unable to read it back and crashes?

Putting a fresh rom on the devices wakes them up again (although a side effect of that is always cleaning up the SNV areas of flash).  

-----------

$addr
N/A
$type
ti.sysbios.family.arm.m3.Hwi.ExcContext
threadType
Task
threadHandle
0x2000214c
threadStack
0x2000219c
threadStackSize
1000
r0
0x200001
r1
0x4014
r2
0x4013
r3
0x200001
r4
0x11000000
r5
0x2afe8
r6
0x4013
r7
0x0
r8
0x1e
r9
0x1e000
r10
0x20000bd0
r11
0x1
r12
0x0
sp
0x200024c0
lr
0xeff7
pc
0xd654
psr
0x21000200
ICSR
0x414803
MMFSR
0x0
BFSR
0x82
UFSR
0x0
HFSR
0x40000000
DFSR
0x0
MMAR
0x2afe8
BFAR
0x2afe8
AFSR
0x0 Exception call stack
0 HalFlashRead at hal_flash_wrapper.c:78 :
PC=0x0000D654
1 halAssertHazardLights at :0 :
PC=0x00000000
  • Hi David,

    If you are using GAPBondManager, it may make sense that it's trying to read bonding information when the device is powered up.

    Can you use ROV to try to debug the hardware exception?

    You mention low battery condition - you are aware that the device should be operated at 1.7 V at the lowest? Operating the device at a lower current can lead to a bricket device, but you wouldn't be able to see it go into ICall_init().
  • Hi Marie,
    Generally what happens is the device is discovered non-responsive. We replace the battery and it still doesn't respond. This doesn't happen consistantly (i.e. we have thousands of these things that run down the battery and still boot straight up when the battery is replaced). However, once they do get bricked, they stay that way until the firmware is reflashed. I have tried a few things (i.e. just flash the program and ignore the user SNV area for example) but only an entire re-flash will bring them back up.

    I don't have any protection for a voltage check around the code where we are using the user areas of SNV (I thought it might be corrupted and stopping my own code from proceeding) but it doesn't seem like that is the case.

    Despite investigating for quite some time now, we are still no closer to really understanding what is happening, so we're trying to limit reproducing the problem to things that are plausible / possible. When using Uniflash to check whether the firmware is OK, it seems fine (right up to where you expect it to differ i.e. the user snv areas at 0x1e000 and upwards).
  • Another related question. In the file nvocop.c is the following code fragment:

    // Checks whether CC26xx voltage high enough to erase/write NV
    #ifdef NV_VOLTAGE_CHECK
    #define NV_CHECK_VOLTAGE() (PWRMON_check(MIN_VDD_FLASH))
    #else
    #define NV_CHECK_VOLTAGE() (TRUE)
    #endif //NV_VOLTAGE_CHECK

    So it would seem that, by default, there is no voltage protection check on the flash read / write routines in the BLE stack. This is not the impression that the documentation around osal_snv_write() suggests.

    defining NV_VOLTAGE_CHECK doesn't work very well (the default project settings don't include pwrmon.c which has the PWRMON_check function in it. I can fix that, but I am curious as to why it is half implemented like that. Is it not meant to be used?
  • Hi David,

    Sorry you ran into that stale code. I will file a ticket to update nvocop.c to actually do a voltage check.

    The PWRMON_check API does not exist any more. You can use AONBatMonBatteryVoltageGet() and compare the value to MIN_VDD_FLASH. You need to call AONBatMonEnable() before using this API.

    Documentation about AONBatMon is found in the driverlib API documentation (e.g. file:///C:/ti/simplelink_cc2640r2_sdk_2_30_00_28/docs/driverlib_cc13xx_cc26xx/cc26x0r2/driverlib/group__aonbatmon__api.html#ga9fa932b57660b7ff1062ca41ff31226a )
  • Thanks Marie - will switch to using that in the application code