2023-07-31 05:59 PM
Hi,
I am working on a custom BLE project using STM32WB5MMG. I have already design a custom board for this project.
In this project I have two different sensors and i have to read both sensors output every 1 second over the bluetooth Gatt server using a Notify. For this I am using Sequencer and Hardware time server (HW_TS) modules available with the package.
My problem is that, I am able to get only one sensor working HW_TS timer. while the other HW_TS timer get successfully created (HW_TS_Create) function but cannot start with (HW_TS_Start) function.
HW_TS_Start(TEMP_TIMER_ID,TEMP_UPDATE_PERIOD); -> work and fuction get call every one second.
HW_TS_Start(UV_TIMER_ID,UV_UPDATE_PERIOD);-> does not call its fuctions.
please help me with this problem
below is the relavent code from my project:
static void TEMP_APP_Init(void)
{
UTIL_SEQ_RegTask( 1<<CFG_TEMP_ID, UTIL_SEQ_RFU, Send_Temp_Notification);
/* Create timer to get the temp params and update charecteristic */
uint8_t A = HW_TS_Create(CFG_TIM_PROC_ID_ISR,TEMP_TIMER_ID,hw_ts_Repeated,TEMP_Timer_Callback);
return;
}
static void TEMP_Timer_Callback(void)
{
UTIL_SEQ_SetTask(1<<CFG_TEMP_ID, CFG_SCH_PRIO_0);
}
void Send_Temp_Notification(void)
{
printf("Temp_sense_call\n");
Temperature=(int32_t)(Temp()*100);
int8_t Temp[4];
uint8_t light_noti[1];
STORE_BE_32(Temp,Temperature)
Custom_STM_App_Update_Char(CUSTOM_STM_IR_T,Temp)
}
void Send_UV_Notification(void)
{
printf("uv measurwement\n");
UV_Data=UV();
Custom_STM_App_Update_Char(CUSTOM_STM_UV_V,UV_Data);
}
static void UV_APP_Init(void)
{
UTIL_SEQ_RegTask( 1<<CFG_UV_ID, UTIL_SEQ_RFU, Send_UV_Notification);
/* Create timer to get the UV params and update charecteristic */
uint8_t A=HW_TS_Create(CFG_TIM_PROC_ID_ISR, &UV_TIMER_ID,hw_ts_Repeated,UV_Timer_Callback);
return;
}
static void UV_Timer_Callback(void)
{
UTIL_SEQ_SetTask(1<CFG_UV_ID,CFG_SCH_PRIO_0);
}
2024-04-24 09:01 AM
I just got some errors on this time server and try to figure out stuff,
Your code error is simple,
uint8_t A = HW_TS_Create(CFG_TIM_PROC_ID_ISR,TEMP_TIMER_ID,hw_ts_Repeated,TEMP_Timer_Callback);
should be
uint8_t A = HW_TS_Create(CFG_TIM_PROC_ID_ISR,&TEMP_TIMER_ID,hw_ts_Repeated,TEMP_Timer_Callback);
HW_TS_Create get a pointer to the timer id