BLE Mesh message acknowledgement

2018-09-10 Thread Aditya Xavier
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

2018-08-31 Thread Aditya Xavier
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

2018-08-31 Thread Aditya Xavier
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.
> 
> 



CBOR Decoding problem

2018-08-10 Thread Aditya Xavier
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 = _count,
.addr.array.maxlen = sizeof(a) / sizeof(a[0]),
.nodefault = true
},
{
.attribute = “b",
.type = CborAttrArrayType,
CBORATTR_STRUCT_ARRAY(c_arr_objs, c_attrs, _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

2018-06-07 Thread Aditya Xavier
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.

2018-05-23 Thread Aditya Xavier
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 <adityaxav...@me.com> 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 <adityaxav...@me.com> 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 <adityaxav...@me.com> 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 <adityaxav...@me.com>
>>> 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,
>>>>>

Re: [RFC] Mesh uses multi advertising instances.

2018-05-19 Thread Aditya Xavier
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 <adityaxav...@me.com> 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 <adityaxav...@me.com> 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 <adityaxav...@me.com>
>> 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 <adityaxav...@me.com>
>> 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.
>>>>>> 
>>&g

Re: [RFC] Mesh uses multi advertising instances.

2018-05-19 Thread Aditya Xavier
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 <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 <adityaxav...@me.com> 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 <adityaxav...@me.com> 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 <adityaxav...@me.com>
>> napisał(a):
>>>> 
>

Re: [RFC] Mesh uses multi advertising instances.

2018-05-18 Thread Aditya Xavier
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 <adityaxav...@me.com> 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 <adityaxav...@me.com> 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:
>>>> 

Re: [RFC] Mesh uses multi advertising instances.

2018-05-18 Thread Aditya Xavier
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 <adityaxav...@me.com> 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 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 <adityaxav...@me.com> 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 <adityaxav...@me.com> 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
>>>> AD

Re: [RFC] Mesh uses multi advertising instances.

2018-05-18 Thread Aditya Xavier
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 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 <adityaxav...@me.com> 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 <adityaxav...@me.com> 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
>&g

Re: [RFC] Mesh uses multi advertising instances.

2018-05-12 Thread Aditya Xavier
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 <lukasz.rymanow...@codecoup.pl> 
> 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 <adityaxav...@me.com> 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 <adityaxav...@me.com> 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
>>>>> }
>>>>&

MESH and BLE co-existence

2018-05-05 Thread Aditya Xavier
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.

2018-04-27 Thread Aditya Xavier
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 <adityaxav...@me.com> 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.
>> 
>> Best
>> Łukasz
>> 
>> On 19 April 2018 at 07:30, Aditya Xavier <adityaxav...@me.com 
>> <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 <adityaxav...@me.com 
>>> <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 <adityaxav...@me.com 
>>> <mailto:adityaxav...@me.com> >> adityaxav...@me.com <mailto:adityaxav...@me.com> 
>>> <mailto:adityaxav...@me.com <mailto:adityaxav...@me.com>> 
>>> <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

Re: Console Read Issue

2018-04-21 Thread Aditya Xavier
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 <adityaxav...@me.com> 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 <ma...@runtime.io> 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 <adityaxav...@me.com> 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 <adityaxav...@me.com> 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, _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 = _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(_queue, ev);
>>>> return;
>>>> }
>>>> 
>>>> static void 
>>>> myapp_init(void)
>>>> {
>>>> os_eventq_init(_queue);
>>>> os_eventq_put(_queue, _console_event);
>>>> 
>>>> console_set_queues(_queue, os_eventq_dflt_get());
>>>> }
>>>> 
>>> 
>> 



Re: [RFC] Mesh uses multi advertising instances.

2018-04-20 Thread Aditya Xavier
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> 
> 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 = 0x10000
> }
> 
> 
> Make sure to rebuild boot and app and then try.
> 
> Best
> Łukasz
> 
> On 19 April 2018 at 07:30, Aditya Xavier <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 <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> 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 > adityaxav...@me.com <mailto:adityaxav...@me.com> <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:
>> 
&

Re: [RFC] Mesh uses multi advertising instances.

2018-04-18 Thread Aditya Xavier
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>> 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 <adityaxav...@me.com>:
>>>>> 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 <adityaxav...@me.com 
>>>>>> <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.

Re: Problem with starting up nRF Custom Board

2018-04-17 Thread Aditya Xavier
That worked!

Thank you so much!

Sent from my iPhone

> On 17-Apr-2018, at 7:43 PM, Alvaro Prieto <alvaropri...@verily.com> 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 <adityaxav...@me.com> 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 <adityaxav...@me.com> 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 <adityaxav...@me.com> 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 <adityaxav...@me.com> 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

2018-04-17 Thread Aditya Xavier
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 <adityaxav...@me.com> 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 <adityaxav...@me.com> 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 <adityaxav...@me.com> 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

2018-04-17 Thread Aditya Xavier
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 <adityaxav...@me.com> 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 <adityaxav...@me.com> 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

2018-04-17 Thread Aditya Xavier
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 <adityaxav...@me.com> 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.



Problem with starting up nRF Custom Board

2018-04-17 Thread Aditya Xavier
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

2018-04-06 Thread Aditya Xavier
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 <ch...@runtime.io> 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.

2018-04-06 Thread 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 <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> 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 <adityaxav...@me.com> 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.

2018-04-03 Thread Aditya Xavier
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 <adityaxav...@me.com> 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 <adityaxav...@me.com> 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 
>>> <andrzej.kaczma...@codecoup.pl> wrote:
>>> 
>>> Hi Aditya,
>>> 
>>> On Sun, Apr 1, 2018 at 3:51 PM, Aditya Xavier <adityaxav...@me.com> 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 
>>>>> <andrzej.kaczma...@codecoup.pl> wrote:
>>>>> 
>>>>> Hi Aditya,
>>>>> 
>>>>> On Sat, Mar 31, 2018 at 5:51 AM, Aditya Xavier <adityaxav...@me.com> 
>>>>> 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() o

Re: [RFC] Mesh uses multi advertising instances.

2018-04-02 Thread 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 <adityaxav...@me.com> 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: [RFC] Mesh uses multi advertising instances.

2018-04-02 Thread Aditya Xavier
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 
> <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.

2018-03-30 Thread Aditya Xavier
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 <ch...@runtime.io> 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: Multicast messaging and group messaging

2018-03-08 Thread Aditya Xavier
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 <lukasz.rymanow...@codecoup.pl> 
> 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 <adityaxav...@me.com> 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 <adityaxav...@me.com> 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

2018-03-08 Thread Aditya Xavier
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

2018-02-28 Thread Aditya Xavier
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 = 
}
},
{NULL},
};

int fetch_map(const char *map){

//  int i;

buf_init(,(char *) map);
console_printf("Buffer Initiated\n");

json_read_object(_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 <adityaxav...@me.com> 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 <ch...@runtime.io> 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

2018-02-28 Thread Aditya Xavier
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 <ch...@runtime.io> 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

2018-02-28 Thread Aditya Xavier
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 = _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 = _count,
},
.nodefault = true,
.len = sizeof(intarr)
},
[6] = {
.attribute = NULL
}
};


> On 28-Feb-2018, at 2:05 PM, marko kiiskila <ma...@runtime.io> wrote:
> 
> 
> 
>> On Feb 28, 2018, at 10:10 AM, Aditya Xavier <adityaxav...@me.com> 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(, 0, sizeof(encoder));
>>  memset(, 0, sizeof(module));
>> 
>>  json_encode_object_start(encoder);
>> 
>>  JSON_VALUE_INT(, 1);
>>  json_encode_object_entry(encoder, “name1", );
>> 
>>  JSON_VALUE_STRING(, “value2");
>>  json_encode_object_entry(encoder, “name2", );
>> 
>>  json_encode_array_name(encoder, “name3");
>>  json_encode_array_start(encoder);
>> 
>>  if(getType){
>>  json_encode_object_start(module);
>>  
>>  JSON_VALUE_INT(, 4);
>>  json_encode_object_entry(module, “name4", );
>> 
>>  JSON_VALUE_INT(, 5);
>>  json_encode_object_entry(module, “name5", );
>>  
>>  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 <ma...@runtime.io> wrote:
>>> 
>>> Hi Aditya,
>>> 
>>>> On Feb 28, 2018, at 9:26 AM, Aditya Xavier <adityaxav...@me.com> 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

2018-02-28 Thread Aditya Xavier
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(, 0, sizeof(encoder));
memset(, 0, sizeof(module));

json_encode_object_start(encoder);

JSON_VALUE_INT(, 1);
json_encode_object_entry(encoder, “name1", );

JSON_VALUE_STRING(, “value2");
json_encode_object_entry(encoder, “name2", );

json_encode_array_name(encoder, “name3");
json_encode_array_start(encoder);

if(getType){
json_encode_object_start(module);

JSON_VALUE_INT(, 4);
json_encode_object_entry(module, “name4", );

JSON_VALUE_INT(, 5);
json_encode_object_entry(module, “name5", );

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 <ma...@runtime.io> wrote:
> 
> Hi Aditya,
> 
>> On Feb 28, 2018, at 9:26 AM, Aditya Xavier <adityaxav...@me.com> 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: BLEMESH PB GATT

2018-02-23 Thread Aditya Xavier
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 = _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 <andrzej.kaczma...@codecoup.pl> 
> wrote:
> 
> Hi Aditya,
> 
> On Fri, Feb 23, 2018 at 12:50 PM, Aditya Xavier <adityaxav...@me.com> 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

2018-02-23 Thread Aditya Xavier
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


Information regarding blemesh implementation

2017-12-28 Thread Aditya Xavier
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.