- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to create an event to send a Mesh message, but the wiced_bt_mesh_create_event function always seems to return NULL. Does anyone have an idea why this might be or how to fix this?
wiced_bt_mesh_event_t *p_event = wiced_bt_mesh_create_event(
0,
0x0131, // MESH_COMPANY_ID_CYPRESS
0x1000, // WICED_BT_MESH_CORE_MODEL_ID_GENERIC_ONOFF_SRV
0,
0);
I'm reopening this discussion after a long time of giving up on Mesh on this device, here is the older one. I was advised by DheerajP_41 to set the element_idx to 0(from 0x00) and to check if MESH_COMPANY_ID_CYPRESS and the model ID were defined correctly. I have tried those but wiced_bt_mesh_create_event still only returns NULL. I'm attaching my code where I marked my code with comments(// MY CODE BEGIN and // MY CODE END), the rest is just the mesh_onoff_client from snip/mesh/ in the SDK.
The device(CYBT-423028-02) is in a Mesh network containing another CYBT-423028-02 programmed with the mesh_onoff_server example from 20719-B1_Bluetooth/apps/snip/mesh/. I'm provisioning both devices, then I give the Generic OnOff Server and the Generic OnOff Client models the same app key, set both their publish addresses and subscription addresses to the same group(0xC000) but I also tried setting the publish address of the client to 0xFFFF and the unicast address of the server, it didn't change anything and wiced_bt_mesh_create_event() keeps returning NULL.
In case it's relevant, I'm reading the WICED_BT_TRACE outputs using PuTTY and a USB-UART bridge.
I'm just trying to send a set message from the client to the server and change the onoff state right now to keep things as simple as possible. If I should be using another function or go about this a different way, I would be glad if anyone could help me out. I'm also wondering if anyone else can recreate the issue or not.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was able to send a message which was received by the onoff_server. My client crashes as soon as the message is sent, but I don't know if it's caused by the same thing or if it's a separate issue. I will open a new thread about that.
Instead of calling wiced_bt_mesh_create_event() I'm creating an event myself and filling in all data fields manually. This is the only combination where the server received a message:
wiced_bt_mesh_event_t event;
event.opcode = WICED_BT_MESH_OPCODE_GEN_ONOFF_SET;
event.element_idx = 0;
event.company_id = MESH_COMPANY_ID_BT_SIG;
event.model_id = WICED_BT_MESH_CORE_MODEL_ID_GENERIC_ONOFF_CLNT;
event.dst = 2;
event.ttl = 63; // DEFAULT_TTL
event.credential_flag = 0;
event.retrans_time = 0;
event.retrans_cnt = 0; // DEFAULT_RETRANSMISSION is 0x41
event.src = 0;
event.app_key_idx = 3241;
event.reply = 0;
wiced_bt_mesh_event_t *p_event = &event;
- opcode: WICED_BT_MESH_OPCODE_UNKNOWN -> no message received, client crashes instantly
- company_id: Both devices have the company ID in their mesh configuration: MESH_COMPANY_ID_BT_SIG which is defined as 0x0000.
- company_id set to 0x1234(just a random number), client and server mesh config set to MESH_COMPANY_ID_BT_SIG -> no message received, client crashes instantly
- company_id set to 0xFFFF, client and server mesh config set to MESH_COMPANY_ID_BT_SIG -> no message received, client crashes after second transmission attempt
- company_id and client mesh config set to 0x1234, server mesh config set to MESH_COMPANY_ID_BT_SIG -> no message received, client crashes instantly
- company_id and server mesh config set to MESH_COMPANY_ID_BT_SIG, client mesh config set to 0x1234 -> no message received, client crashes instantly
- All company IDs(client mesh config, server mesh config, event company ID) set to 0x1234 -> no message received, client crashes instantly
- All company IDs set to MESH_COMPANY_ID_CYPRESS(defined as 0x0131) -> no message received, client crashes instantly
- All company IDs set to 0xFFFF -> no message received, client crashes after second transmission attempt
- model_id set to WICED_BT_MESH_CORE_MODEL_ID_GENERIC_ONOFF_SRV -> no message received, client crashes instantly
- dst: the server is provisioned first so it has the unicast address 0x0002. The client gets the unicast address 0x0003. A group is created and selected as current group before provisioning the devices.
- set to 0xC000(the group address which both devices are provisioned into) -> no message received, client crashes instantly
- set to 0 -> no message received, client crashes after second transmission attempt
- set to 1 -> no message received, client crashes after second transmission attempt
- set to 3(client's unicast address) -> client receives the message, client crashes after second transmission attempt
- set to 5(unused unicast address) -> no message received, client crashes instantly
- src set to 3(client's unicast address) -> no message received, client crashes instantly
- app_key_idx: 3241 is the Generic app key which can be found in the .json file created by MeshClient
- set to 0 -> no message received, client crashes after second transmission attempt
- reply set to 1 -> no message received, client crashes instantly
- ttl: in wiced_mesh_api.c, where wiced_bt_mesh_create_event() is defined, DEFAULT_TTL is defined as 63 and DEFAULT_RETRANSMISSION(used for retrans_cnt) is defined as 0x41
- retrans_cnt set to 0x41-> no message received, client crashes instantly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Hi could you please try using the attached latest MeshClient.
Also, please try with
wiced_bt_mesh_create_event(0, MESH_COMPANY_ID_BT_SIG, WICED_BT_MESH_CORE_MODEL_ID_GENERIC_ONOFF_CLNT, 0, 0);
MESH_COMPANY_ID_BT_SIG = 0xFFFF
WICED_BT_MESH_CORE_MODEL_ID_GENERIC_ONOFF_CLNT= 0x1001 (since it is mesh_onoff_client)
Let me know any change in the results.
By the time, I will also try to test it in WICED Studio 6.2 and update you in couple of days.
Thanks,
-Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was able to send a message which was received by the onoff_server. My client crashes as soon as the message is sent, but I don't know if it's caused by the same thing or if it's a separate issue. I will open a new thread about that.
Instead of calling wiced_bt_mesh_create_event() I'm creating an event myself and filling in all data fields manually. This is the only combination where the server received a message:
wiced_bt_mesh_event_t event;
event.opcode = WICED_BT_MESH_OPCODE_GEN_ONOFF_SET;
event.element_idx = 0;
event.company_id = MESH_COMPANY_ID_BT_SIG;
event.model_id = WICED_BT_MESH_CORE_MODEL_ID_GENERIC_ONOFF_CLNT;
event.dst = 2;
event.ttl = 63; // DEFAULT_TTL
event.credential_flag = 0;
event.retrans_time = 0;
event.retrans_cnt = 0; // DEFAULT_RETRANSMISSION is 0x41
event.src = 0;
event.app_key_idx = 3241;
event.reply = 0;
wiced_bt_mesh_event_t *p_event = &event;
- opcode: WICED_BT_MESH_OPCODE_UNKNOWN -> no message received, client crashes instantly
- company_id: Both devices have the company ID in their mesh configuration: MESH_COMPANY_ID_BT_SIG which is defined as 0x0000.
- company_id set to 0x1234(just a random number), client and server mesh config set to MESH_COMPANY_ID_BT_SIG -> no message received, client crashes instantly
- company_id set to 0xFFFF, client and server mesh config set to MESH_COMPANY_ID_BT_SIG -> no message received, client crashes after second transmission attempt
- company_id and client mesh config set to 0x1234, server mesh config set to MESH_COMPANY_ID_BT_SIG -> no message received, client crashes instantly
- company_id and server mesh config set to MESH_COMPANY_ID_BT_SIG, client mesh config set to 0x1234 -> no message received, client crashes instantly
- All company IDs(client mesh config, server mesh config, event company ID) set to 0x1234 -> no message received, client crashes instantly
- All company IDs set to MESH_COMPANY_ID_CYPRESS(defined as 0x0131) -> no message received, client crashes instantly
- All company IDs set to 0xFFFF -> no message received, client crashes after second transmission attempt
- model_id set to WICED_BT_MESH_CORE_MODEL_ID_GENERIC_ONOFF_SRV -> no message received, client crashes instantly
- dst: the server is provisioned first so it has the unicast address 0x0002. The client gets the unicast address 0x0003. A group is created and selected as current group before provisioning the devices.
- set to 0xC000(the group address which both devices are provisioned into) -> no message received, client crashes instantly
- set to 0 -> no message received, client crashes after second transmission attempt
- set to 1 -> no message received, client crashes after second transmission attempt
- set to 3(client's unicast address) -> client receives the message, client crashes after second transmission attempt
- set to 5(unused unicast address) -> no message received, client crashes instantly
- src set to 3(client's unicast address) -> no message received, client crashes instantly
- app_key_idx: 3241 is the Generic app key which can be found in the .json file created by MeshClient
- set to 0 -> no message received, client crashes after second transmission attempt
- reply set to 1 -> no message received, client crashes instantly
- ttl: in wiced_mesh_api.c, where wiced_bt_mesh_create_event() is defined, DEFAULT_TTL is defined as 63 and DEFAULT_RETRANSMISSION(used for retrans_cnt) is defined as 0x41
- retrans_cnt set to 0x41-> no message received, client crashes instantly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content