2022-11-29 04:40 AM
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
2022-11-29 04:42 AM
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.
2022-11-29 06:11 AM
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.
2022-11-29 07:06 AM
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
2024-08-21 07:19 AM - edited 2024-08-21 07:25 AM
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