Topics

Issue in OTA of zephyr OS over UART on Nordic nrf52840_pca10056 chip #bluetoothmesh #ble #nrf52840 #uart


Mayank
 

Thanks Adam, 
I have upgraded zephyr to latest version (2.1.0) using west update.
Now with the configuration of my application as well as mcuboot, i reached at the stage where i can upload the signed application image using mcumgr cli.

Note: I am not running mcuboot in serial recovery mode.

PFA for hci_uart application.

Regards,
Mayank Patel


On Tue, Nov 12, 2019 at 3:50 PM Adam Podogrocki <a.podogrocki@...> wrote:
Hi Mayank,

could you please attach your 'zephyr/.config' file? Maybe I will find some inaccuracy there.

Cheers,
Adam

On Fri, 8 Nov 2019 at 06:00, Mayank <mayank7117@...> wrote:
Thanks Adam, I have disabled BT and Shell, Only UART is there.
Now, when i run the command with debug mode --> mcumgr -ldebug --conntype=serial --connstring='dev=/dev/ttymxc0,baud=115200' echo hello

I'm getting following response with timeout.

DEBU[2019-11-07 15:24:57.671] Using connection profile: name=unnamed type=serial connstring=dev=/dev/ttymxc0,baud=115200 
DEBU[2019-11-07 15:24:57.678] {add-nmp-listener} [serial_sesn.go:213] seq=66 
DEBU[2019-11-07 15:24:57.68] Encoded &{NmpBase:{hdr:{Op:2 Flags:0 Len:0 Group:0 Seq:66 Id:0}} Payload:hello} to:
00000000  a1 61 64 65 68 65 6c 6c  6f                       |.adehello| 
DEBU[2019-11-07 15:24:57.681] Encoded:
00000000  02 00 00 09 00 00 42 00  a1 61 64 65 68 65 6c 6c  |......B..adehell|
00000010  6f                                                |o| 
DEBU[2019-11-07 15:24:57.705] Tx NMP request: 00000000  02 00 00 09 00 00 42 00  a1 61 64 65 68 65 6c 6c  |......B..adehell|
00000010  6f                                                |o| 
DEBU[2019-11-07 15:24:57.706] Base64 encoding request:
00000000  02 00 00 09 00 00 42 00  a1 61 64 65 68 65 6c 6c  |......B..adehell|
00000010  6f                                                |o| 
DEBU[2019-11-07 15:24:57.707] Tx serial
00000000  06 09                                             |..| 
DEBU[2019-11-07 15:24:57.708] Tx serial
00000000  41 42 4d 43 41 41 41 4a  41 41 42 43 41 4b 46 68  |ABMCAAAJAABCAKFh|
00000010  5a 47 56 6f 5a 57 78 73  62 38 45 4a              |ZGVoZWxsb8EJ| 
DEBU[2019-11-07 15:24:57.709] Tx serial
00000000  0a                                                |.| 
DEBU[2019-11-07 15:25:07.713] {remove-nmp-listener} [serial_sesn.go:213] seq=66 
DEBU[2019-11-07 15:25:07.726] goroutine 1 [running]:
github.com/spf13/cobra.(*Command).execute(0x2ce1400, 0x2ca72e0, 0x4, 0x4, 0x2ce1400, 0x2ca72e0)
        /home/mayank/go/bin/pkg/mod/github.com/spf13/cobra@....5/command.go:830 +0x1f4
        /home/mayank/go/bin/pkg/mod/github.com/spf13/cobra@....5/command.go:914 +0x230
        /home/mayank/go/bin/pkg/mod/github.com/spf13/cobra@....5/command.go:864
main.main()
        /home/mayank/go/src/github.com/apache/mynewt-mcumgr-cli/mcumgr/mcumgr.go:94 +0xe0
 
goroutine 6 [syscall]:
os/signal.signal_recv(0x0)
        /snap/go/4668/src/runtime/sigqueue.go:147 +0x130
os/signal.loop()
        /snap/go/4668/src/os/signal/signal_unix.go:23 +0x14
created by os/signal.init.0
        /snap/go/4668/src/os/signal/signal_unix.go:29 +0x30
 
goroutine 9 [chan receive]:
main.main.func1(0x2c42800)
        /home/mayank/go/src/github.com/apache/mynewt-mcumgr-cli/mcumgr/mcumgr.go:82 +0x34
created by main.main
        /home/mayank/go/src/github.com/apache/mynewt-mcumgr-cli/mcumgr/mcumgr.go:80 +0xd8
 
goroutine 10 [runnable]:
bufio.(*Scanner).Scan(0x2f9be80, 0x2f9be80)
        /snap/go/4668/src/bufio/scan.go:203 +0x230
 
goroutine 11 [select]:
Error: NMP timeout


--> Can anyone has came across such issue.
Regards,
Mayank


Adam Podogrocki
 

Hi Mayank,

could you please attach your 'zephyr/.config' file? Maybe I will find some inaccuracy there.

Cheers,
Adam

On Fri, 8 Nov 2019 at 06:00, Mayank <mayank7117@...> wrote:
Thanks Adam, I have disabled BT and Shell, Only UART is there.
Now, when i run the command with debug mode --> mcumgr -ldebug --conntype=serial --connstring='dev=/dev/ttymxc0,baud=115200' echo hello

I'm getting following response with timeout.

DEBU[2019-11-07 15:24:57.671] Using connection profile: name=unnamed type=serial connstring=dev=/dev/ttymxc0,baud=115200 
DEBU[2019-11-07 15:24:57.678] {add-nmp-listener} [serial_sesn.go:213] seq=66 
DEBU[2019-11-07 15:24:57.68] Encoded &{NmpBase:{hdr:{Op:2 Flags:0 Len:0 Group:0 Seq:66 Id:0}} Payload:hello} to:
00000000  a1 61 64 65 68 65 6c 6c  6f                       |.adehello| 
DEBU[2019-11-07 15:24:57.681] Encoded:
00000000  02 00 00 09 00 00 42 00  a1 61 64 65 68 65 6c 6c  |......B..adehell|
00000010  6f                                                |o| 
DEBU[2019-11-07 15:24:57.705] Tx NMP request: 00000000  02 00 00 09 00 00 42 00  a1 61 64 65 68 65 6c 6c  |......B..adehell|
00000010  6f                                                |o| 
DEBU[2019-11-07 15:24:57.706] Base64 encoding request:
00000000  02 00 00 09 00 00 42 00  a1 61 64 65 68 65 6c 6c  |......B..adehell|
00000010  6f                                                |o| 
DEBU[2019-11-07 15:24:57.707] Tx serial
00000000  06 09                                             |..| 
DEBU[2019-11-07 15:24:57.708] Tx serial
00000000  41 42 4d 43 41 41 41 4a  41 41 42 43 41 4b 46 68  |ABMCAAAJAABCAKFh|
00000010  5a 47 56 6f 5a 57 78 73  62 38 45 4a              |ZGVoZWxsb8EJ| 
DEBU[2019-11-07 15:24:57.709] Tx serial
00000000  0a                                                |.| 
DEBU[2019-11-07 15:25:07.713] {remove-nmp-listener} [serial_sesn.go:213] seq=66 
DEBU[2019-11-07 15:25:07.726] goroutine 1 [running]:
github.com/spf13/cobra.(*Command).execute(0x2ce1400, 0x2ca72e0, 0x4, 0x4, 0x2ce1400, 0x2ca72e0)
        /home/mayank/go/bin/pkg/mod/github.com/spf13/cobra@....5/command.go:830 +0x1f4
        /home/mayank/go/bin/pkg/mod/github.com/spf13/cobra@....5/command.go:914 +0x230
        /home/mayank/go/bin/pkg/mod/github.com/spf13/cobra@....5/command.go:864
main.main()
        /home/mayank/go/src/github.com/apache/mynewt-mcumgr-cli/mcumgr/mcumgr.go:94 +0xe0
 
goroutine 6 [syscall]:
os/signal.signal_recv(0x0)
        /snap/go/4668/src/runtime/sigqueue.go:147 +0x130
os/signal.loop()
        /snap/go/4668/src/os/signal/signal_unix.go:23 +0x14
created by os/signal.init.0
        /snap/go/4668/src/os/signal/signal_unix.go:29 +0x30
 
goroutine 9 [chan receive]:
main.main.func1(0x2c42800)
        /home/mayank/go/src/github.com/apache/mynewt-mcumgr-cli/mcumgr/mcumgr.go:82 +0x34
created by main.main
        /home/mayank/go/src/github.com/apache/mynewt-mcumgr-cli/mcumgr/mcumgr.go:80 +0xd8
 
goroutine 10 [runnable]:
bufio.(*Scanner).Scan(0x2f9be80, 0x2f9be80)
        /snap/go/4668/src/bufio/scan.go:203 +0x230
 
goroutine 11 [select]:
Error: NMP timeout


--> Can anyone has came across such issue.
Regards,
Mayank


Mayank
 

Thanks Adam, I have disabled BT and Shell, Only UART is there.
Now, when i run the command with debug mode --> mcumgr -ldebug --conntype=serial --connstring='dev=/dev/ttymxc0,baud=115200' echo hello

I'm getting following response with timeout.

DEBU[2019-11-07 15:24:57.671] Using connection profile: name=unnamed type=serial connstring=dev=/dev/ttymxc0,baud=115200 
DEBU[2019-11-07 15:24:57.678] {add-nmp-listener} [serial_sesn.go:213] seq=66 
DEBU[2019-11-07 15:24:57.68] Encoded &{NmpBase:{hdr:{Op:2 Flags:0 Len:0 Group:0 Seq:66 Id:0}} Payload:hello} to:
00000000  a1 61 64 65 68 65 6c 6c  6f                       |.adehello| 
DEBU[2019-11-07 15:24:57.681] Encoded:
00000000  02 00 00 09 00 00 42 00  a1 61 64 65 68 65 6c 6c  |......B..adehell|
00000010  6f                                                |o| 
DEBU[2019-11-07 15:24:57.705] Tx NMP request: 00000000  02 00 00 09 00 00 42 00  a1 61 64 65 68 65 6c 6c  |......B..adehell|
00000010  6f                                                |o| 
DEBU[2019-11-07 15:24:57.706] Base64 encoding request:
00000000  02 00 00 09 00 00 42 00  a1 61 64 65 68 65 6c 6c  |......B..adehell|
00000010  6f                                                |o| 
DEBU[2019-11-07 15:24:57.707] Tx serial
00000000  06 09                                             |..| 
DEBU[2019-11-07 15:24:57.708] Tx serial
00000000  41 42 4d 43 41 41 41 4a  41 41 42 43 41 4b 46 68  |ABMCAAAJAABCAKFh|
00000010  5a 47 56 6f 5a 57 78 73  62 38 45 4a              |ZGVoZWxsb8EJ| 
DEBU[2019-11-07 15:24:57.709] Tx serial
00000000  0a                                                |.| 
DEBU[2019-11-07 15:25:07.713] {remove-nmp-listener} [serial_sesn.go:213] seq=66 
DEBU[2019-11-07 15:25:07.726] goroutine 1 [running]:
mynewt.apache.org/newt/util.NewNewtError(0x5b35ca, 0xb, 0xb)
        /home/mayank/go/bin/pkg/mod/mynewt.apache.org/newt@....0-20190805215728-4e771ee138aa/util/util.go:77 +0xa4
mynewt.apache.org/newt/util.ChildNewtError(0x68d080, 0x2c0e010, 0x2c5cbd0)
        /home/mayank/go/bin/pkg/mod/mynewt.apache.org/newt@....0-20190805215728-4e771ee138aa/util/util.go:103 +0x78
mynewt.apache.org/newtmgr/newtmgr/cli.echoRunCmd(0x2ce1400, 0x2ca73e0, 0x1, 0x4)
        /home/mayank/go/bin/pkg/mod/mynewt.apache.org/newtmgr@....0-20190909210301-5029f07bf173/newtmgr/cli/echo.go:48 +0x1dc
github.com/spf13/cobra.(*Command).execute(0x2ce1400, 0x2ca72e0, 0x4, 0x4, 0x2ce1400, 0x2ca72e0)
        /home/mayank/go/bin/pkg/mod/github.com/spf13/cobra@....5/command.go:830 +0x1f4
github.com/spf13/cobra.(*Command).ExecuteC(0x2c82640, 0x5dc824, 0x2c42800, 0x0)
        /home/mayank/go/bin/pkg/mod/github.com/spf13/cobra@....5/command.go:914 +0x230
github.com/spf13/cobra.(*Command).Execute(...)
        /home/mayank/go/bin/pkg/mod/github.com/spf13/cobra@....5/command.go:864
main.main()
        /home/mayank/go/src/github.com/apache/mynewt-mcumgr-cli/mcumgr/mcumgr.go:94 +0xe0
 
goroutine 6 [syscall]:
os/signal.signal_recv(0x0)
        /snap/go/4668/src/runtime/sigqueue.go:147 +0x130
os/signal.loop()
        /snap/go/4668/src/os/signal/signal_unix.go:23 +0x14
created by os/signal.init.0
        /snap/go/4668/src/os/signal/signal_unix.go:29 +0x30
 
goroutine 9 [chan receive]:
main.main.func1(0x2c42800)
        /home/mayank/go/src/github.com/apache/mynewt-mcumgr-cli/mcumgr/mcumgr.go:82 +0x34
created by main.main
        /home/mayank/go/src/github.com/apache/mynewt-mcumgr-cli/mcumgr/mcumgr.go:80 +0xd8
 
goroutine 10 [runnable]:
bufio.(*Scanner).Scan(0x2f9be80, 0x2f9be80)
        /snap/go/4668/src/bufio/scan.go:203 +0x230
mynewt.apache.org/newtmgr/nmxact/nmserial.(*SerialXport).Rx(0x2c42cc0, 0x2c2dfd0, 0x0, 0x0, 0x68cb58, 0x2c0f4f0)
        /home/mayank/go/bin/pkg/mod/mynewt.apache.org/newtmgr@....0-20190909210301-5029f07bf173/nmxact/nmserial/serial_xport.go:304 +0xec
mynewt.apache.org/newtmgr/nmxact/nmserial.(*SerialXport).Start.func1(0x2c42cc0)
        /home/mayank/go/bin/pkg/mod/mynewt.apache.org/newtmgr@....0-20190909210301-5029f07bf173/nmxact/nmserial/serial_xport.go:135 +0xd8
created by mynewt.apache.org/newtmgr/nmxact/nmserial.(*SerialXport).Start
        /home/mayank/go/bin/pkg/mod/mynewt.apache.org/newtmgr@....0-20190909210301-5029f07bf173/nmxact/nmserial/serial_xport.go:127 +0xf8
 
goroutine 11 [select]:
mynewt.apache.org/newtmgr/nmxact/nmserial.(*SerialSesn).Open.func1(0x2c5cbd0)
        /home/mayank/go/bin/pkg/mod/mynewt.apache.org/newtmgr@....0-20190909210301-5029f07bf173/nmxact/nmserial/serial_sesn.go:101 +0xcc
created by mynewt.apache.org/newtmgr/nmxact/nmserial.(*SerialSesn).Open
        /home/mayank/go/bin/pkg/mod/mynewt.apache.org/newtmgr@....0-20190909210301-5029f07bf173/nmxact/nmserial/serial_sesn.go:97 +0x1b8 
Error: NMP timeout


--> Can anyone has came across such issue.
Regards,
Mayank


Adam Podogrocki
 

Hi Mayank,

If you are using UART as a connection type, then please disable other communication channels like BT and shell - at least in my case with STM32 it helped.

I assume that flash partition layout corresponds to what you've wrote: "I have flashed MCUBOOT (0x0 to 0x8000) and smp_svr (0xC000 to 0x27000)." 
I assume that you have signed the 'smp_svr' binary.
Regards,
Adam

On Wed, 6 Nov 2019 at 07:36, Mayank Patel <mayank7117@...> wrote:
Hi Adam,

Thanks for the quick reply.
I have flashed MCUBOOT (0x0 to 0x8000) and smp_svr (0xC000 to 0x27000).
The flag CONFIG_UART_MCUMGR_ON_DEV_NAME is defaults to 'UART_0'.

My DTS file has following configuration right now.
        chosen {
                zephyr,console = &uart0;
                zephyr,shell-uart = &uart0;
                zephyr,uart-mcumgr = &uart0;
                zephyr,bt-mon-uart = &uart0;
                zephyr,sram = &sram0;
                zephyr,flash = &flash0;
                zephyr,code-partition = &slot0_partition;
        };

&uart0 {
        compatible = "nordic,nrf-uart";
        current-speed = <115200>;
        status = "ok";
        //For i.MX DCE configuration
        tx-pin = <8>;
        rx-pin = <4>;
        rts-pin = <26>;
        cts-pin = <6>;
};

Command used from imx6ul board running on yocto linux:
sudo mcumgr --conntype serial --connstring='dev=/dev/ttymxc0,baud=115200' echo hello

So, am i missing some configuration or do you see any other issue?




Regards,
Mayank Patel
(M.Tech VLSI & Embedded system)
Ganpat University
+91-9722260070


On Tue, Nov 5, 2019 at 8:43 PM Adam Podogrocki <a.podogrocki@...> wrote:
Hi Mayank,

If you are sure the partition layout of flash memory is correct and you flashed MCUboot and SMP_SVR sample respectively, then please check if the CONFIG_UART_MCUMGR_ON_DEV_NAME is set correctly.

Regards,
Adam



On Tue, 5 Nov 2019 at 15:15, Mayank <mayank7117@...> wrote:

Hi,
I have nrf52840 on my custom board (Based on IMX6, Running Yocto linux) which is connected over UART.
I want to do an OTA of zephyr OS on that chip over serial/ble and for that i had already tried following things.
1) I have build smp_svr and flashed it to nrf52840 so that i can use 'mcumgr' command line tool for the flashing.
Referred https://docs.zephyrproject.org/1.14.0/samples/subsys/mgmt/mcumgr/smp_svr/README.html?highlight=build%20smp_svr to know how to use 'mcumgr'.

Now, when i use mcumgr to communicate 'hello' message over serial/UART, It shows error of connection timed out. (Also tried with -t switch, but no luck).
Command used are :
sudo mcumgr --conntype serial --connstring='dev=/dev/ttymxc0,baud=115200' echo hello
--> So it's not able to open the connection using mcumgr and not getting any reply (Getting timeout).


Mayank
 

Hi Adam,

Thanks for the quick reply.
I have flashed MCUBOOT (0x0 to 0x8000) and smp_svr (0xC000 to 0x27000).
The flag CONFIG_UART_MCUMGR_ON_DEV_NAME is defaults to 'UART_0'.

My DTS file has following configuration right now.
        chosen {
                zephyr,console = &uart0;
                zephyr,shell-uart = &uart0;
                zephyr,uart-mcumgr = &uart0;
                zephyr,bt-mon-uart = &uart0;
                zephyr,sram = &sram0;
                zephyr,flash = &flash0;
                zephyr,code-partition = &slot0_partition;
        };

&uart0 {
        compatible = "nordic,nrf-uart";
        current-speed = <115200>;
        status = "ok";
        //For i.MX DCE configuration
        tx-pin = <8>;
        rx-pin = <4>;
        rts-pin = <26>;
        cts-pin = <6>;
};

Command used from imx6ul board running on yocto linux:
sudo mcumgr --conntype serial --connstring='dev=/dev/ttymxc0,baud=115200' echo hello

So, am i missing some configuration or do you see any other issue?




Regards,
Mayank Patel
(M.Tech VLSI & Embedded system)
Ganpat University
+91-9722260070


On Tue, Nov 5, 2019 at 8:43 PM Adam Podogrocki <a.podogrocki@...> wrote:
Hi Mayank,

If you are sure the partition layout of flash memory is correct and you flashed MCUboot and SMP_SVR sample respectively, then please check if the CONFIG_UART_MCUMGR_ON_DEV_NAME is set correctly.

Regards,
Adam



On Tue, 5 Nov 2019 at 15:15, Mayank <mayank7117@...> wrote:

Hi,
I have nrf52840 on my custom board (Based on IMX6, Running Yocto linux) which is connected over UART.
I want to do an OTA of zephyr OS on that chip over serial/ble and for that i had already tried following things.
1) I have build smp_svr and flashed it to nrf52840 so that i can use 'mcumgr' command line tool for the flashing.
Referred https://docs.zephyrproject.org/1.14.0/samples/subsys/mgmt/mcumgr/smp_svr/README.html?highlight=build%20smp_svr to know how to use 'mcumgr'.

Now, when i use mcumgr to communicate 'hello' message over serial/UART, It shows error of connection timed out. (Also tried with -t switch, but no luck).
Command used are :
sudo mcumgr --conntype serial --connstring='dev=/dev/ttymxc0,baud=115200' echo hello
--> So it's not able to open the connection using mcumgr and not getting any reply (Getting timeout).


Adam Podogrocki
 

Hi Mayank,

If you are sure the partition layout of flash memory is correct and you flashed MCUboot and SMP_SVR sample respectively, then please check if the CONFIG_UART_MCUMGR_ON_DEV_NAME is set correctly.

Regards,
Adam



On Tue, 5 Nov 2019 at 15:15, Mayank <mayank7117@...> wrote:

Hi,
I have nrf52840 on my custom board (Based on IMX6, Running Yocto linux) which is connected over UART.
I want to do an OTA of zephyr OS on that chip over serial/ble and for that i had already tried following things.
1) I have build smp_svr and flashed it to nrf52840 so that i can use 'mcumgr' command line tool for the flashing.
Referred https://docs.zephyrproject.org/1.14.0/samples/subsys/mgmt/mcumgr/smp_svr/README.html?highlight=build%20smp_svr to know how to use 'mcumgr'.

Now, when i use mcumgr to communicate 'hello' message over serial/UART, It shows error of connection timed out. (Also tried with -t switch, but no luck).
Command used are :
sudo mcumgr --conntype serial --connstring='dev=/dev/ttymxc0,baud=115200' echo hello
--> So it's not able to open the connection using mcumgr and not getting any reply (Getting timeout).


Mayank
 

Hi,
I have nrf52840 on my custom board (Based on IMX6, Running Yocto linux) which is connected over UART.
I want to do an OTA of zephyr OS on that chip over serial/ble and for that i had already tried following things.
1) I have build smp_svr and flashed it to nrf52840 so that i can use 'mcumgr' command line tool for the flashing.
Referred https://docs.zephyrproject.org/1.14.0/samples/subsys/mgmt/mcumgr/smp_svr/README.html?highlight=build%20smp_svr to know how to use 'mcumgr'.

Now, when i use mcumgr to communicate 'hello' message over serial/UART, It shows error of connection timed out. (Also tried with -t switch, but no luck).
Command used are :
sudo mcumgr --conntype serial --connstring='dev=/dev/ttymxc0,baud=115200' echo hello
--> So it's not able to open the connection using mcumgr and not getting any reply (Getting timeout).