2020-12-09 04:46 AM
Hello,
I have a project which contains both: Bootloader (BL) and Application (App.)
The BL is based on minimal devices without interrupts, mainly RS485 - and worked Fine!
The App. is based on "BLE_PERIPHERAL_LITE" example by ST, with my additional freeRTOS integration - Also worked Fine!
After Reset, the control is transferred to the BL then it Jumps successfully to my App. (which is located at address 0x08008000), most of the times App. initialization goes - Fine, and the App. is working OK!!
However sometimes (20% of the cases) the App. initialization doesn't succeed and it stuck in endless loop, but do recover after IWDT timeout.
Below please find my main() code, on 20% of the times, the App. performs the CPU2_Init(); procedure (at line#42) and then stuck at line#48 until next IWDT occur, then my App. successfully recover and RUN!!!
My question are:
Thanks In Advance,
Micha
2022-06-22 12:56 AM
Hi,
did you get any explanation/relief for this ?
It looks like I get caught in the same situation :
No boot-loader. My code works fine on Nucleo (WB55) but get stuck on custom board WB35.
When I debug it (single step through the code), CPU gets initialized.
Before I open a ticket, I'd like to know is anyone came up with a suggestion or a fix.
Thx.
Vincent
2022-06-22 09:14 AM
Hi Vincent,
I don't have this issue anymore, I changed a bit the order and add some small delays
I'll Not be able to comment in the coming month (overseas vacation)
Make sure you use HAL_Delay(xx); at this stage and NOT osDelay(xx) in case of freeRTOS usage
Below please find my current new main() procedure:
Give it a try, Good Luck
Kind Regards,
Micha
int main(void)
{
/* USER CODE BEGIN 1 */
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPTVERR);
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* Tune the HSE internal load capacitors AYK35 */
Tune_HSE();
/* Configure the debug support if needed */
APPD_Init();
// Reset_Device();
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
// Init_Exti(); /**< Configure the system Power Mode */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_USART1_UART_Init();
MX_RTC_Init();
MX_RF_Init();
MX_LPUART1_UART_Init();
MX_SPI1_Init();
MX_TIM2_Init();
MX_TIM1_Init();
MX_TIM16_Init();
MX_TSC_Init();
MX_IWDG_Init();
/* USER CODE BEGIN 2 */
/*## Start the TIM Base generation in interrupt mode ####################*/
/* Initialize all transport layers */
#ifdef __ENABLE_BLE__
CPU2_Init();
// ST support advice 2021-01-13
// hci_reset();
// HAL_Delay(3);
// SHCI_C2_Reinit();
/**
* This is a safe clear in case the engi bytes are not all written
* The error flag should be cleared before moving forward
*/
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPTVERR);
HAL_Delay(3);
while((APP_FLAG_GET(APP_FLAG_CPU2_INITIALIZED) == 0) \
|| (APP_FLAG_GET(APP_FLAG_WIRELESS_FW_RUNNING) == 0))
{
SYS_ProcessEvent();
}
/* Configure the CPU2 Debug (Optional) */
APPD_EnableCPU2();
/* At this point it is still unknown from the app perspective, which wireless stack
and which version is installed on CPU2. It is expected that a BLE stack is installed.
In order to check that, SHCI_GetWirelessFwInfo(...) can be used to read out
the information about the CM0+ wireless stack FW running since the Device Information Table
is initialized. For more information on this topic, please refer to AN5289 and AN5185. */
WirelessFwInfo_t WirelessInfo;
/* Read the firmware version of both the wireless firmware and the FUS */
SHCI_GetWirelessFwInfo( &WirelessInfo );
/* Initialize BLE (BLE TL, BLE stack, HAL, HCI, GATT, GAP) */
BLE_Init();
/* Initialize My Very Own GATT Service - user may also implement SVCCTL_InitCustomSvc()
interface function as explained in AN5289. SVCCTL_InitCustomSvc() is called at the end of
SVCCTL_Init() called from BLE_Init() */
MyVeryOwnService_Init();
/* Start BLE advertising */
BLE_Advertising(SET);