본문 바로가기

Programing/ Nordic(BLE)

Nordic BLE Mesh 예제 분석

모듈 1개로 테스트 할때

1. Connect to the device with the interactive console:

python D:\Nordic\SDK\nrf5_SDK_for_Mesh_v4.0.0_src\scripts\interactive_pyaci\interactive_pyaci.py -d COM6 —no-logfile

 

2. Send a test `Echo` command to see that the device is connected:

send(cmd.Echo("hello world"))

TX : 0C 02 68 65 6C 6C 6F 20 77 6F 72 6C 64

// TX : 0C 02 hello world

RX : 0C 82 68 65 6C 6C 6F 20 77 6F 72 6C 64

// RX : 0C 82 hello world

 

 

모듈 2개로 테스트 할때

1. Set up a tiny mesh network by connecting two devices and starting the serial interface:

python D:\Nordic\SDK\nrf5_SDK_for_Mesh_v4.0.0_src\scripts\interactive_pyaci\interactive_pyaci.py -d COM1 COM2 --no-logfile

 

2. Add a network key, application key, and a local unicast address with the

`quick_setup()` method:

for dev in d: dev.quick_setup()

COM1

TX : 13 92 00 00 BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB

RX : 05 84 92 00 00 00 - SubnetAdd: {'subnet_handle': 0}

TX : 15 97 00 00 00 00 AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA

RX : 05 84 97 00 00 00 - AppkeyAdd: {'appkey_handle': 0}

TX : 05 9F 01 00 01 00

// TX : 05 9F 01(local_unicast_address) 00 01 00

RX : 03 84 9F 00 Success

 

13 92 00 00 BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB 15 97 00 00 00 00 AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA 05 9F 01 00 01 00

 

COM2

TX : 13 92 00 00 BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB

RX : 05 84 92 00 00 00 - SubnetAdd: {'subnet_handle': 0}

TX : 15 97 00 00 00 00 AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA

RX : 05 84 97 00 00 00 - AppkeyAdd: {'appkey_handle': 0}

TX : 05 9F 02 00 01 00

// TX : 05 9F 02(local_unicast_address) 00 01 00

RX : 03 84 9F 00 Success

 

13 92 00 00 BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB 15 97 00 00 00 00 AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA 05 9F 02 00 01 00

 

3. Disable the `access.py` module that hides the raw message events using an event filter

(and is enabled by default on the device):

d[0].event_filter_disable()

d[1].event_filter_disable()

 

4. Add publish addresses:

d[0].send(cmd.AddrPublicationAdd(d[1].local_unicast_address_start))

//d[0].send(cmd.AddrPublicationAdd(2))

COM1

TX : 03 A4 02 00

RX : 05 84 A4 00 00 00 - AddrPublicationAdd: {'address_handle': 0}

 

d[1].send(cmd.AddrPublicationAdd(d[0].local_unicast_address_start))

//d[1].send(cmd.AddrPublicationAdd(1))

COM2

TX : 03 A4 01 00

RX : 05 84 A4 00 00 00 - AddrPublicationAdd: {'address_handle': 0}

 

publish_handle = 0

appkey_handle = 0

ttl = 1

segmented = 0

mic_size = 0

friendship_credentials_flag = 0

 

d[0].send(cmd.PacketSend(appkey_handle, d[0].local_unicast_address_start, publish_handle, ttl, segmented, mic_size, friendship_credentials_flag, "Hello World"))

//d[0].send(cmd.PacketSend(0, 1, 0, 1, 0, 0, 0, "Hello World"))

COM1

TX : 15 AB 00 00 01 00 00 00 01 00 00 00 48 65 6C 6C 6F 20 57 6F 6C 64

// TX : 15 AB 00 00 01 00 00 00 01 00 00 00 Hello World

RX : 07 84 AB 00 01 00 00 00

RX : 05 D2 01 00 00 00

COM2

RX : 1F D0 01 00 02 00 00 00 00 00 01 01 36 11 C4 F5 F7 C1 CA 0B 00 48 65 6C 6C 6F 20 57 6F 72 6C 64

// RX : 1F D0 01 00 02 00 00 00 00 00 01 01 36 11 C4 F5 F7 C1 CA 0B 00 Hello World

 

d[1].send(cmd.PacketSend(appkey_handle, d[1].local_unicast_address_start, publish_handle, ttl, segmented, mic_size, friendship_credentials_flag, "Hi there"))

//d[1].send(cmd.PacketSend(0, 2, 0, 1, 0, 0, 0, "Hi there"))

COM2

TX : 13 AB 00 00 02 00 00 00 01 00 00 00 48 69 20 74 68 65 72 65

// TX : 13 AB 00 00 02 00 00 00 01 00 00 00 Hi there

RX : 07 84 AB 00 01 00 00 00

RX : 05 D2 01 00 00 00

COM1

RX : 1C D0 02 00 01 00 00 00 00 00 01 01 63 A6 6C 39 80 DA CB 08 00 48 69 20 74 68 65 72 65

// RX : 1C D0 02 00 01 00 00 00 00 00 01 01 63 A6 6C 39 80 DA CB 08 00 48 69 20 74 68 65 72 65Hi there