Re: CBOR encoding problems.
On Thu, Mar 29, 2018 at 10:27:36PM +0530, Aditya Xavier wrote: > Thanks for the tip. Would try that too.. > > However, I have tried few variations to check the BLE side ( whether it was > responsible for truncating ) > > 1. I am able to send the same message using encoding only.. i.e. if I trigger > the same using a button to send over ble. > i.e. BLE Connection, Button -> Encoding -> BLE Output, works. > > 2. The method which receives the char * data, itself receives a truncated > value. > BLE Connection, BLE Incoming -> Decoding -> Encoding -> BLE Outgoing, > does not work. Truncation. > > 3. I am able to send the same message using encoding only.. i.e if I trigger > only the encoding method after receiving a message over BLE. > i.e. BLE Connection, BLE Incoming -> Encoding -> BLE Outgoing, works. > > This kinda makes me feel that it should be a memory issue when its BLE + > Decoding + Encoding. With or without using mbuf / mbuf_pool > > Let me know if you require to see the code, I can write another small test > app for you. I think I understand the sequences you described. I'm afraid I don't have a good answer. Are you checking the return code of the encoding function? If the system is running out of mbufs during encoding, the function should return `CborErrorOutOfMemory`, and the mbuf chain will be partially filled. If you are running in gdb, another way to check for mbuf exhaustion is: ``` p os_msys_init_1_mempool ``` and look at the `mp_min_free` value. If it is 0, that means the pool has been exhausted at some point, and it is likely that some allocations have failed. You can also just try increasing the number of mbufs in the system: ``` newt target amend syscfg=MSYS_1_BLOCK_COUNT=16 ``` (assuming you are currently using the default value of 12; adjust accordingly if not) Chris
Re: CBOR encoding problems.
Hi Aditya, On Thu, Mar 29, 2018 at 08:52:08PM +0530, Aditya Xavier wrote: [...] > And it doesn’t work when am trying to trigger it from BLE. > > Assuming it was a memory issue, I used a mem_pool, mbuf, allocating > and reserving space. However, problem remains. > > It usually encodes and sends the following structure: > > {“field1”:1, “field2”:2, “field3”:[{“field4”:4, > > Which naturally fails because of incomplete cbor structure. My guess is that the Bluetooth ATT MTU is too low to accommodate the full packet. The ATT layer is specified with the somewhat surprising behavior of silently truncating overly-long attribute values [1]. How are you sending the CBOR data? If you are using a simple "write characteristic" procedure (`ble_gattc_write()`), you can use the "write long characteristics" procedure instead (`ble_gattc_write_long()`), which will fragment the long attribute value for you. If you are sending the CBOR data in a notification, on the other hand, then I'm afraid the BLE stack doesn't offer any means of fragmentation; you'll need to implement an application-layer fragmentation scheme. Chris [1] Perhaps we should add a syscfg setting which causes an over-long write to indicate an error to the application instead of silently truncating the data. The stack wouldn't be standards-conforming in this mode, but it seems more useful.
Re: Ble mesh questions
Hi, On 29 March 2018 at 14:16, Li-Chun Kowrote: > I hope it works this time! > > https://imgur.com/ZsqnidG Thanks. Well this looks good to me. You can verify with Mesh Profile Specification chapter 3.9.2 Unprovisioned Device beacon Probably Wireshark does not decode it well, but I have not clue why it does not work with Nordic. Will try to find some time to test it against Nordic stack ... > > Cheers, > Lichun > Best Łukasz > 2018-03-29 19:39 GMT+08:00 Michał Narajowski > : > >> Hi Li-Chun, >> >> We still didn't get the picture. Please try using some hosting website >> like Imgur and send us the link to the picture. >> >> Best regards >> Michał Narajowski >> >> 2018-03-29 13:20 GMT+02:00 Li-Chun Ko : >> > Attached it again here. >> > >> > Łukasz Rymanowski 於 2018年3月29日 週四 >> 下午6:33 寫道: >> >> >> >> Hi Lichun >> >> >> >> On 29 March 2018 at 12:28, Li-Chun Ko wrote: >> >> > Hi Łukasz, >> >> > >> >> > I am using the ADV bearer. >> >> > >> >> > I don't have the log at hand but you should get all the information >> from >> >> > the picture I attached in my previous email. It was captured by a low >> >> > cost >> >> > Nordic sniffer. >> >> >> >> Could you resend picture you mentioned? It looks like it is missing in >> >> your first email (at least I did not get it) >> >> >> >> > >> >> > I used bascally the same steps that were mentioned in the BLE mesh >> >> > tutroial >> >> > except I changed the UUID and I also built the bootloader at the same >> >> > time >> >> > (I don't know why without compiling the bootloader the serial >> interface >> >> > of >> >> > the mesh node doesn't seem to work; I haven't got a chance to take a >> >> > further look so now I always compile them together). >> >> > Below are the detailed steps. I will share the configuration with you >> >> > once >> >> > I can reach my computer. >> >> > >> >> > Cheers, >> >> > Lichun >> >> > __ >> >> > newt new my_mesh >> >> > cd my_mesh/ >> >> > newt install -v >> >> > newt target create blemesh >> >> > newt target set blemesh app=@apache-mynewt-core/apps/blemesh >> >> > newt target set blemesh bsp=@apache-mynewt-core/hw/bsp/nrf52dk >> >> > newt target set blemesh build_profile=optimized >> >> > newt target set blemesh syscfg=BLE_MESH_PB_GATT=1:BLE_ >> >> > MESH_DEV_UUID='(uint8_t[16]){0x33, 0x19, 0}' >> >> > newt target create nrf52_boot >> >> > newt target set nrf52_boot app=@apache-mynewt-core/apps/boot >> >> > newt target set nrf52_boot bsp=@apache-mynewt-core/hw/bsp/nrf52dk >> >> > newt target set nrf52_boot build_profile=optimized >> >> > newt build nrf52_boot >> >> > newt build blemesh >> >> > newt create-image blemesh 1.0.0 >> >> > newt load blemesh >> >> > >> >> > Łukasz Rymanowski 於 2018年3月29日 週四 >> 下午5:02 >> >> > 寫道: >> >> > >> >> >> Hi Lichun, >> >> >> >> >> >> On 29 March 2018 at 10:42, Li-Chun Ko wrote: >> >> >> > Hi all, >> >> >> > >> >> >> > I am running blemesh with mynewt 1.3.0 on Nordics pca 10040. Here >> >> >> > are >> >> >> two >> >> >> > questions I have: >> >> >> > >> >> >> > 1. Is it correct that the current mynewt release doesn't support >> the >> >> >> > Provisioner's role? I wasn't able to find a way to do so. >> >> >> > >> >> >> >> >> >> This is correct. Provisioner is not supported in Mynewt. However if >> >> >> you want to test mesh wit two Mynewt devices, I suggest to use >> >> >> blemesh_shell application which gives you a way to hardcode mesh >> >> >> credentians by using "provision" command. >> >> >> >> >> >> > 2. I tried to use the mesh stack from Noridc to play the >> >> >> > Provisioner's >> >> >> role >> >> >> > but it seems the device cannot decode the unprovisioning beacon >> >> >> generated by >> >> >> > mynewt's mesh stack correctly. I captured the beacon with wireshark >> >> >> > 2.5.1 >> >> >> > and noticed that the tool cannot parse the beacon correctly either. >> >> >> > The >> >> >> > AdvData can be recognized as mesh beacon but the content is showed >> as >> >> >> > "unknown data". I am thinking there might be some PDU format issues >> >> >> > (I >> >> >> > suspect the length field of the mesh beacon which is 24 bytes is >> >> >> incorrect) >> >> >> > but I am not sure. I have attached a photo as the reference and >> >> >> > hopefully >> >> >> > someone can help check. >> >> >> > >> >> >> >> >> >> That is interesting. I did not test against Nordic stack but was >> >> >> testing against PTS tool and some other implementation and have not >> >> >> seen such issue. >> >> >> Could you share your target configuration ("newt target show > >> >> name>") and wireshark logs? >> >> >> >> >> >> BTW What bearer uses Nordic stack? >> >> >> >> >> >> > Br, >> >> >> > Lichun >> >> >> >> >> >> Thanks >> >> >> Łukasz >> >> >> >> >> >> >> >> >> Best >> >> Łukasz >>
Re: Ble mesh questions
I hope it works this time! https://imgur.com/ZsqnidG Cheers, Lichun 2018-03-29 19:39 GMT+08:00 Michał Narajowski: > Hi Li-Chun, > > We still didn't get the picture. Please try using some hosting website > like Imgur and send us the link to the picture. > > Best regards > Michał Narajowski > > 2018-03-29 13:20 GMT+02:00 Li-Chun Ko : > > Attached it again here. > > > > Łukasz Rymanowski 於 2018年3月29日 週四 > 下午6:33 寫道: > >> > >> Hi Lichun > >> > >> On 29 March 2018 at 12:28, Li-Chun Ko wrote: > >> > Hi Łukasz, > >> > > >> > I am using the ADV bearer. > >> > > >> > I don't have the log at hand but you should get all the information > from > >> > the picture I attached in my previous email. It was captured by a low > >> > cost > >> > Nordic sniffer. > >> > >> Could you resend picture you mentioned? It looks like it is missing in > >> your first email (at least I did not get it) > >> > >> > > >> > I used bascally the same steps that were mentioned in the BLE mesh > >> > tutroial > >> > except I changed the UUID and I also built the bootloader at the same > >> > time > >> > (I don't know why without compiling the bootloader the serial > interface > >> > of > >> > the mesh node doesn't seem to work; I haven't got a chance to take a > >> > further look so now I always compile them together). > >> > Below are the detailed steps. I will share the configuration with you > >> > once > >> > I can reach my computer. > >> > > >> > Cheers, > >> > Lichun > >> > __ > >> > newt new my_mesh > >> > cd my_mesh/ > >> > newt install -v > >> > newt target create blemesh > >> > newt target set blemesh app=@apache-mynewt-core/apps/blemesh > >> > newt target set blemesh bsp=@apache-mynewt-core/hw/bsp/nrf52dk > >> > newt target set blemesh build_profile=optimized > >> > newt target set blemesh syscfg=BLE_MESH_PB_GATT=1:BLE_ > >> > MESH_DEV_UUID='(uint8_t[16]){0x33, 0x19, 0}' > >> > newt target create nrf52_boot > >> > newt target set nrf52_boot app=@apache-mynewt-core/apps/boot > >> > newt target set nrf52_boot bsp=@apache-mynewt-core/hw/bsp/nrf52dk > >> > newt target set nrf52_boot build_profile=optimized > >> > newt build nrf52_boot > >> > newt build blemesh > >> > newt create-image blemesh 1.0.0 > >> > newt load blemesh > >> > > >> > Łukasz Rymanowski 於 2018年3月29日 週四 > 下午5:02 > >> > 寫道: > >> > > >> >> Hi Lichun, > >> >> > >> >> On 29 March 2018 at 10:42, Li-Chun Ko wrote: > >> >> > Hi all, > >> >> > > >> >> > I am running blemesh with mynewt 1.3.0 on Nordics pca 10040. Here > >> >> > are > >> >> two > >> >> > questions I have: > >> >> > > >> >> > 1. Is it correct that the current mynewt release doesn't support > the > >> >> > Provisioner's role? I wasn't able to find a way to do so. > >> >> > > >> >> > >> >> This is correct. Provisioner is not supported in Mynewt. However if > >> >> you want to test mesh wit two Mynewt devices, I suggest to use > >> >> blemesh_shell application which gives you a way to hardcode mesh > >> >> credentians by using "provision" command. > >> >> > >> >> > 2. I tried to use the mesh stack from Noridc to play the > >> >> > Provisioner's > >> >> role > >> >> > but it seems the device cannot decode the unprovisioning beacon > >> >> generated by > >> >> > mynewt's mesh stack correctly. I captured the beacon with wireshark > >> >> > 2.5.1 > >> >> > and noticed that the tool cannot parse the beacon correctly either. > >> >> > The > >> >> > AdvData can be recognized as mesh beacon but the content is showed > as > >> >> > "unknown data". I am thinking there might be some PDU format issues > >> >> > (I > >> >> > suspect the length field of the mesh beacon which is 24 bytes is > >> >> incorrect) > >> >> > but I am not sure. I have attached a photo as the reference and > >> >> > hopefully > >> >> > someone can help check. > >> >> > > >> >> > >> >> That is interesting. I did not test against Nordic stack but was > >> >> testing against PTS tool and some other implementation and have not > >> >> seen such issue. > >> >> Could you share your target configuration ("newt target show >> >> name>") and wireshark logs? > >> >> > >> >> BTW What bearer uses Nordic stack? > >> >> > >> >> > Br, > >> >> > Lichun > >> >> > >> >> Thanks > >> >> Łukasz > >> >> > >> > >> > >> Best > >> Łukasz >
Re: Ble mesh questions
Hi Li-Chun, We still didn't get the picture. Please try using some hosting website like Imgur and send us the link to the picture. Best regards Michał Narajowski 2018-03-29 13:20 GMT+02:00 Li-Chun Ko: > Attached it again here. > > Łukasz Rymanowski 於 2018年3月29日 週四 下午6:33 寫道: >> >> Hi Lichun >> >> On 29 March 2018 at 12:28, Li-Chun Ko wrote: >> > Hi Łukasz, >> > >> > I am using the ADV bearer. >> > >> > I don't have the log at hand but you should get all the information from >> > the picture I attached in my previous email. It was captured by a low >> > cost >> > Nordic sniffer. >> >> Could you resend picture you mentioned? It looks like it is missing in >> your first email (at least I did not get it) >> >> > >> > I used bascally the same steps that were mentioned in the BLE mesh >> > tutroial >> > except I changed the UUID and I also built the bootloader at the same >> > time >> > (I don't know why without compiling the bootloader the serial interface >> > of >> > the mesh node doesn't seem to work; I haven't got a chance to take a >> > further look so now I always compile them together). >> > Below are the detailed steps. I will share the configuration with you >> > once >> > I can reach my computer. >> > >> > Cheers, >> > Lichun >> > __ >> > newt new my_mesh >> > cd my_mesh/ >> > newt install -v >> > newt target create blemesh >> > newt target set blemesh app=@apache-mynewt-core/apps/blemesh >> > newt target set blemesh bsp=@apache-mynewt-core/hw/bsp/nrf52dk >> > newt target set blemesh build_profile=optimized >> > newt target set blemesh syscfg=BLE_MESH_PB_GATT=1:BLE_ >> > MESH_DEV_UUID='(uint8_t[16]){0x33, 0x19, 0}' >> > newt target create nrf52_boot >> > newt target set nrf52_boot app=@apache-mynewt-core/apps/boot >> > newt target set nrf52_boot bsp=@apache-mynewt-core/hw/bsp/nrf52dk >> > newt target set nrf52_boot build_profile=optimized >> > newt build nrf52_boot >> > newt build blemesh >> > newt create-image blemesh 1.0.0 >> > newt load blemesh >> > >> > Łukasz Rymanowski 於 2018年3月29日 週四 下午5:02 >> > 寫道: >> > >> >> Hi Lichun, >> >> >> >> On 29 March 2018 at 10:42, Li-Chun Ko wrote: >> >> > Hi all, >> >> > >> >> > I am running blemesh with mynewt 1.3.0 on Nordics pca 10040. Here >> >> > are >> >> two >> >> > questions I have: >> >> > >> >> > 1. Is it correct that the current mynewt release doesn't support the >> >> > Provisioner's role? I wasn't able to find a way to do so. >> >> > >> >> >> >> This is correct. Provisioner is not supported in Mynewt. However if >> >> you want to test mesh wit two Mynewt devices, I suggest to use >> >> blemesh_shell application which gives you a way to hardcode mesh >> >> credentians by using "provision" command. >> >> >> >> > 2. I tried to use the mesh stack from Noridc to play the >> >> > Provisioner's >> >> role >> >> > but it seems the device cannot decode the unprovisioning beacon >> >> generated by >> >> > mynewt's mesh stack correctly. I captured the beacon with wireshark >> >> > 2.5.1 >> >> > and noticed that the tool cannot parse the beacon correctly either. >> >> > The >> >> > AdvData can be recognized as mesh beacon but the content is showed as >> >> > "unknown data". I am thinking there might be some PDU format issues >> >> > (I >> >> > suspect the length field of the mesh beacon which is 24 bytes is >> >> incorrect) >> >> > but I am not sure. I have attached a photo as the reference and >> >> > hopefully >> >> > someone can help check. >> >> > >> >> >> >> That is interesting. I did not test against Nordic stack but was >> >> testing against PTS tool and some other implementation and have not >> >> seen such issue. >> >> Could you share your target configuration ("newt target show > >> name>") and wireshark logs? >> >> >> >> BTW What bearer uses Nordic stack? >> >> >> >> > Br, >> >> > Lichun >> >> >> >> Thanks >> >> Łukasz >> >> >> >> >> Best >> Łukasz
Re: Ble mesh questions
Attached it again here. Łukasz Rymanowski於 2018年3月29日 週四 下午6:33 寫道: > Hi Lichun > > On 29 March 2018 at 12:28, Li-Chun Ko wrote: > > Hi Łukasz, > > > > I am using the ADV bearer. > > > > I don't have the log at hand but you should get all the information from > > the picture I attached in my previous email. It was captured by a low > cost > > Nordic sniffer. > > Could you resend picture you mentioned? It looks like it is missing in > your first email (at least I did not get it) > > > > > I used bascally the same steps that were mentioned in the BLE mesh > tutroial > > except I changed the UUID and I also built the bootloader at the same > time > > (I don't know why without compiling the bootloader the serial interface > of > > the mesh node doesn't seem to work; I haven't got a chance to take a > > further look so now I always compile them together). > > Below are the detailed steps. I will share the configuration with you > once > > I can reach my computer. > > > > Cheers, > > Lichun > > __ > > newt new my_mesh > > cd my_mesh/ > > newt install -v > > newt target create blemesh > > newt target set blemesh app=@apache-mynewt-core/apps/blemesh > > newt target set blemesh bsp=@apache-mynewt-core/hw/bsp/nrf52dk > > newt target set blemesh build_profile=optimized > > newt target set blemesh syscfg=BLE_MESH_PB_GATT=1:BLE_ > > MESH_DEV_UUID='(uint8_t[16]){0x33, 0x19, 0}' > > newt target create nrf52_boot > > newt target set nrf52_boot app=@apache-mynewt-core/apps/boot > > newt target set nrf52_boot bsp=@apache-mynewt-core/hw/bsp/nrf52dk > > newt target set nrf52_boot build_profile=optimized > > newt build nrf52_boot > > newt build blemesh > > newt create-image blemesh 1.0.0 > > newt load blemesh > > > > Łukasz Rymanowski 於 2018年3月29日 週四 > 下午5:02 寫道: > > > >> Hi Lichun, > >> > >> On 29 March 2018 at 10:42, Li-Chun Ko wrote: > >> > Hi all, > >> > > >> > I am running blemesh with mynewt 1.3.0 on Nordics pca 10040. Here are > >> two > >> > questions I have: > >> > > >> > 1. Is it correct that the current mynewt release doesn't support the > >> > Provisioner's role? I wasn't able to find a way to do so. > >> > > >> > >> This is correct. Provisioner is not supported in Mynewt. However if > >> you want to test mesh wit two Mynewt devices, I suggest to use > >> blemesh_shell application which gives you a way to hardcode mesh > >> credentians by using "provision" command. > >> > >> > 2. I tried to use the mesh stack from Noridc to play the Provisioner's > >> role > >> > but it seems the device cannot decode the unprovisioning beacon > >> generated by > >> > mynewt's mesh stack correctly. I captured the beacon with wireshark > 2.5.1 > >> > and noticed that the tool cannot parse the beacon correctly either. > The > >> > AdvData can be recognized as mesh beacon but the content is showed as > >> > "unknown data". I am thinking there might be some PDU format issues (I > >> > suspect the length field of the mesh beacon which is 24 bytes is > >> incorrect) > >> > but I am not sure. I have attached a photo as the reference and > hopefully > >> > someone can help check. > >> > > >> > >> That is interesting. I did not test against Nordic stack but was > >> testing against PTS tool and some other implementation and have not > >> seen such issue. > >> Could you share your target configuration ("newt target show >> name>") and wireshark logs? > >> > >> BTW What bearer uses Nordic stack? > >> > >> > Br, > >> > Lichun > >> > >> Thanks > >> Łukasz > >> > > > Best > Łukasz >
Re: Ble mesh questions
Hi Łukasz, I am using the ADV bearer. I don't have the log at hand but you should get all the information from the picture I attached in my previous email. It was captured by a low cost Nordic sniffer. I used bascally the same steps that were mentioned in the BLE mesh tutroial except I changed the UUID and I also built the bootloader at the same time (I don't know why without compiling the bootloader the serial interface of the mesh node doesn't seem to work; I haven't got a chance to take a further look so now I always compile them together). Below are the detailed steps. I will share the configuration with you once I can reach my computer. Cheers, Lichun __ newt new my_mesh cd my_mesh/ newt install -v newt target create blemesh newt target set blemesh app=@apache-mynewt-core/apps/blemesh newt target set blemesh bsp=@apache-mynewt-core/hw/bsp/nrf52dk newt target set blemesh build_profile=optimized newt target set blemesh syscfg=BLE_MESH_PB_GATT=1:BLE_ MESH_DEV_UUID='(uint8_t[16]){0x33, 0x19, 0}' newt target create nrf52_boot newt target set nrf52_boot app=@apache-mynewt-core/apps/boot newt target set nrf52_boot bsp=@apache-mynewt-core/hw/bsp/nrf52dk newt target set nrf52_boot build_profile=optimized newt build nrf52_boot newt build blemesh newt create-image blemesh 1.0.0 newt load blemesh Łukasz Rymanowski於 2018年3月29日 週四 下午5:02 寫道: > Hi Lichun, > > On 29 March 2018 at 10:42, Li-Chun Ko wrote: > > Hi all, > > > > I am running blemesh with mynewt 1.3.0 on Nordics pca 10040. Here are > two > > questions I have: > > > > 1. Is it correct that the current mynewt release doesn't support the > > Provisioner's role? I wasn't able to find a way to do so. > > > > This is correct. Provisioner is not supported in Mynewt. However if > you want to test mesh wit two Mynewt devices, I suggest to use > blemesh_shell application which gives you a way to hardcode mesh > credentians by using "provision" command. > > > 2. I tried to use the mesh stack from Noridc to play the Provisioner's > role > > but it seems the device cannot decode the unprovisioning beacon > generated by > > mynewt's mesh stack correctly. I captured the beacon with wireshark 2.5.1 > > and noticed that the tool cannot parse the beacon correctly either. The > > AdvData can be recognized as mesh beacon but the content is showed as > > "unknown data". I am thinking there might be some PDU format issues (I > > suspect the length field of the mesh beacon which is 24 bytes is > incorrect) > > but I am not sure. I have attached a photo as the reference and hopefully > > someone can help check. > > > > That is interesting. I did not test against Nordic stack but was > testing against PTS tool and some other implementation and have not > seen such issue. > Could you share your target configuration ("newt target show name>") and wireshark logs? > > BTW What bearer uses Nordic stack? > > > Br, > > Lichun > > Thanks > Łukasz >
Re: Ble mesh questions
Hi Lichun, On 29 March 2018 at 10:42, Li-Chun Kowrote: > Hi all, > > I am running blemesh with mynewt 1.3.0 on Nordics pca 10040. Here are two > questions I have: > > 1. Is it correct that the current mynewt release doesn't support the > Provisioner's role? I wasn't able to find a way to do so. > This is correct. Provisioner is not supported in Mynewt. However if you want to test mesh wit two Mynewt devices, I suggest to use blemesh_shell application which gives you a way to hardcode mesh credentians by using "provision" command. > 2. I tried to use the mesh stack from Noridc to play the Provisioner's role > but it seems the device cannot decode the unprovisioning beacon generated by > mynewt's mesh stack correctly. I captured the beacon with wireshark 2.5.1 > and noticed that the tool cannot parse the beacon correctly either. The > AdvData can be recognized as mesh beacon but the content is showed as > "unknown data". I am thinking there might be some PDU format issues (I > suspect the length field of the mesh beacon which is 24 bytes is incorrect) > but I am not sure. I have attached a photo as the reference and hopefully > someone can help check. > That is interesting. I did not test against Nordic stack but was testing against PTS tool and some other implementation and have not seen such issue. Could you share your target configuration ("newt target show ") and wireshark logs? BTW What bearer uses Nordic stack? > Br, > Lichun Thanks Łukasz