cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB5MMG - cannot change device name/model

Adrian Chmiel
Associate II

Hi,

I'm working on a project with your STM32WB5MM module, I managed to enable ZigBee and connect to the network, but I'm having trouble changing the device name, it keeps identifying itself as default value (STM32WB).

ZigBee Stack: 1.24.0
FW Type : FFD Zigbee stack

In function APP_ZIGBEE_StackLayersInit() I add:

struct ZbZclBasicServerDefaults basic_defaults = {
    .app_version = 1,                     
    .stack_version = 2,                     
    .hw_version = 1,                 
    .mfr_name = "0TestName",          
    .model_name = "0LOCKZ1A",          
    .date_code = "02026-03-31",             
    .power_source = ZCL_BASIC_POWER_DC, 	
    .sw_build_id = "0v1.0"                    
};

static void APP_ZIGBEE_StackLayersInit(void)
{
  APP_DBG("APP_ZIGBEE_StackLayersInit");

  zigbee_app_info.zb = ZbInit(0U, NULL, NULL);
  assert(zigbee_app_info.zb != NULL);

//    uint8_t device_name[] = {"0TestDevice"};
//    device_name[0] = 10;
//    ZbZclBasicWriteDirect(zigbee_app_info.zb, ZB_ENDPOINT_BCAST, ZCL_BASIC_ATTR_MFR_NAME, device_name, device_name[0]);

  basic_defaults.mfr_name[0] = strlen((char*)basic_defaults.mfr_name)-1;
  basic_defaults.model_name[0] = strlen((char*)basic_defaults.model_name)-1;
  basic_defaults.date_code[0] = strlen((char*)basic_defaults.date_code)-1;
  basic_defaults.sw_build_id[0] = strlen((char*)basic_defaults.sw_build_id)-1;
  ZbZclBasicServerConfigDefaults(zigbee_app_info.zb, &basic_defaults);

  /* Create the endpoint and cluster(s) */
  APP_ZIGBEE_ConfigEndpoints();

  /* USER CODE BEGIN APP_ZIGBEE_StackLayersInit */

  /* USER CODE END APP_ZIGBEE_StackLayersInit */

  /* Configure the joining parameters */
  zigbee_app_info.join_status = (enum ZbStatusCodeT) 0x01; /* init to error status */
  zigbee_app_info.join_delay = HAL_GetTick(); /* now */
  zigbee_app_info.startupControl = ZbStartTypeJoin;

  /* Initialization Complete */
  zigbee_app_info.has_init = true;

  /* run the task */
  UTIL_SEQ_SetTask(1U << CFG_TASK_ZIGBEE_NETWORK_FORM, CFG_SCH_PRIO_0);
}

But it's still identifying itself with default values. What could I be doing wrong?
Is there a way to read the parameters I'm saving to check their validity?
I also tried direct recording using ZbZclBasicWriteDirect() but also no reaction.

Best regards,
Adrian Chmiel

1 REPLY 1
Ouadi
ST Employee

Hello @Adrian Chmiel,

Thanks for contacting us on the ST Community.

Please find the answer below:

To configure the default ZCL Basic Server attributes, you need to meet the ZCL data format used by ZbZclBasicServerDefaults — in particular, string attributes are encoded as length-prefixed strings rather than standard null-terminated C strings.

As an example, you can refer to the following project available on the official Git: 

STM32CubeWBA/Projects/NUCLEO-WBA55CG/Applications/Zigbee/Zigbee_OnOff_Client_SED/STM32_WPAN/App/app_zigbee.c at main · STMicroelectronics/STM32CubeWBA · GitHub

Regards,

Ouadi