Hi Jacob,

On Sun, Apr 16, 2017 at 03:47:24PM -0700, Jacob Rosenthal wrote:
> I got a linux partition and newtmgr working finally, However the upload
> command fails after writing one packet. The logs appear to show
> BLE_HS_ENOTSUP , but I just cant find where that could becoming from! any
> help appreciated :)

Welcome to return code hell :).  The status=8 is actually a Bluetooth
error code, not a NimBLE host error code.  In this case, the controller
belonging to the destination device has indicated a disconnect reason of
8, which translates to "supervision timeout."  In other words, your PC's
controller unexpectedly went silent, so the NimBLE device was forced to
drop the connection.

The GATT library (what newtmgr uses for BLE) is a bit sketchy, so it's
hard to tell who as at fault.  What controller are you using to send the
newtmgr command (e.g., built-in Bluetooth radio)?

Do you have any luck with a smaller newtmgr command (e.g., echo)?  The
image upload command is especially troublesome because it causes the
destination device to perform a flash erase operation.  This causes the
MCU to stall, which can lead to supervision timeouts.  I believe the
newtmgr tool uses fairly lenient connection settings for this reason,
but this could still be the problem, especially on the nRF51.

You could try connecting to the NimBLE device with a known good setup
such as the Lightblue app on OS X or an iphone.  Then, subscribe to the
newtmgr characteristic and try writing a value to the same
characteristic.  If the connection stays up and you get a notification
from the NimBLE device (newtmgr response), then I would suspect
something on the PC side.

Chris

> 
> 
> Jacobs-MacBook-Air:chippd3 jacobrosenthal$ newt target show split-nrf51dk
> targets/split-nrf51dk
>     app=@apache-mynewt-core/apps/blesplit
>     bsp=@apache-mynewt-core/hw/bsp/nrf51dk
>     build_profile=optimized
>     loader=@apache-mynewt-core/apps/bleprph
> 
> syscfg=BLE_ACL_BUF_SIZE=128:BLE_LL_CFG_FEAT_LE_ENCRYPTION=0:BLE_SM_LEGACY=0:LOG_LEVEL=0
> 
> 
> [jacobrosenthal@localhost Downloads]$ sudo "$(which newtmgr)" -c ble image
> upload  blesplit.img -t -ldebug
> 2017/04/14 15:02:08 [DEBUG] BLE Connection devaddr:[]
> 2017/04/14 15:02:08 dev: hci0 up
> 2017/04/14 15:02:08 dev: hci0 down
> 2017/04/14 15:02:08 dev: hci0 opened
> 2017/04/14 15:02:08 [DEBUG] State:PoweredOn
> 2017/04/14 15:02:08 [DEBUG] scanning...
> 2017/04/14 15:02:08 [DEBUG] Peripheral Discovered: nimble-bleprph,
> Address:[10 10 10 10 10 10] Address Type:0
> 2017/04/14 15:02:08 [DEBUG] Peripheral Connected
> 2017/04/14 15:02:08 [DEBUG] Newtmgr Service Found
> 2017/04/14 15:02:08 [DEBUG] Newtmgr Characteristic Found
> 2017/04/14 15:02:08 [DEBUG] Writing newtmgr request &{Op:2 Flags:0 Len:99
> Group:1 Seq:0 Id:1 Data:[163 100 100 97 116 97 88 79 60 184 243 150 36 0 0
> 0 32 0 0 0 72 16 0 0 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 64 0 32 41 56 2 0 0
> 26 128 243 20 136 128 243 16 136 3 33 24 72 2 104 10 67 2 96 23 72 2 104 10
> 67 2 96 0 26 22 74 22 75 154 66 1 210 1 99 108 101 110 25 16 140 99 111 102
> 102 0]}
> 2017/04/14 15:02:08 [DEBUG] Serializing request &{Op:2 Flags:0 Len:99
> Group:1 Seq:0 Id:1 Data:[163 100 100 97 116 97 88 79 60 184 243 150 36 0 0
> 0 32 0 0 0 72 16 0 0 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 64 0 32 41 56 2 0 0
> 26 128 243 20 136 128 243 16 136 3 33 24 72 2 104 10 67 2 96 23 72 2 104 10
> 67 2 96 0 26 22 74 22 75 154 66 1 210 1 99 108 101 110 25 16 140 99 111 102
> 102 0]} into buffer [2 0 0 99 0 1 0 1 163 100 100 97 116 97 88 79 60 184
> 243 150 36 0 0 0 32 0 0 0 72 16 0 0 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 64 0
> 32 41 56 2 0 0 26 128 243 20 136 128 243 16 136 3 33 24 72 2 104 10 67 2 96
> 23 72 2 104 10 67 2 96 0 26 22 74 22 75 154 66 1 210 1 99 108 101 110 25 16
> 140 99 111 102 102 0]
> 2017/04/14 15:02:08 [DEBUG] Tx packet dump:
> 00000000  02 00 00 63 00 01 00 01  a3 64 64 61 74 61 58 4f
>  |...c.....ddataXO|
> 00000010  3c b8 f3 96 24 00 00 00  20 00 00 00 48 10 00 00  |<...$...
> ...H...|
> 00000020  12 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>  |................|
> 00000030  00 40 00 20 29 38 02 00  00 1a 80 f3 14 88 80 f3  |.@.
> )8..........|
> 00000040  10 88 03 21 18 48 02 68  0a 43 02 60 17 48 02 68
>  |...!.H.h.C.`.H.h|
> 00000050  0a 43 02 60 00 1a 16 4a  16 4b 9a 42 01 d2 01 63
>  |.C.`...J.K.B...c|
> 00000060  6c 65 6e 19 10 8c 63 6f  66 66 00                 |len...coff.|
> 
> 2017/04/14 15:02:08 [DEBUG] Write BLE Packet:buf:: c �ddataXO<���$ H @ )8
> �� ��� � ! H h
> C ` H h
> C ` J K�B � clen �coff len::107
> 2017/04/14 15:02:12 [DEBUG] Disconnected%!(EXTRA <nil>)
> 
> 
> Logs show its 520, presumably BLE_HS_ENOTSUP???
> 
> 832:[ts=6499968ssb, mod=4 level=0] Disconnection Complete: status=0
> handle=1 reason=8
> 834:[ts=6515592ssb, mod=64 level=1] connection updated; status=520 handle=1
> our_ota_addr_type=0 our_ota_addr=0a:0a:0a:0a:0a:0a our_id_addr_type=0
> our_id_addr=0a:0a:0a:0a:0a:0a peer_ota_addr_type=0
> peer_ota_addr=b8:e8:56:03:d3:ed peer_id_addr_type=0
> peer_id_addr=b8:e8:56:03:d3:ed conn_itvl=12 conn_latency=0
> supervision_timeout=200 encrypted=0 authenticated=0 bonded=0
> 
> 
> Breakpoint at the disconnect callback:
> Breakpoint 1, bleprph_gap_event (event=0x20000a9c <os_main_stack+1484>,
> arg=0x0) at repos/apache-mynewt-core/apps/bleprph/src/main.c:182
> (gdb) where
> #0  bleprph_gap_event (event=0x20000a9c <os_main_stack+1484>, arg=0x0) at
> repos/apache-mynewt-core/apps/bleprph/src/main.c:182
> #1  0x000153f2 in ble_gap_call_event_cb (cb_arg=0x0, cb=0xad85
> <bleprph_gap_event>, event=0x20000a9c <os_main_stack+1484>)
>     at repos/apache-mynewt-core/net/nimble/host/src/ble_gap.c:447
> #2  ble_gap_conn_broken (conn_handle=<optimized out>, reason=520) at
> repos/apache-mynewt-core/net/nimble/host/src/ble_gap.c:819
> #3  0x00015434 in ble_gap_rx_disconn_complete (evt=evt@entry=0x20000b2c
> <os_main_stack+1628>) at
> repos/apache-mynewt-core/net/nimble/host/src/ble_gap.c:846
> #4  0x00019308 in ble_hs_hci_evt_disconn_complete (event_code=<optimized
> out>, data=0x2000395c "\005\004", len=<optimized out>)
>     at repos/apache-mynewt-core/net/nimble/host/src/ble_hs_hci_evt.c:145
> #5  0x0001935a in ble_hs_hci_evt_process (data=data@entry=0x2000395c
> "\005\004") at
> repos/apache-mynewt-core/net/nimble/host/src/ble_hs_hci_evt.c:592
> #6  0x00017aaa in ble_hs_event_rx_hci_ev (ev=<optimized out>) at
> repos/apache-mynewt-core/net/nimble/host/src/ble_hs.c:366
> #7  0x00008d72 in os_eventq_run (evq=<optimized out>) at
> repos/apache-mynewt-core/kernel/os/src/os_eventq.c:158
> #8  0x0000aebc in main () at
> repos/apache-mynewt-core/apps/bleprph/src/main.c:301

Reply via email to