cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB sequencer bug?

Diego B.
Associate II

Hi,

I'm using CubeMX to generate the code for the STM32WB and I found a problem in the secuencer library which is automatically generated.

When I register a new task in the scheduler, this places the callback function in TaskCb[0] but when I set the task to be exectued the scheduler tries to trigger it from TaskCb[1] and this leads into a HardFault error.

I don't know if the problem is registering the tasks or exectuting them. Anyone else have seen this? Any ideas?

Working with the vesrion: STM32Cube FW_WB V1.4.0.

Regards,

Diego

4 REPLIES 4
Remi QUINTIN
ST Employee

​First of all, could you try generate your code based on the latest releases V1.8 of the CubeWB FW package.

Looks like an error in the index computation.

Diego B.
Associate II

Hi Remi,

Thanks for your answer. I've tried the latest release V1.8 but the scheduler still fails either registering the task or enabling it (see the image below)

I have uploaded the project to github but it's pretty much a copy/paste from the STM32WB Workshop video.

Ignoring the scheduler I can call the functions in different way but I guess if is there any bug you probably want to get it fixed.

Regards,

Diego

https://github.com/litanx/STM32WB55_BLE_Test

0693W000003P7FyQAK.png

Christophe Arnal
ST Employee

​Hello,

The interface of the Sequencer requests a bit mask for all API.

In app_entry.c, you wrote

void HAL_GPIO_EXTI_Callback( uint16_t GPIO_Pin )
{
//  switch (GPIO_Pin)
//  {
//  case BUTTON_SW1_Pin:
	UTIL_SEQ_SetTask(1<<CFG_TASK_SW1_BUTTON_PUSHED_ID, CFG_SCH_PRIO_0);
////    break;
////  default:
////    break;
////  }
//  return;
}

which is correct but in p2p_server_app.c, you wrote

void P2PS_APP_Init(void)
{
/* USER CODE BEGIN P2PS_APP_Init */
	UTIL_SEQ_RegTask( CFG_TASK_SW1_BUTTON_PUSHED_ID, 0, P2PS_Send_Notification );
/* USER CODE END P2PS_APP_Init */
  return;
}

which is not correct because you have been using the enum value and not the bit location.

It should be fixed this way

void P2PS_APP_Init(void)
{
/* USER CODE BEGIN P2PS_APP_Init */
	UTIL_SEQ_RegTask( 1<<CFG_TASK_SW1_BUTTON_PUSHED_ID, 0, P2PS_Send_Notification );
/* USER CODE END P2PS_APP_Init */
  return;
}

Generally speaking, the only way to get an HardFault with the Sequencer is to jump to a NULL callback.

There is most of the time only two reasons for this :

1/ The enum has been used in the interface whereas 1<<enum should have been used

2/ The interrupt that calls UTIL_SEQ_SetTask() is generated before UTIL_SEQ_RegTask() has been called to register the callback.

Regards.

Diego B.
Associate II

Thanks for your help Christophe,

That actually have a lot of sense and looks kind of obvious now. It worked perfect with that change.

Regards,

Diego