I'm working on implementing a device that collect some sensors data and cache it. It also uses the peripheral BLE role to send collected data to the phone when it's available. As starting point I used heart_rate baremetal sample (without OS ). I use QN9080SIP-DK as hardware platform and MCUXpresso 10.3.0 and SDK_2.x_QN908XCDK (SDK version 2.2.0).
I've found that on phone connection event my firmware falls to SystemInit() and main(), as I think through ResetHandler (Reset_Handler address from the MAP file is 0x00000374, but firmware falls at 0x21000374, which is aliased to flash memory). Then it leads to Hard Fault, but I don't catch whats going on.
This issue repeats if I don't use cPWR_UsePowerDownMode, in case of definition cPWR_UsePowerDownMode, connection with phone finish successfully.
To found whats happens I've activated gUsePanic_c/MEM_STATISTICS/MEM_TRACKING/MEM_DEBUG/MEM_DEBUG_OUT_OF_MEMORY capabilities and found that sometimes
connection event leads to error in BleApp_AdvertisingCallback() with pAdvertisingEvent->eventType = gAdvertisingCommandFailed_c and
pAdvertisingEvent->eventData.failReason = gHciCommandDisallowed_c. In case of gUsePanic_c is equal to 1, this leads to hang in Panic(),
but issue with strange reset to SystemInit() occurs whatever. I've increase pool size in MemManager, but this doesn't help solving my problem.
I have some questions to investigate the reason of issue:
1) Is QN908x supports Instruction Trace? MCUXpresso doesn't allow me use it with message "Unsupported target detected". I've found that QN908x include ETM, but didn't found any information about instruction trace support in the documenatation. I try to use SWO trace ability to track issue, but it didn't help me.
2) Could someone advise me how to use MEM_STATISTICS/MEM_TRACKING/MEM_DEBUG/MEM_DEBUG_OUT_OF_MEMORY capabilities to found where overflow of heap can take place if it is a reason of my issue?
3) Is there some suggestion how to found place of restart in other way?