Skip to main content
DWalk.3
Associate III
July 7, 2021
Question

Hard Fault in BLE_OTA demo application

  • July 7, 2021
  • 2 replies
  • 849 views

When I compile the BLE_OTA demo application and run it, it hard faults in APPE_Init when it configures the BLE processor to control flash activity using hardware semaphore SEM7:

SHCI_C2_SetFlashActivityControl(FLASH_ACTIVITY_CONTROL_SEM7);

Stepping through the code, I found that in "shci_send", it accesses "pCmdBuffer" and stores several variables. I found that the pCmdBuffer gets initialized in "appe_Tl_Init" that gets called from APPE_Init right at the end. By moving the SHCI_C2_SetFlashActivityControl call after this, the hard fault was eliminated. My final APPE_Init function is:

void APPE_Init( void )
{
 /* Select which mechanism is used by CPU2 to protect its timing versus flash operation */
// SHCI_C2_SetFlashActivityControl(FLASH_ACTIVITY_CONTROL_SEM7);
 
 SystemPower_Config(); /**< Configure the system Power Mode */
 
 HW_TS_Init(hw_ts_InitMode_Full, &hrtc); /**< Initialize the TimerServer */
 
 APPD_Init( );
 
 /**
 * The Standby mode should not be entered before the initialization is over
 * The default state of the Low Power Manager is to allow the Standby Mode so an request is needed here
 */
 UTIL_LPM_SetOffMode(1 << CFG_LPM_APP, UTIL_LPM_DISABLE);
 
 Led_Init();
 
 Button_Init();
 
 appe_Tl_Init();	/**< Initialize all transport layers */
 /* Select which mechanism is used by CPU2 to protect its timing versus flash operation */
 SHCI_C2_SetFlashActivityControl(FLASH_ACTIVITY_CONTROL_SEM7);
 
 /**
 * From now, the application is waiting for the ready event ( VS_HCI_C2_Ready )
 * received on the system channel before starting the Stack
 * This system event is received with APPE_SysUserEvtRx()
 */
 
 return;
}

Is this a bug or is there something else going on?

This topic has been closed for replies.

2 replies

ST Technical Moderator
July 12, 2021

Hello @Community member​ and welcome to the Community :)

Have a look at this AN5289, in the hardfault section, and check if you have the same conditions as described.

Try to follow the recommendations related to the BLE_OTA application.

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
DWalk.3
DWalk.3Author
Associate III
July 27, 2021

I checked out the app note. The hardfault section refers to CPU2 hardfaulting. In my case, CPU1 hardfaulted because of the uninitialized "pCmdBuffer" variable in function "shci_send." Are you saying that the demo builds fine for you? Maybe there's something funky with my environment.