BLE Mesh message acknowledgement
Hi All, I wanted to understand how BLE Mesh Message Acknowledgment works. Is it handled internally by default for all VND Models ? Or is there a API / method to set it for a specific Model ? Or do we have to handle them at the Application Layer only instead of the Transport layer ? Thanks, Aditya Xavier.
Re: Mynewt crash when releasing semaphore
Am really bad at GDB. Also its like a rabbit hole :) I ported over my application with the git version of Mynewt-core, and enabled OS_CRASH_STACKTRACE. With it enabled, the following is the dump. #mesh-onoff STATUS: Sent ! Action Received over MESH Length :- 14 000486 Unhandled interrupt (3), exception sp 0x2000aba0 000486 r0:0xcf0f98cb r1:0x5c5a76b3 r2:0x681af5c8 r3:0xb1334673 000486 r4:0x2000ac68 r5:0x0007 r6:0x r7:0x28a9 000486 r8:0x2000acf0 r9:0x00012101 r10:0xd7229882 r11:0xd929b3bb 000486 r12:0x7e3cdeb8 lr:0x2266a80b pc:0x59d8de5b psr:0xe8eb9828 000486 ICSR:0x00421803 HFSR:0x4000 CFSR:0x0004 000486 BFAR:0xe000ed38 MMFAR:0xe000ed34 000486 task:DECODE_TASK 000486 0x2000abec: 0x0003b4d8 000486 0x2000abf4: 0x000246a7 000486 0x2000ac04: 0x0003b4d8 000486 0x2000ac0c: 0x0002488d 000486 0x2000ac4c: 0x00012101 000486 0x2000ad0c: 0xc1e7 000486 0x2000ad1c: 0xc1e7 000486 0x2000ad2c: 0xc211 000486 0x2000ad30: 0x0003ad44 000486 0x2000ad3c: 0x00013023 000486 0x2000ad58: 0x000238e1 000486 0x2000ad60: 0x00037f81 000486 0x2000ad6c: 0x00023a79 000486 0x2000ad70: 0x00039b80 000486 0x2000ad74: 0x00039b7f 000486 0x2000ad84: 0x00023587 000486 0x2000ada8: 0x87cd 000486 0x2000adc4: 0xd51d 000486 0x2000adc8: 0xd51c 000486 0x2000add8: 0x000398cd 000486 0x2000ade4: 0x87e9 000486 0x2000ae08: 0x00010001 000486 0x2000ae0c: 0x0001c239 000486 0x2000ae10: 0x0003b35c 000486 0x2000ae1c: 0x00020001 000486 0x2000ae20: 0x0001c38d 000486 0x2000ae30: 0x00030001 000486 0x2000ae34: 0x0001c509 000486 0x2000ae48: 0x0001c38d 000486 0x2000ae5c: 0x0001c509 000486 0x2000ae70: 0x0001c239 000486 0x2000ae74: 0x0003b37c 000486 0x2000ae84: 0x0001c38d 000486 0x2000ae98: 0x0001c509 000486 0x2000aeac: 0x0001c54d 000486 0x2000aec0: 0x0001c239 000486 0x2000aec4: 0x0003ba28 000486 0x2000aed4: 0x0001c38d 000486 0x2000aee8: 0x0001c509 000486 0x2000aefc: 0x0001c38d 000486 0x2000af10: 0x0001c509 000486 0x2000af24: 0x0001c54d 000486 0x2000af38: 0x0001c38d 000486 0x2000af4c: 0x0001c509 000486 0x2000af60: 0x0001c38d 000486 0x2000af74: 0x0001c509 000486 0x2000af88: 0x0001c54d 000486 0x2000af9c: 0x0001c38d 000486 0x2000afb0: 0x0001c509 > On 31-Aug-2018, at 5:21 PM, marko kiiskila wrote: > > Some suggestions (inline). > >> On Aug 31, 2018, at 2:32 PM, Aditya Xavier >> wrote: >> >> Gosh, this doesn’t make much sense to me :( >> >> (gdb) monitor go >> (gdb) monitor reset >> Resetting target >> (gdb) c >> Continuing. >> >> Program received signal SIGTRAP, Trace/breakpoint trap. >> hal_system_reset () at >> repos/apache-mynewt-core/hw/mcu/nordic/nrf52xxx/src/hal_system.c:50 >> 50 asm("bkpt"); >> (gdb) bt >> #0 hal_system_reset () at >> repos/apache-mynewt-core/hw/mcu/nordic/nrf52xxx/src/hal_system.c:50 >> #1 0xbf2e in os_default_irq (tf=0x2000ffc8) at >> repos/apache-mynewt-core/kernel/os/src/arch/cortex_m4/os_fault.c:170 >> #2 0xda56 in os_default_irq_asm () at >> repos/apache-mynewt-core/kernel/os/src/arch/cortex_m4/m4/HAL_CM4.s:260 >> #3 >> #4 0x in ?? () >> Backtrace stopped: previous frame identical to this frame (corrupt stack?) >> (gdb) frame 1 >> #1 0xbf2e in os_default_irq (tf=0x2000ffc8) at >> repos/apache-mynewt-core/kernel/os/src/arch/cortex_m4/os_fault.c:170 >> 170 hal_system_reset(); >> (gdb) p/x *tf >> $1 = {ef = 0x2000abd0, r4 = 0x1b00, r5 = 0x2000acc0, r6 = 0x2000aca0, r7 >> = 0x7, r8 = 0x0, r9 = 0x28a9, r10 = 0x2000ad28, r11 = 0x11d91, lr = >> 0xfffd} >> (gdb) p/x *tf->ef >> $2 = {r0 = 0xd7229882, r1 = 0xd929b3bb, r2 = 0xcf0f98cb, r3 = 0x5c5a76b3, >> r12 = 0x681af5c8, lr = 0xb1334673, pc = 0x7e3cdeb8, psr = 0x2266a80b} >> (gdb) x/32x 0xd7229882 >> 0xd7229882: 0x 0x 0x 0x >> 0xd7229892: 0x 0x 0x 0x >> 0xd72298a2: 0x 0x 0x 0x >> 0xd72298b2: 0x 0x 0x 0x >> 0xd72298c2: 0x 0x 0x 0x >> 0xd72298d2: 0x 0x 0x 0x >> 0xd72298e2: 0x 0x 0x 0x >> 0xd72298f2: 0x 0x 0x 0x >> (gdb) x/32x 0x2000abd0 >> 0x2000abd0: 0xd7229882 0xd929b3bb 0xcf0f98cb 0x5c5a76b3 >> 0x2000abe0: 0x681af5c8 0xb1334673 0x7e3cdeb8 0x2266a80b >> 0x2000abf0: 0x59d8de5b 0xe8eb9828 0x96d74690 0xb4b1ee9b >> 0x2000ac00: 0x95f0cad6 0x7d1b52fe 0xebcc146
Re: Mynewt crash when releasing semaphore
cu/nordic/nrf52xxx/src/hal_system.c:50 > 50asm("bkpt"); > (gdb) bt > #0 hal_system_reset () >at repos/apache-mynewt-core/hw/mcu/nordic/nrf52xxx/src/hal_system.c:50 > #1 0x8be8 in os_default_irq (tf=0x2000ffc0) >at repos/apache-mynewt-core/kernel/os/src/arch/cortex_m4/os_fault.c:171 > #2 0xa5b6 in os_default_irq_asm () >at repos/apache-mynewt-core/kernel/os/src/arch/cortex_m4/m4/HAL_CM4.s:260 > #3 > #4 0x in ?? () > #5 0x812c in Reset_Handler () >at > repos/apache-mynewt-core/hw/bsp/nrf52dk/src/arch/cortex_m4/gcc_startup_nrf52.s:180 > Backtrace stopped: previous frame identical to this frame (corrupt stack?) > (gdb) frame 1 > #1 0x8be8 in os_default_irq (tf=0x2000ffc0) >at repos/apache-mynewt-core/kernel/os/src/arch/cortex_m4/os_fault.c:171 > 171 hal_system_reset(); > (gdb) p/x *tf > $1 = {ef = 0x20001dd8, r4 = 0x200041d6, r5 = 0x0, r6 = 0x2318, r7 = 0x0, > r8 = 0x0, r9 = 0x0, r10 = 0x0, r11 = 0x0, lr = 0xfffd} > (gdb) p/x *tf->ef > $2 = {r0 = 0x0, r1 = 0x17161, r2 = 0x0, r3 = 0x2a, r12 = 0x0, lr = 0x14949, > pc = 0x14978, psr = 0x6100} > (gdb) x/32x 0x20001dd8 > 0x20001dd8 : 0x 0x00017161 > 0x 0x002a > 0x20001de8 : 0x 0x00014949 > 0x00014978 0x6100 > 0x20001df8 : 0x0003 0x > 0x 0x002a > 0x20001e08 : 0x0001 0x0002 > 0x000a 0x00014a21 > 0x20001e18 : 0x00014a15 0xebd9 > 0x 0x200041d0 > 0x20001e28 : 0x200041d6 0x > 0x000a 0x0001574d > 0x20001e38 : 0x00015741 0xc925 > 0x200041d0 0x0011 > 0x20001e48 : 0x0073 0x200041d3 > 0x 0xede9 > (gdb) p &__text > $3 = ( *) 0x8020 <__isr_vector> > (gdb) p &__etext > $4 = ( *) 0x175f0 > (gdb) x/i 0x00017161 > 0x17161:movsr0, r0 > (gdb) x/i 0x00014949 > 0x14949 : cbz r0, 0x1496a > (gdb) x/i 0x00014978 > 0x14978 : sdivr3, r3, r2 > (gdb) x/i 0x00014a21 > 0x14a21 : cbz r0, 0x14a28 > (gdb) x/i 0x00014a15 > 0x14a15 :push{r3, lr} > (gdb) list *0x14949 > 0x14949 is in crash_device > (repos/apache-mynewt-core/test/crash_test/src/crash_test.c:42). > warning: Source file is more recent than executable. > 37int > 38crash_device(char *how) > 39{ > 40volatile int val1, val2, val3; > 41 > 42if (!strcmp(how, "div0")) { > 43 > 44val1 = 42; > 45val2 = 0; > 46 > (gdb) list *0x00014a21 > 0x14a21 is in crash_cli_cmd > (repos/apache-mynewt-core/test/crash_test/src/crash_cli.c:41). > 36}; > 37 > 38static int > 39crash_cli_cmd(int argc, char **argv) > 40{ > 41if (argc >= 2 && crash_device(argv[1]) == 0) { > 42return 0; > 43} > 44console_printf("Usage crash [div0|jump0|ref0|assert|wdog]\n"); > 45return 0; > (gdb) list *0x14a21 > 0x14a21 is in crash_cli_cmd > (repos/apache-mynewt-core/test/crash_test/src/crash_cli.c:41). > 36}; > 37 > 38static int > 39crash_cli_cmd(int argc, char **argv) > 40{ > 41if (argc >= 2 && crash_device(argv[1]) == 0) { > 42return 0; > 43} > 44console_printf("Usage crash [div0|jump0|ref0|assert|wdog]\n"); > 45return 0; > > good luck. > >> On Aug 31, 2018, at 2:10 PM, Aditya Xavier >> wrote: >> >> It seems OS_CRASH_STACKTRACE was introduced after 1.4.1 and hence not in the >> release. >> >> If I change the release, I believe there would be many API changes to be >> done on MESH side. >> >> Can you guide me on how to "manually walk the stack for looking for things >> which look like pointers to text” ? >> >> My gdb skill are pretty weak. >> >> I tried gdb where, with the following outcome. >> >> (gdb) c >> Continuing. >> >> >> Program received signal SIGTRAP, Trace/breakpoint trap. >> hal_system_reset () at >> repos/apache-mynewt-core/hw/mcu/nordic/nrf52xxx/src/hal_system.c:50 >> 50 asm("bkpt"); >> (gdb) >> Continuing. >> >> Program received signal SIGTRAP, Trace/breakpoint trap. >> hal_system_reset () at >> repos/apache-mynewt-core/hw/mcu/nordic/nrf52xxx/src/hal_system.c:50 >> 50 asm("bkpt"); >> (gdb) where >> #0 hal_system_reset () at >>
Re: Mynewt crash when releasing semaphore
It seems OS_CRASH_STACKTRACE was introduced after 1.4.1 and hence not in the release. If I change the release, I believe there would be many API changes to be done on MESH side. Can you guide me on how to "manually walk the stack for looking for things which look like pointers to text” ? My gdb skill are pretty weak. I tried gdb where, with the following outcome. (gdb) c Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. hal_system_reset () at repos/apache-mynewt-core/hw/mcu/nordic/nrf52xxx/src/hal_system.c:50 50 asm("bkpt"); (gdb) Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. hal_system_reset () at repos/apache-mynewt-core/hw/mcu/nordic/nrf52xxx/src/hal_system.c:50 50 asm("bkpt"); (gdb) where #0 hal_system_reset () at repos/apache-mynewt-core/hw/mcu/nordic/nrf52xxx/src/hal_system.c:50 #1 0xbf2e in os_default_irq (tf=0x2000ffc8) at repos/apache-mynewt-core/kernel/os/src/arch/cortex_m4/os_fault.c:170 #2 0xda56 in os_default_irq_asm () at repos/apache-mynewt-core/kernel/os/src/arch/cortex_m4/m4/HAL_CM4.s:260 #3 #4 0x in ?? () Backtrace stopped: previous frame identical to this frame (corrupt stack?) > On 31-Aug-2018, at 4:30 PM, marko kiiskila wrote: > > > >> On Aug 31, 2018, at 1:47 PM, Aditya Xavier >> wrote: >> >> Hi ! >> >> Am having an issue with Sending and Receiving a Mesh Message. Though am >> positive the problem is more towards releasing the semaphore. >> >> Action Received over MESH Length :- 15 >> 012273 Unhandled interrupt (3), exception sp 0x2000abd0 >> 012273 r0:0xd7229882 r1:0xd929b3bb r2:0xcf0f98cb r3:0x5c5a76b3 >> 012273 r4:0x1b00 r5:0x2000acc0 r6:0x2000aca0 r7:0x0008 >> 012273 r8:0x r9:0x28a9 r10:0x2000ad28 r11:0x00011d91 >> 012273 r12:0x681af5c8 lr:0xb1334673 pc:0x7e3cdeb8 psr:0x2266a80b >> 012273 ICSR:0x00411803 HFSR:0x4000 CFSR:0x0004 >> 012273 BFAR:0xe000ed38 MMFAR:0xe000ed34 >> >> Am sending a group mesh message for testing. The sequence of events are as >> follows. >> >> Button TASK -> send message over MESH -> Mesh receives message on model -> >> copies the data and starts releases the Semaphore for another task -> LOG >> Task starts and logs the message. >> >> In this entire flow, the moment I receive the message and release the >> semaphore the firmware crashes. >> >> I tried increasing the STACK size of the LOG task, however that didn’t help. >> >> Could someone let me know how to understand where / why the crash is >> happening ? > > Looking at your registers they seem to be garbage, so I’m guessing stack > corruption of some sort; does not have to be overflow. > Try turning on OS_CRASH_STACKTRACE, or manually walk the stack for looking > for things which > look like pointers to text. > >
Mynewt crash when releasing semaphore
Hi ! Am having an issue with Sending and Receiving a Mesh Message. Though am positive the problem is more towards releasing the semaphore. Action Received over MESH Length :- 15 012273 Unhandled interrupt (3), exception sp 0x2000abd0 012273 r0:0xd7229882 r1:0xd929b3bb r2:0xcf0f98cb r3:0x5c5a76b3 012273 r4:0x1b00 r5:0x2000acc0 r6:0x2000aca0 r7:0x0008 012273 r8:0x r9:0x28a9 r10:0x2000ad28 r11:0x00011d91 012273 r12:0x681af5c8 lr:0xb1334673 pc:0x7e3cdeb8 psr:0x2266a80b 012273 ICSR:0x00411803 HFSR:0x4000 CFSR:0x0004 012273 BFAR:0xe000ed38 MMFAR:0xe000ed34 Am sending a group mesh message for testing. The sequence of events are as follows. Button TASK -> send message over MESH -> Mesh receives message on model -> copies the data and starts releases the Semaphore for another task -> LOG Task starts and logs the message. In this entire flow, the moment I receive the message and release the semaphore the firmware crashes. I tried increasing the STACK size of the LOG task, however that didn’t help. Could someone let me know how to understand where / why the crash is happening ? Thanks, Aditya Xavier.
Re: CBOR Decoding problem
Thanks for replying ! Yeah, but If I do that, I won’t have an Array of Arrays right ? i.e. I want to have {a:[1,2,3,4], b:[ {c:[1,2,3,4,5]}, {c:[1,2,3,4,5]}]} structure.. Which means, I need multiple instances of C object. Hence the struct c_object creation.. If I make CborAttrArrayType Am not sure that will work. Please correct me if am wrong. Thanks, Aditya Xavier. > On 13-Aug-2018, at 12:53 PM, marko kiiskila wrote: > > “c" looks like an int array instead of an object. Hope that helps > >> On Aug 10, 2018, at 10:06 AM, Aditya Xavier >> wrote: >> >> Hello ! >> >> >> Require some guidance on how to write a CBOR parsing implementation for the >> following structure. >> >> {a:[1,2,3,4], b:[ {c:[1,2,3,4,5]}, {c:[1,2,3,4,5]}]} >> >> I tried the following implementation. >> ——— >> >> uint64_t a[5]; >> Int a_count = 0; >> >> struct c_object{ >> int c[6]; >> }c_arr_objs[5]; >> int c_obj_count = 0; >> >> struct cbor_attr_t c_attrs[] = { >> { >> .attribute = “c", >> .type = CborAttrObjectType, >> CBORATTR_STRUCT_OBJECT(struct c_object, c), >> .dflt.integer = 0 >> }, >> { >> .attribute = NULL >> } >> }; >> >> >> struct cbor_attr_t root_attrs[] = { >> { >> .attribute = “a", >> .type = CborAttrArrayType, >> .addr.array.element_type = CborAttrUnsignedIntegerType, >> .addr.array.arr.uintegers.store = a, >> .addr.array.count = &a_count, >> .addr.array.maxlen = sizeof(a) / sizeof(a[0]), >> .nodefault = true >> }, >> { >> .attribute = “b", >> .type = CborAttrArrayType, >> CBORATTR_STRUCT_ARRAY(c_arr_objs, c_attrs, &c_obj_count), >> .nodefault = true >> }, >> { >> .attribute = NULL >> } >> }; >> >> ——— >> >> >> I assumed this to work as I have been using the same albeit without ‘c’ >> being a int Array. It works when I use ‘c’ as a Int etc, but not as a int >> Array, >> >> The example :- >> https://github.com/apache/mynewt-core/blob/master/encoding/cborattr/test/src/testcases/cborattr_decode_object_array.c >> >> <https://github.com/apache/mynewt-core/blob/master/encoding/cborattr/test/src/testcases/cborattr_decode_object_array.c> >> >> Has a similar implementation for Text String instead of Int Array. >> >> Thanks, >> Aditya Xavier. >> >> >> >
Re: CBOR Decoding problem
Guys any help on this? How do I implement cbor decoding for such a structure Sent from my iPhone > On 10-Aug-2018, at 12:36 PM, Aditya Xavier > wrote: > > Hello ! > > > Require some guidance on how to write a CBOR parsing implementation for the > following structure. > > {a:[1,2,3,4], b:[ {c:[1,2,3,4,5]}, {c:[1,2,3,4,5]}]} > > I tried the following implementation. > ——— > > uint64_t a[5]; > Int a_count = 0; > > struct c_object{ >int c[6]; > }c_arr_objs[5]; > int c_obj_count = 0; > > struct cbor_attr_t c_attrs[] = { >{ >.attribute = “c", >.type = CborAttrObjectType, >CBORATTR_STRUCT_OBJECT(struct c_object, c), >.dflt.integer = 0 >}, >{ >.attribute = NULL >} > }; > > > struct cbor_attr_t root_attrs[] = { >{ >.attribute = “a", >.type = CborAttrArrayType, >.addr.array.element_type = CborAttrUnsignedIntegerType, >.addr.array.arr.uintegers.store = a, >.addr.array.count = &a_count, >.addr.array.maxlen = sizeof(a) / sizeof(a[0]), >.nodefault = true >}, >{ >.attribute = “b", >.type = CborAttrArrayType, >CBORATTR_STRUCT_ARRAY(c_arr_objs, c_attrs, &c_obj_count), >.nodefault = true >}, >{ >.attribute = NULL >} > }; > > ——— > > > I assumed this to work as I have been using the same albeit without ‘c’ being > a int Array. It works when I use ‘c’ as a Int etc, but not as a int Array, > > The example :- > https://github.com/apache/mynewt-core/blob/master/encoding/cborattr/test/src/testcases/cborattr_decode_object_array.c > > <https://github.com/apache/mynewt-core/blob/master/encoding/cborattr/test/src/testcases/cborattr_decode_object_array.c> > > Has a similar implementation for Text String instead of Int Array. > > Thanks, > Aditya Xavier. > > >
CBOR Decoding problem
Hello ! Require some guidance on how to write a CBOR parsing implementation for the following structure. {a:[1,2,3,4], b:[ {c:[1,2,3,4,5]}, {c:[1,2,3,4,5]}]} I tried the following implementation. ——— uint64_t a[5]; Int a_count = 0; struct c_object{ int c[6]; }c_arr_objs[5]; int c_obj_count = 0; struct cbor_attr_t c_attrs[] = { { .attribute = “c", .type = CborAttrObjectType, CBORATTR_STRUCT_OBJECT(struct c_object, c), .dflt.integer = 0 }, { .attribute = NULL } }; struct cbor_attr_t root_attrs[] = { { .attribute = “a", .type = CborAttrArrayType, .addr.array.element_type = CborAttrUnsignedIntegerType, .addr.array.arr.uintegers.store = a, .addr.array.count = &a_count, .addr.array.maxlen = sizeof(a) / sizeof(a[0]), .nodefault = true }, { .attribute = “b", .type = CborAttrArrayType, CBORATTR_STRUCT_ARRAY(c_arr_objs, c_attrs, &c_obj_count), .nodefault = true }, { .attribute = NULL } }; ——— I assumed this to work as I have been using the same albeit without ‘c’ being a int Array. It works when I use ‘c’ as a Int etc, but not as a int Array, The example :- https://github.com/apache/mynewt-core/blob/master/encoding/cborattr/test/src/testcases/cborattr_decode_object_array.c <https://github.com/apache/mynewt-core/blob/master/encoding/cborattr/test/src/testcases/cborattr_decode_object_array.c> Has a similar implementation for Text String instead of Int Array. Thanks, Aditya Xavier.
Apache Mynewt Passkey Authentication
Hi all, I wanted to create an application which would request a Mobile connecting to it a Passkey which when provided correctly would allow the gatt connections to work. 1. Is this even possible ? 2. How do I achieve this, I have gone through several examples like btshell etc but could not figure out the direction. Thanks, Aditya Xavier.
Re: [RFC] Mesh uses multi advertising instances.
Hi Łukasz, I tried the sample application again with your patches. I could not get mesh working with / without co-existing with BLE. Are there any changes which I need to do in the App ? Thanks, Aditya Xavier. > On 23-May-2018, at 10:47 PM, Aditya Xavier wrote: > > Hi Łukasz, > > Sent from my iPhone > >> On 23-May-2018, at 1:23 PM, Łukasz Rymanowski >> wrote: >> >> Hi Aditya, >>> On Wed, 23 May 2018 at 09:43, Aditya Xavier wrote: >>> >>> Hi Łukasz, >>> >>> >>> Just saw a PR which you raised, does this fix the problem we were >>> discussing ? >>> >> >> I don't think it fixes it. I will put info on the issue you created once >> it is done. > > Got it thanks! >> >>> >>> Also, the example I gave you has Device Address being generated Randomly. >>> Is it possible to use Mesh with a Public BLE Address ? >>> >> >> Yes, you just need to set it using MYNEW_VAL with address you like: e.g. >> BLE_PUBLIC_DEV_ADDR: ((uint8_t[6]){0x11, 0xaa, 0xbb, 0xcc, 0xdd, 0xee}) >> and then use it. You can check cmd_mesh_init() in shell.c file how we do it. >> > > I was wondering if it actually allows using the public address from the chip > directly instead of setting it using Mynewt_val. Something akin to how BLE > allows. Incase of BLE we don’t need to set an address specifically, if it’s > available from the chip it’s used directly. If not we can set it > programmatically. When I tried that with mesh it didn’t work. > >> >>> >>> Thanks, >>> Aditya Xavier. >>> >>> Best >> \Łukasz >> >>> >>>> On 19-May-2018, at 7:41 PM, Aditya Xavier wrote: >>>> >>>> Hi Łukasz, >>>> >>>> Thanks for looking into it. >>>> >>>> Have raised an issue in Github for the same. >>>> >>>> Thanks, >>>> Aditya Xavier. >>>> >>>> >>>>> On 19-May-2018, at 6:05 PM, Łukasz Rymanowski < >>> lukasz.rymanow...@codecoup.pl> wrote: >>>>> >>>>> Hi, >>>>> >>>>> >>>>>> On Sat, May 19, 2018, 14:21 Aditya Xavier wrote: >>>>>> >>>>>> Hi Michał / Łukasz, >>>>>> >>>>>> Were you able to identify the issue ? Do let me know if you need any >>>>>> further testing from my end. >>>>>> >>>>> >>>>> We found one issue. Not yet PR bit you can apply patch for you to test >>>>> >>>>> ble_adv_copy_to_ext_param(struct ble_gap_ext_adv_params *ext_param, >>>>> const struct ble_gap_adv_params *param) >>>>> @@ -510,6 +522,7 @@ ble_adv_copy_to_ext_param(struct >>> ble_gap_ext_adv_params >>>>> *ext_param, >>>>> ext_param->itvl_min = param->itvl_min; >>>>> ext_param->channel_map = param->channel_map; >>>>> ext_param->high_duty_directed = param->high_duty_cycle; >>>>> +ext_param->own_addr_type = g_mesh_addr_type; >>>>> } >>>>> >>>>> >>>>> This is not yet solving the issue but you should see adv going out from >>>>> Device which uses BLE_EXT_ADV and uses non public address. >>>>> >>>>> >>>>>> Also, do you recommend I submit a new Issue on Github for the same ? >>>>>> >>>>> >>>>> Please do it. >>>>> >>>>> \Łukasz >>>>> >>>>> >>>>>> From my testing its pretty apparent that BLE_EXT_ADV does not allow >>>>>> bt_mesh_model_send ( mesh_init.c Line 155 ) to work anymore. >>>>>> >>>>>> Regarding the issue of Device B not receiving messages till around >>> 15-50 >>>>>> attempts, I believe it requires further deep dive. >>>>>> >>>>>> Am under the assumption that BLE_EXT_ADV does not actually require BLE >>> to >>>>>> be used and just Mesh to be configured. >>>>>> >>>>>> Do let me know if there are any issues in the code / my thought >>> process. >>>>>> >>>>>> Thanks, >>>>>> Aditya Xavier. >>>>>> >>>>>> >>>>>> >>>>
Re: [RFC] Mesh uses multi advertising instances.
Hi Łukasz, Sent from my iPhone > On 23-May-2018, at 1:23 PM, Łukasz Rymanowski > wrote: > > Hi Aditya, >> On Wed, 23 May 2018 at 09:43, Aditya Xavier wrote: >> >> Hi Łukasz, >> >> >> Just saw a PR which you raised, does this fix the problem we were >> discussing ? >> > > I don't think it fixes it. I will put info on the issue you created once > it is done. Got it thanks! > >> >> Also, the example I gave you has Device Address being generated Randomly. >> Is it possible to use Mesh with a Public BLE Address ? >> > > Yes, you just need to set it using MYNEW_VAL with address you like: e.g. > BLE_PUBLIC_DEV_ADDR: ((uint8_t[6]){0x11, 0xaa, 0xbb, 0xcc, 0xdd, 0xee}) > and then use it. You can check cmd_mesh_init() in shell.c file how we do it. > I was wondering if it actually allows using the public address from the chip directly instead of setting it using Mynewt_val. Something akin to how BLE allows. Incase of BLE we don’t need to set an address specifically, if it’s available from the chip it’s used directly. If not we can set it programmatically. When I tried that with mesh it didn’t work. > >> >> Thanks, >> Aditya Xavier. >> >> Best > \Łukasz > >> >>> On 19-May-2018, at 7:41 PM, Aditya Xavier wrote: >>> >>> Hi Łukasz, >>> >>> Thanks for looking into it. >>> >>> Have raised an issue in Github for the same. >>> >>> Thanks, >>> Aditya Xavier. >>> >>> >>>> On 19-May-2018, at 6:05 PM, Łukasz Rymanowski < >> lukasz.rymanow...@codecoup.pl> wrote: >>>> >>>> Hi, >>>> >>>> >>>>> On Sat, May 19, 2018, 14:21 Aditya Xavier wrote: >>>>> >>>>> Hi Michał / Łukasz, >>>>> >>>>> Were you able to identify the issue ? Do let me know if you need any >>>>> further testing from my end. >>>>> >>>> >>>> We found one issue. Not yet PR bit you can apply patch for you to test >>>> >>>> ble_adv_copy_to_ext_param(struct ble_gap_ext_adv_params *ext_param, >>>>const struct ble_gap_adv_params *param) >>>> @@ -510,6 +522,7 @@ ble_adv_copy_to_ext_param(struct >> ble_gap_ext_adv_params >>>> *ext_param, >>>> ext_param->itvl_min = param->itvl_min; >>>> ext_param->channel_map = param->channel_map; >>>> ext_param->high_duty_directed = param->high_duty_cycle; >>>> +ext_param->own_addr_type = g_mesh_addr_type; >>>> } >>>> >>>> >>>> This is not yet solving the issue but you should see adv going out from >>>> Device which uses BLE_EXT_ADV and uses non public address. >>>> >>>> >>>>> Also, do you recommend I submit a new Issue on Github for the same ? >>>>> >>>> >>>> Please do it. >>>> >>>> \Łukasz >>>> >>>> >>>>> From my testing its pretty apparent that BLE_EXT_ADV does not allow >>>>> bt_mesh_model_send ( mesh_init.c Line 155 ) to work anymore. >>>>> >>>>> Regarding the issue of Device B not receiving messages till around >> 15-50 >>>>> attempts, I believe it requires further deep dive. >>>>> >>>>> Am under the assumption that BLE_EXT_ADV does not actually require BLE >> to >>>>> be used and just Mesh to be configured. >>>>> >>>>> Do let me know if there are any issues in the code / my thought >> process. >>>>> >>>>> Thanks, >>>>> Aditya Xavier. >>>>> >>>>> >>>>> >>>>>> On 19-May-2018, at 12:23 PM, Aditya Xavier >> wrote: >>>>>> >>>>>> Hi Michał, >>>>>> >>>>>> Sorry fo the confusion. I have done some more testing on the same, >>>>> please find the test results in the xl file. >>>>>> >>>>>> Please note, the test results are of Device A; wherein the Device B is >>>>> kept in the same state ( with all the mentioned flags turned off) >>>>>> >>>>>> Also, test cases 2 - 5 have an issue wherein right after loading the >>>>> firmware Device A would receive Messages from Dev B. >>>>>> >>>>>
Re: [RFC] Mesh uses multi advertising instances.
Hi Łukasz, Just saw a PR which you raised, does this fix the problem we were discussing ? Also, the example I gave you has Device Address being generated Randomly. Is it possible to use Mesh with a Public BLE Address ? Thanks, Aditya Xavier. > On 19-May-2018, at 7:41 PM, Aditya Xavier wrote: > > Hi Łukasz, > > Thanks for looking into it. > > Have raised an issue in Github for the same. > > Thanks, > Aditya Xavier. > > >> On 19-May-2018, at 6:05 PM, Łukasz Rymanowski >> wrote: >> >> Hi, >> >> >> On Sat, May 19, 2018, 14:21 Aditya Xavier wrote: >> >>> Hi Michał / Łukasz, >>> >>> Were you able to identify the issue ? Do let me know if you need any >>> further testing from my end. >>> >> >> We found one issue. Not yet PR bit you can apply patch for you to test >> >> ble_adv_copy_to_ext_param(struct ble_gap_ext_adv_params *ext_param, >> const struct ble_gap_adv_params *param) >> @@ -510,6 +522,7 @@ ble_adv_copy_to_ext_param(struct ble_gap_ext_adv_params >> *ext_param, >> ext_param->itvl_min = param->itvl_min; >> ext_param->channel_map = param->channel_map; >> ext_param->high_duty_directed = param->high_duty_cycle; >> +ext_param->own_addr_type = g_mesh_addr_type; >> } >> >> >> This is not yet solving the issue but you should see adv going out from >> Device which uses BLE_EXT_ADV and uses non public address. >> >> >>> Also, do you recommend I submit a new Issue on Github for the same ? >>> >> >> Please do it. >> >> \Łukasz >> >> >>> From my testing its pretty apparent that BLE_EXT_ADV does not allow >>> bt_mesh_model_send ( mesh_init.c Line 155 ) to work anymore. >>> >>> Regarding the issue of Device B not receiving messages till around 15-50 >>> attempts, I believe it requires further deep dive. >>> >>> Am under the assumption that BLE_EXT_ADV does not actually require BLE to >>> be used and just Mesh to be configured. >>> >>> Do let me know if there are any issues in the code / my thought process. >>> >>> Thanks, >>> Aditya Xavier. >>> >>> >>> >>>> On 19-May-2018, at 12:23 PM, Aditya Xavier wrote: >>>> >>>> Hi Michał, >>>> >>>> Sorry fo the confusion. I have done some more testing on the same, >>> please find the test results in the xl file. >>>> >>>> Please note, the test results are of Device A; wherein the Device B is >>> kept in the same state ( with all the mentioned flags turned off) >>>> >>>> Also, test cases 2 - 5 have an issue wherein right after loading the >>> firmware Device A would receive Messages from Dev B. >>>> >>>> However, Device A would not be able to send messages to Dev B, till >>> around 15-50 attempts. A restart of Dev B helps. >>>> >>>> The initial delay to receive messages was what I thought not working >>> earlier. >>>> >>>> >>>> Thanks, >>>> Aditya Xavier. >>>> >>>> >>>>> On 18-May-2018, at 6:27 PM, Michał Narajowski < >>> michal.narajow...@codecoup.pl> wrote: >>>>> >>>>> Hi Aditya, >>>>> >>>>> BLE_ROLE_BROADCASTER should not have an impact on this. There is only >>> one >>>>> place in the code where this is used: >>>>> >>>>> include/nimble/nimble_opt_auto.h:37:#define NIMBLE_BLE_ADVERTISE >>>>> \ >>>>> (MYNEWT_VAL(BLE_ROLE_BROADCASTER) || MYNEWT_VAL(BLE_ROLE_PERIPHERAL)) >>>>> >>>>> Best regards >>>>> Michał Narajowski >>>>> >>>>> pt., 18 maj 2018 o 14:02 Aditya Xavier >>> napisał(a): >>>>> >>>>>> Hi Michał, >>>>>> >>>>>> A correction. >>>>>> >>>>>> It seems its out of the two BLE_ROLE* flags, its only >>> BLE_ROLE_BROADCASTER >>>>>> that has an adverse effect. >>>>>> Enabling BLE_ROLE_BROADCASTER stops the device from receiving messages. >>>>>> >>>>>> Thanks, >>>>>> Aditya Xavier. >>>>>> >>>>>> >>>>>> >>>>>> >>>>
Re: [RFC] Mesh uses multi advertising instances.
Hi Łukasz, Thanks for looking into it. Have raised an issue in Github for the same. Thanks, Aditya Xavier. > On 19-May-2018, at 6:05 PM, Łukasz Rymanowski > wrote: > > Hi, > > > On Sat, May 19, 2018, 14:21 Aditya Xavier wrote: > >> Hi Michał / Łukasz, >> >> Were you able to identify the issue ? Do let me know if you need any >> further testing from my end. >> > > We found one issue. Not yet PR bit you can apply patch for you to test > > ble_adv_copy_to_ext_param(struct ble_gap_ext_adv_params *ext_param, > const struct ble_gap_adv_params *param) > @@ -510,6 +522,7 @@ ble_adv_copy_to_ext_param(struct ble_gap_ext_adv_params > *ext_param, >ext_param->itvl_min = param->itvl_min; >ext_param->channel_map = param->channel_map; >ext_param->high_duty_directed = param->high_duty_cycle; > +ext_param->own_addr_type = g_mesh_addr_type; > } > > > This is not yet solving the issue but you should see adv going out from > Device which uses BLE_EXT_ADV and uses non public address. > > >> Also, do you recommend I submit a new Issue on Github for the same ? >> > > Please do it. > > \Łukasz > > >> From my testing its pretty apparent that BLE_EXT_ADV does not allow >> bt_mesh_model_send ( mesh_init.c Line 155 ) to work anymore. >> >> Regarding the issue of Device B not receiving messages till around 15-50 >> attempts, I believe it requires further deep dive. >> >> Am under the assumption that BLE_EXT_ADV does not actually require BLE to >> be used and just Mesh to be configured. >> >> Do let me know if there are any issues in the code / my thought process. >> >> Thanks, >> Aditya Xavier. >> >> >> >>> On 19-May-2018, at 12:23 PM, Aditya Xavier wrote: >>> >>> Hi Michał, >>> >>> Sorry fo the confusion. I have done some more testing on the same, >> please find the test results in the xl file. >>> >>> Please note, the test results are of Device A; wherein the Device B is >> kept in the same state ( with all the mentioned flags turned off) >>> >>> Also, test cases 2 - 5 have an issue wherein right after loading the >> firmware Device A would receive Messages from Dev B. >>> >>> However, Device A would not be able to send messages to Dev B, till >> around 15-50 attempts. A restart of Dev B helps. >>> >>> The initial delay to receive messages was what I thought not working >> earlier. >>> >>> >>> Thanks, >>> Aditya Xavier. >>> >>> >>>> On 18-May-2018, at 6:27 PM, Michał Narajowski < >> michal.narajow...@codecoup.pl> wrote: >>>> >>>> Hi Aditya, >>>> >>>> BLE_ROLE_BROADCASTER should not have an impact on this. There is only >> one >>>> place in the code where this is used: >>>> >>>> include/nimble/nimble_opt_auto.h:37:#define NIMBLE_BLE_ADVERTISE >>>> \ >>>> (MYNEWT_VAL(BLE_ROLE_BROADCASTER) || MYNEWT_VAL(BLE_ROLE_PERIPHERAL)) >>>> >>>> Best regards >>>> Michał Narajowski >>>> >>>> pt., 18 maj 2018 o 14:02 Aditya Xavier >> napisał(a): >>>> >>>>> Hi Michał, >>>>> >>>>> A correction. >>>>> >>>>> It seems its out of the two BLE_ROLE* flags, its only >> BLE_ROLE_BROADCASTER >>>>> that has an adverse effect. >>>>> Enabling BLE_ROLE_BROADCASTER stops the device from receiving messages. >>>>> >>>>> Thanks, >>>>> Aditya Xavier. >>>>> >>>>> >>>>> >>>>> >>>>>> On 18-May-2018, at 3:44 PM, Aditya Xavier >> wrote: >>>>>> >>>>>> Hi Michał, >>>>>> >>>>>> Yes, that is what you should be seeing, because the message is being >>>>> sent to the GROUP; originator receives it as well. >>>>>> If you change it to the destination / target address, you wouldn’t see >>>>> Received. >>>>>> >>>>>> To test this, you would require two devices. >>>>>> >>>>>> Assuming Device A and B. >>>>>> >>>>>> With all three flags disabled and unique address ( node_address in >>>>> mesh_init.c Line 28). >>>>>> D
Re: [RFC] Mesh uses multi advertising instances.
Hi Michał / Łukasz, Were you able to identify the issue ? Do let me know if you need any further testing from my end. Also, do you recommend I submit a new Issue on Github for the same ? From my testing its pretty apparent that BLE_EXT_ADV does not allow bt_mesh_model_send ( mesh_init.c Line 155 ) to work anymore. Regarding the issue of Device B not receiving messages till around 15-50 attempts, I believe it requires further deep dive. Am under the assumption that BLE_EXT_ADV does not actually require BLE to be used and just Mesh to be configured. Do let me know if there are any issues in the code / my thought process. Thanks, Aditya Xavier. > On 19-May-2018, at 12:23 PM, Aditya Xavier wrote: > > Hi Michał, > > Sorry fo the confusion. I have done some more testing on the same, please > find the test results in the xl file. > > Please note, the test results are of Device A; wherein the Device B is kept > in the same state ( with all the mentioned flags turned off) > > Also, test cases 2 - 5 have an issue wherein right after loading the firmware > Device A would receive Messages from Dev B. > > However, Device A would not be able to send messages to Dev B, till around > 15-50 attempts. A restart of Dev B helps. > > The initial delay to receive messages was what I thought not working earlier. > > > Thanks, > Aditya Xavier. > > >> On 18-May-2018, at 6:27 PM, Michał Narajowski >> wrote: >> >> Hi Aditya, >> >> BLE_ROLE_BROADCASTER should not have an impact on this. There is only one >> place in the code where this is used: >> >> include/nimble/nimble_opt_auto.h:37:#define NIMBLE_BLE_ADVERTISE >> \ >> (MYNEWT_VAL(BLE_ROLE_BROADCASTER) || MYNEWT_VAL(BLE_ROLE_PERIPHERAL)) >> >> Best regards >> Michał Narajowski >> >> pt., 18 maj 2018 o 14:02 Aditya Xavier napisał(a): >> >>> Hi Michał, >>> >>> A correction. >>> >>> It seems its out of the two BLE_ROLE* flags, its only BLE_ROLE_BROADCASTER >>> that has an adverse effect. >>> Enabling BLE_ROLE_BROADCASTER stops the device from receiving messages. >>> >>> Thanks, >>> Aditya Xavier. >>> >>> >>> >>> >>>> On 18-May-2018, at 3:44 PM, Aditya Xavier wrote: >>>> >>>> Hi Michał, >>>> >>>> Yes, that is what you should be seeing, because the message is being >>> sent to the GROUP; originator receives it as well. >>>> If you change it to the destination / target address, you wouldn’t see >>> Received. >>>> >>>> To test this, you would require two devices. >>>> >>>> Assuming Device A and B. >>>> >>>> With all three flags disabled and unique address ( node_address in >>> mesh_init.c Line 28). >>>> Device A ( button Pressed ) -> Device B should say in the Log Received. >>> ( Model callback method - mesh_init.c Line 78 ) >>>> Device B ( button Pressed ) -> Device A should say in the Log Received. >>>> >>>> With all three flags enabled and unique node_address. >>>> Device A ( button Pressed )-> Device B will not receive any message. >>>> Device B ( button Pressed )-> Device A will not receive any message. >>>> >>>> With only BLE_ROLE* flags disabled on Device B and all three flags >>> disabled on Device B, and unique node_address. >>>> Device A ( button Pressed )-> Device B should say in the Log Received. >>>> Device B ( button Pressed )-> Device A will not receive any message. >>>> >>>> Thanks, >>>> Aditya Xavier. >>>> >>>> >>>>> On 18-May-2018, at 3:23 PM, Michał Narajowski < >>> michal.narajow...@codecoup.pl> wrote: >>>>> >>>>> Hi Aditya, >>>>> >>>>> I enabled these flags: >>>>> >>>>> BLE_ROLE_BROADCASTER: 1 >>>>> BLE_ROLE_PERIPHERAL: 1 >>>>> BLE_EXT_ADV: 1 >>>>> >>>>> And this is what i see after pushing the button a few times: >>>>> >>>>> 045120 #mesh-onoff STATUS >>>>> 045121 #mesh-onoff STATUS: Sent ! >>>>> 045123 Received >>>>> 045263 #mesh-onoff STATUS >>>>> 045264 #mesh-onoff STATUS: Sent ! >>>>> 045266 Received >>>>> 045402 #mesh-onoff STATUS >>>>> 045402 #mesh-onoff STATUS: Sent ! >>>
Re: [RFC] Mesh uses multi advertising instances.
Hi Michał, Sorry fo the confusion. I have done some more testing on the same, please find the test results in the xl file. Please note, the test results are of Device A; wherein the Device B is kept in the same state ( with all the mentioned flags turned off) Also, test cases 2 - 5 have an issue wherein right after loading the firmware Device A would receive Messages from Dev B. However, Device A would not be able to send messages to Dev B, till around 15-50 attempts. A restart of Dev B helps. The initial delay to receive messages was what I thought not working earlier. Book1.xlsx Description: MS-Excel 2007 spreadsheet Thanks, Aditya Xavier. > On 18-May-2018, at 6:27 PM, Michał Narajowski > wrote: > > Hi Aditya, > > BLE_ROLE_BROADCASTER should not have an impact on this. There is only one > place in the code where this is used: > > include/nimble/nimble_opt_auto.h:37:#define NIMBLE_BLE_ADVERTISE >\ >(MYNEWT_VAL(BLE_ROLE_BROADCASTER) || MYNEWT_VAL(BLE_ROLE_PERIPHERAL)) > > Best regards > Michał Narajowski > > pt., 18 maj 2018 o 14:02 Aditya Xavier napisał(a): > >> Hi Michał, >> >> A correction. >> >> It seems its out of the two BLE_ROLE* flags, its only BLE_ROLE_BROADCASTER >> that has an adverse effect. >> Enabling BLE_ROLE_BROADCASTER stops the device from receiving messages. >> >> Thanks, >> Aditya Xavier. >> >> >> >> >>> On 18-May-2018, at 3:44 PM, Aditya Xavier wrote: >>> >>> Hi Michał, >>> >>> Yes, that is what you should be seeing, because the message is being >> sent to the GROUP; originator receives it as well. >>> If you change it to the destination / target address, you wouldn’t see >> Received. >>> >>> To test this, you would require two devices. >>> >>> Assuming Device A and B. >>> >>> With all three flags disabled and unique address ( node_address in >> mesh_init.c Line 28). >>> Device A ( button Pressed ) -> Device B should say in the Log Received. >> ( Model callback method - mesh_init.c Line 78 ) >>> Device B ( button Pressed ) -> Device A should say in the Log Received. >>> >>> With all three flags enabled and unique node_address. >>> Device A ( button Pressed )-> Device B will not receive any message. >>> Device B ( button Pressed )-> Device A will not receive any message. >>> >>> With only BLE_ROLE* flags disabled on Device B and all three flags >> disabled on Device B, and unique node_address. >>> Device A ( button Pressed )-> Device B should say in the Log Received. >>> Device B ( button Pressed )-> Device A will not receive any message. >>> >>> Thanks, >>> Aditya Xavier. >>> >>> >>>> On 18-May-2018, at 3:23 PM, Michał Narajowski < >> michal.narajow...@codecoup.pl> wrote: >>>> >>>> Hi Aditya, >>>> >>>> I enabled these flags: >>>> >>>> BLE_ROLE_BROADCASTER: 1 >>>> BLE_ROLE_PERIPHERAL: 1 >>>> BLE_EXT_ADV: 1 >>>> >>>> And this is what i see after pushing the button a few times: >>>> >>>> 045120 #mesh-onoff STATUS >>>> 045121 #mesh-onoff STATUS: Sent ! >>>> 045123 Received >>>> 045263 #mesh-onoff STATUS >>>> 045264 #mesh-onoff STATUS: Sent ! >>>> 045266 Received >>>> 045402 #mesh-onoff STATUS >>>> 045402 #mesh-onoff STATUS: Sent ! >>>> 045404 Received >>>> 045535 #mesh-onoff STATUS >>>> 045536 #mesh-onoff STATUS: Sent ! >>>> 045538 Received >>>> 046559 #mesh-onoff STATUS >>>> 046559 #mesh-onoff STATUS: Sent ! >>>> 046561 Received >>>> 046601 #mesh-onoff STATUS >>>> 046602 #mesh-onoff STATUS: Sent ! >>>> 046604 Received >>>> 046627 #mesh-onoff STATUS >>>> 046628 #mesh-onoff STATUS: Sent ! >>>> 046630 Received >>>> 046656 #mesh-onoff STATUS >>>> 046656 #mesh-onoff STATUS: Sent ! >>>> 046658 Received >>>> >>>> >>>> >>>> Is this what I should see? What are your symptoms? >>>> >>>> Best regards >>>> Michał Narajowski >>>> >>>> pt., 18 maj 2018 o 11:47 Aditya Xavier >> napisał(a): >>>> >>>>> Hi Łukasz, >>>>> >>>>> Disabling only the following flags in syscfg.yml allows the devi
Re: [RFC] Mesh uses multi advertising instances.
Hi Michał, A correction. It seems its out of the two BLE_ROLE* flags, its only BLE_ROLE_BROADCASTER that has an adverse effect. Enabling BLE_ROLE_BROADCASTER stops the device from receiving messages. Thanks, Aditya Xavier. > On 18-May-2018, at 3:44 PM, Aditya Xavier wrote: > > Hi Michał, > > Yes, that is what you should be seeing, because the message is being sent to > the GROUP; originator receives it as well. > If you change it to the destination / target address, you wouldn’t see > Received. > > To test this, you would require two devices. > > Assuming Device A and B. > > With all three flags disabled and unique address ( node_address in > mesh_init.c Line 28). > Device A ( button Pressed ) -> Device B should say in the Log Received. ( > Model callback method - mesh_init.c Line 78 ) > Device B ( button Pressed ) -> Device A should say in the Log Received. > > With all three flags enabled and unique node_address. > Device A ( button Pressed )-> Device B will not receive any message. > Device B ( button Pressed )-> Device A will not receive any message. > > With only BLE_ROLE* flags disabled on Device B and all three flags disabled > on Device B, and unique node_address. > Device A ( button Pressed )-> Device B should say in the Log Received. > Device B ( button Pressed )-> Device A will not receive any message. > > Thanks, > Aditya Xavier. > > >> On 18-May-2018, at 3:23 PM, Michał Narajowski >> wrote: >> >> Hi Aditya, >> >> I enabled these flags: >> >> BLE_ROLE_BROADCASTER: 1 >> BLE_ROLE_PERIPHERAL: 1 >> BLE_EXT_ADV: 1 >> >> And this is what i see after pushing the button a few times: >> >> 045120 #mesh-onoff STATUS >> 045121 #mesh-onoff STATUS: Sent ! >> 045123 Received >> 045263 #mesh-onoff STATUS >> 045264 #mesh-onoff STATUS: Sent ! >> 045266 Received >> 045402 #mesh-onoff STATUS >> 045402 #mesh-onoff STATUS: Sent ! >> 045404 Received >> 045535 #mesh-onoff STATUS >> 045536 #mesh-onoff STATUS: Sent ! >> 045538 Received >> 046559 #mesh-onoff STATUS >> 046559 #mesh-onoff STATUS: Sent ! >> 046561 Received >> 046601 #mesh-onoff STATUS >> 046602 #mesh-onoff STATUS: Sent ! >> 046604 Received >> 046627 #mesh-onoff STATUS >> 046628 #mesh-onoff STATUS: Sent ! >> 046630 Received >> 046656 #mesh-onoff STATUS >> 046656 #mesh-onoff STATUS: Sent ! >> 046658 Received >> >> >> >> Is this what I should see? What are your symptoms? >> >> Best regards >> Michał Narajowski >> >> pt., 18 maj 2018 o 11:47 Aditya Xavier napisał(a): >> >>> Hi Łukasz, >>> >>> Disabling only the following flags in syscfg.yml allows the device to >>> receive but not send mesh messages. >>> >>> BLE_ROLE_BROADCASTER: 1 >>> BLE_ROLE_PERIPHERAL: 1 >>> >>> Disabling BLE_EXT_ADV: 1, flag allows the device to send and receive mesh >>> messages. >>> >>> And as I said earlier enabling all three of them, does not allow the >>> device to send / receive mesh messages. >>> >>> It is quite possible its a mistake on my end. Would be grateful if you let >>> me know what am I doing wrong :) >>> >>> Thanks, >>> Aditya Xavier. >>> >>> >>>> On 18-May-2018, at 2:59 PM, Aditya Xavier wrote: >>>> >>>> Hi Łukasz, >>>> >>>> Am actually sending it to the Group Address. >>>> >>>> In main.c :- Line 27 >>>> void button_cb(struct os_event *ev) >>>> { >>>> mesh_msg_send(MODEL_ID_CBOR_ACTION, GROUP_ADDR, "HELLO WORLD", 12); >>>> >>>> } >>>> >>>> And its relevant method :- >>>> >>>> In mesh_init.c :- Line 138. >>>> void mesh_msg_send(uint16_t model_id, uint16_t target_address, char >>> *tmsg, uint16_t tlen) >>>> { >>>> struct os_mbuf *msg = NET_BUF_SIMPLE(10 + tlen); >>>> struct bt_mesh_msg_ctx ctx = { >>>> .net_idx = net_idx, >>>> .app_idx = app_idx, >>>> // .addr = node_address, >>>> // .addr = GROUP_ADDR, >>>> .addr = target_address, >>>> .send_ttl = BT_MESH_TTL_MAX, >>>> }; >>>> >>>> >>>> >>>> Which I registered here :- >>>> In mesh_init.c :- Line 129. >>>>
Re: [RFC] Mesh uses multi advertising instances.
Hi Michał, Yes, that is what you should be seeing, because the message is being sent to the GROUP; originator receives it as well. If you change it to the destination / target address, you wouldn’t see Received. To test this, you would require two devices. Assuming Device A and B. With all three flags disabled and unique address ( node_address in mesh_init.c Line 28). Device A ( button Pressed ) -> Device B should say in the Log Received. ( Model callback method - mesh_init.c Line 78 ) Device B ( button Pressed ) -> Device A should say in the Log Received. With all three flags enabled and unique node_address. Device A ( button Pressed )-> Device B will not receive any message. Device B ( button Pressed )-> Device A will not receive any message. With only BLE_ROLE* flags disabled on Device B and all three flags disabled on Device B, and unique node_address. Device A ( button Pressed )-> Device B should say in the Log Received. Device B ( button Pressed )-> Device A will not receive any message. Thanks, Aditya Xavier. > On 18-May-2018, at 3:23 PM, Michał Narajowski > wrote: > > Hi Aditya, > > I enabled these flags: > >BLE_ROLE_BROADCASTER: 1 >BLE_ROLE_PERIPHERAL: 1 >BLE_EXT_ADV: 1 > > And this is what i see after pushing the button a few times: > > 045120 #mesh-onoff STATUS > 045121 #mesh-onoff STATUS: Sent ! > 045123 Received > 045263 #mesh-onoff STATUS > 045264 #mesh-onoff STATUS: Sent ! > 045266 Received > 045402 #mesh-onoff STATUS > 045402 #mesh-onoff STATUS: Sent ! > 045404 Received > 045535 #mesh-onoff STATUS > 045536 #mesh-onoff STATUS: Sent ! > 045538 Received > 046559 #mesh-onoff STATUS > 046559 #mesh-onoff STATUS: Sent ! > 046561 Received > 046601 #mesh-onoff STATUS > 046602 #mesh-onoff STATUS: Sent ! > 046604 Received > 046627 #mesh-onoff STATUS > 046628 #mesh-onoff STATUS: Sent ! > 046630 Received > 046656 #mesh-onoff STATUS > 046656 #mesh-onoff STATUS: Sent ! > 046658 Received > > > > Is this what I should see? What are your symptoms? > > Best regards > Michał Narajowski > > pt., 18 maj 2018 o 11:47 Aditya Xavier napisał(a): > >> Hi Łukasz, >> >> Disabling only the following flags in syscfg.yml allows the device to >> receive but not send mesh messages. >> >>BLE_ROLE_BROADCASTER: 1 >>BLE_ROLE_PERIPHERAL: 1 >> >> Disabling BLE_EXT_ADV: 1, flag allows the device to send and receive mesh >> messages. >> >> And as I said earlier enabling all three of them, does not allow the >> device to send / receive mesh messages. >> >> It is quite possible its a mistake on my end. Would be grateful if you let >> me know what am I doing wrong :) >> >> Thanks, >> Aditya Xavier. >> >> >>> On 18-May-2018, at 2:59 PM, Aditya Xavier wrote: >>> >>> Hi Łukasz, >>> >>> Am actually sending it to the Group Address. >>> >>> In main.c :- Line 27 >>> void button_cb(struct os_event *ev) >>> { >>> mesh_msg_send(MODEL_ID_CBOR_ACTION, GROUP_ADDR, "HELLO WORLD", 12); >>> >>> } >>> >>> And its relevant method :- >>> >>> In mesh_init.c :- Line 138. >>> void mesh_msg_send(uint16_t model_id, uint16_t target_address, char >> *tmsg, uint16_t tlen) >>> { >>> struct os_mbuf *msg = NET_BUF_SIMPLE(10 + tlen); >>> struct bt_mesh_msg_ctx ctx = { >>> .net_idx = net_idx, >>> .app_idx = app_idx, >>> // .addr = node_address, >>> // .addr = GROUP_ADDR, >>> .addr = target_address, >>> .send_ttl = BT_MESH_TTL_MAX, >>> }; >>> >>> >>> >>> Which I registered here :- >>> In mesh_init.c :- Line 129. >>> * Add model subscription */ >>> bt_mesh_cfg_mod_sub_add_vnd(net_idx, node_address, node_address, >> GROUP_ADDR, >>> MOD_LF, CID_VENDOR, NULL); >>> >>> Also, I believe the mesh_msg_send is correctly because it works >> correctly when I switch off the following flags. >>> >>> BLE_ROLE_BROADCASTER: 1 >>> BLE_ROLE_PERIPHERAL: 1 >>> BLE_EXT_ADV: 1 >>> >>> Please do correct me if am wrong. >>> >>> Thanks, >>> Aditya Xavier. >>> >>>> On 18-May-2018, at 2:53 PM, Łukasz Rymanowski < >> lukasz.rymanow...@codecoup.pl> wrote: >>>> >>>> Hi Aditya, >>>> >>>> Sending to destination with s
Re: [RFC] Mesh uses multi advertising instances.
Hi Łukasz, Disabling only the following flags in syscfg.yml allows the device to receive but not send mesh messages. BLE_ROLE_BROADCASTER: 1 BLE_ROLE_PERIPHERAL: 1 Disabling BLE_EXT_ADV: 1, flag allows the device to send and receive mesh messages. And as I said earlier enabling all three of them, does not allow the device to send / receive mesh messages. It is quite possible its a mistake on my end. Would be grateful if you let me know what am I doing wrong :) Thanks, Aditya Xavier. > On 18-May-2018, at 2:59 PM, Aditya Xavier wrote: > > Hi Łukasz, > > Am actually sending it to the Group Address. > > In main.c :- Line 27 > void button_cb(struct os_event *ev) > { >mesh_msg_send(MODEL_ID_CBOR_ACTION, GROUP_ADDR, "HELLO WORLD", 12); > > } > > And its relevant method :- > > In mesh_init.c :- Line 138. > void mesh_msg_send(uint16_t model_id, uint16_t target_address, char *tmsg, > uint16_t tlen) > { >struct os_mbuf *msg = NET_BUF_SIMPLE(10 + tlen); >struct bt_mesh_msg_ctx ctx = { >.net_idx = net_idx, >.app_idx = app_idx, >// .addr = node_address, >// .addr = GROUP_ADDR, >.addr = target_address, >.send_ttl = BT_MESH_TTL_MAX, >}; > > > > Which I registered here :- > In mesh_init.c :- Line 129. > * Add model subscription */ >bt_mesh_cfg_mod_sub_add_vnd(net_idx, node_address, node_address, > GROUP_ADDR, >MOD_LF, CID_VENDOR, NULL); > > Also, I believe the mesh_msg_send is correctly because it works correctly > when I switch off the following flags. > > BLE_ROLE_BROADCASTER: 1 > BLE_ROLE_PERIPHERAL: 1 > BLE_EXT_ADV: 1 > > Please do correct me if am wrong. > > Thanks, > Aditya Xavier. > >> On 18-May-2018, at 2:53 PM, Łukasz Rymanowski >> wrote: >> >> Hi Aditya, >> >> Sending to destination with same address as source will result in sending >> msg to source. It will not go into the air. >> >> Best >> Łukasz >> >> On Thu, 17 May 2018 at 12:21, Aditya Xavier wrote: >> >>> Hi Łukasz, >>> >>> Sorry for the late reply. >>> >>> I created a test application for BLE + MESH co-existence, to test the >>> functionality and your patch. >>> >>> The following are my observations. >>> >>> 1. On enabling any of the following flags, MESH is unable to send / >>> receive messages don’t work. (Using mesh_model_send) >>> >>> BLE_ROLE_BROADCASTER: 1 >>> BLE_ROLE_PERIPHERAL: 1 >>> BLE_EXT_ADV: 1 >>> >>> 2. Incase using the same Node_Address on two devices, send/ receive >>> messages don't work. ( This might be as per protocol specifications, am not >>> aware) >>> >>> You can try the application to verify the same. >>> 1. Do remember the node_address value should be unique. You can >>> change the same in mesh_init.c >>> 2. You can enable BLE / mesh by changing the relevant value in >>> headers.h ( ble_enable and mesh_enable ) >>> >>> >>> Please let me know your findings and in case of any mistake on my part, >>> please let me know. >>> >>> Thanks for looking into it. >>> >>> Thanks, >>> Aditya Xavier. >>> >>> >>> >>> >>>> On 15-May-2018, at 7:59 PM, Łukasz Rymanowski < >>> lukasz.rymanow...@codecoup.pl> wrote: >>>> >>>> Hi Aditya, >>>> >>>> On Sat, 12 May 2018 at 08:23, Aditya Xavier wrote: >>>> >>>>> Hi Łukasz, >>>>> >>>>> Thanks for looking into it. >>>>> >>>>> As per the documentation, >>>>> >>>>> To make use of it application needs to set BLE_EXT_ADV and >>>>> BLE_MULTI_ADV_INSTANCES at least to 1. Mesh will use last available >>>>> advertising instance for PB-ADV and second to last for PB-GATT and >>>>> PROXY >>>>> >>>>> What would happen when the Application is not utilizing PB-ADV / >>> PB-GATT ? >>>>> i.e. provisioned Mesh Instance co-existing with a BLE instance ? >>>>> >>>> >>>> Ah this is error in the documentation. Instead of PB_ADV/GATT It should >>> be >>>> ADV bearer and GATT bearer. Actually also name of #defines >>>> BLE_ADV_PB_ADV/GATT_IDX is not good. Thanks f
Re: [RFC] Mesh uses multi advertising instances.
Hi Łukasz, Am actually sending it to the Group Address. In main.c :- Line 27 void button_cb(struct os_event *ev) { mesh_msg_send(MODEL_ID_CBOR_ACTION, GROUP_ADDR, "HELLO WORLD", 12); } And its relevant method :- In mesh_init.c :- Line 138. void mesh_msg_send(uint16_t model_id, uint16_t target_address, char *tmsg, uint16_t tlen) { struct os_mbuf *msg = NET_BUF_SIMPLE(10 + tlen); struct bt_mesh_msg_ctx ctx = { .net_idx = net_idx, .app_idx = app_idx, // .addr = node_address, // .addr = GROUP_ADDR, .addr = target_address, .send_ttl = BT_MESH_TTL_MAX, }; Which I registered here :- In mesh_init.c :- Line 129. * Add model subscription */ bt_mesh_cfg_mod_sub_add_vnd(net_idx, node_address, node_address, GROUP_ADDR, MOD_LF, CID_VENDOR, NULL); Also, I believe the mesh_msg_send is correctly because it works correctly when I switch off the following flags. BLE_ROLE_BROADCASTER: 1 BLE_ROLE_PERIPHERAL: 1 BLE_EXT_ADV: 1 Please do correct me if am wrong. Thanks, Aditya Xavier. > On 18-May-2018, at 2:53 PM, Łukasz Rymanowski > wrote: > > Hi Aditya, > > Sending to destination with same address as source will result in sending > msg to source. It will not go into the air. > > Best > Łukasz > > On Thu, 17 May 2018 at 12:21, Aditya Xavier wrote: > >> Hi Łukasz, >> >> Sorry for the late reply. >> >> I created a test application for BLE + MESH co-existence, to test the >> functionality and your patch. >> >> The following are my observations. >> >> 1. On enabling any of the following flags, MESH is unable to send / >> receive messages don’t work. (Using mesh_model_send) >> >>BLE_ROLE_BROADCASTER: 1 >>BLE_ROLE_PERIPHERAL: 1 >>BLE_EXT_ADV: 1 >> >> 2. Incase using the same Node_Address on two devices, send/ receive >> messages don't work. ( This might be as per protocol specifications, am not >> aware) >> >> You can try the application to verify the same. >> 1. Do remember the node_address value should be unique. You can >> change the same in mesh_init.c >> 2. You can enable BLE / mesh by changing the relevant value in >> headers.h ( ble_enable and mesh_enable ) >> >> >> Please let me know your findings and in case of any mistake on my part, >> please let me know. >> >> Thanks for looking into it. >> >> Thanks, >> Aditya Xavier. >> >> >> >> >>> On 15-May-2018, at 7:59 PM, Łukasz Rymanowski < >> lukasz.rymanow...@codecoup.pl> wrote: >>> >>> Hi Aditya, >>> >>> On Sat, 12 May 2018 at 08:23, Aditya Xavier wrote: >>> >>>> Hi Łukasz, >>>> >>>> Thanks for looking into it. >>>> >>>> As per the documentation, >>>> >>>> To make use of it application needs to set BLE_EXT_ADV and >>>> BLE_MULTI_ADV_INSTANCES at least to 1. Mesh will use last available >>>> advertising instance for PB-ADV and second to last for PB-GATT and >>>> PROXY >>>> >>>> What would happen when the Application is not utilizing PB-ADV / >> PB-GATT ? >>>> i.e. provisioned Mesh Instance co-existing with a BLE instance ? >>>> >>> >>> Ah this is error in the documentation. Instead of PB_ADV/GATT It should >> be >>> ADV bearer and GATT bearer. Actually also name of #defines >>> BLE_ADV_PB_ADV/GATT_IDX is not good. Thanks for pointing it out. Would >> you >>> mind to send PR for this? >>> >>> In general, when BLE_EXT_ADV is enabled and application wants to use BLE >>> instance and Mesh, then >>> a) BLE_MULTI_ADV_INSTANCES shall be set at least to 1 if ADV bearer is >> used >>> b) BLE_MULTI_ADV_INSTANCES shall be set at least to 2 if ADV and GATT >>> bearer is used >>> >>> >>>> Trying to understand whether this would require me to enable PB-ADV / >>>> PB-GATT because my application uses neither. >>>> >>> >>> There should be no need for this. >>> >>> >>>> >>>> Similarly, please correct me if am wrong but I would need to set >>>> BLE_MULTI_ADV_INSTANCES to 2 to have MESH and BLE coexist. >>>> >>> >>> No, 1 is enough. It is because BLE_MULTI_ADV_INSTANCES stays for an >>> additional instances. There is always one available. >>> Actually I understand t
Re: [RFC] Mesh uses multi advertising instances.
Hi Łukasz, Thanks for looking into it. As per the documentation, To make use of it application needs to set BLE_EXT_ADV and BLE_MULTI_ADV_INSTANCES at least to 1. Mesh will use last available advertising instance for PB-ADV and second to last for PB-GATT and PROXY What would happen when the Application is not utilizing PB-ADV / PB-GATT ? i.e. provisioned Mesh Instance co-existing with a BLE instance ? Trying to understand whether this would require me to enable PB-ADV / PB-GATT because my application uses neither. Similarly, please correct me if am wrong but I would need to set BLE_MULTI_ADV_INSTANCES to 2 to have MESH and BLE coexist. Thanks, Aditya Xavier. > On 10-May-2018, at 1:16 PM, Łukasz Rymanowski > wrote: > > Hi, > > We found the issue which was related to latest controller changes. > Basically controller does not allow now to mix legacy HCI with ext adv HCI > which of course is good. The PR > https://github.com/apache/mynewt-nimble/pull/8 is fixed now. > I removed RFC and I plan to merge it soon. > > @Aditya - feedback very welcome. > > \Łukasz > > On Mon, 7 May 2018 at 13:41, Łukasz Rymanowski < > lukasz.rymanow...@codecoup.pl> wrote: > >> Hi Aditya, >> >> Sorry for late answer. >> >> Could you please provide btmon logs along with console logs so we can help >> you to analyze what is going on? >> Here is instruction how to get btmon logs: >> https://www.codecoup.pl/blog/support-for-btmon-in-mynewt/ >> >> Thanks and best regards >> Łukasz >> >> >> On Fri, 27 Apr 2018 at 11:48, Aditya Xavier wrote: >> >>> Hi Łukasz, >>> >>> Any update on it? Were you able to check this ? >>> >>> Bt_mesh_model_send does not work after enabling BLE_EXT_ADV.. >>> >>> Or, can you give me a sample code where it works so that I can check if >>> there is something am doing wrong. >>> >>> Thanks, >>> Aditya Xavier. >>> >>> >>>> On 20-Apr-2018, at 3:56 PM, Aditya Xavier wrote: >>>> >>>> Hi Łukasz, >>>> >>>> Thanks, was able to build btshell + blemesh into nrf52832. >>>> >>>> I think I found an issue with regards to bt_mesh_model_send method. >>>> >>>> It seems bt_mesh_model_send is no longer working. >>>> >>>> In my test app, I have remove all ble code, and using only blemesh ( >>> auto provisioning ) and send a message to another device over mesh on a >>> press of a button. >>>> >>>> When I disable BLE_EXT_ADV and BLE_MULTI_ADV_INSTANCES, it works. >>>> >>>> Can you try and confirm it works ? >>>> >>>> Thanks, >>>> Aditya Xavier >>>> >>>>> On 19-Apr-2018, at 2:00 PM, Łukasz Rymanowski < >>> lukasz.rymanow...@codecoup.pl <mailto:lukasz.rymanow...@codecoup.pl>> >>> wrote: >>>>> >>>>> Hi Aditya, >>>>> >>>>> I suggest to hack around flash map instead of removing code. >>>>> >>>>> I would do something like this (hopefully calculations are OK). >>>>> >>>>> +++ b/hw/bsp/nrf52dk/bsp.yml >>>>> @@ -41,11 +41,11 @@ bsp.flash_map: >>>>> FLASH_AREA_IMAGE_0: >>>>> device: 0 >>>>> offset: 0x8000 >>>>> -size: 232kB >>>>> +size: 462kB >>>>> FLASH_AREA_IMAGE_1: >>>>> device: 0 >>>>> - offset: 0x00042000 >>>>> -size: 232kB >>>>> +offset: 0x0007B800 >>>>> +size: 2kB >>>>> FLASH_AREA_IMAGE_SCRATCH: >>>>> device: 0 >>>>> offset: 0x0007c000 >>>>> diff --git a/hw/bsp/nrf52dk/nrf52xxaa.ld b/hw/bsp/nrf52dk/nrf52xxaa.ld >>>>> index 9433e37fd..55e293da1 100644 >>>>> --- a/hw/bsp/nrf52dk/nrf52xxaa.ld >>>>> +++ b/hw/bsp/nrf52dk/nrf52xxaa.ld >>>>> @@ -17,7 +17,7 @@ >>>>> */ >>>>> MEMORY >>>>> { >>>>> - FLASH (rx) : ORIGIN = 0x8000, LENGTH = 0x3a000 >>>>> + FLASH (rx) : ORIGIN = 0x8000, LENGTH = 0x73800 >>>>> RAM (rwx) : ORIGIN = 0x2000, LENGTH = 0x1 >>>>> } >>>>> >>>>> >>>>> Make sure to rebuild boot and app and then try. >>
MESH and BLE co-existence
Hi Dev Team, From my understanding BLE Mesh utilizing extended advertising is still in development. Is it possible to have BLE MESH and BLE to co-exist with using extended advertisement ? i.e. similar to Nordic Softdevice doing time slicing BLE Mesh and BLE advertising signals. Thanks, Aditya Xavier.
Re: [RFC] Mesh uses multi advertising instances.
Hi Łukasz, Any update on it? Were you able to check this ? Bt_mesh_model_send does not work after enabling BLE_EXT_ADV.. Or, can you give me a sample code where it works so that I can check if there is something am doing wrong. Thanks, Aditya Xavier. > On 20-Apr-2018, at 3:56 PM, Aditya Xavier wrote: > > Hi Łukasz, > > Thanks, was able to build btshell + blemesh into nrf52832. > > I think I found an issue with regards to bt_mesh_model_send method. > > It seems bt_mesh_model_send is no longer working. > > In my test app, I have remove all ble code, and using only blemesh ( auto > provisioning ) and send a message to another device over mesh on a press of a > button. > > When I disable BLE_EXT_ADV and BLE_MULTI_ADV_INSTANCES, it works. > > Can you try and confirm it works ? > > Thanks, > Aditya Xavier > >> On 19-Apr-2018, at 2:00 PM, Łukasz Rymanowski > <mailto:lukasz.rymanow...@codecoup.pl>> wrote: >> >> Hi Aditya, >> >> I suggest to hack around flash map instead of removing code. >> >> I would do something like this (hopefully calculations are OK). >> >> +++ b/hw/bsp/nrf52dk/bsp.yml >> @@ -41,11 +41,11 @@ bsp.flash_map: >>FLASH_AREA_IMAGE_0: >>device: 0 >>offset: 0x8000 >> -size: 232kB >> +size: 462kB >>FLASH_AREA_IMAGE_1: >>device: 0 >> -offset: 0x00042000 >> -size: 232kB >> +offset: 0x0007B800 >> +size: 2kB >>FLASH_AREA_IMAGE_SCRATCH: >>device: 0 >>offset: 0x0007c000 >> diff --git a/hw/bsp/nrf52dk/nrf52xxaa.ld b/hw/bsp/nrf52dk/nrf52xxaa.ld >> index 9433e37fd..55e293da1 100644 >> --- a/hw/bsp/nrf52dk/nrf52xxaa.ld >> +++ b/hw/bsp/nrf52dk/nrf52xxaa.ld >> @@ -17,7 +17,7 @@ >> */ >> MEMORY >> { >> - FLASH (rx) : ORIGIN = 0x8000, LENGTH = 0x3a000 >> + FLASH (rx) : ORIGIN = 0x8000, LENGTH = 0x73800 >> RAM (rwx) : ORIGIN = 0x2000, LENGTH = 0x1 >> } >> >> >> Make sure to rebuild boot and app and then try. >> >> Best >> Łukasz >> >> On 19 April 2018 at 07:30, Aditya Xavier > <mailto:adityaxav...@me.com> <mailto:adityaxav...@me.com >> <mailto:adityaxav...@me.com>>> wrote: >> >>> Hi Łukasz, >>> >>> PFA the app I used to test Mesh using multi advertising instances. >>> >>> I get the following error. >>> [ts=275343728ssb, mod=4 level=3] adv_send: Advertising failed: err 3 >>> >>> >>> >>> I had to comment out a lot of code to get it in a flash-able size. >>> >>> Thanks, >>> Aditya Xavier. >>> >>> >>> On 18-Apr-2018, at 1:13 PM, Aditya Xavier >> <mailto:adityaxav...@me.com>> wrote: >>> >>> Hi Łukasz, >>> >>> Am using nrf52832, hence the problem of flash overflow. >>> >>> Would create a test app, using btshell + blemesh + the flags which you >>> recommended, and test again. >>> >>> Thanks, >>> Aditya Xavier. >>> >>> On 18-Apr-2018, at 12:29 PM, Łukasz Rymanowski < >>> lukasz.rymanow...@codecoup.pl <mailto:lukasz.rymanow...@codecoup.pl>> wrote: >>> >>> Hi Aditya, >>> >>> If there is flash overflow consider removing some features from the >>> configuration. >>> What HW are you using? We are running on nrf52840 >>> >>> BTW There is no special application. It is btshell plus those 4 flags ( >>> BLE_EXT_ADV, BLE_MULTI_ADV_INSTANCES, BLE_MESH, BLE_MESH_SHELL) . Of >>> course you need my PR. I did not test it personally, but I know it worked >>> for Michal. >>> >>> Please share your target configuration, >>> >>> Best >>> Łukasz >>> >>> On 17 April 2018 at 12:04, Aditya Xavier >> <mailto:adityaxav...@me.com> >> adityaxav...@me.com <mailto:adityaxav...@me.com> >>> <mailto:adityaxav...@me.com <mailto:adityaxav...@me.com>> >>> mailto:adityaxav...@me.com> >>> <mailto:adityaxav...@me.com <mailto:adityaxav...@me.com>>>>> wrote: >>> >>> Hi Łukasz, >>> >>> Been trying to join both blemesh_shell and bt_shell, but there is a >>> problem of flash overflow. >>> >>> Created another app, which basically is btshell and some portions of >>> blem
Re: Console Read Issue
Thanks a ton. Would go through them. Thanks, Aditya Xavier. > On 21-Apr-2018, at 11:45 PM, marko kiiskila wrote: > > Console itself uses uart driver interface. Other examples you can use > > mgmt/newtmgr/transport/nmgr_uart/src/nmgr_uart.c > https://github.com/runtimeco/mynewt_arduino_zero/blob/master/libs/espduino/src/espduino.c > boot/boot_serial/src/boot_uart.c > > the air quality sensor tutorial: > http://mynewt.apache.org/latest/os/tutorials/air_quality_sensor/#air-quality-sensor-project > > <http://mynewt.apache.org/latest/os/tutorials/air_quality_sensor/#air-quality-sensor-project> > >> On Apr 21, 2018, at 9:06 PM, Aditya Xavier wrote: >> >> I went through HAL UART APIs however am not able to understand how to >> receive UART data. >> >> Is there any example out there which would tell me how to use the relevant >> functions (hal_uart_start_rx ? ) so that we can receive binary data over >> UART ? >> >> Any help is much appreciated. >> >> Thanks, >> Aditya Xavier. >> >> >>> On 21-Apr-2018, at 8:44 PM, Aditya Xavier wrote: >>> >>> Could you specifically point how to use the uart driver interface? >>> >>> I’ll look at how to base64 encode as well.. >>> >>> Sent from my iPhone >>> >>>> On 21-Apr-2018, at 8:17 PM, marko kiiskila wrote: >>>> >>>> Console is for printable characters only, not meant for binary data. >>>> You should go straight to uart driver interface, or base64 encode your >>>> CBOR. >>>> >>>>> On Apr 21, 2018, at 4:30 PM, Aditya Xavier wrote: >>>>> >>>>> Hi Mynewt Team, >>>>> >>>>> It seems UART is not capable of handling non-asci characters and instead >>>>> enters new line on occurrence of one. >>>>> >>>>> Thanks, >>>>> Aditya Xavier. >>>>> >>>>> >>>>>> On 21-Apr-2018, at 5:28 PM, Aditya Xavier wrote: >>>>>> >>>>>> Hi Mynewt Team, >>>>>> >>>>>> Am facing issues with console_read API. >>>>>> >>>>>> I have a MCU sending CBOR data to nRF over UART. >>>>>> >>>>>> Console_read works perfect when receiving data from USB->Serial adapter >>>>>> (Computer) & RTT. >>>>>> >>>>>> Console_read give multiple hits ( i.e. multiple times it would reach >>>>>> either /*Got Full line - break …*/ or /*Do some work…*/ >>>>>> >>>>>> How do I fix such a situation. >>>>>> >>>>>> Thanks, >>>>>> Aditya Xavier. >>>>>> >>>>>> >>>>>> #define MAX_INPUT 128 >>>>>> >>>>>> static void >>>>>> read_function(void *arg) >>>>>> { >>>>>> char buf[MAX_INPUT]; >>>>>> int rc; >>>>>> int full_line; >>>>>> int off; >>>>>> >>>>>> off = 0; >>>>>> while (1) { >>>>>> rc = console_read(buf + off, MAX_INPUT - off, &full_line); >>>>>> if (rc <= 0 && !full_line) { >>>>>> continue; >>>>>> } >>>>>> off += rc; >>>>>> if (!full_line) { >>>>>> if (off == MAX_INPUT) { >>>>>> /* >>>>>>* Full line, no newline yet. Reset the input buffer. >>>>>>*/ >>>>>> off = 0; >>>>>> } >>>>>> continue; >>>>>> } >>>>>> /* Got full line - break out of the loop and process the input data */ >>>>>> break; >>>>>> } >>>>>> >>>>>> /* Process the input line here */ >>>>>> >>>>>> >>>>>> return; >>>>>> } >>>>>> static void myapp_process_input(struct os_event *ev); >>>>>> >>>>>> static struct os_eventq avail_queue; >>>>>> >>>>>> static struct console_input myapp_console_buf; >>>>>> >>>>>> static struct os_event myapp_console_event = { >>>>>> .ev_cb = myapp_process_input, >>>>>> .ev_arg = &myapp_console_buf >>>>>> }; >>>>>> >>>>>> /* Event callback to process a line of input from console. */ >>>>>> static void >>>>>> myapp_process_input(struct os_event *ev) >>>>>> { >>>>>> char *line; >>>>>> struct console_input *input; >>>>>> >>>>>> input = ev->ev_arg; >>>>>> assert (input != NULL); >>>>>> >>>>>> line = input->line; >>>>>> /* Do some work with line */ >>>>>> >>>>>> /* Done processing line. Add the event back to the avail_queue */ >>>>>> os_eventq_put(&avail_queue, ev); >>>>>> return; >>>>>> } >>>>>> >>>>>> static void >>>>>> myapp_init(void) >>>>>> { >>>>>> os_eventq_init(&avail_queue); >>>>>> os_eventq_put(&avail_queue, &myapp_console_event); >>>>>> >>>>>> console_set_queues(&avail_queue, os_eventq_dflt_get()); >>>>>> } >>>>>> >>>>> >>>> >> >
Re: Console Read Issue
I went through HAL UART APIs however am not able to understand how to receive UART data. Is there any example out there which would tell me how to use the relevant functions (hal_uart_start_rx ? ) so that we can receive binary data over UART ? Any help is much appreciated. Thanks, Aditya Xavier. > On 21-Apr-2018, at 8:44 PM, Aditya Xavier wrote: > > Could you specifically point how to use the uart driver interface? > > I’ll look at how to base64 encode as well.. > > Sent from my iPhone > >> On 21-Apr-2018, at 8:17 PM, marko kiiskila wrote: >> >> Console is for printable characters only, not meant for binary data. >> You should go straight to uart driver interface, or base64 encode your CBOR. >> >>> On Apr 21, 2018, at 4:30 PM, Aditya Xavier wrote: >>> >>> Hi Mynewt Team, >>> >>> It seems UART is not capable of handling non-asci characters and instead >>> enters new line on occurrence of one. >>> >>> Thanks, >>> Aditya Xavier. >>> >>> >>>> On 21-Apr-2018, at 5:28 PM, Aditya Xavier wrote: >>>> >>>> Hi Mynewt Team, >>>> >>>> Am facing issues with console_read API. >>>> >>>> I have a MCU sending CBOR data to nRF over UART. >>>> >>>> Console_read works perfect when receiving data from USB->Serial adapter >>>> (Computer) & RTT. >>>> >>>> Console_read give multiple hits ( i.e. multiple times it would reach >>>> either /*Got Full line - break …*/ or /*Do some work…*/ >>>> >>>> How do I fix such a situation. >>>> >>>> Thanks, >>>> Aditya Xavier. >>>> >>>> >>>> #define MAX_INPUT 128 >>>> >>>> static void >>>> read_function(void *arg) >>>> { >>>> char buf[MAX_INPUT]; >>>> int rc; >>>> int full_line; >>>> int off; >>>> >>>> off = 0; >>>> while (1) { >>>> rc = console_read(buf + off, MAX_INPUT - off, &full_line); >>>> if (rc <= 0 && !full_line) { >>>> continue; >>>> } >>>> off += rc; >>>> if (!full_line) { >>>> if (off == MAX_INPUT) { >>>> /* >>>> * Full line, no newline yet. Reset the input buffer. >>>> */ >>>> off = 0; >>>> } >>>> continue; >>>> } >>>> /* Got full line - break out of the loop and process the input data */ >>>> break; >>>> } >>>> >>>> /* Process the input line here */ >>>> >>>> >>>> return; >>>> } >>>> static void myapp_process_input(struct os_event *ev); >>>> >>>> static struct os_eventq avail_queue; >>>> >>>> static struct console_input myapp_console_buf; >>>> >>>> static struct os_event myapp_console_event = { >>>> .ev_cb = myapp_process_input, >>>> .ev_arg = &myapp_console_buf >>>> }; >>>> >>>> /* Event callback to process a line of input from console. */ >>>> static void >>>> myapp_process_input(struct os_event *ev) >>>> { >>>> char *line; >>>> struct console_input *input; >>>> >>>> input = ev->ev_arg; >>>> assert (input != NULL); >>>> >>>> line = input->line; >>>> /* Do some work with line */ >>>> >>>> /* Done processing line. Add the event back to the avail_queue */ >>>> os_eventq_put(&avail_queue, ev); >>>> return; >>>> } >>>> >>>> static void >>>> myapp_init(void) >>>> { >>>> os_eventq_init(&avail_queue); >>>> os_eventq_put(&avail_queue, &myapp_console_event); >>>> >>>> console_set_queues(&avail_queue, os_eventq_dflt_get()); >>>> } >>>> >>> >>
Re: Console Read Issue
Could you specifically point how to use the uart driver interface? I’ll look at how to base64 encode as well.. Sent from my iPhone > On 21-Apr-2018, at 8:17 PM, marko kiiskila wrote: > > Console is for printable characters only, not meant for binary data. > You should go straight to uart driver interface, or base64 encode your CBOR. > >> On Apr 21, 2018, at 4:30 PM, Aditya Xavier wrote: >> >> Hi Mynewt Team, >> >> It seems UART is not capable of handling non-asci characters and instead >> enters new line on occurrence of one. >> >> Thanks, >> Aditya Xavier. >> >> >>> On 21-Apr-2018, at 5:28 PM, Aditya Xavier wrote: >>> >>> Hi Mynewt Team, >>> >>> Am facing issues with console_read API. >>> >>> I have a MCU sending CBOR data to nRF over UART. >>> >>> Console_read works perfect when receiving data from USB->Serial adapter >>> (Computer) & RTT. >>> >>> Console_read give multiple hits ( i.e. multiple times it would reach either >>> /*Got Full line - break …*/ or /*Do some work…*/ >>> >>> How do I fix such a situation. >>> >>> Thanks, >>> Aditya Xavier. >>> >>> >>> #define MAX_INPUT 128 >>> >>> static void >>> read_function(void *arg) >>> { >>> char buf[MAX_INPUT]; >>> int rc; >>> int full_line; >>> int off; >>> >>> off = 0; >>> while (1) { >>> rc = console_read(buf + off, MAX_INPUT - off, &full_line); >>> if (rc <= 0 && !full_line) { >>> continue; >>> } >>> off += rc; >>> if (!full_line) { >>> if (off == MAX_INPUT) { >>> /* >>> * Full line, no newline yet. Reset the input buffer. >>> */ >>> off = 0; >>> } >>> continue; >>> } >>> /* Got full line - break out of the loop and process the input data */ >>> break; >>> } >>> >>> /* Process the input line here */ >>> >>> >>> return; >>> } >>> static void myapp_process_input(struct os_event *ev); >>> >>> static struct os_eventq avail_queue; >>> >>> static struct console_input myapp_console_buf; >>> >>> static struct os_event myapp_console_event = { >>> .ev_cb = myapp_process_input, >>> .ev_arg = &myapp_console_buf >>> }; >>> >>> /* Event callback to process a line of input from console. */ >>> static void >>> myapp_process_input(struct os_event *ev) >>> { >>> char *line; >>> struct console_input *input; >>> >>> input = ev->ev_arg; >>> assert (input != NULL); >>> >>> line = input->line; >>> /* Do some work with line */ >>> >>> /* Done processing line. Add the event back to the avail_queue */ >>> os_eventq_put(&avail_queue, ev); >>> return; >>> } >>> >>> static void >>> myapp_init(void) >>> { >>> os_eventq_init(&avail_queue); >>> os_eventq_put(&avail_queue, &myapp_console_event); >>> >>> console_set_queues(&avail_queue, os_eventq_dflt_get()); >>> } >>> >> >
Re: Console Read Issue
Hi Mynewt Team, It seems UART is not capable of handling non-asci characters and instead enters new line on occurrence of one. Thanks, Aditya Xavier. > On 21-Apr-2018, at 5:28 PM, Aditya Xavier wrote: > > Hi Mynewt Team, > > Am facing issues with console_read API. > > I have a MCU sending CBOR data to nRF over UART. > > Console_read works perfect when receiving data from USB->Serial adapter > (Computer) & RTT. > > Console_read give multiple hits ( i.e. multiple times it would reach either > /*Got Full line - break …*/ or /*Do some work…*/ > > How do I fix such a situation. > > Thanks, > Aditya Xavier. > > > #define MAX_INPUT 128 > > static void > read_function(void *arg) > { >char buf[MAX_INPUT]; >int rc; >int full_line; >int off; > >off = 0; >while (1) { >rc = console_read(buf + off, MAX_INPUT - off, &full_line); >if (rc <= 0 && !full_line) { >continue; >} >off += rc; >if (!full_line) { >if (off == MAX_INPUT) { >/* > * Full line, no newline yet. Reset the input buffer. > */ >off = 0; >} >continue; >} >/* Got full line - break out of the loop and process the input data */ >break; >} > >/* Process the input line here */ > > >return; > } > static void myapp_process_input(struct os_event *ev); > > static struct os_eventq avail_queue; > > static struct console_input myapp_console_buf; > > static struct os_event myapp_console_event = { >.ev_cb = myapp_process_input, >.ev_arg = &myapp_console_buf > }; > > /* Event callback to process a line of input from console. */ > static void > myapp_process_input(struct os_event *ev) > { >char *line; >struct console_input *input; > >input = ev->ev_arg; >assert (input != NULL); > >line = input->line; >/* Do some work with line */ > >/* Done processing line. Add the event back to the avail_queue */ >os_eventq_put(&avail_queue, ev); >return; > } > > static void > myapp_init(void) > { >os_eventq_init(&avail_queue); >os_eventq_put(&avail_queue, &myapp_console_event); > >console_set_queues(&avail_queue, os_eventq_dflt_get()); > } >
Console Read Issue
Hi Mynewt Team, Am facing issues with console_read API. I have a MCU sending CBOR data to nRF over UART. Console_read works perfect when receiving data from USB->Serial adapter (Computer) & RTT. Console_read give multiple hits ( i.e. multiple times it would reach either /*Got Full line - break …*/ or /*Do some work…*/ How do I fix such a situation. Thanks, Aditya Xavier. #define MAX_INPUT 128 static void read_function(void *arg) { char buf[MAX_INPUT]; int rc; int full_line; int off; off = 0; while (1) { rc = console_read(buf + off, MAX_INPUT - off, &full_line); if (rc <= 0 && !full_line) { continue; } off += rc; if (!full_line) { if (off == MAX_INPUT) { /* * Full line, no newline yet. Reset the input buffer. */ off = 0; } continue; } /* Got full line - break out of the loop and process the input data */ break; } /* Process the input line here */ return; } static void myapp_process_input(struct os_event *ev); static struct os_eventq avail_queue; static struct console_input myapp_console_buf; static struct os_event myapp_console_event = { .ev_cb = myapp_process_input, .ev_arg = &myapp_console_buf }; /* Event callback to process a line of input from console. */ static void myapp_process_input(struct os_event *ev) { char *line; struct console_input *input; input = ev->ev_arg; assert (input != NULL); line = input->line; /* Do some work with line */ /* Done processing line. Add the event back to the avail_queue */ os_eventq_put(&avail_queue, ev); return; } static void myapp_init(void) { os_eventq_init(&avail_queue); os_eventq_put(&avail_queue, &myapp_console_event); console_set_queues(&avail_queue, os_eventq_dflt_get()); }
Re: [RFC] Mesh uses multi advertising instances.
Hi Łukasz, Thanks, was able to build btshell + blemesh into nrf52832. I think I found an issue with regards to bt_mesh_model_send method. It seems bt_mesh_model_send is no longer working. In my test app, I have remove all ble code, and using only blemesh ( auto provisioning ) and send a message to another device over mesh on a press of a button. When I disable BLE_EXT_ADV and BLE_MULTI_ADV_INSTANCES, it works. Can you try and confirm it works ? Thanks, Aditya Xavier > On 19-Apr-2018, at 2:00 PM, Łukasz Rymanowski > wrote: > > Hi Aditya, > > I suggest to hack around flash map instead of removing code. > > I would do something like this (hopefully calculations are OK). > > +++ b/hw/bsp/nrf52dk/bsp.yml > @@ -41,11 +41,11 @@ bsp.flash_map: > FLASH_AREA_IMAGE_0: > device: 0 > offset: 0x8000 > -size: 232kB > +size: 462kB > FLASH_AREA_IMAGE_1: > device: 0 > -offset: 0x00042000 > -size: 232kB > +offset: 0x0007B800 > +size: 2kB > FLASH_AREA_IMAGE_SCRATCH: > device: 0 > offset: 0x0007c000 > diff --git a/hw/bsp/nrf52dk/nrf52xxaa.ld b/hw/bsp/nrf52dk/nrf52xxaa.ld > index 9433e37fd..55e293da1 100644 > --- a/hw/bsp/nrf52dk/nrf52xxaa.ld > +++ b/hw/bsp/nrf52dk/nrf52xxaa.ld > @@ -17,7 +17,7 @@ > */ > MEMORY > { > - FLASH (rx) : ORIGIN = 0x8000, LENGTH = 0x3a000 > + FLASH (rx) : ORIGIN = 0x8000, LENGTH = 0x73800 > RAM (rwx) : ORIGIN = 0x2000, LENGTH = 0x1 > } > > > Make sure to rebuild boot and app and then try. > > Best > Łukasz > > On 19 April 2018 at 07:30, Aditya Xavier <mailto:adityaxav...@me.com>> wrote: > >> Hi Łukasz, >> >> PFA the app I used to test Mesh using multi advertising instances. >> >> I get the following error. >> [ts=275343728ssb, mod=4 level=3] adv_send: Advertising failed: err 3 >> >> >> >> I had to comment out a lot of code to get it in a flash-able size. >> >> Thanks, >> Aditya Xavier. >> >> >> On 18-Apr-2018, at 1:13 PM, Aditya Xavier wrote: >> >> Hi Łukasz, >> >> Am using nrf52832, hence the problem of flash overflow. >> >> Would create a test app, using btshell + blemesh + the flags which you >> recommended, and test again. >> >> Thanks, >> Aditya Xavier. >> >> On 18-Apr-2018, at 12:29 PM, Łukasz Rymanowski < >> lukasz.rymanow...@codecoup.pl> wrote: >> >> Hi Aditya, >> >> If there is flash overflow consider removing some features from the >> configuration. >> What HW are you using? We are running on nrf52840 >> >> BTW There is no special application. It is btshell plus those 4 flags ( >> BLE_EXT_ADV, BLE_MULTI_ADV_INSTANCES, BLE_MESH, BLE_MESH_SHELL) . Of >> course you need my PR. I did not test it personally, but I know it worked >> for Michal. >> >> Please share your target configuration, >> >> Best >> Łukasz >> >> On 17 April 2018 at 12:04, Aditya Xavier > adityaxav...@me.com <mailto:adityaxav...@me.com> > <mailto:adityaxav...@me.com>>>> wrote: >> >> Hi Łukasz, >> >> Been trying to join both blemesh_shell and bt_shell, but there is a >> problem of flash overflow. >> >> Created another app, which basically is btshell and some portions of >> blemesh, but that didn’t work. >> >> Is it possible for you to share a sample / test app ? >> >> Thanks, >> Aditya Xavier. >> >> On 10-Apr-2018, at 1:09 PM, Łukasz Rymanowski < >> >> lukasz.rymanow...@codecoup.pl <mailto:lukasz.rymanow...@codecoup.pl>> wrote: >> >> >> Hi Michał, Aditya, >> >> I just upload a new version of PR: >> https://github.com/apache/mynewt-nimble/pull/8 >> <https://github.com/apache/mynewt-nimble/pull/8> >> It contains fixes for the problem mentioned above, however solution is >> >> bit >> >> different from what Michał suggested. >> @MIchał, could you take a look? >> >> @Aditya, Could you be able to test it and give us a feedback on this? >> >> Best >> Łukasz >> >> >> >> On 6 April 2018 at 14:08, Michał Narajowski < >> >> michal.narajow...@codecoup.pl <mailto:michal.narajow...@codecoup.pl>> >> >> wrote: >> >> Hi Aditya, >> >> Mesh is using Adv extensions under the hood if you have Łukasz's patch >> and enable BLE_EXT_AD
Re: [RFC] Mesh uses multi advertising instances.
Hi Łukasz, Am using nrf52832, hence the problem of flash overflow. Would create a test app, using btshell + blemesh + the flags which you recommended, and test again. Thanks, Aditya Xavier. > On 18-Apr-2018, at 12:29 PM, Łukasz Rymanowski > wrote: > > Hi Aditya, > > If there is flash overflow consider removing some features from the > configuration. > What HW are you using? We are running on nrf52840 > > BTW There is no special application. It is btshell plus those 4 flags ( > BLE_EXT_ADV, BLE_MULTI_ADV_INSTANCES, BLE_MESH, BLE_MESH_SHELL) . Of > course you need my PR. I did not test it personally, but I know it worked > for Michal. > > Please share your target configuration, > > Best > Łukasz > > On 17 April 2018 at 12:04, Aditya Xavier <mailto:adityaxav...@me.com>> wrote: > >> Hi Łukasz, >> >> Been trying to join both blemesh_shell and bt_shell, but there is a >> problem of flash overflow. >> >> Created another app, which basically is btshell and some portions of >> blemesh, but that didn’t work. >> >> Is it possible for you to share a sample / test app ? >> >> Thanks, >> Aditya Xavier. >> >>> On 10-Apr-2018, at 1:09 PM, Łukasz Rymanowski < >> lukasz.rymanow...@codecoup.pl> wrote: >>> >>> Hi Michał, Aditya, >>> >>> I just upload a new version of PR: >>> https://github.com/apache/mynewt-nimble/pull/8 >>> It contains fixes for the problem mentioned above, however solution is >> bit >>> different from what Michał suggested. >>> @MIchał, could you take a look? >>> >>> @Aditya, Could you be able to test it and give us a feedback on this? >>> >>> Best >>> Łukasz >>> >>> >>> >>> On 6 April 2018 at 14:08, Michał Narajowski < >> michal.narajow...@codecoup.pl> >>> wrote: >>> >>>> Hi Aditya, >>>> >>>> Mesh is using Adv extensions under the hood if you have Łukasz's patch >>>> and enable BLE_EXT_ADV and set BLE_MULTI_ADV_INSTANCES to at least 1. >>>> Blemesh_shell has a command "init" which initializes mesh stack and >>>> starts advertising Unprovisioned Mesh Beacon. >>>> >>>> I tested this now and I noticed a bug. Here is a patch for that bug: >>>> https://pastebin.com/gbyX8H56 >>>> Please apply it on top of Łukasz's branch. >>>> >>>> Hope that helps. Let us know how it works for you. >>>> >>>> BR, >>>> Michał >>>> >>>> 2018-04-06 11:09 GMT+02:00 Aditya Xavier : >>>>> Hi Michał / Łukasz, >>>>> >>>>> I have been trying to understand the blemesh_shell, and I fail to >>>> understand how / where it is using the Advertisement extensions. >>>>> >>>>> Basically, could you point me towards the difference if I need to >>>> implement, in order to use blemesh instead. >>>>> >>>>> From what I gathered / understood after going through the code is that >>>> blemesh_shell basically allows various functions to be triggered through >>>> shell commands. >>>>> >>>>> Thanks, >>>>> Aditya Xavier. >>>>> >>>>> >>>>>> On 03-Apr-2018, at 3:54 PM, Michał Narajowski < >>>> michal.narajow...@codecoup.pl> wrote: >>>>>> >>>>>> Hi Aditya, >>>>>> >>>>>> Please set BLE_MESH: 1 and BLE_MESH_SHELL: 1 and you should be able to >>>>>> use both btshell and mesh shell. Let us know how that works for you. >>>>>> av...@gmail.com <mailto:av...@gmail.com> >>>>>> Best regards >>>>>> Michał >>>>>> >>>>>> 2018-04-03 7:56 GMT+02:00 Aditya Xavier >>>>> <mailto:adityaxav...@me.com>>: >>>>>>> Hi Łukasz, >>>>>>> >>>>>>> Any pointers, as to what needs to be implemented from the >>>> blemesh_shell app ? >>>>>>> >>>>>>> >>>>>>> Thanks, >>>>>>> Aditya Xavier. >>>>>>> >>>>>>>> On 02-Apr-2018, at 11:34 PM, Łukasz Rymanowski < >>>> lukasz.rymanow...@codecoup.pl <mailto:lukasz.rymanow...@codecoup.pl>> >>>> wrote: >>>>>
Re: Problem with starting up nRF Custom Board
That worked! Thank you so much! Sent from my iPhone > On 17-Apr-2018, at 7:43 PM, Alvaro Prieto wrote: > > Aditya, > > Have you tried disabling the DCDC (if you don't have the DC DC inductors)? > > MCU_DCDC_ENABLED: 0 > > I've had problems like these that were caused by that. > > Cheers, > > Alvaro > >> On Tue, Apr 17, 2018 at 7:09 AM, Aditya Xavier wrote: >> >> Sorry for spamming you all. >> >> However found one curious issue. >> >> Apache is able to boot and start Blinky, if I do Connect (Target -> >> Connect) from Segger. >> >> The moment I disconnect from Segger i.e (Target -> Disconnect ), apache >> doesn’t work anymore. >> >> >> Thanks, >> Aditya Xavier. >> >> >>> On 17-Apr-2018, at 6:19 PM, Aditya Xavier wrote: >>> >>> Some more information for sake of clarity. >>> >>> I used the nrf52dk in apache, nrf52_pca10040 in zephyr and pca10040 in >> Nordic SDK. >>> >>> Hardware wise its very similar to nrf52dk without the Programmer part. >>> >>> Thanks, >>> Aditya Xavier. >>> >>>> On 17-Apr-2018, at 4:05 PM, Aditya Xavier wrote: >>>> >>>> Just tested Zephyr SDK Blinky too. >>>> >>>> It works similar to the Nordic SDK, so now its only Mynewt SDK which is >> not booting. >>>> >>>> Do I need to make any changes to BSP ? >>>> >>>> How do I figure out where the problem is ? >>>> >>>> Thanks, >>>> Aditya Xavier. >>>> >>>> >>>>> On 17-Apr-2018, at 1:18 PM, Aditya Xavier wrote: >>>>> >>>>> Hi Team, >>>>> >>>>> Am stuck at trying to install Blinky firmware on a custom nRF52832 >> board (not using any peripherals apart from 1 GPIO (LED_1)). >>>>> >>>>> The sequence of events which am doing and the results are as follows. >>>>> >>>>> 1. Connect Segger and Erase Device. >>>>> 2. Load nrf52_boot >>>>> 3. Load nrf52_blinky >>>>> 4. nRF starts blinking the LED. >>>>> 5. Restart ( remove power and reconnect power ) >>>>> 6. nRF is no longer blinking the LED. >>>>> >>>>> 1. Connect Segger and Erase Device >>>>> 2. Load nRF SDK Blinky >>>>> 3. nRF starts blinking the LED >>>>> 4. Restart ( remove power and reconnect power ) >>>>> 5. nRF starts blinking the LED. >>>>> >>>>> Am I missing something? >>>>> >>>>> Thanks, >>>>> Aditya Xavier. >>>> >>> >> >>
Re: Problem with starting up nRF Custom Board
Sorry for spamming you all. However found one curious issue. Apache is able to boot and start Blinky, if I do Connect (Target -> Connect) from Segger. The moment I disconnect from Segger i.e (Target -> Disconnect ), apache doesn’t work anymore. Thanks, Aditya Xavier. > On 17-Apr-2018, at 6:19 PM, Aditya Xavier wrote: > > Some more information for sake of clarity. > > I used the nrf52dk in apache, nrf52_pca10040 in zephyr and pca10040 in Nordic > SDK. > > Hardware wise its very similar to nrf52dk without the Programmer part. > > Thanks, > Aditya Xavier. > >> On 17-Apr-2018, at 4:05 PM, Aditya Xavier wrote: >> >> Just tested Zephyr SDK Blinky too. >> >> It works similar to the Nordic SDK, so now its only Mynewt SDK which is not >> booting. >> >> Do I need to make any changes to BSP ? >> >> How do I figure out where the problem is ? >> >> Thanks, >> Aditya Xavier. >> >> >>> On 17-Apr-2018, at 1:18 PM, Aditya Xavier wrote: >>> >>> Hi Team, >>> >>> Am stuck at trying to install Blinky firmware on a custom nRF52832 board >>> (not using any peripherals apart from 1 GPIO (LED_1)). >>> >>> The sequence of events which am doing and the results are as follows. >>> >>> 1. Connect Segger and Erase Device. >>> 2. Load nrf52_boot >>> 3. Load nrf52_blinky >>> 4. nRF starts blinking the LED. >>> 5. Restart ( remove power and reconnect power ) >>> 6. nRF is no longer blinking the LED. >>> >>> 1. Connect Segger and Erase Device >>> 2. Load nRF SDK Blinky >>> 3. nRF starts blinking the LED >>> 4. Restart ( remove power and reconnect power ) >>> 5. nRF starts blinking the LED. >>> >>> Am I missing something? >>> >>> Thanks, >>> Aditya Xavier. >> >
Re: Problem with starting up nRF Custom Board
Some more information for sake of clarity. I used the nrf52dk in apache, nrf52_pca10040 in zephyr and pca10040 in Nordic SDK. Hardware wise its very similar to nrf52dk without the Programmer part. Thanks, Aditya Xavier. > On 17-Apr-2018, at 4:05 PM, Aditya Xavier wrote: > > Just tested Zephyr SDK Blinky too. > > It works similar to the Nordic SDK, so now its only Mynewt SDK which is not > booting. > > Do I need to make any changes to BSP ? > > How do I figure out where the problem is ? > > Thanks, > Aditya Xavier. > > >> On 17-Apr-2018, at 1:18 PM, Aditya Xavier wrote: >> >> Hi Team, >> >> Am stuck at trying to install Blinky firmware on a custom nRF52832 board >> (not using any peripherals apart from 1 GPIO (LED_1)). >> >> The sequence of events which am doing and the results are as follows. >> >> 1. Connect Segger and Erase Device. >> 2. Load nrf52_boot >> 3. Load nrf52_blinky >> 4. nRF starts blinking the LED. >> 5. Restart ( remove power and reconnect power ) >> 6. nRF is no longer blinking the LED. >> >> 1. Connect Segger and Erase Device >> 2. Load nRF SDK Blinky >> 3. nRF starts blinking the LED >> 4. Restart ( remove power and reconnect power ) >> 5. nRF starts blinking the LED. >> >> Am I missing something? >> >> Thanks, >> Aditya Xavier. >
Re: Problem with starting up nRF Custom Board
Just tested Zephyr SDK Blinky too. It works similar to the Nordic SDK, so now its only Mynewt SDK which is not booting. Do I need to make any changes to BSP ? How do I figure out where the problem is ? Thanks, Aditya Xavier. > On 17-Apr-2018, at 1:18 PM, Aditya Xavier wrote: > > Hi Team, > > Am stuck at trying to install Blinky firmware on a custom nRF52832 board (not > using any peripherals apart from 1 GPIO (LED_1)). > > The sequence of events which am doing and the results are as follows. > > 1.Connect Segger and Erase Device. > 2.Load nrf52_boot > 3.Load nrf52_blinky > 4.nRF starts blinking the LED. > 5.Restart ( remove power and reconnect power ) > 6.nRF is no longer blinking the LED. > > 1.Connect Segger and Erase Device > 2.Load nRF SDK Blinky > 3.nRF starts blinking the LED > 4.Restart ( remove power and reconnect power ) > 5.nRF starts blinking the LED. > > Am I missing something? > > Thanks, > Aditya Xavier.
Re: [RFC] Mesh uses multi advertising instances.
Hi Łukasz, Been trying to join both blemesh_shell and bt_shell, but there is a problem of flash overflow. Created another app, which basically is btshell and some portions of blemesh, but that didn’t work. Is it possible for you to share a sample / test app ? Thanks, Aditya Xavier. > On 10-Apr-2018, at 1:09 PM, Łukasz Rymanowski > wrote: > > Hi Michał, Aditya, > > I just upload a new version of PR: > https://github.com/apache/mynewt-nimble/pull/8 > It contains fixes for the problem mentioned above, however solution is bit > different from what Michał suggested. > @MIchał, could you take a look? > > @Aditya, Could you be able to test it and give us a feedback on this? > > Best > Łukasz > > > > On 6 April 2018 at 14:08, Michał Narajowski > wrote: > >> Hi Aditya, >> >> Mesh is using Adv extensions under the hood if you have Łukasz's patch >> and enable BLE_EXT_ADV and set BLE_MULTI_ADV_INSTANCES to at least 1. >> Blemesh_shell has a command "init" which initializes mesh stack and >> starts advertising Unprovisioned Mesh Beacon. >> >> I tested this now and I noticed a bug. Here is a patch for that bug: >> https://pastebin.com/gbyX8H56 >> Please apply it on top of Łukasz's branch. >> >> Hope that helps. Let us know how it works for you. >> >> BR, >> Michał >> >> 2018-04-06 11:09 GMT+02:00 Aditya Xavier : >>> Hi Michał / Łukasz, >>> >>> I have been trying to understand the blemesh_shell, and I fail to >> understand how / where it is using the Advertisement extensions. >>> >>> Basically, could you point me towards the difference if I need to >> implement, in order to use blemesh instead. >>> >>> From what I gathered / understood after going through the code is that >> blemesh_shell basically allows various functions to be triggered through >> shell commands. >>> >>> Thanks, >>> Aditya Xavier. >>> >>> >>>> On 03-Apr-2018, at 3:54 PM, Michał Narajowski < >> michal.narajow...@codecoup.pl> wrote: >>>> >>>> Hi Aditya, >>>> >>>> Please set BLE_MESH: 1 and BLE_MESH_SHELL: 1 and you should be able to >>>> use both btshell and mesh shell. Let us know how that works for you. >>>> >>>> Best regards >>>> Michał >>>> >>>> 2018-04-03 7:56 GMT+02:00 Aditya Xavier : >>>>> Hi Łukasz, >>>>> >>>>> Any pointers, as to what needs to be implemented from the >> blemesh_shell app ? >>>>> >>>>> >>>>> Thanks, >>>>> Aditya Xavier. >>>>> >>>>>> On 02-Apr-2018, at 11:34 PM, Łukasz Rymanowski < >> lukasz.rymanow...@codecoup.pl> wrote: >>>>>> >>>>>> Second thought >>>>>> >>>>>> Aditya, >>>>>> Since I did not test it a lot, would it be possible to give us >> feedback how >>>>>> it works for you? >>>>>> >>>>>> Best >>>>>> Lukasz >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Mon, Apr 2, 2018, 20:01 Łukasz Rymanowski < >> lukasz.rymanow...@codecoup.pl> >>>>>> wrote: >>>>>> >>>>>>> Hi Aditya. >>>>>>> >>>>>>> On Mon, Apr 2, 2018, 19:14 Aditya Xavier >> wrote: >>>>>>> >>>>>>>> Hi Łukasz, >>>>>>>> >>>>>>>> Is there anything special required to get this working along with >> BLE ? >>>>>>> >>>>>>> >>>>>>>> For e.g. would the btshell app code for ADV_EXT work along with >> mesh with >>>>>>>> the provided patches ? >>>>>>>> >>>>>>> >>>>>>> In addition to configuration mentioned in PR commit message, the >> btshell >>>>>>> app would have to enable ble mesh and ble mesh shell (check >> blemesh_shell >>>>>>> app for that) >>>>>>> >>>>>>>> >>>>>>>> Mesh and BLE seems to compile however, am currently unable to get >> Mesh >>>>>>>> working. >>>>>>>> >>>>>>>> Also, any reason w
Problem with starting up nRF Custom Board
Hi Team, Am stuck at trying to install Blinky firmware on a custom nRF52832 board (not using any peripherals apart from 1 GPIO (LED_1)). The sequence of events which am doing and the results are as follows. 1. Connect Segger and Erase Device. 2. Load nrf52_boot 3. Load nrf52_blinky 4. nRF starts blinking the LED. 5. Restart ( remove power and reconnect power ) 6. nRF is no longer blinking the LED. 1. Connect Segger and Erase Device 2. Load nRF SDK Blinky 3. nRF starts blinking the LED 4. Restart ( remove power and reconnect power ) 5. nRF starts blinking the LED. Am I missing something? Thanks, Aditya Xavier.
Re: MBUF behaviour
That explains everything. However, one question. When we do a os_mbuf_free_chain, shouldn’t om_data also provide “”, instead of the previous value ? I understand its not wise to delete the data from the memory for the sake of efficiency, however was wondering if thats the expected result. Thanks for the explanation though. Would change the code accordingly. Thanks, Aditya Xavier. > On 07-Apr-2018, at 8:55 AM, Christopher Collins wrote: > > Hi Aditya, > > On Sat, Apr 07, 2018 at 07:59:44AM +0530, Aditya Xavier wrote: >> Hi Christopher, >> >> That is the expected behaviour, however if you try running the sample app I >> gave you would notice the following >> After step 11, I.e initialise the os_mbuf by doing a os_mbuf_get from a >> mempool, the new value is overwritten on the previous value. >> >> I.e >> 1. Accessing the mbuf after doing a free chain, om_data still holds the >> value. >> 2. Initialising it again by doing a os_mbuf_get is not getting me a clean >> mbuf, rather it holds the previous value and om_mbuf_copyinto merely >> overwrites it. So incase the new string length is smaller, om_data would >> return wrong value. >> >> Am sorry if am not able to explain it properly however I would appreciate it >> if you can test the app once. > > I ran your app, and I see nothing unusual in the output. Here is what I > get: > >(gdb) r >Starting program: > > /mnt/data2/work/micosa/repos/mynewt-core/bin/targets/blinky-sim/app/apps/blinky/blinky.elf >uart0 at /dev/pts/16 >UART MBUF Created 1 to 1 >Received Value :- abc >Received Length :- 3 >Value after Reinit :- abc >Length after Reinit :- 0 >Received Value :- hello >Received Length :- 5 >Value after Reinit :- hello >Length after Reinit :- 0 >Received Value :- gagao >Received Length :- 4 >Value after Reinit :- gagao >Length after Reinit :- 0 > > To get this output, I typed the following strings into the console: > >abc >hello >gaga > > If I understand correctly, your concern is the following part of the > output: > >Received Value :- gagao >Received Length :- 4 >Value after Reinit :- gagao >Length after Reinit :- 0 > > Specifically, you are unsure why: > >* The first line contains "gagao" rather than "gaga". >* The third line contains "gagao" rather than "". > > Your program uses the `%s` format specifier to print the contents of an > mbuf. This is probably not what you want, for a number of reasons: > >* Mbuf contents are not typically null-terminated. >* Mbuf contents are not guaranteed to be contiguous (i.e., multiple > bufers may be chained). > > Here is a reliable, if inefficient, way to print an mbuf as a string: > >static void >print_mbuf(const struct os_mbuf *om) >{ >int i; > >for (; om != NULL; om = SLIST_NEXT(om, om_next)) { >for (i = 0; i < om->om_len; i++) { >putchar(om->om_data[i]); >} >} >} > > If you are sure the mbuf is not chained, then you don't need the outer > loop. > > Chris
Re: MBUF behaviour
Hi Christopher, That is the expected behaviour, however if you try running the sample app I gave you would notice the following After step 11, I.e initialise the os_mbuf by doing a os_mbuf_get from a mempool, the new value is overwritten on the previous value. I.e 1. Accessing the mbuf after doing a free chain, om_data still holds the value. 2. Initialising it again by doing a os_mbuf_get is not getting me a clean mbuf, rather it holds the previous value and om_mbuf_copyinto merely overwrites it. So incase the new string length is smaller, om_data would return wrong value. Am sorry if am not able to explain it properly however I would appreciate it if you can test the app once. Thanks, Aditya Xavier > On 07-Apr-2018, at 7:32 AM, Christopher Collins wrote: > > Hi Aditya, > >> On Fri, Apr 06, 2018 at 07:36:41PM +0530, Aditya Xavier wrote: >> Hi Mynewt Team, >> >> Please help me understand the behavior of MBUF. >> >> PFB the steps I did :- >> >> 1.os_mempool_init >> 2.os_mbuf_pool_init >> 3.Initialized a os_mbuf by os_mbuf_get >> 4.Triggered Console Reader. >> 5.os_mbuf_copyinto the console_buf into the os_mbuf >> 6.Did a eventq_put to get into a event callback. >> 7.Read os_mbuf value & os_mbuf len >> 8.os_mbuf_free_chain >> 9.Read os_mbuf value & os_mbuf len >> 10.Initialized a os_mbuf by os_mbuf_get >> 11.Repeat step 4 onwards. >> >> Problem :- >> In step 7, I read the previous string, however the length is correct. >> In step 9, I read the previous string, however the length is 0. > > `os_mbuf_free_chain` frees the mbuf chain back to its source pool. From > that point, accessing the mbuf via this pointer is an error. > > This is analogous to the following example: > >int *x = malloc(sizeof(*x)); >*x = 99; >free(x); >printf("*x = %d\n", *x); > > In other words, don't access something after you free it! :) You'll > need to allocate a new mbuf if you need one after freeing the first. > > Chris
Re: [RFC] Mesh uses multi advertising instances.
Hi Michał / Łukasz, I have been trying to understand the blemesh_shell, and I fail to understand how / where it is using the Advertisement extensions. Basically, could you point me towards the difference if I need to implement, in order to use blemesh instead. From what I gathered / understood after going through the code is that blemesh_shell basically allows various functions to be triggered through shell commands. Thanks, Aditya Xavier. > On 03-Apr-2018, at 3:54 PM, Michał Narajowski > wrote: > > Hi Aditya, > > Please set BLE_MESH: 1 and BLE_MESH_SHELL: 1 and you should be able to > use both btshell and mesh shell. Let us know how that works for you. > > Best regards > Michał > > 2018-04-03 7:56 GMT+02:00 Aditya Xavier : >> Hi Łukasz, >> >> Any pointers, as to what needs to be implemented from the blemesh_shell app ? >> >> >> Thanks, >> Aditya Xavier. >> >>> On 02-Apr-2018, at 11:34 PM, Łukasz Rymanowski >>> wrote: >>> >>> Second thought >>> >>> Aditya, >>> Since I did not test it a lot, would it be possible to give us feedback how >>> it works for you? >>> >>> Best >>> Lukasz >>> >>> >>> >>> >>> On Mon, Apr 2, 2018, 20:01 Łukasz Rymanowski >>> wrote: >>> >>>> Hi Aditya. >>>> >>>> On Mon, Apr 2, 2018, 19:14 Aditya Xavier wrote: >>>> >>>>> Hi Łukasz, >>>>> >>>>> Is there anything special required to get this working along with BLE ? >>>> >>>> >>>>> For e.g. would the btshell app code for ADV_EXT work along with mesh with >>>>> the provided patches ? >>>>> >>>> >>>> In addition to configuration mentioned in PR commit message, the btshell >>>> app would have to enable ble mesh and ble mesh shell (check blemesh_shell >>>> app for that) >>>> >>>>> >>>>> Mesh and BLE seems to compile however, am currently unable to get Mesh >>>>> working. >>>>> >>>>> Also, any reason why this was not accepted yet ? >>>>> >>>> >>>> People are busy with other stuff I guess. I think it will be merged >>>> eventually. >>>> >>>>> >>>>> >>>>> >>>>> Thanks, >>>>> Aditya Xavier. >>>>> >>>> >>>> Best >>>> Lukasz >>>> >>>> >>>>> >>>>>> On 20-Mar-2018, at 12:57 AM, Sterling Hughes < >>>>> sterling.hughes.pub...@gmail.com> wrote: >>>>>> >>>>>> +1 - this is great, thanks Lukasz! >>>>>> >>>>>> On 19 Mar 2018, at 6:36, Łukasz Rymanowski wrote: >>>>>> >>>>>>> Hi All, >>>>>>> >>>>>>> I saw people asking around about possibility to advertise with non-mesh >>>>>>> data while mesh is running on Mynewt. Well this is possible to do but >>>>> of >>>>>>> course it brings a lot of risk for mesh operations and especially for >>>>>>> friendship scenario. However I went ahead and added support for this in >>>>>>> Mynewt and I'm interested in how it works for you. >>>>>>> >>>>>>> So here is a PR which makes use of multi instances from BT5 Advertising >>>>>>> extensions and basically allows you to create additional instances >>>>> which >>>>>>> contains non-mesh data. >>>>>>> >>>>>>> https://github.com/apache/mynewt-nimble/pull/8 >>>>>>> >>>>>>> Instructions on how to enable it you can find in the commit message. >>>>>>> >>>>>>> Comments are welcome >>>>>>> >>>>>>> Best >>>>>>> Łukasz >>>>> >>>>> >>
Re: CBOR encoding problems.
Never mind, I think I got it working. The problem it seems is that the Array has to be a const or declared inside the method. Even though the compiler doesn’t throw a warning / error, thats what it needs. PS, doing a os_mbuf_clear_chain and then doing os_mbuf_get is that an efficient way to do this ? Thanks, Aditya Xavier. > On 03-Apr-2018, at 1:19 PM, Aditya Xavier wrote: > > Hi Andrzej, > > I have implemented the changes you suggested, however cbor_read_mbuf_attrs > causes a crash. > > Side note, I don’t think, the problem has ever been regarding cbor decoding. > Rather its about cbor encoding, so am not sure how much cbor_read_mbuf_attrs > would help. > > Also, no mater what method I use, am unable to get the cbor_int aray printed. > > Thanks, > Aditya Xavier. > > > >> On 03-Apr-2018, at 11:25 AM, Aditya Xavier wrote: >> >> Thanks Andrzej, >> >> Yeah I have made the changes to the app, to get it working ( Didn’t test the >> BLE message Truncation & MSYS issues yet). >> >> Regarding your suggestion about using cbor_read_mbuf_attrs(), yes it does >> makes sense. >> >> However, is there any way to use a mbuf as a scratchpad ? i.e. write >> something to it, erase it / overwrite on it, without re-initializing it ? >> >> Because, even if am doing a os_mbuf_free / os_mbuf_free_chain, am still able >> to access the previous values. >> >> Thanks, >> Aditya Xavier. >> >> >>> On 02-Apr-2018, at 11:34 PM, Andrzej Kaczmarek >>> wrote: >>> >>> Hi Aditya, >>> >>> On Sun, Apr 1, 2018 at 3:51 PM, Aditya Xavier wrote: >>>> Hi Andrzej, >>>> >>>> PFB my the test code, this is a torn down version of the code we were >>>> trying to do. >>>> >>>> However it should be good enough for you to understand the objective and >>>> the issues at hand. >>>> >>>> I did not personally try the code myself, I would be able to do so and let >>>> you know the same tomorrow. >>> >>> I checked the code and there are some issues wrt to mbuf handling >>> which can cause problems. >>> >>> Firstly, I don't see where you actually initialize cbor_codex_mbuf >>> with proper mbuf as you neither received it from somewhere or call >>> os_msys_get()/os_mbuf_get() to get it from a pool. >>> Calling net_buf_simple_init() does not work here since it only >>> initializes existing mbuf and you probably should not use it at all >>> unless you're using this code for mesh. In case of mesh you can get >>> valid mbuf by using NET_BUF_SIMPLE(). I assume this looks a bit >>> different in your app as this sample app will most likely crash during >>> startup. >>> >>> Secondly, this probably causes data truncation: >>> cbor_decode_action((char *)cbor_codex_mbuf->om_data, >>> cbor_codex_mbuf->om_len); >>> Basically this way you pass contents of first mbuf in chain to >>> decoding function, not complete chain. Internally this calls >>> cbor_read_flat_attrs() but when working with mbufs you should use >>> cbor_read_mbuf_attrs() instead and pass mbuf instead of its data. >>> >>>> Thanks, >>>> Aditya Xavier. >>> >>> Best, >>> Andrzej >>> >>>> >>>> >>>>> On 31-Mar-2018, at 3:06 PM, Andrzej Kaczmarek >>>>> wrote: >>>>> >>>>> Hi Aditya, >>>>> >>>>> On Sat, Mar 31, 2018 at 5:51 AM, Aditya Xavier >>>>> wrote: >>>>>> Increasing MSYS_1_BLOCK_COUNT to 30 gets it to work, but if I increase >>>>>> it to 40 it doesn’t. >>>>>> Block size being 110. >>>>>> >>>>>> Any reasoning behind this pattern? >>>>> >>>>> This is strange. Can you post some piece of code to show how you handle >>>>> this? >>>>> >>>>>> Also what would is behaviour of os_mbuf_free? Do I need to re init it >>>>>> again? >>>>> >>>>> Not sure what you mean by "reinit". Calling os_mbuf_free() releases >>>>> mbuf back to pool and it should no longer be used. You should call >>>>> os_mbuf_get() or os_msys_get() to get new mbuf from appropriate pool. >>>>> Also, if your CBOR stream exceeds size of block then you will have >>>>> chain of
Re: [RFC] Mesh uses multi advertising instances.
Hi Łukasz, Any pointers, as to what needs to be implemented from the blemesh_shell app ? Thanks, Aditya Xavier. > On 02-Apr-2018, at 11:34 PM, Łukasz Rymanowski > wrote: > > Second thought > > Aditya, > Since I did not test it a lot, would it be possible to give us feedback how > it works for you? > > Best > Lukasz > > > > > On Mon, Apr 2, 2018, 20:01 Łukasz Rymanowski > wrote: > >> Hi Aditya. >> >> On Mon, Apr 2, 2018, 19:14 Aditya Xavier wrote: >> >>> Hi Łukasz, >>> >>> Is there anything special required to get this working along with BLE ? >> >> >>> For e.g. would the btshell app code for ADV_EXT work along with mesh with >>> the provided patches ? >>> >> >> In addition to configuration mentioned in PR commit message, the btshell >> app would have to enable ble mesh and ble mesh shell (check blemesh_shell >> app for that) >> >>> >>> Mesh and BLE seems to compile however, am currently unable to get Mesh >>> working. >>> >>> Also, any reason why this was not accepted yet ? >>> >> >> People are busy with other stuff I guess. I think it will be merged >> eventually. >> >>> >>> >>> >>> Thanks, >>> Aditya Xavier. >>> >> >> Best >> Lukasz >> >> >>> >>>> On 20-Mar-2018, at 12:57 AM, Sterling Hughes < >>> sterling.hughes.pub...@gmail.com> wrote: >>>> >>>> +1 - this is great, thanks Lukasz! >>>> >>>> On 19 Mar 2018, at 6:36, Łukasz Rymanowski wrote: >>>> >>>>> Hi All, >>>>> >>>>> I saw people asking around about possibility to advertise with non-mesh >>>>> data while mesh is running on Mynewt. Well this is possible to do but >>> of >>>>> course it brings a lot of risk for mesh operations and especially for >>>>> friendship scenario. However I went ahead and added support for this in >>>>> Mynewt and I'm interested in how it works for you. >>>>> >>>>> So here is a PR which makes use of multi instances from BT5 Advertising >>>>> extensions and basically allows you to create additional instances >>> which >>>>> contains non-mesh data. >>>>> >>>>> https://github.com/apache/mynewt-nimble/pull/8 >>>>> >>>>> Instructions on how to enable it you can find in the commit message. >>>>> >>>>> Comments are welcome >>>>> >>>>> Best >>>>> Łukasz >>> >>>
Re: CBOR encoding problems.
Thanks Andrzej, Yeah I have made the changes to the app, to get it working ( Didn’t test the BLE message Truncation & MSYS issues yet). Regarding your suggestion about using cbor_read_mbuf_attrs(), yes it does makes sense. However, is there any way to use a mbuf as a scratchpad ? i.e. write something to it, erase it / overwrite on it, without re-initializing it ? Because, even if am doing a os_mbuf_free / os_mbuf_free_chain, am still able to access the previous values. Thanks, Aditya Xavier. > On 02-Apr-2018, at 11:34 PM, Andrzej Kaczmarek > wrote: > > Hi Aditya, > > On Sun, Apr 1, 2018 at 3:51 PM, Aditya Xavier wrote: >> Hi Andrzej, >> >> PFB my the test code, this is a torn down version of the code we were trying >> to do. >> >> However it should be good enough for you to understand the objective and the >> issues at hand. >> >> I did not personally try the code myself, I would be able to do so and let >> you know the same tomorrow. > > I checked the code and there are some issues wrt to mbuf handling > which can cause problems. > > Firstly, I don't see where you actually initialize cbor_codex_mbuf > with proper mbuf as you neither received it from somewhere or call > os_msys_get()/os_mbuf_get() to get it from a pool. > Calling net_buf_simple_init() does not work here since it only > initializes existing mbuf and you probably should not use it at all > unless you're using this code for mesh. In case of mesh you can get > valid mbuf by using NET_BUF_SIMPLE(). I assume this looks a bit > different in your app as this sample app will most likely crash during > startup. > > Secondly, this probably causes data truncation: > cbor_decode_action((char *)cbor_codex_mbuf->om_data, cbor_codex_mbuf->om_len); > Basically this way you pass contents of first mbuf in chain to > decoding function, not complete chain. Internally this calls > cbor_read_flat_attrs() but when working with mbufs you should use > cbor_read_mbuf_attrs() instead and pass mbuf instead of its data. > >> Thanks, >> Aditya Xavier. > > Best, > Andrzej > >> >> >>> On 31-Mar-2018, at 3:06 PM, Andrzej Kaczmarek >>> wrote: >>> >>> Hi Aditya, >>> >>> On Sat, Mar 31, 2018 at 5:51 AM, Aditya Xavier wrote: >>>> Increasing MSYS_1_BLOCK_COUNT to 30 gets it to work, but if I increase it >>>> to 40 it doesn’t. >>>> Block size being 110. >>>> >>>> Any reasoning behind this pattern? >>> >>> This is strange. Can you post some piece of code to show how you handle >>> this? >>> >>>> Also what would is behaviour of os_mbuf_free? Do I need to re init it >>>> again? >>> >>> Not sure what you mean by "reinit". Calling os_mbuf_free() releases >>> mbuf back to pool and it should no longer be used. You should call >>> os_mbuf_get() or os_msys_get() to get new mbuf from appropriate pool. >>> Also, if your CBOR stream exceeds size of block then you will have >>> chain of mbufs which should be freed using os_mbuf_free_chain() >>> instead. Basically, if you're not sure whether your mbuf is just a >>> single mbuf or chain of mbufs, you can always use os_mbuf_free_chain() >>> instead of os_mbuf_free(). >>> >>>> Sent from my iPhone >>>> >>>>> On 30-Mar-2018, at 1:58 AM, Christopher Collins wrote: >>>>> >>>>>> 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 -&g
Re: [RFC] Mesh uses multi advertising instances.
Hi Łukasz, Is there anything special required to get this working along with BLE ? For e.g. would the btshell app code for ADV_EXT work along with mesh with the provided patches ? Mesh and BLE seems to compile however, am currently unable to get Mesh working. Also, any reason why this was not accepted yet ? Thanks, Aditya Xavier. > On 20-Mar-2018, at 12:57 AM, Sterling Hughes > wrote: > > +1 - this is great, thanks Lukasz! > > On 19 Mar 2018, at 6:36, Łukasz Rymanowski wrote: > >> Hi All, >> >> I saw people asking around about possibility to advertise with non-mesh >> data while mesh is running on Mynewt. Well this is possible to do but of >> course it brings a lot of risk for mesh operations and especially for >> friendship scenario. However I went ahead and added support for this in >> Mynewt and I'm interested in how it works for you. >> >> So here is a PR which makes use of multi instances from BT5 Advertising >> extensions and basically allows you to create additional instances which >> contains non-mesh data. >> >> https://github.com/apache/mynewt-nimble/pull/8 >> >> Instructions on how to enable it you can find in the commit message. >> >> Comments are welcome >> >> Best >> Łukasz
Re: CBOR encoding problems.
Increasing MSYS_1_BLOCK_COUNT to 30 gets it to work, but if I increase it to 40 it doesn’t. Block size being 110. Any reasoning behind this pattern? Also what would is behaviour of os_mbuf_free? Do I need to re init it again? Sent from my iPhone > On 30-Mar-2018, at 1:58 AM, Christopher Collins wrote: > >> 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.
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. Thanks, Aditya Xavier. > On 29-Mar-2018, at 9:34 PM, Christopher Collins wrote: > > 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.
CBOR encoding problems.
Hi Mynewt Team, Am facing some weird problem trying to use CBOR encoding and decoding. The structure am trying to do is the following. Decode :- {“field1”:1, “field2”:2, “field3”:[{“field4”:4,”field5”:5}]} Encode :- {“field1”:1, “field2”:2, “field3”:[{“field4”:4,”field5”:[1,2,3,4,5]}]} Decoding works, however when am trying to encode it doesn’t work. Now heres the kicker, Encoding works every single time when am trying to trigger it from a Task. 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. Thanks, Aditya Xavier.
Re: Multicast messaging and group messaging
Thanks Łukasz ! That helped. Would try that and would ping back incase of problems. Thanks, Aditya Xavier. > On 08-Mar-2018, at 6:18 PM, Łukasz Rymanowski > wrote: > > Hi Aditiya, > > Alright, there is no really documentation but you can try it out on our > btmesh_shell app. > > There is shell.c file which expose configuration client which you can use > for testing - e.g. you can subscribe virtual address. > You can also trigger sending messages to devices. By playing with "dst" > command you probably should be able to set destination to some group. > > Btw. Since we do not support provisioner role, there is command > "provision" which sets fixed keys so you can create mesh network out of > couple of nodes without the actuall provisioner. > > Best > Łukasz > > > On 8 March 2018 at 12:25, Aditya Xavier wrote: > >> Thanks Łukasz, >> >> Yes I am aware its possible as per the ble mesh spec, wanted to know if >> there is any documentation / example of using and registering a group >> address. >> >> Thanks, >> Aditya Xavier >> >> >> >> >>> On 08-Mar-2018, at 4:37 PM, Łukasz Rymanowski < >> lukasz.rymanow...@codecoup.pl> wrote: >>> >>> Hello Aditya, >>> >>> It should be possible to do so with a publish model. Group address or >>> virtual address should help here (see Mesh spec) >>> >>> Best >>> Łukasz >>> >>> On 8 March 2018 at 10:39, Aditya Xavier wrote: >>> >>>> Hello Mynewt Team, >>>> >>>> >>>> Is it possible to send a broadcast message by one of the devices present >>>> in the mesh ? >>>> >>>> For e.g. to broadcast a event which happened ? Something like push >>>> notification instead of continuously polling for it by a client. >>>> >>>> Thanks, >>>> Aditya Xavier. >> >>
Re: Multicast messaging and group messaging
Thanks Łukasz, Yes I am aware its possible as per the ble mesh spec, wanted to know if there is any documentation / example of using and registering a group address. Thanks, Aditya Xavier > On 08-Mar-2018, at 4:37 PM, Łukasz Rymanowski > wrote: > > Hello Aditya, > > It should be possible to do so with a publish model. Group address or > virtual address should help here (see Mesh spec) > > Best > Łukasz > > On 8 March 2018 at 10:39, Aditya Xavier wrote: > >> Hello Mynewt Team, >> >> >> Is it possible to send a broadcast message by one of the devices present >> in the mesh ? >> >> For e.g. to broadcast a event which happened ? Something like push >> notification instead of continuously polling for it by a client. >> >> Thanks, >> Aditya Xavier.
Multicast messaging and group messaging
Hello Mynewt Team, Is it possible to send a broadcast message by one of the devices present in the mesh ? For e.g. to broadcast a event which happened ? Something like push notification instead of continuously polling for it by a client. Thanks, Aditya Xavier.
Re: JSON Encoding and Decoding
Hi Mynewt Team, I have been trying to decode JSON using the provided json decoding library. This particular library seems quite similar to mJSON, however there are difference regarding json_read_object etc. Also unlike mJSON, there is a requirement to write few more methods :- char jbuf_read_next(struct json_buffer *jb); char jbuf_read_prev(struct json_buffer *jb); int jbuf_readn(struct json_buffer *jb, char *buf, int size); int write(void *buf, char* data, int len); void buf_init(struct jbuf *ptjb, char *string); At least thats what I gathered as per the test example. (Am I correct in this thought ?) However, am unable to get the following code working. /*--- #define MAXCHANNELS 72 long long int PRN[MAXCHANNELS]; long long int elevation[MAXCHANNELS]; long long int azimuth[MAXCHANNELS]; int visible; struct jbuf tjb; const struct json_attr_t sat_attrs[] = { { .attribute = "PRN", .type = t_integer, .addr.integer = PRN }, { .attribute = "el", .type = t_integer, .addr.integer = elevation }, { .attribute = "az", .type = t_integer, .addr.integer = azimuth }, {NULL}, }; const struct json_attr_t json_attrs_sky[] = { { .attribute = "class", .type = t_check, .dflt.check = "SKY" }, { .attribute = "satellites", .type = t_array, .addr.array = { .element_type = t_structobject, .arr.objects.subtype=sat_attrs, .maxlen = MAXCHANNELS, .count = &visible } }, {NULL}, }; int fetch_map(const char *map){ // int i; buf_init(&tjb,(char *) map); console_printf("Buffer Initiated\n"); json_read_object(&tjb.json_buf, json_attrs_sky); console_printf("JSON Read %d!\n", visible); // for (i = 0; i < visible; i++){ console_printf("PRN = %lld, elevation = %lld, azimuth = %lld\n", PRN[0], elevation[0], azimuth[0]); console_printf("PRN = %lld, elevation = %lld, azimuth = %lld\n", PRN[1], elevation[1], azimuth[1]); // } printf(“Completed\n"); return 1; } */ Calling this method using fetch_map(R"=({"class":"SKY","satellites":[{"PRN":10,"el":45,"az":196,"used":true},{"PRN":29,"el":67,"az":310,"used":true}]})=“); Am getting the following response :- 01 Buffer Initiated 02 JSON Read 0! 03 PRN = 10, elevation = 45, azimuth = 196 04 PRN = 0, elevation = 0, azimuth = 0 Completed Which means its not populating the count value in the array as it should. It is also quite possible am completely wrong about it :) Thanks, Aditya Xavier. > On 28-Feb-2018, at 10:49 PM, Aditya Xavier wrote: > > I have been trying to use the same example as is; assuming that apache was > also utilizing mJSON. > > However, it seems there are quite some differences from that library. For > e.g. > > .addr.integer = PRN is no longer valid. > > It is now > .arr.integers.store = PRN > > And json_read_object requires a struct json_buffer *jb instead of a char > array. > > This struct has to be populated using user method etc. There are multiple > differences from the MicroJSON implementation. > > Isn’t there some good documentation on this ? > > >> On 28-Feb-2018, at 10:39 PM, Christopher Collins wrote: >> >> Hi Aditya, >> >> On Wed, Feb 28, 2018 at 06:35:04PM +0530, Aditya Xavier wrote: >>> Thanks got Encoding working for the required JSON. >>> >>> Any pointers on how to get the decoding working ? >>> >>> From the example >>> https://github.com/apache/mynewt-core/blob/master/encoding/json/test/src/testcases/json_simple_decode.c >>> >>> <https://github.com/apache/mynewt-core/blob/master/encoding/json/test/src/testcases/json_simple_decode.c> >>> >>> Am able to decode upto name2 only. >>> >>> {“name1": 1,”name2": “value2”, “name3”: [{“name4”: 2, “name5”: 3}]}; >>> >>> Please let me know the Structure for Array of objects. >> >> Example 2 in the microjson document >> (http://www.catb.org/~esr/microjson/microjson.html) does something >> similar, so I would take a look at that. This example is under the >> "Compound Value Types" heading. >> >> Chris >
Re: JSON Encoding and Decoding
I have been trying to use the same example as is; assuming that apache was also utilizing mJSON. However, it seems there are quite some differences from that library. For e.g. .addr.integer = PRN is no longer valid. It is now .arr.integers.store = PRN And json_read_object requires a struct json_buffer *jb instead of a char array. This struct has to be populated using user method etc. There are multiple differences from the MicroJSON implementation. Isn’t there some good documentation on this ? > On 28-Feb-2018, at 10:39 PM, Christopher Collins wrote: > > Hi Aditya, > > On Wed, Feb 28, 2018 at 06:35:04PM +0530, Aditya Xavier wrote: >> Thanks got Encoding working for the required JSON. >> >> Any pointers on how to get the decoding working ? >> >> From the example >> https://github.com/apache/mynewt-core/blob/master/encoding/json/test/src/testcases/json_simple_decode.c >> >> <https://github.com/apache/mynewt-core/blob/master/encoding/json/test/src/testcases/json_simple_decode.c> >> >> Am able to decode upto name2 only. >> >> {“name1": 1,”name2": “value2”, “name3”: [{“name4”: 2, “name5”: 3}]}; >> >> Please let me know the Structure for Array of objects. > > Example 2 in the microjson document > (http://www.catb.org/~esr/microjson/microjson.html) does something > similar, so I would take a look at that. This example is under the > "Compound Value Types" heading. > > Chris
Re: JSON Encoding and Decoding
Thanks got Encoding working for the required JSON. Any pointers on how to get the decoding working ? From the example https://github.com/apache/mynewt-core/blob/master/encoding/json/test/src/testcases/json_simple_decode.c <https://github.com/apache/mynewt-core/blob/master/encoding/json/test/src/testcases/json_simple_decode.c> Am able to decode upto name2 only. {“name1": 1,”name2": “value2”, “name3”: [{“name4”: 2, “name5”: 3}]}; Please let me know the Structure for Array of objects. struct json_attr_t test_attr[3] = { [0] = { .attribute = “name1", .type = t_integer, .addr.integer = &int_val, .nodefault = true }, [1] = { .attribute = “name2", .type = t_string, .addr.string = string1, .nodefault = true, .len = sizeof(string1) }, [2] = { .attribute = “name3", .type = t_array, .addr.array = { .element_type = t_integer, .arr.integers.store = intarr, .maxlen = sizeof intarr / sizeof intarr[0], .count = &array_count, }, .nodefault = true, .len = sizeof(intarr) }, [6] = { .attribute = NULL } }; > On 28-Feb-2018, at 2:05 PM, marko kiiskila wrote: > > > >> On Feb 28, 2018, at 10:10 AM, Aditya Xavier wrote: >> >> Yes, that was derp from my end. >> >> Any clue on how to encode the JSON structure I mentioned ? >> >> Is this method correct ? > > You need to initialize the encoder; it needs to be told where to write > the encoded data. Specifically, you need to at least fill in je_write > function pointer. This is who’ll get the stream of encoded data. > > Take a look at unit test @ > encoding/json/test/src/testcases/json_simple_encode.c > > Otherwise it looks pretty good, based on my cursory inspection. > >> >> struct json_encoder *encoder, *module; >> struct json_value data; >> >> memset(&encoder, 0, sizeof(encoder)); >> memset(&module, 0, sizeof(module)); >> >> json_encode_object_start(encoder); >> >> JSON_VALUE_INT(&data, 1); >> json_encode_object_entry(encoder, “name1", &data); >> >> JSON_VALUE_STRING(&data, “value2"); >> json_encode_object_entry(encoder, “name2", &data); >> >> json_encode_array_name(encoder, “name3"); >> json_encode_array_start(encoder); >> >> if(getType){ >> json_encode_object_start(module); >> >> JSON_VALUE_INT(&data, 4); >> json_encode_object_entry(module, “name4", &data); >> >> JSON_VALUE_INT(&data, 5); >> json_encode_object_entry(module, “name5", &data); >> >> json_encode_object_finish(module); >> } >> >> json_encode_array_finish(encoder); >> json_encode_object_finish(encoder); >> >> >> >>> On 28-Feb-2018, at 1:18 PM, marko kiiskila wrote: >>> >>> Hi Aditya, >>> >>>> On Feb 28, 2018, at 9:26 AM, Aditya Xavier wrote: >>>> >>>> HI Mynewt Team, >>>> >>>>Wanted some assistance on how to encode and decode the following JSON >>>> string. >>>> >>>>{“name1":1,”name2”:"value2”,"name3":[{“name4":1,”name5":5}]} >>>> >>>>Because of sparse documentation, I used the Test sample; however am >>>> stuck with encoding an array of objects. >>>> >>> >>> … >>> >>>> >>>>I followed the example provided at >>>> https://mynewt.apache.org/latest/os/modules/json/json_encode_object_entry >>>> <https://mynewt.apache.org/latest/os/modules/json/json_encode_object_entry> >>>> >>>>And it gives me error :- >>>>error: implicit declaration of function 'json_encode_object_start' >>>> >>>> Thanks, >>>> Aditya Xavier. >>> >>> you need to #include to see function/macro declarations. >>> >> >
Re: JSON Encoding and Decoding
Yes, that was derp from my end. Any clue on how to encode the JSON structure I mentioned ? Is this method correct ? struct json_encoder *encoder, *module; struct json_value data; memset(&encoder, 0, sizeof(encoder)); memset(&module, 0, sizeof(module)); json_encode_object_start(encoder); JSON_VALUE_INT(&data, 1); json_encode_object_entry(encoder, “name1", &data); JSON_VALUE_STRING(&data, “value2"); json_encode_object_entry(encoder, “name2", &data); json_encode_array_name(encoder, “name3"); json_encode_array_start(encoder); if(getType){ json_encode_object_start(module); JSON_VALUE_INT(&data, 4); json_encode_object_entry(module, “name4", &data); JSON_VALUE_INT(&data, 5); json_encode_object_entry(module, “name5", &data); json_encode_object_finish(module); } json_encode_array_finish(encoder); json_encode_object_finish(encoder); > On 28-Feb-2018, at 1:18 PM, marko kiiskila wrote: > > Hi Aditya, > >> On Feb 28, 2018, at 9:26 AM, Aditya Xavier wrote: >> >> HI Mynewt Team, >> >> Wanted some assistance on how to encode and decode the following JSON >> string. >> >> {“name1":1,”name2”:"value2”,"name3":[{“name4":1,”name5":5}]} >> >> Because of sparse documentation, I used the Test sample; however am >> stuck with encoding an array of objects. >> > > … > >> >> I followed the example provided at >> https://mynewt.apache.org/latest/os/modules/json/json_encode_object_entry >> <https://mynewt.apache.org/latest/os/modules/json/json_encode_object_entry> >> >> And it gives me error :- >> error: implicit declaration of function 'json_encode_object_start' >> >> Thanks, >> Aditya Xavier. > > you need to #include to see function/macro declarations. >
JSON Encoding and Decoding
HI Mynewt Team, Wanted some assistance on how to encode and decode the following JSON string. {“name1":1,”name2”:"value2”,"name3":[{“name4":1,”name5":5}]} Because of sparse documentation, I used the Test sample; however am stuck with encoding an array of objects. struct json_encoder *encoder, *module; struct json_value value; json_encode_object_start(encoder); JSON_VALUE_INT(value, 1); json_encode_object_entry(encoder, “name1", value); JSON_VALUE_STRING(value, “value2”); json_encode_object_entry(encoder, “name2", value); json_encode_array_name(encoder, “name3”); json_encode_array_start(encoder); json_encode_object_start(module); //Is this correct ? JSON_VALUE_INT(value, 1); json_encode_object_entry(encoder, “name4", value); JSON_VALUE_INT(&value, 1); json_encode_object_entry(encoder, “name5", value); json_encode_object_finish(module); // How to insert this object into the array ? json_encode_array_finish(encoder); json_encode_object_finish(encoder); I followed the example provided at https://mynewt.apache.org/latest/os/modules/json/json_encode_object_entry <https://mynewt.apache.org/latest/os/modules/json/json_encode_object_entry> And it gives me error :- error: implicit declaration of function 'json_encode_object_start' Thanks, Aditya Xavier.
Re: BLEMESH PB GATT
Perfect got it to run.. > On 23-Feb-2018, at 6:13 PM, Andrzej Kaczmarek > wrote: > > Hi Aditya, > > Seems like you're using Mynewt 1.3.0 release and probably see issue > fixed by following commit on master branch: > https://github.com/apache/mynewt-core/commit/0fd8239b7f914ddae77ac396bfce288fd6bc5b5f > > Please apply this change to your tree and check if this solves your problem. > > Best regards, > Andrzej > > >> On Fri, Feb 23, 2018 at 1:17 PM, Aditya Xavier wrote: >> Thanks for quick reply ! >> >> With BLE_MESH_PB_GATT: FALSE and BLE_MESH_GATT_PROXY: FALSE, build fails for >> the app. >> >> Error: repos/apache-mynewt-core/net/nimble/host/mesh/src/proxy.c: In >> function 'proxy_send': >> repos/apache-mynewt-core/net/nimble/host/mesh/src/proxy.c:852:21: error: >> unused variable 'om' [-Werror=unused-variable] >> struct os_mbuf *om; >> ^~ >> At top level: >> repos/apache-mynewt-core/net/nimble/host/mesh/src/proxy.c:126:3: error: >> 'gatt_svc' defined but not used [-Werror=unused-variable] >> } gatt_svc = MESH_GATT_NONE; >> ^~~~ >> repos/apache-mynewt-core/net/nimble/host/mesh/src/proxy.c:95:41: error: >> 'proxy_adv_param' defined but not used [-Werror=unused-variable] >> static const struct ble_gap_adv_params *proxy_adv_param = &fast_adv_param; >> ^~~ >> repos/apache-mynewt-core/net/nimble/host/mesh/src/proxy.c:83:40: error: >> 'slow_adv_param' defined but not used [-Werror=unused-const-variable=] >> static const struct ble_gap_adv_params slow_adv_param = { >>^~ >> cc1: all warnings being treated as errors >> >> With BLE_MESH_PB_GATT: “0” and BLE_MESH_GATT_PROXY: “0”, build is >> successful. However, device restarts. >> >> 00 Unhandled interrupt (2), exception sp 0x20001280 >> 00 r0:0x r1:0x r2:0x8000 r3:0xe000ed00 >> 00 r4:0x00019a3f r5:0x r6:0x r7:0x >> 00 r8:0x r9:0x r10:0x r11:0x >> 00 r12:0x0000 lr:0x8add pc:0x8aec psr:0x6100 >> 00 ICSR:0x00421802 HFSR:0x CFSR:0x >> 00 BFAR:0xe000ed38 MMFAR:0xe000ed34 >> 00 Assert @ 0x19a3f >> >> >> >>> On 23-Feb-2018, at 5:26 PM, Andrzej Kaczmarek >>> wrote: >>> >>> Hi Aditya, >>> >>>> On Fri, Feb 23, 2018 at 12:50 PM, Aditya Xavier >>>> wrote: >>>> Hi Mynewt Team, >>>> >>>> >>>> I have been going through and testing the BLEMESH sample app. >>>> >>>> Turning on only one device, which does not have BLE_MESH_GATT_PROXY >>>> & BLE_MESH_PB_GATT flag, still allows the Silicon Labs application to scan >>>> and connect to it. >>>> >>>> Correct me if am wrong, but I thought only those devices with >>>> BLE_MESH_PB_GATT should be scannable / connectable by the Silicon Labs app. >>>> >>>> Am I missing something ? >>>> >>>> For reference am using the master branch. >>> >>> Did you disable GATT PB and proxy flags in your target settings? If >>> not then these are enabled by default in Mesh package so blemesh will >>> work with app from Silicon Labs. >>> >>>> Thanks and Regards, >>>> Aditya Xavier >>> >>> Best regards, >>> Andrzej >>
Re: BLEMESH PB GATT
Thanks for quick reply ! With BLE_MESH_PB_GATT: FALSE and BLE_MESH_GATT_PROXY: FALSE, build fails for the app. Error: repos/apache-mynewt-core/net/nimble/host/mesh/src/proxy.c: In function 'proxy_send': repos/apache-mynewt-core/net/nimble/host/mesh/src/proxy.c:852:21: error: unused variable 'om' [-Werror=unused-variable] struct os_mbuf *om; ^~ At top level: repos/apache-mynewt-core/net/nimble/host/mesh/src/proxy.c:126:3: error: 'gatt_svc' defined but not used [-Werror=unused-variable] } gatt_svc = MESH_GATT_NONE; ^~~~ repos/apache-mynewt-core/net/nimble/host/mesh/src/proxy.c:95:41: error: 'proxy_adv_param' defined but not used [-Werror=unused-variable] static const struct ble_gap_adv_params *proxy_adv_param = &fast_adv_param; ^~~ repos/apache-mynewt-core/net/nimble/host/mesh/src/proxy.c:83:40: error: 'slow_adv_param' defined but not used [-Werror=unused-const-variable=] static const struct ble_gap_adv_params slow_adv_param = { ^~ cc1: all warnings being treated as errors With BLE_MESH_PB_GATT: “0” and BLE_MESH_GATT_PROXY: “0”, build is successful. However, device restarts. 00 Unhandled interrupt (2), exception sp 0x20001280 00 r0:0x r1:0x r2:0x8000 r3:0xe000ed00 00 r4:0x00019a3f r5:0x r6:0x r7:0x 00 r8:0x r9:0x r10:0x r11:0x 00 r12:0x lr:0x8add pc:0x8aec psr:0x6100 00 ICSR:0x00421802 HFSR:0x CFSR:0x 00 BFAR:0xe000ed38 MMFAR:0xe000ed34 00 Assert @ 0x19a3f > On 23-Feb-2018, at 5:26 PM, Andrzej Kaczmarek > wrote: > > Hi Aditya, > > On Fri, Feb 23, 2018 at 12:50 PM, Aditya Xavier wrote: >> Hi Mynewt Team, >> >> >>I have been going through and testing the BLEMESH sample app. >> >>Turning on only one device, which does not have BLE_MESH_GATT_PROXY & >> BLE_MESH_PB_GATT flag, still allows the Silicon Labs application to scan and >> connect to it. >> >>Correct me if am wrong, but I thought only those devices with >> BLE_MESH_PB_GATT should be scannable / connectable by the Silicon Labs app. >> >>Am I missing something ? >> >>For reference am using the master branch. > > Did you disable GATT PB and proxy flags in your target settings? If > not then these are enabled by default in Mesh package so blemesh will > work with app from Silicon Labs. > >> Thanks and Regards, >> Aditya Xavier > > Best regards, > Andrzej
BLEMESH PB GATT
Hi Mynewt Team, I have been going through and testing the BLEMESH sample app. Turning on only one device, which does not have BLE_MESH_GATT_PROXY & BLE_MESH_PB_GATT flag, still allows the Silicon Labs application to scan and connect to it. Correct me if am wrong, but I thought only those devices with BLE_MESH_PB_GATT should be scannable / connectable by the Silicon Labs app. Am I missing something ? For reference am using the master branch. Thanks and Regards, Aditya Xavier
Re: Information regarding blemesh implementation
Thanks for explaining.. Yes I am experimenting, and have create a different vendor module to test the same. However, am still confused about the following aspects.. From my understanding, in BLE; we can transfer data upto 23 bytes in a single packet. Incase I want to read all the 20 bytes into a buffer and then process the same.. for e.g. receive a JSON String to parse, would the following approach be correct ? In vnd_command_set char value[]; Char data_length for(int i = 0; i < = buf->om_len; i++){ value[i] = buf->om_data[i]; } data_length = buf->om_len; Or should I be using os_mbuf_pullup ? And would the status message use os_mbuf_append(om, &val, sizeof(val)); inorder to push the value into the buffer ? It would be extremely helpful if you could let me know the method to retrieve and push a large string into the mbuf. > On 02-Jan-2018, at 8:20 PM, Łukasz Rymanowski > wrote: > > Hi, > > On 2 January 2018 at 11:30, Aditya Xavier wrote: >> Thanks, I think I have a better understanding of how this works now. >> >> So, in order to receive a String / byte array instead of a single byte; am I >> correct that I would need to make the following changes ? > > As you probably know, you should create own model and define own > operation opcodes instead of using on/off model, but I understand you > are doing some experiments which is fine >> >> 1. In Status function.. >> >>Line :- 172 >>struct os_mbuf *msg = NET_BUF_SIMPLE(3); // Change this to a higher >> number ? > > Function gen_onoff_status() (refered above) shows how to send message > over the model as a response to some device (address already in ctx) > In on/off model we have there 2 octets for opcode and one for status. > So you can play around here as you suggested above. > >> >> 2. In Set Function >> >>Line :- 203 >>gen_on_off_state = buf->om_data[0]; // Retrieve more data than only >> the 0th position in the array ? > > Buf is struct os_mbuf * and to see how to use it I recommend to read > this https://mynewt.apache.org/v1_0_0/os/core_os/mbuf/mbuf/ > In general buf->om_data points to data sent by remote device. > >> >> 3. Am not sure whats the purpose of net_buf_simple_pull_le16 etc are.. >> Would I need that for e.g. being utilised in Level.. >>level = (int16_t) net_buf_simple_pull_le16(buf); > > Level is 2 octet value and according to Mesh spec it is sent in LE > order. This helper decodes this and also moves data pointer in buf by > 2. > >> >> If I did miss something or completely wrong about it.. please do let me know. >> >> Thanks, >> Aditya Xavier. >> > > Best > \Łukasz >> >> >> >>> On 29-Dec-2017, at 5:34 PM, Łukasz Rymanowski >>> wrote: >>> >>> Hi, >>> >>> On 29 December 2017 at 07:22, Aditya Xavier wrote: >>>> Hello, am I correct in my understanding that the BLE Mesh implementation >>>> would require us to follow one of the Models as specified? >>> You need to create model, but you are not limited to the one specified by >>> BT SIG >>> >>>> >>>> For e.g. in my case I need to implement a REST client over BLE Mesh. I >>>> believe this can be easily on Bluetooth, however am not sure how to do so >>>> on blemesh. >>> >>> Probably you need to design your own model for this. In blemesh >>> application in main.c you can find example of vendor model which >>> implements generic on/off but you can implement your own one. >>> >>>> >>>> Please do point me in the right direction if I missed something. >>>> >>>> Thanks, >>>> Aditya Xavier. >>> >>> Hope that helps >>> >>> Łukasz >>
Re: Information regarding blemesh implementation
Thanks, I think I have a better understanding of how this works now. So, in order to receive a String / byte array instead of a single byte; am I correct that I would need to make the following changes ? 1. In Status function.. Line :- 172 struct os_mbuf *msg = NET_BUF_SIMPLE(3); // Change this to a higher number ? 2. In Set Function Line :- 203 gen_on_off_state = buf->om_data[0]; // Retrieve more data than only the 0th position in the array ? 3. Am not sure whats the purpose of net_buf_simple_pull_le16 etc are.. Would I need that for e.g. being utilised in Level.. level = (int16_t) net_buf_simple_pull_le16(buf); If I did miss something or completely wrong about it.. please do let me know. Thanks, Aditya Xavier. > On 29-Dec-2017, at 5:34 PM, Łukasz Rymanowski > wrote: > > Hi, > > On 29 December 2017 at 07:22, Aditya Xavier wrote: >> Hello, am I correct in my understanding that the BLE Mesh implementation >> would require us to follow one of the Models as specified? > You need to create model, but you are not limited to the one specified by BT > SIG > >> >> For e.g. in my case I need to implement a REST client over BLE Mesh. I >> believe this can be easily on Bluetooth, however am not sure how to do so on >> blemesh. > > Probably you need to design your own model for this. In blemesh > application in main.c you can find example of vendor model which > implements generic on/off but you can implement your own one. > >> >> Please do point me in the right direction if I missed something. >> >> Thanks, >> Aditya Xavier. > > Hope that helps > > Łukasz
Information regarding blemesh implementation
Hello, am I correct in my understanding that the BLE Mesh implementation would require us to follow one of the Models as specified? For e.g. in my case I need to implement a REST client over BLE Mesh. I believe this can be easily on Bluetooth, however am not sure how to do so on blemesh. Please do point me in the right direction if I missed something. Thanks, Aditya Xavier.