MCUMgr failed to connect to peer after 10 sec

Hello!

I am trying out the SMP Server sample. I have it all built and flashed on my nRF52DK and have tried the echo command using the nRF Device Manager on iOS which worked.

I now want to try it on MACos running the following command:

sudo ./mcumgr --conntype ble --connstring peer_name='Zephyr' echo hello

Upon running this, I get the error: 

Error: Failed to connect to peer after 10s

How can I solve this?

  • I don't have a Mac to test on, but I just tested this on Linux Ubuntu an was able to get it to work, I did the following:

    • Built and programmed the smp_svr (NCS v1.9.0) onto the nRF52840 DK using the command under SMP SVR --> Building the sample:
      • west build -b nrf52840dk_nrf52840 -d build_ble_52840 -- -DOVERLAY_CONFIG=overlay-bt.conf
      • cd build_ble_52840 && west flash
    • Tested the echo command using the command under SMP SVR --> Sample image: hello world!
      • sudo /home/simon/go/bin/mcumgr --conntype ble --connstring ctlr_name=hci0,peer_name='Zephyr' echo hello
        • Got the response "hello" back

    Not sure why it doesn't work for you. Could try to add --loglevel debug to the mcumgr command? Could you also try to debug the nRF52 DK and enable logs, to see what's happening on that side.

    Best regards,

    Simon

  • Hey! I tried using --loglevel debug quickly. Maybe you can find something useful here?

    I am going to try reinstalling the SMP server and doing exactly as you did

    markusarnoldsson@Markuss-MacBook-Air ~ % sudo go/bin/mcumgr --loglevel debug --conntype ble --connstring ctlr_name=hci0,peer_name='Zephyr' echo hello

    DEBU[2022-05-02 17:19:41.851] Using connection profile: name=unnamed type=ble connstring=ctlr_name=hci0,peer_name=Zephyr 

    DEBU[2022-05-02 17:19:41.898] CentralManagerDidUpdateState: cmgr=0x6000030003f0 

    DEBU[2022-05-02 17:19:41.912] PeripheralManagerDidUpdateState: pmgr=0x600003504000 

    DEBU[2022-05-02 17:19:41.912] Connecting to peer                           

    DEBU[2022-05-02 17:19:51.914] goroutine 1 [running]:

    mynewt.apache.org/newt/util.NewNewtError({0xc0002261e0, 0x23})

    /Users/markusarnoldsson/go/pkg/mod/mynewt.apache.org/[email protected]/util/util.go:77 +0xc5

    mynewt.apache.org/newt/util.ChildNewtError({0x44e4080, 0xc00020c2e0})

    /Users/markusarnoldsson/go/pkg/mod/mynewt.apache.org/[email protected]/util/util.go:103 +0x6b

    mynewt.apache.org/newtmgr/newtmgr/cli.GetSesn()

    /Users/markusarnoldsson/go/pkg/mod/mynewt.apache.org/[email protected]/newtmgr/cli/common.go:339 +0x1f8

    mynewt.apache.org/newtmgr/newtmgr/cli.echoRunCmd(0xc00025a000, {0xc000260000, 0x1, 0xc})

    /Users/markusarnoldsson/go/pkg/mod/mynewt.apache.org/[email protected]/newtmgr/cli/echo.go:37 +0x4a

    github.com/spf13/cobra.(*Command).execute(0xc00025a000, {0xc00025e000, 0x7, 0xc})

    /Users/markusarnoldsson/go/pkg/mod/github.com/spf13/[email protected]/command.go:830 +0x5f8

    github.com/spf13/cobra.(*Command).ExecuteC(0xc000224000)

    /Users/markusarnoldsson/go/pkg/mod/github.com/spf13/[email protected]/command.go:914 +0x2fc

    github.com/spf13/cobra.(*Command).Execute(...)

    /Users/markusarnoldsson/go/pkg/mod/github.com/spf13/[email protected]/command.go:864

    main.main()

    /Users/markusarnoldsson/go/pkg/mod/github.com/apache/[email protected]/mcumgr/mcumgr.go:94 +0x173

    goroutine 20 [syscall]:

    os/signal.signal_recv()

    /usr/local/go/src/runtime/sigqueue.go:166 +0x28

    os/signal.loop()

    /usr/local/go/src/os/signal/signal_unix.go:24 +0x19

    created by os/signal.Notify.func1.1

    /usr/local/go/src/os/signal/signal.go:151 +0x2c

    goroutine 34 [chan receive]:

    main.main.func1()

    /Users/markusarnoldsson/go/pkg/mod/github.com/apache/[email protected]/mcumgr/mcumgr.go:82 +0x38

    created by main.main

    /Users/markusarnoldsson/go/pkg/mod/github.com/apache/[email protected]/mcumgr/mcumgr.go:80 +0x169 

    Error: Failed to connect to peer after 10s

  • I decided to try Linux ubuntu instead. This worked, so something wrong on the Mac, will not delve further into it tho.

Related