Skip to content

smp_svr sample does not discover services #16735

@mfiumara

Description

@mfiumara

Describe the bug
When following steps in the smp_svr example (https://docs.zephyrproject.org/latest/samples/subsys/mgmt/mcumgr/smp_svr/README.html#smp-svr-sample) and try to perform a ping to the target device, I get the following error:

mcumgr --conntype ble --connstring peer_name=Zephyr echo hello
Error: can't discover services: ATT request timeout: req timeout

To Reproduce

  1. Follow guide at https://docs.zephyrproject.org/latest/samples/subsys/mgmt/mcumgr/smp_svr/README.html#smp-svr-sample using a nrf52_pca10040 dev kit to flash bootloader and application

Expected behavior
Expected output:

sudo mcumgr --conntype ble --connstring ctlr_name=hci0,peer_name='Zephyr' echo hello
hello

Impact
showstopper, I cannot DFU the smp_svr example.

Screenshots or console output
The MCU bootloader and application are correctly flashed as I get expected output from the UART terminal on the device:

***** Booting Zephyr OS zephyr-v1.14.0-1297-g5a2c6d33e490 *****
[00:00:00.005,065] <inf> mcuboot: Starting bootloader
[00:00:00.011,596] <inf> mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=03
[00:00:00.022,155] <inf> mcuboot: Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[00:00:00.032,165] <inf> mcuboot: Boot source: primary slot
[00:00:00.041,534] <inf> mcuboot: Swap type: none
[00:00:00.265,563] <inf> mcuboot: Bootloader chainload address offset: 0xc000
[00:00:00.273,193] <inf> mcuboot: Jumping to the first image slot
***** Booting Zephyr OS zephyr-v1.14.0-1297-g5a2c6d33e490 *****
Bluetooth initialized
Advertising successfully started

Output from BTmon when issuing mcumgr --conntype ble --connstring peer_name=Zephyr echo hello:

< HCI Command: LE Create Connection (0x08|0x000d) plen 25                    #16048 [hci0] 3112.172454
        Scan interval: 10.000 msec (0x0010)
        Scan window: 10.000 msec (0x0010)
        Filter policy: White list is not used (0x00)
        Peer address type: Random (0x01)
        Peer address: C3:6A:41:0F:21:66 (Static)
        Own address type: Public (0x00)
        Min connection interval: 7.50 msec (0x0006)
        Max connection interval: 7.50 msec (0x0006)
        Connection latency: 0 (0x0000)
        Supervision timeout: 720 msec (0x0048)
        Min connection length: 0.000 msec (0x0000)
        Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Status (0x0f) plen 4                                    #16049 [hci0] 3112.177446
      LE Create Connection (0x08|0x000d) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 19                                    #16050 [hci0] 3112.231279
      LE Connection Complete (0x01)
        Status: Success (0x00)
        Handle: 77
        Role: Master (0x00)
        Peer address type: Random (0x01)
        Peer address: C3:6A:41:0F:21:66 (Static)
        Connection interval: 7.50 msec (0x0006)
        Connection latency: 0 (0x0000)
        Supervision timeout: 720 msec (0x0048)
        Master clock accuracy: 0x00
< ACL Data TX: Handle 77 flags 0x00 dlen 7                                   #16051 [hci0] 3112.231448
      ATT: Exchange MTU Request (0x02) len 2
        Client RX MTU: 512
> HCI Event: Number of Completed Packets (0x13) plen 5                       #16052 [hci0] 3112.242665
        Num handles: 1
        Handle: 77
        Count: 1
> ACL Data RX: Handle 77 flags 0x02 dlen 7                                   #16053 [hci0] 3112.246759
      ATT: Exchange MTU Response (0x03) len 2
        Server RX MTU: 252
< ACL Data TX: Handle 77 flags 0x00 dlen 11                                  #16054 [hci0] 3112.246875
      ATT: Read By Group Type Request (0x10) len 6
        Handle range: 0x0001-0xffff
        Attribute group type: Primary Service (0x2800)
> HCI Event: Number of Completed Packets (0x13) plen 5                       #16055 [hci0] 3112.255309
        Num handles: 1
        Handle: 77
        Count: 1
> ACL Data RX: Handle 77 flags 0x02 dlen 16                                  #16056 [hci0] 3117.234379
      LE L2CAP: Connection Parameter Update Request (0x12) ident 1 len 8
        Min interval: 24
        Max interval: 40
        Slave latency: 0
        Timeout multiplier: 42
< HCI Command: LE Connection Update (0x08|0x0013) plen 14                    #16057 [hci0] 3117.234625
        Handle: 77
        Min connection interval: 30.00 msec (0x0018)
        Max connection interval: 50.00 msec (0x0028)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Min connection length: 0.000 msec (0x0000)
        Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Status (0x0f) plen 4                                    #16058 [hci0] 3117.249303
      LE Connection Update (0x08|0x0013) ncmd 1
        Status: Success (0x00)
< ACL Data TX: Handle 77 flags 0x00 dlen 10                                  #16059 [hci0] 3117.249501
      LE L2CAP: Connection Parameter Update Response (0x13) ident 1 len 2
        Result: Connection Parameters accepted (0x0000)
> HCI Event: Number of Completed Packets (0x13) plen 5                       #16060 [hci0] 3117.258296
        Num handles: 1
        Handle: 77
        Count: 1
> HCI Event: LE Meta Event (0x3e) plen 10                                    #16061 [hci0] 3117.339382
      LE Connection Update Complete (0x03)
        Status: Success (0x00)
        Handle: 77
        Connection interval: 50.00 msec (0x0028)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
< HCI Command: Disconnect (0x01|0x0006) plen 3                               #16062 [hci0] 3142.247160
        Handle: 77
        Reason: Remote User Terminated Connection (0x13)
> HCI Event: Command Status (0x0f) plen 4                                    #16063 [hci0] 3142.263293
      Disconnect (0x01|0x0006) ncmd 1
        Status: Success (0x00)
< HCI Command: Read BD ADDR (0x04|0x0009) plen 0                             #16064 [hci0] 3142.263617
> HCI Event: Command Complete (0x0e) plen 10                                 #16065 [hci0] 3142.268320
      Read BD ADDR (0x04|0x0009) ncmd 1
        Status: Success (0x00)
        Address: 00:01:95:48:41:2C (Sena Technologies, Inc.)
@ USER Close: mcumgr                                                       {0x0004} [hci0] 3142.268438
= Close Index: 00:01:95:48:41:2C                                                    [hci0] 3142.269352

I have also tried connecting directly using bluetoothctl, it seems the smp_svr service is available so I don't know what is causing the problem:

[bluetooth]# connect C3:6A:41:0F:21:66 
Attempting to connect to C3:6A:41:0F:21:66
[CHG] Device C3:6A:41:0F:21:66 Connected: yes
Connection successful
[Zephyr]# info
Device C3:6A:41:0F:21:66 (random)
	Name: Zephyr
	Alias: Zephyr
	Paired: no
	Trusted: yes
	Blocked: no
	Connected: yes
	LegacyPairing: no
	UUID: Vendor specific           (8d53dc1d-1db7-4cd3-868b-8a527460aa84)

Environment (please complete the following information):

  • OS: Manjaro Linux 64 bit. bluez 5.50
  • Zephyr SDK 0.10.0
  • Zephyr 1.14, MCUBoot @ fc07eab

Additional context

Metadata

Metadata

Labels

area: BluetoothbugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions