Re: [Zephyr-devel] Zephyr Based Bluetooth Mesh implementation on nRF52840-PDK boards


Vikrant More <vikrant8051@...>
 

Could you please share in details documentation for Bluetooth Mesh implementation for Zephyr ?

On Fri, Nov 17, 2017 at 11:43 AM, Vikrant More <vikrant8051@...> wrote:
patch are giving me error. 

So please share original files.

what is original file for bluez-mesh.patch ?


On Fri, Nov 17, 2017 at 11:28 AM, Vikrant More <vikrant8051@...> wrote:
I simply add nrf52840.h & nrf_delay.h from nrf52_SDK into --> zephyr/boards/arm/nrf52840_pca10056.

And include these headder file in main.c ( Zephyr Mesh Example)

After that I add following line for testing of integration of newly added files with Zephyr project.



void main(void)
{
int err;
        
        NRF_P0->DIR |= 0x0001E000;
        NRF_P0->OUTSET |= 0x0001E000;
        
        while(1)
        {
           printk("Initializing...\n");

           NRF_P0->OUT ^= 0x0001E000;
        
          nrf_delay_ms(100);

        } 

/* Initialize the Bluetooth Subsystem */
err = bt_enable(bt_ready);
if (err) {
printk("Bluetooth init failed (err %d)\n", err);
}
}


After executing this on PDK board, I get result as expected .....All four LEDs are blinking continuously.



Next,

I removed above mentioned while loop & edit 

static void gen_onoff_get(struct bt_mesh_model *model,
  struct bt_mesh_msg_ctx *ctx,
  struct net_buf_simple *buf)
{
    NRF_P0->OUT |= 0x0001E000;
}

static void gen_onoff_set(struct bt_mesh_model *model,
  struct bt_mesh_msg_ctx *ctx,
  struct net_buf_simple *buf)
{
    NRF_P0->OUT &= 0xFFFE1FFF;
}


-------------------------------------------------------------------------------------

After giving onoff 1 / get on [on/off: Target=0111]# terminal I get following error -->

Failed to write


After trying same command again it does not reply anything. But LEDs status is also not changes on the Board.

On Thu, Nov 16, 2017 at 7:32 PM, Steve Brown <sbrown@...> wrote:
Here is the code I've been working with.

There is a patch to sample/bluetooth/mesh/main.c and another one to
bluez's mesh stuff.

The first one adds the led code. Some is commented out for working on
another board. I had all 4 leds working at 0100, 0101, 0102 & 0103. Per
the mesh specs, 0100 is the primary element and is the only one with a
config and health server. It also adds an onoff client for the button.
I only hooked up one button. If you want to experiment with group
addresses, you need to configure the button client (element 0100 &
model 1001) to publish to a group address, like c000 and set one or
more buttons to subscribe to c000. That way the button can control more
than one led. Also, the provisioning UUID is set to the MAC address of
the board instead of dddd00...000 so you don't have to power the boards
up one at a time.

You can't use meshctl to send onoff to group addresses. That isn't
implemented yet in the bluez mesh stack.

The bluez's patch adds some informational diagnostics, fixes a bug in
ascii oob input and adds heartbeat and subscribe commands.

I'm certain this is all very buggy, but it's been pretty educational
getting this far.

Steve


On Thu, 2017-11-16 at 19:04 +0530, Vikrant More wrote:
> [meshctl]# configure 0109
> [config: Target = 0109]# add-appkey 1
> [config: Target = 0109]# bind 0 1 1000
> [config: Target = 0109]# back
> [meshctl]# onoff 0109
> [on/off: Target = 0109] onoff 1     // nothing changed on PDK serial
> terminal nor changed LED status
> [on/off: Target = 0109] onoff 0     // nothing changed on PDK serial
> terminal nor changed LED status
>
> I last mail you mentioned that, to change LED status we have to write
> code which will execute after giving onoff 1/0 command.
> So could you please help me it that ?
>
> I know this code to Turn LED1 ON:
> NRF_P0 ->OUT &= ~(1<<13);
>
> & for off -->  NRF_P0 ->OUT |= (1<<13);
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Thu, Nov 16, 2017 at 6:42 PM, Steve Brown <sbrown@...>
> wrote:
> > Looks like you are making progress.
> >
> > I'd recommend that you do a "git checkout mesh/*.json" when you
> > start
> > each session. Otherwise, the node/element data accumulates and it's
> > hard to keep track of which node is which. This initializes the
> > first
> > element to 0100.
> >
> > Before you can use the onoff server, you have to issue the
> > following
> > configure commands:
> >
> > add-appkey 1   # that's the appkey that meshctl uses for the onoff
> > app
> > bind 0 1 1000  # this binds that appkey to the onoff server
> >
> > Now the onoff server should be able to accept meshctl onnoff
> > commands.
> >
> > Steve
> >
> > On Thu, 2017-11-16 at 18:26 +0530, Vikrant More wrote:
> > > Thanks !!
> > >
> > > After following your idea,
> > >
> > > On [nRF52840 termianl]-->  provisined ......
> > >                                              Failed to advertise
> > > using Node ID (err -5)
> > >
> > > & after this PDK board stop advertising itself as "Zephyr"
> > >
> > >
> > > If I hit command as "provision dddd0000000000000000000000000000"
> > > then it give as o/p as --> Already provisioned with unicast 0106
> > >
> > > So unicast address is 0106
> > >
> > > Then I run --> configure 0106
> > > [config: Target = 0077]# help
> > >
> > >  Client Configuration Menu
> > > Available commands:
> > >   target <unicast>                          Set target node to
> > > configure
> > >   get-composition [<page_num>]              Get Composition Data
> > >   add-netkey <net_idx>                      Add network key
> > >   del-netkey <net_idx>                      Delete network key
> > >   add-appkey <app_idx>                      Add application key
> > >   del-appkey <app_idx>                      Delete application
> > key
> > >   bind <ele_idx> <app_idx> <mod_id> [cid]   Bind app key to a
> > model
> > >   set-ttl <ttl>                             Set default TTL
> > >   get-ttl                                   Get default TTL
> > >   set-pub <ele_addr> <pub_addr> <app_idx> <period (step|res)>
> > <model>
> > > Set publication
> > >   back                                      Back to main menu
> > >   help                                      Config Commands
> > >
> > >
> > > If I run --> onff 0106       it gives
> > >
> > > [on/off: Target = 0106]# help
> > > Client Configuration Menu
> > > Available commands:
> > >   target <unicast>                          Set node to configure
> > >   get                                       Get ON/OFF status
> > >   onoff <0/1>                               Send "SET ON/OFF"
> > command
> > >   back                                      Back to main menu
> > >   help                                      Config Commands
> > > [on/off: Target = 0106]#
> > >
> > > If I run --> [on/off: Target = 0106]#  onoff 0          it gives
> > > Failed to write
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Then we test #
> > >
> > > On Thu, Nov 16, 2017 at 4:53 PM, Steve Brown <sbrown@...
> > >
> > > wrote:
> > > > In the 52840 terminal output, you will see something like:
> > > >
> > > > OOB Number: 6021
> > > >
> > > > That's the number to input to meshctl.
> > > >
> > > > Steve
> > > >
> > > > On Thu, 2017-11-16 at 16:11 +0530, Vikrant More wrote:
> > > > > On [meshctl] --> [mesh] Enter Numeric key:
> > > > > Here I input 1234
> > > > >
> > > > > On [nRF52840 termianl]--> Invalid Confirmation Value
> > > > >
> > > > >
> > > > >
> > > > > -----------------------------------------------------------
> > ----
> > > > ----
> > > > > ------------------------------------------
> > > > >
> > > > > On Thu, Nov 16, 2017 at 2:14 PM, Steve Brown <sbrown@cortland
> > .com
> > > > >
> > > > > wrote:
> > > > > > In looking at the output again, It doesn't look like
> > > > > > provisioningcompleted.
> > > > > >
> > > > > > The out-of-band code is output on the 52840's serial port
> > and
> > > > > > forwarded
> > > > > > to probably /dev/ttyACM0. That's the code you need to
> > enter.
> > > > > >
> > > > > > Steve
> > > > > >
> > > > > > On Thu, 2017-11-16 at 10:45 +0530, Vikrant More wrote:
> > > > > > > It is working now !!
> > > > > > > I run hcitool lescan on another terminal & { discover-
> > > > > > unprovisioned
> > > > > > > on , provision dddd0000000000000000000000000000 } on
> > messhctl
> > > > > > > terminal.
> > > > > > >
> > > > > > > Output -->
> > > > > > > -------------------------------------------------------
> > ----
> > > > ----
> > > > > > ----
> > > > > > > -------------------------------------------------------
> > ----
> > > > ----
> > > > > > ----
> > > > > > > -------------------------------------------------------
> > ----
> > > > ----
> > > > > > ----
> > > > > > > -----------------------------
> > > > > > >
> > > > > > > [meshctl]# discover-unprovisioned on
> > > > > > > set_scan_filter_uuids 00001827-0000-1000-8000-
> > 00805f9b34fb
> > > > > > > SetDiscoveryFilter success
> > > > > > > Discovery started
> > > > > > > Adapter property changed
> > > > > > > [CHG] Controller F0:03:8C:B7:5A:18 Discovering: yes
> > > > > > >               Mesh Provisioning Service (00001827-0000-
> > 1000-
> > > > 8000-
> > > > > > > 00805f9b34fb)
> > > > > > >                       Device UUID:
> > > > > > dddd0000000000000000000000000000
> > > > > > >                       OOB: 0000
> > > > > > > [NEW] Device EA:E8:05:9B:16:1D Zephyr
> > > > > > > [meshctl]# provision dddd0000000000000000000000000000
> > > > > > > Trying to connect Device EA:E8:05:9B:16:1D Zephyr
> > > > > > > Adapter property changed
> > > > > > > [CHG] Controller F0:03:8C:B7:5A:18 Discovering: no
> > > > > > > [Zephyr]# Connection successful
> > > > > > > [Zephyr]# Service added
> > > > > > > /org/bluez/hci0/dev_EA_E8_05_9B_16_1D/service0006
> > > > > > > Service added
> > > > /org/bluez/hci0/dev_EA_E8_05_9B_16_1D/service000a
> > > > > > > Char added
> > > > > > >
> > /org/bluez/hci0/dev_EA_E8_05_9B_16_1D/service000a/char000b:
> > > > > > > Char added
> > > > > > >
> > /org/bluez/hci0/dev_EA_E8_05_9B_16_1D/service000a/char000d:
> > > > > > > Services resolved yes
> > > > > > > Found matching char: path
> > > > > > >
> > /org/bluez/hci0/dev_EA_E8_05_9B_16_1D/service000a/char000b,
> > > > uuid
> > > > > > > 00002adb-0000-1000-8000-00805f9b34fb
> > > > > > > Found matching char: path
> > > > > > >
> > /org/bluez/hci0/dev_EA_E8_05_9B_16_1D/service000a/char000d,
> > > > uuid
> > > > > > > 00002adc-0000-1000-8000-00805f9b34fb
> > > > > > > Start notification on
> > > > > > >
> > /org/bluez/hci0/dev_EA_E8_05_9B_16_1D/service000a/char000d
> > > > > > > Characteristic property changed
> > > > > > >
> > /org/bluez/hci0/dev_EA_E8_05_9B_16_1D/service000a/char000d
> > > > > > > Notify started
> > > > > > > Notify for Mesh Provisioning Out Data started
> > > > > > > Open-Node: 0x1444640
> > > > > > > Open-Prov: 0x1446380
> > > > > > > Open-Prov: proxy 0x144a150
> > > > > > > GATT-TX:  03 00 10
> > > > > > > Attempting to write
> > > > > > >
> > /org/bluez/hci0/dev_EA_E8_05_9B_16_1D/service000a/char000b
> > > > > > > Initiated provisioning
> > > > > > > Characteristic property changed
> > > > > > >
> > /org/bluez/hci0/dev_EA_E8_05_9B_16_1D/service000a/char000d
> > > > > > > GATT-RX:       03 01 01 00 01 00 00 04 00 08 00 00 00
> > > > > > > Got provisioning data (12 bytes)
> > > > > > >        01 01 00 01 00 00 04 00 08 00 00 00
> > > > > > > GATT-TX:  03 02 00 00 02 03 04
> > > > > > > Attempting to write
> > > > > > >
> > /org/bluez/hci0/dev_EA_E8_05_9B_16_1D/service000a/char000b
> > > > > > > GATT-TX:  03 03 a8 09 93 50 18 6f 0d 3a cb af 39 40 28 60
> > > > > > > GATT-TX:  9b fa 15 c9
> > > > > > > Attempting to write
> > > > > > >
> > /org/bluez/hci0/dev_EA_E8_05_9B_16_1D/service000a/char000b
> > > > > > > Characteristic property changed
> > > > > > >
> > /org/bluez/hci0/dev_EA_E8_05_9B_16_1D/service000a/char000d
> > > > > > > GATT-RX:       03 03 3a bd 0b 6e 8a d8 dd a9 92 22 a9 3c
> > e4
> > > > c7
> > > > > > > GATT-RX:       fe c3 f1 08 d9 5b ef ff 56 49 87 aa 64 ca
> > 74
> > > > af
> > > > > > > GATT-RX:       ed 3d 89 b9 60 9c b8 19 a3 54 16 a4 dd 12
> > 8d
> > > > 3c
> > > > > > > GATT-RX:       f3 79 1c 18 15 2e 64 3a 4a e2 c1 34 19 c7
> > 39
> > > > ab
> > > > > > > GATT-RX:       9f e3
> > > > > > > Got provisioning data (65 bytes)
> > > > > > >        03 3a bd 0b 6e 8a d8 dd a9 92 22 a9 3c e4 c7 fe
> > > > > > >        c3 f1 08 d9 5b ef ff 56 49 87 aa 64 ca 74 af ed
> > > > > > >        3d 89 b9 60 9c b8 19 a3 54 16 a4 dd 12 8d 3c f3
> > > > > > >        79 1c 18 15 2e 64 3a 4a e2 c1 34 19 c7 39 ab 9f
> > > > > > >        e3
> > > > > > > Request decimal key (0 - 9999)
> > > > > > > [mesh] Enter Numeric key: 1234
> > > > > > > GATT-TX:  03 05 79 75 31 d9 3c ce a3 27 2c d7 1b 5d 90 f3
> > > > > > > GATT-TX:  30 27
> > > > > > > Attempting to write
> > > > > > >
> > /org/bluez/hci0/dev_EA_E8_05_9B_16_1D/service000a/char000b
> > > > > > > Characteristic property changed
> > > > > > >
> > /org/bluez/hci0/dev_EA_E8_05_9B_16_1D/service000a/char000d
> > > > > > > GATT-RX:       03 05 eb 68 f7 99 be 18 ef 71 6e 51 10 f6
> > f5
> > > > 05
> > > > > > > GATT-RX:       d2 40
> > > > > > > Got provisioning data (17 bytes)
> > > > > > >        05 eb 68 f7 99 be 18 ef 71 6e 51 10 f6 f5 05 d2
> > > > > > >        40
> > > > > > > GATT-TX:  03 06 af 78 37 46 88 64 92 8f f1 f4 9c c1 18 95
> > > > > > > GATT-TX:  a7 8d
> > > > > > > Attempting to write
> > > > > > >
> > /org/bluez/hci0/dev_EA_E8_05_9B_16_1D/service000a/char000b
> > > > > > > [Zephyr]#
> > > > > > >
> > > > > > > -------------------------------------------------------
> > ----
> > > > ----
> > > > > > ----
> > > > > > > -------------------------------------------------------
> > ----
> > > > ----
> > > > > > ----
> > > > > > > -------------------------------------------------------
> > ----
> > > > ----
> > > > > > ----
> > > > > > > -------------------------------------------------------
> > ----
> > > > ----
> > > > > > ----
> > > > > > > -------------------------------------------------------
> > ----
> > > > ----
> > > > > > ----
> > > > > > > ---
> > > > > > >
> > > > > > > Now what to do next ??
> > > > > > > I've repeat this procedure on all three board.
> > > > > > >
> > > > > > > How to control LEDs on these board using meshctl or any
> > > > android
> > > > > > APP
> > > > > > > ??
> > > > > > >
> > > > > > > Thank You!!
> > > > > > >
> > > > > > >
> > > > > > >
> > > > >
> > > > >
> > >
> > >
>
>



Join users@lists.zephyrproject.org to automatically receive all group messages.