2021-09-22 03:50 AM
Hi support,
I'm working with STM32WB5MM, the application is a ble application with freertos.
I have this issue, sometimes at the boot the MX_APPE_Init() fails. In the details, the fuction APP_BLE_Init( void ) isn't executed because the function APPE_SysUserEvtRx() is never called.
I try without success to:
1) Increase the minimun stack size (setting to 0x1000) and minimum heap size (setting to 0x400)
2) Increase the priority of the following interrupt: IPCC RX, IPCC TX
I attach the code of the main function:
int main(void)
{
/* USER CODE BEGIN 1 */
/**
* The OPTVERR flag is wrongly set at power on
* It shall be cleared before using any HAL_FLASH_***() api
*/
__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();
/* Config code for STM32_WPAN (HSE Tuning must be done before system clock configuration) */
MX_APPE_Config();
/* USER CODE BEGIN Init */
//Reset_Device(); // BLE_ADD
//Config_HSE(); // BLE_ADD
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* IPCC initialisation */
MX_IPCC_Init();
/* USER CODE BEGIN SysInit */
//MX_IPCC_Init(); // BLE_ADD
PeriphClock_Config(); // BLE_ADD
//Init_Exti(); // BLE_ADD /**< Configure the system Power Mode */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_ADC1_Init();
MX_COMP1_Init();
MX_I2C1_Init();
MX_LPUART1_UART_Init();
MX_USART1_UART_Init();
MX_SAI1_Init();
MX_SPI1_Init();
MX_SPI2_Init();
MX_TIM1_Init();
if (MX_FATFS_Init() != APP_OK) {
Error_Handler();
}
MX_USB_Device_Init();
MX_IWDG_Init();
MX_RTC_Init();
MX_RF_Init();
/* USER CODE BEGIN 2 */
Configure_PWR();
HAL_NVIC_DisableIRQ(EXTI9_5_IRQn);
HAL_NVIC_DisableIRQ(EXTI4_IRQn);
HAL_NVIC_DisableIRQ(EXTI15_10_IRQn);
HAL_NVIC_DisableIRQ(SPI1_IRQn);
HAL_NVIC_DisableIRQ(COMP_IRQn);
HAL_UART_AbortReceive(&huart1);
HAL_UART_AbortTransmit(&huart1);
HAL_UART_AbortReceive_IT(&huart1);
HAL_UART_AbortTransmit_IT(&huart1);
HAL_UART_AbortReceive(&hlpuart1);
HAL_UART_AbortTransmit(&hlpuart1);
HAL_UART_AbortReceive_IT(&hlpuart1);
HAL_UART_AbortTransmit_IT(&hlpuart1);
/* USER CODE END 2 */
/* Init scheduler */
osKernelInitialize();
/* USER CODE BEGIN RTOS_MUTEX */
/* add mutexes, ... */
/* USER CODE END RTOS_MUTEX */
/* Create the semaphores(s) */
/* creation of imuAccessSemaphore */
imuAccessSemaphoreHandle = osSemaphoreNew(1, 1, &imuAccessSemaphore_attributes);
/* creation of txDebugSemaphore */
txDebugSemaphoreHandle = osSemaphoreNew(1, 1, &txDebugSemaphore_attributes);
/* USER CODE BEGIN RTOS_SEMAPHORES */
/* add semaphores, ... */
/* USER CODE END RTOS_SEMAPHORES */
/* USER CODE BEGIN RTOS_TIMERS */
/* start timers, add new ones, ... */
/* USER CODE END RTOS_TIMERS */
/* USER CODE BEGIN RTOS_QUEUES */
/* add queues, ... */
/* USER CODE END RTOS_QUEUES */
/* Create the thread(s) */
/* creation of defaultTask */
defaultTaskHandle = osThreadNew(StartDefaultTask, NULL, &defaultTask_attributes);
/* USER CODE BEGIN RTOS_THREADS */
/* add threads, ... */
/* USER CODE END RTOS_THREADS */
/* Create the event(s) */
/* creation of generalEvent */
generalEventHandle = osEventFlagsNew(&generalEvent_attributes);
/* creation of xCreatedEventGroupSystem */
xCreatedEventGroupSystemHandle = osEventFlagsNew(&xCreatedEventGroupSystem_attributes);
/* USER CODE BEGIN RTOS_EVENTS */
/* add events, ... */
xEventGroupClearBits(xCreatedEventGroupSystemHandle, init_Board_done_BIT );
xEventGroupClearBits(xCreatedEventGroupSystemHandle, ble_init_BIT );
/* USER CODE END RTOS_EVENTS */
/* Init code for STM32_WPAN */
MX_APPE_Init();
/* Start scheduler */
osKernelStart();
/* We should never get here as control is now taken by the scheduler */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
What should be the issue? Can you give me any suggestion for try to solve this problem?
Regards,
Giampietro
2022-12-20 01:27 PM
Hello Giampietro,
Have you found a solution to this issue? I'm noticing a similar issue that APPE_SysUserEvtRx() isn't called. I do notice that it sometimes works depending on my compiler optimization settings, but its seems very non-deterministic.
FreeRTOS appears to initialize just fine, but the APPE_SysUserEvtRx callback does not trigger.
Best,
Patrick