Skip to main content
Associate III
November 13, 2024
Solved

STM32WB55CG Zigbee write sensor value

  • November 13, 2024
  • 1 reply
  • 2340 views

Hi,

i want to send sensor values from my STM to my Homeassistant via zigbee.

Therefore I have configured a temperature sensor cluster at one endpoint and because my device should also control LEDs, I have an onoff cluster.

I have tried to send my sensordata with 

 

ZbZclAttrIntegerWrite(zigbee_app_info.temperature_meas_server_2, ZCL_WC_MEAS_ATTR_MEAS_VAL, 12);

 

As a start, i places this line into the "onOff_server_1_on" function, so that I could see, when I send an on command from my Homeassistant, the temperature gets send, which also works fine.

However, I tried calling the function with an external set routine cyclic (every 10s) from my ISR, which did not work and caused my processor to crash. Can anybody see a reason for that? I also attachted my app_zigbee.c here.

Thanks

Best answer by Ouadi

Hi @vh789,

Can you please try to make a higher level of your Timer ISR ? From your ioc file, the timer is configured the highest priority ( level 0) which may have a conflict with the sequencer and IPCC management explaining that the ack is not received.

If this does not resolve the issue, please share the hole project to analyze.

Kind regards,

Ouadi

1 reply

Technical Moderator
November 14, 2024

Hi @vh789,

Please find the answer to your problem following this post. 

Solved: Re: STM32WB55 - First data sent but no one after c... - STMicroelectronics Community

Regards,

Ouadi

vh789Author
Associate III
November 14, 2024

Hi Ouadi,

thanks for your reply. I have read the post that you linked and also tried to implement my write/set function as described there. However, this did not change the behaviour: as soon as the function is called, the Controller crashes / the program does not cunctinue.

As I understood from your linked post, the problen there was, that

ZbZclAttrIntegerWrite

only writes to an internal storage which has to be read out by the client over the air afterwards (e.g. with reporting).

This works for me already. As a test, i call the ZbZclAtrrIntegerWrite for temperature cluster (endpoint 22), when an "on" command on my OnOff cluster (endpoint 21) is received. This works fine, and my client can read out the themperature value that i set. 

However, when I call the suggested function by you (see below) from my isr, the controller stops running.

void APP_ZIGBEE_WriteTempAttribute(float temp_val)
{
enum ZclStatusCodeT status;
float temp = temp_val*100;
int16_t temp_val_attr;
/* Write attribute */
temp_val_attr = (int16_t) temp ;
status = ZbZclAttrIntegerWrite(zigbee_app_info.temp_meas_server, ZCL_TEMP_MEAS_ATTR_MEAS_VAL, (int16_t)temp_val_attr);
}/*APP

 

Technical Moderator
November 15, 2024

Hi @vh789,

What do you mean by the controller stops running ? do you fail into a Hard fault ? please give more debug inputs?

I think that the issue may be linked to your ISR implementation.

Best regards,

Ouadi