Kernel BUG at /usr/src/kernel/kernel/time/timer.c:806!

Hello everyone,

we’re having a problem with msm_serial_hs_0 for some reason in one of our apps. However, we cannot find the issue and also don’t think that it’s a problem in our app. The issue only appears sometimes but with no specific pattern.
Besides, it can only appear after the device has completely been disconnected from and re-connected to the power supply. If it doesn’t crash after a power cycle, it never crashes. If it crashes after a power cycle it crashes always.
Also, the error is thrown before the COMPONENT_INIT function is called and after the error is raised SierraWireless crashes completely.
We use a WP7607 module with the Linux version swi-mdm9x28-wp 3.18.140 #1 PREEMPT Tue Aug 3 08:17:34 UTC 2021 armv7l GNU/Linux

[  146.904159] ------------[ cut here ]------------
[  146.907745] kernel BUG at /usr/src/kernel/kernel/time/timer.c:806!
[  146.913909] Internal error: Oops - BUG: 0 [#1] PREEMPT ARM
[  146.919373] Modules linked in:
[  146.922417] CPU: 0 PID: 51 Comm: msm_serial_hs_0 Not tainted 3.18.140 #1
[  146.929098] task: ce193200 ti: ce220000 task.ti: ce220000
[  146.934484] PC is at mod_timer+0x7c/0x12c
[  146.938474] LR is at msm_hs_submit_tx_locked+0x108/0x14c
[  146.943770] pc : [<c005b130>]    lr : [<c02a9f70>]    psr: 60070193
[  146.943770] sp : ce221ed0  ip : 00000000  fp : 00000000
[  146.955227] r10: 00000000  r9 : 00000001  r8 : c0016e80
[  146.960436] r7 : cef971c4  r6 : ce1c0000  r5 : 00000000  r4 : ffffc496
[  146.966942] r3 : 00000000  r2 : 00000001  r1 : ffffc496  r0 : cef971c4
[  146.973457] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
[  146.980663] Control: 10c53c7d  Table: 88828059  DAC: 00000051
[  146.986392]
[  146.986392] PC: 0xc005b0b0:
[  146.990642] b0b0  c0e091d8 e92d41f3 e1a07000 e5904018 e3540000 a0844001 aa000006 e59f3104
[  146.998802] b0d0  e5934000 e0414004 e35400ff d1a04001 da000009 e0814444 e1510004 e0213004
[  147.006958] b0f0  e58d3004 0a000004 e3a01020 e28d0004 eb06fb02 e3e03000 e0044013 e5973000
[  147.015120] b110  e3530000 0a000002 e5973008 e1530004 0a00002a e5973010 e3530000 1a000000
[  147.023281] b130  e7f001f2 e28d1004 e1a00007 ebfffe19 e3a02000 e1a01000 e1a06000 e1a00007
[  147.031436] b150  ebffff85 e1a08000 eb070ecb e59f3078 e5935000 e1560005 0a00000e e5963010
[  147.039599] b170  e1570003 01a05006 0a00000a e597300c e1a00006 e2033003 e587300c eb1cecab
[  147.047755] b190  e1a00005 eb1cec9b e597300c e2033003 e1853003 e587300c e1a01007 e1a00005
[  147.055918]
[  147.055918] LR: 0xc02a9ef0:
[  147.060169] 9ef0  01a0300c e5938024 e3580000 0a000001 e3a03001 e12fff38 e5847100 e3a01000
[  147.068332] 9f10  e596314c e5962144 e59401d0 e0822003 e58d5000 e58d1004 e58d7008 e59f1070
[  147.076493] 9f30  ebffffa8 e1a01005 e1a02007 e3a03903 e594013c e58d3000 e1a03004 eb09f2db
[  147.084648] 9f50  e1a05000 e3a00ffa ebf6c02a e59f3044 e5931000 e0801001 e2840f6d ebf6c450
[  147.092810] 9f70  e5943434 e3530003 daffffc9 e594042c e3500000 0affffc6 e1a03005 e59f2018
[  147.100973] 9f90  e59f1018 e28dd010 e8bd41f0 eaf75aad c0e0479c c09d3d8f c0e091e0 c07c204f
[  147.109129] 9fb0  c09d3d92 e92d4070 e1a04000 e590341c e3530000 0a00000c e59f108c e59f008c
[  147.117291] 9fd0  eb139173 e594042c e3500000 08bd8070 e5943434 e3530001 d8bd8070 e59f2068
[  147.125448]
[  147.125448] SP: 0xce221e50:
[  147.129705] 1e50  ce1bc0a4 00000002 00000008 0000ffff ce1bc000 00000002 c005b134 00000000
[  147.137860] 1e70  c00131d8 00000000 e7100000 c0012da0 cef971c4 ffffc496 00000001 00000000
[  147.146021] 1e90  ffffc496 00000000 ce1c0000 cef971c4 c0016e80 00000001 00000000 00000000
[  147.154182] 1eb0  00000000 ce221ed0 c02a9f70 c005b130 60070193 ffffffff 00000051 0000c000
[  147.162338] 1ed0  cef971c4 00000000 cef97010 00000000 ce1c0000 0000001d c0016e80 c02a9f70
[  147.170500] 1ef0  0000c000 00000000 0000001d 00000003 cef97118 cef97010 20070113 ce1c0000
[  147.178662] 1f10  c098c8ec c02ac85c cef97118 cef97128 ce220000 c0f1a84c c098c8ec c0035680
[  147.186818] 1f30  ce1adbc0 00000000 cef97128 c00355d4 00000000 00000000 00000000 c00357dc
[  147.194980]
[  147.194980] R0: 0xcef97144:
[  147.199237] 7144  cef97118 ce193200 ce1bc400 7fffffff cccccccc 00000000 ce1bc000 cccccccc
[  147.207393] 7164  00000002 00000001 cccccccc 20000021 cf442000 8f442000 cccccccc 00000048
[  147.215555] 7184  cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc 00000010 cccccccc
[  147.223711] 71a4  cccccccc cccccccc cccccccc 00000021 00000000 00000000 c02a84cc cef97010
[  147.231872] 71c4  00000000 00000000 00000000 00000000 00000000 00000000 00000000 ce1bd240
[  147.240033] 71e4  00000000 00000001 dead4ead ffffffff ffffffff cef971f8 cef971f8 8f443000
[  147.248196] 7204  cf443000 00000000 ffffffe0 cef97210 cef97210 c02a86f4 00000000 00000000
[  147.256351] 7224  00000000 c0f1a902 c002fe50 cef9720c ffffffff 00000000 00000000 cef97240
[  147.264513]
[  147.264513] R1: 0xffffc416:
[  147.268764] c414  ******** ******** ******** ******** ******** ******** ******** ********
[  147.276928] c434  ******** ******** ******** ******** ******** ******** ******** ********
[  147.285084] c454  ******** ******** ******** ******** ******** ******** ******** ********
[  147.293247] c474  ******** ******** ******** ******** ******** ******** ******** ********
[  147.301402] c494  ******** ******** ******** ******** ******** ******** ******** ********
[  147.309566] c4b4  ******** ******** ******** ******** ******** ******** ******** ********
[  147.317722] c4d4  ******** ******** ******** ******** ******** ******** ******** ********
[  147.325886] c4f4  ******** ******** ******** ******** ******** ******** ******** ********
[  147.334043] c514  ******** ******** ******** ******** ******** ******** ******** ********
[  147.342207]
[  147.342207] R4: 0xffffc416:
[  147.346457] c414  ******** ******** ******** ******** ******** ******** ******** ********
[  147.354620] c434  ******** ******** ******** ******** ******** ******** ******** ********
[  147.362775] c454  ******** ******** ******** ******** ******** ******** ******** ********
[  147.370932] c474  ******** ******** ******** ******** ******** ******** ******** ********
[  147.379096] c494  ******** ******** ******** ******** ******** ******** ******** ********
[  147.387252] c4b4  ******** ******** ******** ******** ******** ******** ******** ********
[  147.395415] c4d4  ******** ******** ******** ******** ******** ******** ******** ********
[  147.403578] c4f4  ******** ******** ******** ******** ******** ******** ******** ********
[  147.411733] c514  ******** ******** ******** ******** ******** ******** ******** ********
[  147.419897]
[  147.419897] R6: 0xce1bff80:
[  147.424148] ff80  00000001 dead4ead ffffffff ffffffff ce1bff90 ce1bff90 ce1adbc0 ce1adbc0
[  147.432304] ffa0  c0035714 00000000 00000000 c000e798 00000000 00000000 00000000 00000000
[  147.440465] ffc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  147.448627] ffe0  00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[  147.456786] 0000  c26cfc00 cfc76405 c0e06b10 c0e06b10 c0294634 00000000 00000001 dead4ead
[  147.464948] 0020  ffffffff ffffffff ce1c0028 ce1c0028 ccd55900 00000000 ce1c0014 00000000
[  147.473104] 0040  c26cfc00 00000000 00000000 00000000 00000000 00000000 00000000 00000100
[  147.481266] 0060  000a0000 c26cfc00 c26cf800 c26cf800 c07c1cd8 00000001 dead4ead ffffffff
[  147.489429]
[  147.489429] R7: 0xcef97144:
[  147.493680] 7144  cef97118 ce193200 ce1bc400 7fffffff cccccccc 00000000 ce1bc000 cccccccc
[  147.501835] 7164  00000002 00000001 cccccccc 20000021 cf442000 8f442000 cccccccc 00000048
[  147.509997] 7184  cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc 00000010 cccccccc
[  147.518159] 71a4  cccccccc cccccccc cccccccc 00000021 00000000 00000000 c02a84cc cef97010
[  147.526314] 71c4  00000000 00000000 00000000 00000000 00000000 00000000 00000000 ce1bd240
[  147.534476] 71e4  00000000 00000001 dead4ead ffffffff ffffffff cef971f8 cef971f8 8f443000
[  147.542638] 7204  cf443000 00000000 ffffffe0 cef97210 cef97210 c02a86f4 00000000 00000000
[  147.550800] 7224  00000000 c0f1a902 c002fe50 cef9720c ffffffff 00000000 00000000 cef97240
[  147.558955]
[  147.558955] R8: 0xc0016e00:
[  147.563213] 6e00  13c4403c 1a00001a e5953000 e3130080 13c4403c 1a000002 e5953000 e3130008
[  147.571369] 6e20  0a000012 e3844c02 e28d3014 e1a02008 e1a01007 e1a00006 eb0b3611 e3500000
[  147.579532] 6e40  159d0014 1a000007 e98d0401 e1a03009 e58d500c e1a02008 e58d4000 e1a01007
[  147.587688] 6e60  e1a00006 ebffff00 e28dd018 e8bd87f0 e3c44f8f e3844f81 eaffffea c0ef72b0
[  147.595851] 6e80  e92d4007 e3500000 e7ebe051 e1a01621 15900148 e59fc02c 10811000 e59f0028
[  147.604006] 6ea0  e59cc000 e5900000 e0410000 e59f101c e08c0280 e58d1000 e1a0100e ebfffc34
[  147.612167] 6ec0  e28dd00c e49df004 c0f1e33c c0e02fc0 c0019d50 e92d40f0 e3a05000 e1530005
[  147.620329] 6ee0  e3e04000 01520004 e1a06002 e1a07003 e59fc058 9a000007 e3500000 e59ce000
[  147.628493] Process msm_serial_hs_0 (pid: 51, stack limit = 0xce220208)
[  147.635087] Stack: (0xce221ed0 to 0xce222000)
[  147.639427] 1ec0:                                     cef971c4 00000000 cef97010 00000000
[  147.647588] 1ee0: ce1c0000 0000001d c0016e80 c02a9f70 0000c000 00000000 0000001d 00000003
[  147.655749] 1f00: cef97118 cef97010 20070113 ce1c0000 c098c8ec c02ac85c cef97118 cef97128
[  147.663908] 1f20: ce220000 c0f1a84c c098c8ec c0035680 ce1adbc0 00000000 cef97128 c00355d4
[  147.672068] 1f40: 00000000 00000000 00000000 c00357dc 00000000 00000000 00000000 cef97128
[  147.680228] 1f60: 00000000 00000001 dead4ead ffffffff ffffffff ce221f74 ce221f74 00000000
[  147.688389] 1f80: 00000001 dead4ead ffffffff ffffffff ce221f90 ce221f90 ce1adbc0 ce1adbc0
[  147.696549] 1fa0: c0035714 00000000 00000000 c000e798 00000000 00000000 00000000 00000000
[  147.704709] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  147.712868] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[  147.721040] [<c005b130>] (mod_timer) from [<c02a9f70>] (msm_hs_submit_tx_locked+0x108/0x14c)
[  147.729455] [<c02a9f70>] (msm_hs_submit_tx_locked) from [<c02ac85c>] (msm_serial_hs_tx_work+0x64/0x14c)
[  147.738825] [<c02ac85c>] (msm_serial_hs_tx_work) from [<c0035680>] (kthread_worker_fn+0xac/0x140)
[  147.747681] [<c0035680>] (kthread_worker_fn) from [<c00357dc>] (kthread+0xc8/0xd4)
[  147.755230] [<c00357dc>] (kthread) from [<c000e798>] (ret_from_fork+0x14/0x3c)
[  147.762436] Code: 0a00002a e5973010 e3530000 1a000000 (e7f001f2)
[  147.768511] ---[ end trace c7db7e7559458adc ]---
[  147.773114] BUG: sleeping function called from invalid context at /usr/src/kernel/kernel/locking/rwsem.c:41
[  147.782828] in_atomic(): 1, irqs_disabled(): 128, pid: 51, name: msm_serial_hs_0
[  147.790205] Preemption disabled at:[<  (null)>]   (null)
[  147.795499]
[  147.796983] CPU: 0 PID: 51 Comm: msm_serial_hs_0 Tainted: G      D        3.18.140 #1
[  147.804800] [<c0014428>] (unwind_backtrace) from [<c00122ac>] (show_stack+0x10/0x14)
[  147.812524] [<c00122ac>] (show_stack) from [<c0795470>] (down_read+0x18/0x48)
[  147.819647] [<c0795470>] (down_read) from [<c002a288>] (exit_signals+0x14/0x12c)
[  147.827019] [<c002a288>] (exit_signals) from [<c0020fb8>] (do_exit+0xcc/0x8a8)
[  147.834224] [<c0020fb8>] (do_exit) from [<c00124b8>] (die+0x208/0x240)
[  147.840737] [<c00124b8>] (die) from [<c00082f0>] (do_undefinstr+0xec/0x21c)
[  147.847678] [<c00082f0>] (do_undefinstr) from [<c0012da0>] (__und_svc_finish+0x0/0x20)
[  147.855572] Exception stack(0xce221e80 to 0xce221ec8)
[  147.860613] 1e80: cef971c4 ffffc496 00000001 00000000 ffffc496 00000000 ce1c0000 cef971c4
[  147.868773] 1ea0: c0016e80 00000001 00000000 00000000 00000000 ce221ed0 c02a9f70 c005b130
[  147.876924] 1ec0: 60070193 ffffffff
[  147.880402] [<c0012da0>] (__und_svc_finish) from [<c005b130>] (mod_timer+0x7c/0x12c)
[  147.888128] [<c005b130>] (mod_timer) from [<c02a9f70>] (msm_hs_submit_tx_locked+0x108/0x14c)
[  147.896554] [<c02a9f70>] (msm_hs_submit_tx_locked) from [<c02ac85c>] (msm_serial_hs_tx_work+0x64/0x14c)
[  147.905923] [<c02ac85c>] (msm_serial_hs_tx_work) from [<c0035680>] (kthread_worker_fn+0xac/0x140)
[  147.914777] [<c0035680>] (kthread_worker_fn) from [<c00357dc>] (kthread+0xc8/0xd4)
[  147.922331] [<c00357dc>] (kthread) from [<c000e798>] (ret_from_fork+0x14/0x3c)
[  147.929533] note: msm_serial_hs_0[51] exited with preempt_count 1

We’ve also opened a Github issue for that yesterday: kernel BUG at /usr/src/kernel/kernel/time/timer.c:806! · Issue #72 · legatoproject/legato-af · GitHub

  1. Are you testing on r16.1?

  2. I saw the following in your crash log:

sleeping function called from invalid context

Does the system go sleep?

  1. Not sure if this helps to keep uart awake or disabling uart sleep mode, you can give a try:
  1. In addition, as you said " the error is thrown before the COMPONENT_INIT function is called ", does it solve if you delay the application start time?

  2. Lastly, do you see problem with this app?

  1. No, I don’t think so. Can we read out the release from the device? I just flashed SWI9X07Y_02.37.03.05 / 002.115_002 and SWI9X07Y_02.37.10.02 from https://source.sierrawireless.com/resources/airprime/software/wp76xx/wp76xx-firmware-release-16,-d-,1-components/. fwupdate query shows
Firmware Version: SWI9X07Y_02.37.03.05 52ddef jenkins 2021/12/22 04:24:24
Bootloader Version: SWI9X07Y_02.37.03.05 52ddef jenkins 2021/12/22 04:24:24
Linux Version: 3.18.140 #1 PREEMPT Fri Feb 11 09:40:40 UTC 2022
  1. I already tried to remove all sleeps or timer calls but it didn’t change anything.
  2. I also tried to disable the UART timeout via echo -1 > /sys/devices/78b0000.uart/power/autosuspend_delay_ms but the error still persists.
  3. What do you mean with delay? Adding a sleep to the function?
  4. Just tried to run ONLY your UART test app. The device crashes immediately, as soon as I start the app (but only sometimes after a complete power reset, as described in the original post).
usb 1-1: device descriptor read/64, error -110
root@swi-mdm9x28-wp:~# app status[   33.300978]

[stopped] UART_Test1

root@swi-mdm9x28-wp:~# app start UART_Test1
root@swi-mdm9x28-wp:~# [   37.561718] ------------[ cut here ]------------
[   37.565297] kernel BUG at /usr/src/kernel/kernel/time/timer.c:806!
[   37.571461] Internal error: Oops - BUG: 0 [#1] PREEMPT ARM
[   37.576930] Modules linked in:
[   37.579973] CPU: 0 PID: 51 Comm: msm_serial_hs_0 Not tainted 3.18.140 #1
[   37.586655] task: ce193200 ti: ce220000 task.ti: ce220000
[   37.592043] PC is at mod_timer+0x7c/0x12c
[   37.596028] LR is at msm_hs_submit_tx_locked+0x108/0x14c
[   37.601323] pc : [<c005b130>]    lr : [<c02a9f70>]    psr: 60000093
[   37.601323] sp : ce221ed0  ip : 00000000  fp : 00000000
[   37.612781] r10: 00000000  r9 : 00000001  r8 : c0016e80
[   37.617988] r7 : cef971c4  r6 : ce1c0000  r5 : 00000000  r4 : ffff99e0
[   37.624501] r3 : 00000000  r2 : 00000001  r1 : ffff99e0  r0 : cef971c4
[   37.631009] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
[   37.638213] Control: 10c53c7d  Table: 8cac4059  DAC: 00000051
[   37.643942]
[   37.643942] PC: 0xc005b0b0:
[   37.648197] b0b0  c0e091d8 e92d41f3 e1a07000 e5904018 e3540000 a0844001 aa000006 e59f3104
[   37.656354] b0d0  e5934000 e0414004 e35400ff d1a04001 da000009 e0814444 e1510004 e0213004
[   37.664515] b0f0  e58d3004 0a000004 e3a01020 e28d0004 eb06fb02 e3e03000 e0044013 e5973000
[   37.672674] b110  e3530000 0a000002 e5973008 e1530004 0a00002a e5973010 e3530000 1a000000
[   37.680834] b130  e7f001f2 e28d1004 e1a00007 ebfffe19 e3a02000 e1a01000 e1a06000 e1a00007
[   37.688994] b150  ebffff85 e1a08000 eb070ecb e59f3078 e5935000 e1560005 0a00000e e5963010
[   37.697153] b170  e1570003 01a05006 0a00000a e597300c e1a00006 e2033003 e587300c eb1cecab
[   37.705314] b190  e1a00005 eb1cec9b e597300c e2033003 e1853003 e587300c e1a01007 e1a00005
[   37.713475]
[   37.713475] LR: 0xc02a9ef0:
[   37.717723] 9ef0  01a0300c e5938024 e3580000 0a000001 e3a03001 e12fff38 e5847100 e3a01000
[   37.725889] 9f10  e596314c e5962144 e59401d0 e0822003 e58d5000 e58d1004 e58d7008 e59f1070
[   37.734048] 9f30  ebffffa8 e1a01005 e1a02007 e3a03903 e594013c e58d3000 e1a03004 eb09f2db
[   37.742208] 9f50  e1a05000 e3a00ffa ebf6c02a e59f3044 e5931000 e0801001 e2840f6d ebf6c450
[   37.750367] 9f70  e5943434 e3530003 daffffc9 e594042c e3500000 0affffc6 e1a03005 e59f2018
[   37.758527] 9f90  e59f1018 e28dd010 e8bd41f0 eaf75aad c0e0479c c09d3d8f c0e091e0 c07c204f
[   37.766687] 9fb0  c09d3d92 e92d4070 e1a04000 e590341c e3530000 0a00000c e59f108c e59f008c
[   37.774841] 9fd0  eb139173 e594042c e3500000 08bd8070 e5943434 e3530001 d8bd8070 e59f2068
[   37.783009]
[   37.783009] SP: 0xce221e50:
[   37.787257] 1e50  ce1bc0a4 00000002 00000008 0000ffff ce1bc000 00000002 c005b134 00000000
[   37.795417] 1e70  c00131d8 00000000 e7100000 c0012da0 cef971c4 ffff99e0 00000001 00000000
[   37.803576] 1e90  ffff99e0 00000000 ce1c0000 cef971c4 c0016e80 00000001 00000000 00000000
[   37.811736] 1eb0  00000000 ce221ed0 c02a9f70 c005b130 60000093 ffffffff 00000051 0000c000
[   37.819896] 1ed0  cef971c4 00000000 cef97010 00000000 ce1c0000 00000008 c0016e80 c02a9f70
[   37.828055] 1ef0  0000c000 00000000 00000008 00000003 cef97118 cef97010 20000013 ce1c0000
[   37.836215] 1f10  c098c8ec c02ac85c cef97118 cef97128 ce220000 c0f1a84c c098c8ec c0035680
[   37.844375] 1f30  ce1adbc0 00000000 cef97128 c00355d4 00000000 00000000 00000000 c00357dc
[   37.852535]
[   37.852535] R0: 0xcef97144:
[   37.856791] 7144  cef97118 ce193200 ce1bc400 7fffffff cccccccc 00000000 ce1bc000 cccccccc
[   37.864951] 7164  00000002 00000001 cccccccc 20000021 cf442000 8f442000 cccccccc 00000048
[   37.873111] 7184  cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc 00000010 cccccccc
[   37.881271] 71a4  cccccccc cccccccc cccccccc 00000021 00000000 00000000 c02a84cc cef97010
[   37.889430] 71c4  00000000 00000000 00000000 00000000 00000000 00000000 00000000 ce1bd240
[   37.897589] 71e4  00000000 00000001 dead4ead ffffffff ffffffff cef971f8 cef971f8 8f443000
[   37.905749] 7204  cf443000 00000000 ffffffe0 cef97210 cef97210 c02a86f4 00000000 00000000
[   37.913909] 7224  00000000 c0f1a902 c002fe50 cef9720c ffffffff 00000000 00000000 cef97240
[   37.922071]
[   37.922071] R1: 0xffff9960:
[   37.926320] 9960  ******** ******** ******** ******** ******** ******** ******** ********
[   37.934481] 9980  ******** ******** ******** ******** ******** ******** ******** ********
[   37.942642] 99a0  ******** ******** ******** ******** ******** ******** ******** ********
[   37.950803] 99c0  ******** ******** ******** ******** ******** ******** ******** ********
[   37.958957] 99e0  ******** ******** ******** ******** ******** ******** ******** ********
[   37.967117] 9a00  ******** ******** ******** ******** ******** ******** ******** ********
[   37.975277] 9a20  ******** ******** ******** ******** ******** ******** ******** ********
[   37.983439] 9a40  ******** ******** ******** ******** ******** ******** ******** ********
[   37.991601]
[   37.991601] R4: 0xffff9960:
[   37.995849] 9960  ******** ******** ******** ******** ******** ******** ******** ********
[   38.004011] 9980  ******** ******** ******** ******** ******** ******** ******** ********
[   38.012172] 99a0  ******** ******** ******** ******** ******** ******** ******** ********
[   38.020333] 99c0  ******** ******** ******** ******** ******** ******** ******** ********
[   38.028487] 99e0  ******** ******** ******** ******** ******** ******** ******** ********
[   38.036648] 9a00  ******** ******** ******** ******** ******** ******** ******** ********
[   38.044809] 9a20  ******** ******** ******** ******** ******** ******** ******** ********
[   38.052970] 9a40  ******** ******** ******** ******** ******** ******** ******** ********
[   38.061132]
[   38.061132] R6: 0xce1bff80:
[   38.065381] ff80  00000001 dead4ead ffffffff ffffffff ce1bff90 ce1bff90 ce1adbc0 ce1adbc0
[   38.073541] ffa0  c0035714 00000000 00000000 c000e798 00000000 00000000 00000000 00000000
[   38.081701] ffc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   38.089860] ffe0  00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[   38.098025] 0000  ccadc400 cfc76405 c0e06b10 c0e06b10 c0294634 00000000 00000001 dead4ead
[   38.106184] 0020  ffffffff ffffffff ce1c0028 ce1c0028 ccf9a800 00000000 ce1c0014 00000000
[   38.114344] 0040  ccadc400 00000000 00000000 00000000 00000000 00000000 00000000 00000100
[   38.122502] 0060  000a0000 ccadc400 ccadc000 ccadc000 c07c1cd8 00000001 dead4ead ffffffff
[   38.130663]
[   38.130663] R7: 0xcef97144:
[   38.134912] 7144  cef97118 ce193200 ce1bc400 7fffffff cccccccc 00000000 ce1bc000 cccccccc
[   38.143072] 7164  00000002 00000001 cccccccc 20000021 cf442000 8f442000 cccccccc 00000048
[   38.151232] 7184  cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc 00000010 cccccccc
[   38.159392] 71a4  cccccccc cccccccc cccccccc 00000021 00000000 00000000 c02a84cc cef97010
[   38.167551] 71c4  00000000 00000000 00000000 00000000 00000000 00000000 00000000 ce1bd240
[   38.175710] 71e4  00000000 00000001 dead4ead ffffffff ffffffff cef971f8 cef971f8 8f443000
[   38.183870] 7204  cf443000 00000000 ffffffe0 cef97210 cef97210 c02a86f4 00000000 00000000
[   38.192030] 7224  00000000 c0f1a902 c002fe50 cef9720c ffffffff 00000000 00000000 cef97240
[   38.200190]
[   38.200190] R8: 0xc0016e00:
[   38.204446] 6e00  13c4403c 1a00001a e5953000 e3130080 13c4403c 1a000002 e5953000 e3130008
[   38.212607] 6e20  0a000012 e3844c02 e28d3014 e1a02008 e1a01007 e1a00006 eb0b3611 e3500000
[   38.220767] 6e40  159d0014 1a000007 e98d0401 e1a03009 e58d500c e1a02008 e58d4000 e1a01007
[   38.228921] 6e60  e1a00006 ebffff00 e28dd018 e8bd87f0 e3c44f8f e3844f81 eaffffea c0ef72b0
[   38.237081] 6e80  e92d4007 e3500000 e7ebe051 e1a01621 15900148 e59fc02c 10811000 e59f0028
[   38.245241] 6ea0  e59cc000 e5900000 e0410000 e59f101c e08c0280 e58d1000 e1a0100e ebfffc34
[   38.253401] 6ec0  e28dd00c e49df004 c0f1e33c c0e02fc0 c0019d50 e92d40f0 e3a05000 e1530005
[   38.261561] 6ee0  e3e04000 01520004 e1a06002 e1a07003 e59fc058 9a000007 e3500000 e59ce000
[   38.269723] Process msm_serial_hs_0 (pid: 51, stack limit = 0xce220208)
[   38.276325] Stack: (0xce221ed0 to 0xce222000)
[   38.280664] 1ec0:                                     cef971c4 00000000 cef97010 00000000
[   38.288828] 1ee0: ce1c0000 00000008 c0016e80 c02a9f70 0000c000 00000000 00000008 00000003
[   38.296986] 1f00: cef97118 cef97010 20000013 ce1c0000 c098c8ec c02ac85c cef97118 cef97128
[   38.305144] 1f20: ce220000 c0f1a84c c098c8ec c0035680 ce1adbc0 00000000 cef97128 c00355d4
[   38.313308] 1f40: 00000000 00000000 00000000 c00357dc 00000000 00000000 00000000 cef97128
[   38.321465] 1f60: 00000000 00000001 dead4ead ffffffff ffffffff ce221f74 ce221f74 00000000
[   38.329623] 1f80: 00000001 dead4ead ffffffff ffffffff ce221f90 ce221f90 ce1adbc0 ce1adbc0
[   38.337786] 1fa0: c0035714 00000000 00000000 c000e798 00000000 00000000 00000000 00000000
[   38.345944] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   38.354100] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[   38.362277] [<c005b130>] (mod_timer) from [<c02a9f70>] (msm_hs_submit_tx_locked+0x108/0x14c)
[   38.370686] [<c02a9f70>] (msm_hs_submit_tx_locked) from [<c02ac85c>] (msm_serial_hs_tx_work+0x64/0x14c)
[   38.380060] [<c02ac85c>] (msm_serial_hs_tx_work) from [<c0035680>] (kthread_worker_fn+0xac/0x140)
[   38.388917] [<c0035680>] (kthread_worker_fn) from [<c00357dc>] (kthread+0xc8/0xd4)
[   38.396467] [<c00357dc>] (kthread) from [<c000e798>] (ret_from_fork+0x14/0x3c)
[   38.403670] Code: 0a00002a e5973010 e3530000 1a000000 (e7f001f2)
[   38.409744] ---[ end trace fb44254e93c3db88 ]---
[   38.414344] BUG: sleeping function called from invalid context at /usr/src/kernel/kernel/locking/rwsem.c:41
[   38.424067] in_atomic(): 1, irqs_disabled(): 128, pid: 51, name: msm_serial_hs_0
[   38.431442] Preemption disabled at:[<  (null)>]   (null)
[   38.436737]
[   38.438216] CPU: 0 PID: 51 Comm: msm_serial_hs_0 Tainted: G      D        3.18.140 #1
[   38.446039] [<c0014428>] (unwind_backtrace) from [<c00122ac>] (show_stack+0x10/0x14)
[   38.453760] [<c00122ac>] (show_stack) from [<c0795470>] (down_read+0x18/0x48)
[   38.460878] [<c0795470>] (down_read) from [<c002a288>] (exit_signals+0x14/0x12c)
[   38.468256] [<c002a288>] (exit_signals) from [<c0020fb8>] (do_exit+0xcc/0x8a8)
[   38.475458] [<c0020fb8>] (do_exit) from [<c00124b8>] (die+0x208/0x240)
[   38.481970] [<c00124b8>] (die) from [<c00082f0>] (do_undefinstr+0xec/0x21c)
[   38.488911] [<c00082f0>] (do_undefinstr) from [<c0012da0>] (__und_svc_finish+0x0/0x20)
[   38.496811] Exception stack(0xce221e80 to 0xce221ec8)
[   38.501848] 1e80: cef971c4 ffff99e0 00000001 00000000 ffff99e0 00000000 ce1c0000 cef971c4
[   38.510006] 1ea0: c0016e80 00000001 00000000 00000000 00000000 ce221ed0 c02a9f70 c005b130
[   38.518161] 1ec0: 60000093 ffffffff
[   38.521638] [<c0012da0>] (__und_svc_finish) from [<c005b130>] (mod_timer+0x7c/0x12c)
[   38.529368] [<c005b130>] (mod_timer) from [<c02a9f70>] (msm_hs_submit_tx_locked+0x108/0x14c)
[   38.537787] [<c02a9f70>] (msm_hs_submit_tx_locked) from [<c02ac85c>] (msm_serial_hs_tx_work+0x64/0x14c)
[   38.547158] [<c02ac85c>] (msm_serial_hs_tx_work) from [<c0035680>] (kthread_worker_fn+0xac/0x140)
[   38.556014] [<c0035680>] (kthread_worker_fn) from [<c00357dc>] (kthread+0xc8/0xd4)
[   38.563564] [<c00357dc>] (kthread) from [<c000e798>] (ret_from_fork+0x14/0x3c)
[   38.570768] note: msm_serial_hs_0[51] exited with preempt_count 1

You can use ati3 and ati8 to check the version.

I don’t see problem to run my uart app on r13.3, you can give a try.
Btw, are you using uart1 as data port?
Are you using mangoh board to test?

We found the issue. The problem is that another part of our hardware sends data on the UART continuously. This seems to cause some problems on the Sierra Wireless UART which lets the device crash.

  1. Do you see a reason why the device is crashing?
  2. Is there a way to detect that on the Sierra Wireless?
  1. Is this happening in both R13.3 and R16?

  2. seems it will not crash the module if you did not enter “app start your_app”, right? (provided that the app is not automatically run by default)

  3. is this only happening to legato application?
    For example, if you enter the following in console, will it crash?

stty -F /dev/ttyHS0 raw 115200 -crtscts 
microcom /dev/ttyHS0 -s 115200

You can also compile an UART program with toolchain only (i.e. not using legato framework), this can isolate if problem only happens to legato application

  1. Yes, it happens on both
  2. Yes, it’s not happening until the app is started (not just if our app is started, but also if the UART test app is started).
  3. Do you mean running this command if the app is stopped? Yes, it also crashes if the app is not started and stty -F /dev/ttyHS0 raw 115200 -crtscts is executed.

then this is not legato problem…
Which line makes the crash in OpenPort() function?

int OpenPort(const char* port)
{
	LE_INFO("Opening serial %s\r\n", port);
     int fd=open(port, O_RDWR | O_NOCTTY | O_NDELAY);
     if(fd==-1)
     {
    	 LE_INFO("Error opening serial port %s... exiting", port);
          exit(-1);
     }

     fcntl(fd, F_SETFL, 0); /* Reads will be blocking */
     struct termios options;
     tcgetattr(fd, &options);
     (void)cfsetispeed(&options, B115200); /* (void) is to stop warning in cygwin */
     (void)cfsetospeed(&options, B115200);
     options.c_cflag &= ~CSIZE;
     options.c_cflag |= CS8;  /* 8 bits */
     options.c_cflag &= ~CSTOPB; /* 1 stop bit */
     options.c_cflag &= ~PARENB; /* no parity */
     options.c_cflag &= ~PARODD;
   //  options.c_cflag &= ~CRTSCTS; /* HW flow control off */

     options.c_cflag |=CRTSCTS; /* HW flow control on */


     options.c_lflag =0; /* RAW input */
     options.c_iflag = 0;            /* SW flow control off, no parity checks etc */
     options.c_oflag &= ~OPOST; /* RAW output */
     options.c_cc[VTIME]=1; /* 1 sec */
     options.c_cc[VMIN]=BUFFER_SIZE;
     options.c_cflag |= (CLOCAL | CREAD);
     tcsetattr(fd, TCSAFLUSH, &options);

     return fd;
}

Will the peer side stop sending data to WP module if UART CTS is asserted?

I added a few debugging logs to the code. However, this code is not reached before the device crashes.

int OpenPort(const char* port)
{
	LE_INFO("Opening serial %s\r\n", port);
    LE_INFO("UART-0");
     int fd=open(port, O_RDWR | O_NOCTTY | O_NDELAY);
     if(fd==-1)
     {
    	 LE_INFO("Error opening serial port %s... exiting", port);
          exit(-1);
     }
     LE_INFO("UART-1");
     fcntl(fd, F_SETFL, 0); /* Reads will be blocking */
     LE_INFO("UART-2");
     struct termios options;
     LE_INFO("UART-3");
     tcgetattr(fd, &options);
     LE_INFO("UART-4");
     (void)cfsetispeed(&options, B115200); /* (void) is to stop warning in cygwin */
     LE_INFO("UART-5");
     (void)cfsetospeed(&options, B115200);

//     (void)cfsetispeed(&options, B9600); /* (void) is to stop warning in cygwin */
//          (void)cfsetospeed(&options, B9600);

    LE_INFO("UART-6");
     options.c_cflag &= ~CSIZE;
     LE_INFO("UART-7");
     options.c_cflag |= CS8;  /* 8 bits */
     LE_INFO("UART-8");
     options.c_cflag &= ~CSTOPB; /* 1 stop bit */
     LE_INFO("UART-9");
     options.c_cflag &= ~PARENB; /* no parity */
     LE_INFO("UART-10");
     options.c_cflag &= ~PARODD;
     LE_INFO("UART-11");
   //  options.c_cflag &= ~CRTSCTS; /* HW flow control off */
    LE_INFO("UART-12");
     options.c_cflag |=CRTSCTS; /* HW flow control on */

     LE_INFO("UART-13");
     options.c_lflag =0; /* RAW input */
     LE_INFO("UART-14");
     options.c_iflag = 0;            /* SW flow control off, no parity checks etc */
     LE_INFO("UART-15");
     options.c_oflag &= ~OPOST; /* RAW output */
     LE_INFO("UART-16");
     options.c_cc[VTIME]=1; /* 1 sec */
     LE_INFO("UART-17");
     options.c_cc[VMIN]=BUFFER_SIZE;
     LE_INFO("UART-18");
     options.c_cflag |= (CLOCAL | CREAD);
     LE_INFO("UART-19");
     tcsetattr(fd, TCSAFLUSH, &options);

     return fd;
}

As you can see, the code is definitely executed if the error doesn’t occur

root@swi-mdm9x28-wp:~# logread -f | grep -e "UART-"
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 62 | UART-0
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 69 | UART-1
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 71 | UART-2
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 73 | UART-3
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 75 | UART-4
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 77 | UART-5
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 83 | UART-6
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 85 | UART-7
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 87 | UART-8
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 89 | UART-9
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 91 | UART-10
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 93 | UART-11
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 95 | UART-12
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 98 | UART-13
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 100 | UART-14
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 102 | UART-15
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 104 | UART-16
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 106 | UART-17
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 108 | UART-18
Dec 23 09:42:35 swi-mdm9x28-wp user.info Legato:  INFO | uart[2287]/UART_Test1Component T=main | UART_Test1.c OpenPort() 110 | UART-19

But it’s not, if the device crashes. In both cases I started the logging in one remote session and the app in another to make sure I don’t miss anything.

root@swi-mdm9x28-wp:~# logread -f | grep -e "UART-"
[   88.788525] ------------[ cut here ]------------
[   88.792112] kernel BUG at /usr/src/kernel/kernel/time/timer.c:806!
[   88.798276] Internal error: Oops - BUG: 0 [#1] PREEMPT ARM
[   88.803741] Modules linked in:
[   88.806785] CPU: 0 PID: 51 Comm: msm_serial_hs_0 Not tainted 3.18.140 #1
[   88.813466] task: ce193200 ti: ce220000 task.ti: ce220000
[   88.818852] PC is at mod_timer+0x7c/0x12c
[   88.822842] LR is at msm_hs_submit_tx_locked+0x108/0x14c
[   88.828137] pc : [<c005b130>]    lr : [<c02a9f70>]    psr: 60070093
[   88.828137] sp : ce221ed0  ip : 00000000  fp : 00000000
[   88.839592] r10: 00000000  r9 : 00000001  r8 : c0016e80
[   88.844800] r7 : cef971c4  r6 : ce1c0000  r5 : 00000000  r4 : ffffade2
[   88.851313] r3 : 00000000  r2 : 00000001  r1 : ffffade2  r0 : cef971c4
[   88.857823] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
[   88.865031] Control: 10c53c7d  Table: 893c4059  DAC: 00000051
[   88.870753]
[   88.870753] PC: 0xc005b0b0:
[   88.875010] b0b0  c0e091d8 e92d41f3 e1a07000 e5904018 e3540000 a0844001 aa000006 e59f3104
[   88.883167] b0d0  e5934000 e0414004 e35400ff d1a04001 da000009 e0814444 e1510004 e0213004
[   88.891330] b0f0  e58d3004 0a000004 e3a01020 e28d0004 eb06fb02 e3e03000 e0044013 e5973000
[   88.899485] b110  e3530000 0a000002 e5973008 e1530004 0a00002a e5973010 e3530000 1a000000
[   88.907647] b130  e7f001f2 e28d1004 e1a00007 ebfffe19 e3a02000 e1a01000 e1a06000 e1a00007
[   88.915803] b150  ebffff85 e1a08000 eb070ecb e59f3078 e5935000 e1560005 0a00000e e5963010
[   88.923964] b170  e1570003 01a05006 0a00000a e597300c e1a00006 e2033003 e587300c eb1cecab
[   88.932127] b190  e1a00005 eb1cec9b e597300c e2033003 e1853003 e587300c e1a01007 e1a00005
[   88.940284]
[   88.940284] LR: 0xc02a9ef0:
[   88.944541] 9ef0  01a0300c e5938024 e3580000 0a000001 e3a03001 e12fff38 e5847100 e3a01000
[   88.952697] 9f10  e596314c e5962144 e59401d0 e0822003 e58d5000 e58d1004 e58d7008 e59f1070
[   88.960859] 9f30  ebffffa8 e1a01005 e1a02007 e3a03903 e594013c e58d3000 e1a03004 eb09f2db
[   88.969015] 9f50  e1a05000 e3a00ffa ebf6c02a e59f3044 e5931000 e0801001 e2840f6d ebf6c450
[   88.977177] 9f70  e5943434 e3530003 daffffc9 e594042c e3500000 0affffc6 e1a03005 e59f2018
[   88.985340] 9f90  e59f1018 e28dd010 e8bd41f0 eaf75aad c0e0479c c09d3d8f c0e091e0 c07c204f
[   88.993495] 9fb0  c09d3d92 e92d4070 e1a04000 e590341c e3530000 0a00000c e59f108c e59f008c
[   89.001657] 9fd0  eb139173 e594042c e3500000 08bd8070 e5943434 e3530001 d8bd8070 e59f2068
[   89.009819]
[   89.009819] SP: 0xce221e50:
[   89.014070] 1e50  ce1bc0a4 00000002 00000008 0000ffff ce1bc000 00000002 c005b134 00000000
[   89.022232] 1e70  c00131d8 00000000 e7100000 c0012da0 cef971c4 ffffade2 00000001 00000000
[   89.030387] 1e90  ffffade2 00000000 ce1c0000 cef971c4 c0016e80 00000001 00000000 00000000
[   89.038548] 1eb0  00000000 ce221ed0 c02a9f70 c005b130 60070093 ffffffff 00000051 0000c000
[   89.046710] 1ed0  cef971c4 00000000 cef97010 00000000 ce1c0000 0000000d c0016e80 c02a9f70
[   89.054871] 1ef0  0000c000 00000000 0000000d 00000003 cef97118 cef97010 20070013 ce1c0000
[   89.063026] 1f10  c098c8ec c02ac85c cef97118 cef97128 ce220000 c0f1a84c c098c8ec c0035680
[   89.071188] 1f30  ce1adbc0 00000000 cef97128 c00355d4 00000000 00000000 00000000 c00357dc
[   89.079352]
[   89.079352] R0: 0xcef97144:
[   89.083602] 7144  cef97118 ce193200 ce1bc400 7fffffff cccccccc 00000000 ce1bc000 cccccccc
[   89.091757] 7164  00000002 00000001 cccccccc 20000021 cf442000 8f442000 cccccccc 00000048
[   89.099920] 7184  cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc 00000010 cccccccc
[   89.108081] 71a4  cccccccc cccccccc cccccccc 00000021 00000000 00000000 c02a84cc cef97010
[   89.116243] 71c4  00000000 00000000 00000000 00000000 00000000 00000000 00000000 ce1bd240
[   89.124396] 71e4  00000000 00000001 dead4ead ffffffff ffffffff cef971f8 cef971f8 8f443000
[   89.132559] 7204  cf443000 00000000 ffffffe0 cef97210 cef97210 c02a86f4 00000000 00000000
[   89.140721] 7224  00000000 c0f1a902 c002fe50 cef9720c ffffffff 00000000 00000000 cef97240
[   89.148878]
[   89.148878] R1: 0xffffad62:
[   89.153135] ad60  ******** ******** ******** ******** ******** ******** ******** ********
[   89.161291] ad80  ******** ******** ******** ******** ******** ******** ******** ********
[   89.169454] ada0  ******** ******** ******** ******** ******** ******** ******** ********
[   89.177610] adc0  ******** ******** ******** ******** ******** ******** ******** ********
[   89.185774] ade0  ******** ******** ******** ******** ******** ******** ******** ********
[   89.193931] ae00  ******** ******** ******** ******** ******** ******** ******** ********
[   89.202087] ae20  ******** ******** ******** ******** ******** ******** ******** ********
[   89.210249] ae40  ******** ******** ******** ******** ******** ******** ******** ********
[   89.218412] ae60  ******** ******** ******** ******** ******** ******** ******** ********
[   89.226569]
[   89.226569] R4: 0xffffad62:
[   89.230820] ad60  ******** ******** ******** ******** ******** ******** ******** ********
[   89.238983] ad80  ******** ******** ******** ******** ******** ******** ******** ********
[   89.247140] ada0  ******** ******** ******** ******** ******** ******** ******** ********
[   89.255302] adc0  ******** ******** ******** ******** ******** ******** ******** ********
[   89.263464] ade0  ******** ******** ******** ******** ******** ******** ******** ********
[   89.271620] ae00  ******** ******** ******** ******** ******** ******** ******** ********
[   89.279782] ae20  ******** ******** ******** ******** ******** ******** ******** ********
[   89.287938] ae40  ******** ******** ******** ******** ******** ******** ******** ********
[   89.296102] ae60  ******** ******** ******** ******** ******** ******** ******** ********
[   89.304260]
[   89.304260] R6: 0xce1bff80:
[   89.308517] ff80  00000001 dead4ead ffffffff ffffffff ce1bff90 ce1bff90 ce1adbc0 ce1adbc0
[   89.316673] ffa0  c0035714 00000000 00000000 c000e798 00000000 00000000 00000000 00000000
[   89.324833] ffc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   89.332994] ffe0  00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[   89.341155] 0000  c93d0800 cfc76405 c0e06b10 c0e06b10 c0294634 00000001 00000001 dead4ead
[   89.349311] 0020  ffffffff ffffffff ce1c0028 ce1c0028 00000000 00000000 ce1c0014 00000000
[   89.357473] 0040  c93d0800 00000000 00000000 00000000 00000000 00000000 00000000 00000100
[   89.365633] 0060  000a0000 c93d0800 c93d0400 c93d0400 c07c1cd8 00000001 dead4ead ffffffff
[   89.373795]
[   89.373795] R7: 0xcef97144:
[   89.378045] 7144  cef97118 ce193200 ce1bc400 7fffffff cccccccc 00000000 ce1bc000 cccccccc
[   89.386207] 7164  00000002 00000001 cccccccc 20000021 cf442000 8f442000 cccccccc 00000048
[   89.394362] 7184  cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc 00000010 cccccccc
[   89.402525] 71a4  cccccccc cccccccc cccccccc 00000021 00000000 00000000 c02a84cc cef97010
[   89.410686] 71c4  00000000 00000000 00000000 00000000 00000000 00000000 00000000 ce1bd240
[   89.418846] 71e4  00000000 00000001 dead4ead ffffffff ffffffff cef971f8 cef971f8 8f443000
[   89.427001] 7204  cf443000 00000000 ffffffe0 cef97210 cef97210 c02a86f4 00000000 00000000
[   89.435162] 7224  00000000 c0f1a902 c002fe50 cef9720c ffffffff 00000000 00000000 cef97240
[   89.443325]
[   89.443325] R8: 0xc0016e00:
[   89.447575] 6e00  13c4403c 1a00001a e5953000 e3130080 13c4403c 1a000002 e5953000 e3130008
[   89.455739] 6e20  0a000012 e3844c02 e28d3014 e1a02008 e1a01007 e1a00006 eb0b3611 e3500000
[   89.463894] 6e40  159d0014 1a000007 e98d0401 e1a03009 e58d500c e1a02008 e58d4000 e1a01007
[   89.472057] 6e60  e1a00006 ebffff00 e28dd018 e8bd87f0 e3c44f8f e3844f81 eaffffea c0ef72b0
[   89.480219] 6e80  e92d4007 e3500000 e7ebe051 e1a01621 15900148 e59fc02c 10811000 e59f0028
[   89.488374] 6ea0  e59cc000 e5900000 e0410000 e59f101c e08c0280 e58d1000 e1a0100e ebfffc34
[   89.496536] 6ec0  e28dd00c e49df004 c0f1e33c c0e02fc0 c0019d50 e92d40f0 e3a05000 e1530005
[   89.504692] 6ee0  e3e04000 01520004 e1a06002 e1a07003 e59fc058 9a000007 e3500000 e59ce000
[   89.512856] Process msm_serial_hs_0 (pid: 51, stack limit = 0xce220208)
[   89.519458] Stack: (0xce221ed0 to 0xce222000)
[   89.523797] 1ec0:                                     cef971c4 00000000 cef97010 00000000
[   89.531957] 1ee0: ce1c0000 0000000d c0016e80 c02a9f70 0000c000 00000000 0000000d 00000003
[   89.540117] 1f00: cef97118 cef97010 20070013 ce1c0000 c098c8ec c02ac85c cef97118 cef97128
[   89.548278] 1f20: ce220000 c0f1a84c c098c8ec c0035680 ce1adbc0 00000000 cef97128 c00355d4
[   89.556437] 1f40: 00000000 00000000 00000000 c00357dc 00000000 00000000 00000000 cef97128
[   89.564598] 1f60: 00000000 00000001 dead4ead ffffffff ffffffff ce221f74 ce221f74 00000000
[   89.572758] 1f80: 00000001 dead4ead ffffffff ffffffff ce221f90 ce221f90 ce1adbc0 ce1adbc0
[   89.580918] 1fa0: c0035714 00000000 00000000 c000e798 00000000 00000000 00000000 00000000
[   89.589077] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   89.597236] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[   89.605408] [<c005b130>] (mod_timer) from [<c02a9f70>] (msm_hs_submit_tx_locked+0x108/0x14c)
[   89.613816] [<c02a9f70>] (msm_hs_submit_tx_locked) from [<c02ac85c>] (msm_serial_hs_tx_work+0x64/0x14c)
[   89.623193] [<c02ac85c>] (msm_serial_hs_tx_work) from [<c0035680>] (kthread_worker_fn+0xac/0x140)
[   89.632048] [<c0035680>] (kthread_worker_fn) from [<c00357dc>] (kthread+0xc8/0xd4)
[   89.639597] [<c00357dc>] (kthread) from [<c000e798>] (ret_from_fork+0x14/0x3c)
[   89.646802] Code: 0a00002a e5973010 e3530000 1a000000 (e7f001f2)
[   89.652877] ---[ end trace 55139897c59addcc ]---
[   89.657481] BUG: sleeping function called from invalid context at /usr/src/kernel/kernel/locking/rwsem.c:41
[   89.667196] in_atomic(): 1, irqs_disabled(): 128, pid: 51, name: msm_serial_hs_0
[   89.674573] Preemption disabled at:[<  (null)>]   (null)
[   89.679867]
[   89.681351] CPU: 0 PID: 51 Comm: msm_serial_hs_0 Tainted: G      D        3.18.140 #1
[   89.689168] [<c0014428>] (unwind_backtrace) from [<c00122ac>] (show_stack+0x10/0x14)
[   89.696891] [<c00122ac>] (show_stack) from [<c0795470>] (down_read+0x18/0x48)
[   89.704007] [<c0795470>] (down_read) from [<c002a288>] (exit_signals+0x14/0x12c)
[   89.711387] [<c002a288>] (exit_signals) from [<c0020fb8>] (do_exit+0xcc/0x8a8)
[   89.718594] [<c0020fb8>] (do_exit) from [<c00124b8>] (die+0x208/0x240)
[   89.725099] [<c00124b8>] (die) from [<c00082f0>] (do_undefinstr+0xec/0x21c)
[   89.732047] [<c00082f0>] (do_undefinstr) from [<c0012da0>] (__und_svc_finish+0x0/0x20)
[   89.739939] Exception stack(0xce221e80 to 0xce221ec8)
[   89.744980] 1e80: cef971c4 ffffade2 00000001 00000000 ffffade2 00000000 ce1c0000 cef971c4
[   89.753140] 1ea0: c0016e80 00000001 00000000 00000000 00000000 ce221ed0 c02a9f70 c005b130
[   89.761297] 1ec0: 60070093 ffffffff
[   89.764768] [<c0012da0>] (__und_svc_finish) from [<c005b130>] (mod_timer+0x7c/0x12c)
[   89.772496] [<c005b130>] (mod_timer) from [<c02a9f70>] (msm_hs_submit_tx_locked+0x108/0x14c)
[   89.780915] [<c02a9f70>] (msm_hs_submit_tx_locked) from [<c02ac85c>] (msm_serial_hs_tx_work+0x64/0x14c)
[   89.790292] [<c02ac85c>] (msm_serial_hs_tx_work) from [<c0035680>] (kthread_worker_fn+0xac/0x140)
[   89.799147] [<c0035680>] (kthread_worker_fn) from [<c00357dc>] (kthread+0xc8/0xd4)
[   89.806700] [<c00357dc>] (kthread) from [<c000e798>] (ret_from_fork+0x14/0x3c)
[   89.813901] note: msm_serial_hs_0[51] exited with preempt_count 1

so it crashes during open(), right?
But i don’t even see “UART-0” message, can you add some delay to confirm.

BTW, will the peer side stop sending data to WP module if UART CTS is asserted?

Yes, the open command is causing the problem

root@swi-mdm9x28-wp:~# logread -f | grep -e "UART-"
Dec 23 10:23:41 swi-mdm9x28-wp user.info Legato:  INFO | uart[2146]/UART_Test1Component T=main | UART_Test1.c OpenPort() 62 | UART-0
[   83.677461] ------------[ cut here ]------------
[   83.681055] kernel BUG at /usr/src/kernel/kernel/time/timer.c:806!
[   83.687213] Internal error: Oops - BUG: 0 [#1] PREEMPT ARM
[   83.692681] Modules linked in:
[   83.695725] CPU: 0 PID: 51 Comm: msm_serial_hs_0 Not tainted 3.18.140 #1
[   83.702404] task: ce193200 ti: ce220000 task.ti: ce220000
[   83.707795] PC is at mod_timer+0x7c/0x12c
[   83.711787] LR is at msm_hs_submit_tx_locked+0x108/0x14c
[   83.717078] pc : [<c005b130>]    lr : [<c02a9f70>]    psr: 600d0093
[   83.717078] sp : ce221ed0  ip : 00000064  fp : 00000000
[   83.728530] r10: 00000000  r9 : 00000001  r8 : c0016e80
[   83.733741] r7 : cef971c4  r6 : ce1c0000  r5 : 00000000  r4 : ffffabe3
[   83.740257] r3 : 00000000  r2 : 00000001  r1 : ffffabe3  r0 : cef971c4
[   83.746764] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
[   83.753970] Control: 10c53c7d  Table: 8ccc8059  DAC: 00000051
[   83.759701]
[   83.759701] PC: 0xc005b0b0:
[   83.763951] b0b0  c0e091d8 e92d41f3 e1a07000 e5904018 e3540000 a0844001 aa000006 e59f3104
[   83.772109] b0d0  e5934000 e0414004 e35400ff d1a04001 da000009 e0814444 e1510004 e0213004
[   83.780263] b0f0  e58d3004 0a000004 e3a01020 e28d0004 eb06fb02 e3e03000 e0044013 e5973000
[   83.788427] b110  e3530000 0a000002 e5973008 e1530004 0a00002a e5973010 e3530000 1a000000
[   83.796588] b130  e7f001f2 e28d1004 e1a00007 ebfffe19 e3a02000 e1a01000 e1a06000 e1a00007
[   83.804744] b150  ebffff85 e1a08000 eb070ecb e59f3078 e5935000 e1560005 0a00000e e5963010
[   83.812907] b170  e1570003 01a05006 0a00000a e597300c e1a00006 e2033003 e587300c eb1cecab
[   83.821069] b190  e1a00005 eb1cec9b e597300c e2033003 e1853003 e587300c e1a01007 e1a00005
[   83.829223]
[   83.829223] LR: 0xc02a9ef0:
[   83.833483] 9ef0  01a0300c e5938024 e3580000 0a000001 e3a03001 e12fff38 e5847100 e3a01000
[   83.841637] 9f10  e596314c e5962144 e59401d0 e0822003 e58d5000 e58d1004 e58d7008 e59f1070
[   83.849800] 9f30  ebffffa8 e1a01005 e1a02007 e3a03903 e594013c e58d3000 e1a03004 eb09f2db
[   83.857954] 9f50  e1a05000 e3a00ffa ebf6c02a e59f3044 e5931000 e0801001 e2840f6d ebf6c450
[   83.866118] 9f70  e5943434 e3530003 daffffc9 e594042c e3500000 0affffc6 e1a03005 e59f2018
[   83.874281] 9f90  e59f1018 e28dd010 e8bd41f0 eaf75aad c0e0479c c09d3d8f c0e091e0 c07c204f
[   83.882436] 9fb0  c09d3d92 e92d4070 e1a04000 e590341c e3530000 0a00000c e59f108c e59f008c
[   83.890597] 9fd0  eb139173 e594042c e3500000 08bd8070 e5943434 e3530001 d8bd8070 e59f2068
[   83.898762]
[   83.898762] SP: 0xce221e50:
[   83.903013] 1e50  ce1bc0a4 00000002 00000008 0000ffff ce1bc000 00000002 c005b134 00000000
[   83.911166] 1e70  c00131d8 00000000 e7100000 c0012da0 cef971c4 ffffabe3 00000001 00000000
[   83.919328] 1e90  ffffabe3 00000000 ce1c0000 cef971c4 c0016e80 00000001 00000000 00000000
[   83.927491] 1eb0  00000064 ce221ed0 c02a9f70 c005b130 600d0093 ffffffff 00000051 0000c000
[   83.935653] 1ed0  cef971c4 00000000 cef97010 00000000 ce1c0000 00000009 c0016e80 c02a9f70
[   83.943806] 1ef0  0000c000 00000000 00000009 00000003 cef97118 cef97010 200d0013 ce1c0000
[   83.951968] 1f10  c098c8ec c02ac85c cef97118 cef97128 ce220000 c0f1a84c c098c8ec c0035680
[   83.960129] 1f30  ce1adbc0 00000000 cef97128 c00355d4 00000000 00000000 00000000 c00357dc
[   83.968293]
[   83.968293] R0: 0xcef97144:
[   83.972542] 7144  cef97118 ce193200 ce1bc400 7fffffff cccccccc 00000000 ce1bc000 cccccccc
[   83.980697] 7164  00000002 00000001 cccccccc 20000021 cf442000 8f442000 cccccccc 00000048
[   83.988862] 7184  cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc 00000010 cccccccc
[   83.997023] 71a4  cccccccc cccccccc cccccccc 00000021 00000000 00000000 c02a84cc cef97010
[   84.005177] 71c4  00000000 00000000 00000000 00000000 00000000 00000000 00000000 ce1bd240
[   84.013339] 71e4  00000000 00000001 dead4ead ffffffff ffffffff cef971f8 cef971f8 8f443000
[   84.021503] 7204  cf443000 00000000 ffffffe0 cef97210 cef97210 c02a86f4 00000000 00000000
[   84.029656] 7224  00000000 c0f1a902 c002fe50 cef9720c ffffffff 00000000 00000000 cef97240
[   84.037820]
[   84.037820] R1: 0xffffab63:
[   84.042070] ab60  ******** ******** ******** ******** ******** ******** ******** ********
[   84.050232] ab80  ******** ******** ******** ******** ******** ******** ******** ********
[   84.058392] aba0  ******** ******** ******** ******** ******** ******** ******** ********
[   84.066555] abc0  ******** ******** ******** ******** ******** ******** ******** ********
[   84.074708] abe0  ******** ******** ******** ******** ******** ******** ******** ********
[   84.082870] ac00  ******** ******** ******** ******** ******** ******** ******** ********
[   84.091032] ac20  ******** ******** ******** ******** ******** ******** ******** ********
[   84.099194] ac40  ******** ******** ******** ******** ******** ******** ******** ********
[   84.107348] ac60  ******** ******** ******** ******** ******** ******** ******** ********
[   84.115512]
[   84.115512] R4: 0xffffab63:
[   84.119763] ab60  ******** ******** ******** ******** ******** ******** ******** ********
[   84.127927] ab80  ******** ******** ******** ******** ******** ******** ******** ********
[   84.136082] aba0  ******** ******** ******** ******** ******** ******** ******** ********
[   84.144238] abc0  ******** ******** ******** ******** ******** ******** ******** ********
[   84.152400] abe0  ******** ******** ******** ******** ******** ******** ******** ********
[   84.160562] ac00  ******** ******** ******** ******** ******** ******** ******** ********
[   84.168724] ac20  ******** ******** ******** ******** ******** ******** ******** ********
[   84.176878] ac40  ******** ******** ******** ******** ******** ******** ******** ********
[   84.185039] ac60  ******** ******** ******** ******** ******** ******** ******** ********
[   84.193201]
[   84.193201] R6: 0xce1bff80:
[   84.197451] ff80  00000001 dead4ead ffffffff ffffffff ce1bff90 ce1bff90 ce1adbc0 ce1adbc0
[   84.205613] ffa0  c0035714 00000000 00000000 c000e798 00000000 00000000 00000000 00000000
[   84.213774] ffc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   84.221934] ffe0  00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[   84.230095] 0000  ca2e4c00 cfc76405 c0e06b10 c0e06b10 c0294634 00000000 00000001 dead4ead
[   84.238249] 0020  ffffffff ffffffff ce1c0028 ce1c0028 ccfc1e00 00000000 ce1c0014 00000000
[   84.246411] 0040  ca2e4c00 00000000 00000000 00000000 00000000 00000000 00000000 00000100
[   84.254573] 0060  000a0000 ca2e4c00 ca2e4800 ca2e4800 c07c1cd8 00000001 dead4ead ffffffff
[   84.262738]
[   84.262738] R7: 0xcef97144:
[   84.266988] 7144  cef97118 ce193200 ce1bc400 7fffffff cccccccc 00000000 ce1bc000 cccccccc
[   84.275142] 7164  00000002 00000001 cccccccc 20000021 cf442000 8f442000 cccccccc 00000048
[   84.283304] 7184  cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc 00000010 cccccccc
[   84.291467] 71a4  cccccccc cccccccc cccccccc 00000021 00000000 00000000 c02a84cc cef97010
[   84.299621] 71c4  00000000 00000000 00000000 00000000 00000000 00000000 00000000 ce1bd240
[   84.307781] 71e4  00000000 00000001 dead4ead ffffffff ffffffff cef971f8 cef971f8 8f443000
[   84.315944] 7204  cf443000 00000000 ffffffe0 cef97210 cef97210 c02a86f4 00000000 00000000
[   84.324107] 7224  00000000 c0f1a902 c002fe50 cef9720c ffffffff 00000000 00000000 cef97240
[   84.332270]
[   84.332270] R8: 0xc0016e00:
[   84.336521] 6e00  13c4403c 1a00001a e5953000 e3130080 13c4403c 1a000002 e5953000 e3130008
[   84.344677] 6e20  0a000012 e3844c02 e28d3014 e1a02008 e1a01007 e1a00006 eb0b3611 e3500000
[   84.352840] 6e40  159d0014 1a000007 e98d0401 e1a03009 e58d500c e1a02008 e58d4000 e1a01007
[   84.360995] 6e60  e1a00006 ebffff00 e28dd018 e8bd87f0 e3c44f8f e3844f81 eaffffea c0ef72b0
[   84.369157] 6e80  e92d4007 e3500000 e7ebe051 e1a01621 15900148 e59fc02c 10811000 e59f0028
[   84.377312] 6ea0  e59cc000 e5900000 e0410000 e59f101c e08c0280 e58d1000 e1a0100e ebfffc34
[   84.385474] 6ec0  e28dd00c e49df004 c0f1e33c c0e02fc0 c0019d50 e92d40f0 e3a05000 e1530005
[   84.393639] 6ee0  e3e04000 01520004 e1a06002 e1a07003 e59fc058 9a000007 e3500000 e59ce000
[   84.401797] Process msm_serial_hs_0 (pid: 51, stack limit = 0xce220208)
[   84.408399] Stack: (0xce221ed0 to 0xce222000)
[   84.412741] 1ec0:                                     cef971c4 00000000 cef97010 00000000
[   84.420905] 1ee0: ce1c0000 00000009 c0016e80 c02a9f70 0000c000 00000000 00000009 00000003
[   84.429060] 1f00: cef97118 cef97010 200d0013 ce1c0000 c098c8ec c02ac85c cef97118 cef97128
[   84.437224] 1f20: ce220000 c0f1a84c c098c8ec c0035680 ce1adbc0 00000000 cef97128 c00355d4
[   84.445377] 1f40: 00000000 00000000 00000000 c00357dc 00000000 00000000 00000000 cef97128
[   84.453540] 1f60: 00000000 00000001 dead4ead ffffffff ffffffff ce221f74 ce221f74 00000000
[   84.461703] 1f80: 00000001 dead4ead ffffffff ffffffff ce221f90 ce221f90 ce1adbc0 ce1adbc0
[   84.469856] 1fa0: c0035714 00000000 00000000 c000e798 00000000 00000000 00000000 00000000
[   84.478019] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   84.486181] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[   84.494361] [<c005b130>] (mod_timer) from [<c02a9f70>] (msm_hs_submit_tx_locked+0x108/0x14c)
[   84.502766] [<c02a9f70>] (msm_hs_submit_tx_locked) from [<c02ac85c>] (msm_serial_hs_tx_work+0x64/0x14c)
[   84.512142] [<c02ac85c>] (msm_serial_hs_tx_work) from [<c0035680>] (kthread_worker_fn+0xac/0x140)
[   84.520990] [<c0035680>] (kthread_worker_fn) from [<c00357dc>] (kthread+0xc8/0xd4)
[   84.528542] [<c00357dc>] (kthread) from [<c000e798>] (ret_from_fork+0x14/0x3c)
[   84.535744] Code: 0a00002a e5973010 e3530000 1a000000 (e7f001f2)
[   84.541820] ---[ end trace 98c9418788dbbecf ]---
[   84.546416] BUG: sleeping function called from invalid context at /usr/src/kernel/kernel/locking/rwsem.c:41
[   84.556139] in_atomic(): 1, irqs_disabled(): 128, pid: 51, name: msm_serial_hs_0
[   84.563518] Preemption disabled at:[<  (null)>]   (null)
[   84.568809]
[   84.570290] CPU: 0 PID: 51 Comm: msm_serial_hs_0 Tainted: G      D        3.18.140 #1
[   84.578113] [<c0014428>] (unwind_backtrace) from [<c00122ac>] (show_stack+0x10/0x14)
[   84.585842] [<c00122ac>] (show_stack) from [<c0795470>] (down_read+0x18/0x48)
[   84.592955] [<c0795470>] (down_read) from [<c002a288>] (exit_signals+0x14/0x12c)
[   84.600331] [<c002a288>] (exit_signals) from [<c0020fb8>] (do_exit+0xcc/0x8a8)
[   84.607535] [<c0020fb8>] (do_exit) from [<c00124b8>] (die+0x208/0x240)
[   84.614051] [<c00124b8>] (die) from [<c00082f0>] (do_undefinstr+0xec/0x21c)
[   84.620990] [<c00082f0>] (do_undefinstr) from [<c0012da0>] (__und_svc_finish+0x0/0x20)
[   84.628882] Exception stack(0xce221e80 to 0xce221ec8)
[   84.633922] 1e80: cef971c4 ffffabe3 00000001 00000000 ffffabe3 00000000 ce1c0000 cef971c4
[   84.642086] 1ea0: c0016e80 00000001 00000000 00000000 00000064 ce221ed0 c02a9f70 c005b130
[   84.650236] 1ec0: 600d0093 ffffffff
[   84.653713] [<c0012da0>] (__und_svc_finish) from [<c005b130>] (mod_timer+0x7c/0x12c)
[   84.661443] [<c005b130>] (mod_timer) from [<c02a9f70>] (msm_hs_submit_tx_locked+0x108/0x14c)
[   84.669863] [<c02a9f70>] (msm_hs_submit_tx_locked) from [<c02ac85c>] (msm_serial_hs_tx_work+0x64/0x14c)
[   84.679237] [<c02ac85c>] (msm_serial_hs_tx_work) from [<c0035680>] (kthread_worker_fn+0xac/0x140)
[   84.688091] [<c0035680>] (kthread_worker_fn) from [<c00357dc>] (kthread+0xc8/0xd4)
[   84.695642] [<c00357dc>] (kthread) from [<c000e798>] (ret_from_fork+0x14/0x3c)
[   84.702838] note: msm_serial_hs_0[51] exited with preempt_count 1
int OpenPort(const char* port)
{
	LE_INFO("Opening serial %s\r\n", port);
    LE_INFO("UART-0");
    sleep(1);
     int fd=open(port, O_RDWR | O_NOCTTY | O_NDELAY);
     if(fd==-1)
     {
    	 LE_INFO("Error opening serial port %s... exiting", port);
          exit(-1);
     }
     LE_INFO("UART-1");
     sleep(1);
     fcntl(fd, F_SETFL, 0); /* Reads will be blocking */
     LE_INFO("UART-2");
     sleep(1);
     struct termios options;
     LE_INFO("UART-3");
     sleep(1);
     tcgetattr(fd, &options);
     LE_INFO("UART-4");
     sleep(1);
     (void)cfsetispeed(&options, B115200); /* (void) is to stop warning in cygwin */
     LE_INFO("UART-5");
     sleep(1);
     (void)cfsetospeed(&options, B115200);

//     (void)cfsetispeed(&options, B9600); /* (void) is to stop warning in cygwin */
//          (void)cfsetospeed(&options, B9600);

    LE_INFO("UART-6");
    sleep(1);
     options.c_cflag &= ~CSIZE;
     LE_INFO("UART-7");
     sleep(1);
     options.c_cflag |= CS8;  /* 8 bits */
     LE_INFO("UART-8");
     sleep(1);
     options.c_cflag &= ~CSTOPB; /* 1 stop bit */
     LE_INFO("UART-9");
     sleep(1);
     options.c_cflag &= ~PARENB; /* no parity */
     LE_INFO("UART-10");
     sleep(1);
     options.c_cflag &= ~PARODD;
     LE_INFO("UART-11");
     sleep(1);
   //  options.c_cflag &= ~CRTSCTS; /* HW flow control off */
    LE_INFO("UART-12");
    sleep(1);
     options.c_cflag |=CRTSCTS; /* HW flow control on */

     LE_INFO("UART-13");
     sleep(1);
     options.c_lflag =0; /* RAW input */
     LE_INFO("UART-14");
     sleep(1);
     options.c_iflag = 0;            /* SW flow control off, no parity checks etc */
     LE_INFO("UART-15");
     sleep(1);
     options.c_oflag &= ~OPOST; /* RAW output */
     LE_INFO("UART-16");
     sleep(1);
     options.c_cc[VTIME]=1; /* 1 sec */
     LE_INFO("UART-17");
     sleep(1);
     options.c_cc[VMIN]=BUFFER_SIZE;
     LE_INFO("UART-18");
     sleep(1);
     options.c_cflag |= (CLOCAL | CREAD);
     LE_INFO("UART-19");
     sleep(1);
     tcsetattr(fd, TCSAFLUSH, &options);

     return fd;
}

At the moment we don’t use the CTS pin. Maybe we’ll implement that in the future.

OK, you might need to try to assert CTS in hardware

But even if CTS is asserted, it’s still weird that the device crashes completely just because something is sent by another device.

Does it happen for other baud rate like 9600, 921600, 230400 etc?

stty -F /dev/ttyHS0 raw 115200 -crtscts
microcom /dev/ttyHS0 -s 115200

I tried with your suggested ones and it happened with all of them, so I think baud rate is not the issue.

For further responses I will get back to you in January. I wish you a merry Christmas and a happy new year.

I cannot reproduce this in mangoh green board with UART1 in data mode. (already send data continuously with baud rate 921600 on other side since boot up)
Can you load this “yocto_wp76xx.4k_msm_serial_hs.cwe” on top of R16.0.01 and see if problem still happens at your side?

Hello, sorry for the late response. We know how to avoid this issue (as said before) but I don’t have enough time to run these tests at the moment. I will get back to that in a while.

Just to have a solution here. The problem occurs if data is being received on the UART while /dev/ttyHS0 is being opened. The kernel panics and the device crashes. I don’t know if this is a Linux or a Legato but it should urgently be fixed.

Linux: Linux swi-mdm9x28-wp 3.18.140 #1 PREEMPT Tue Aug 3 08:17:34 UTC 2021 armv7l GNU/Linux
Legato: 19.11.6_af84a308b18c93dd4f3ae40f63c9bc67