Skip to main content
Shahin
Associate III
November 29, 2022
Question

STM32WB Getting Started Series WB15 issue

  • November 29, 2022
  • 4 replies
  • 1417 views

Hello, I am following this tutorial, but it is designed for the WB55 and I am using the WB15.

I have managed to get the LED task before this one working. However with this task I do not get an output to the App.

I have modified the code to have an LED on button press as shown below:

void myTask(void)

{

if(!HAL_GPIO_ReadPin(B2_GPIO_Port, B2_Pin))

{

UpdateCharData[0] ^= 0x1;

Custom_Mycharnotify_Update_Char();

HAL_GPIO_TogglePin(LD1_GPIO_Port, LD1_Pin);

}

UTIL_SEQ_SetTask(1 << CFG_TASK_MY_TASK, CFG_SCH_PRIO_0);

}

Am I correct in saying the routine works as it is able to re-enter the function (using LED as an indicator that it is) on button press and my issue is strictly these lines of code:

UpdateCharData[0] ^= 0x1;

Custom_Mycharnotify_Update_Char();

Thank you,

Shahin Haque

https://www.youtube.com/watch?v=Zgw3wRpGSRQ&list=PLnMKNibPkDnG9JRe2fbOOpVpWY7E4WbJ-&index=17&ab_channel=STMicroelectronics

4 replies

Shahin
ShahinAuthor
Associate III
November 29, 2022

0693W00000WJkafQAD.png 

ignore the line numbers as this is a different board (I am using NUCLEO-WB15), but the code is in the correct location for each file.

Shahin
ShahinAuthor
Associate III
November 29, 2022

ANSWER: I have replaced the custom_app.c with the WB55 custom.app.c file and have it working. I will investigate the difference and reply for others with the same issue.

Shahin
ShahinAuthor
Associate III
November 29, 2022

The difference is the updatedflag variable,

void Custom_Mycharnotify_Send_Notification(void) /* Property Notification */

{

 uint8_t updateflag = 0;

 /* USER CODE BEGIN Mycharnotify_NS_1*/

 /* USER CODE END Mycharnotify_NS_1*/

 if (updateflag != 0)

 {

  Custom_STM_App_Update_Char(CUSTOM_STM_MYCHARNOTIFY, (uint8_t *)NotifyCharData);

 }

 /* USER CODE BEGIN Mycharnotify_NS_Last*/

 /* USER CODE END Mycharnotify_NS_Last*/

 return;

}

The if statement will never be entered as updateflag will always equal 0

this is stock code from MXCube. removing this allows the code to work

Associate III
August 21, 2024

Hi, I'm facing the same problem. The if statement in the function Custom_Mycharnotify_Update_Char will never enter because updateflag is set to 0 just before. Someone finds a solution? 

Thanks