Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quectel-bg9x crashes in modem_rssi_query_work #35175

Closed
aep opened this issue May 11, 2021 · 2 comments
Closed

quectel-bg9x crashes in modem_rssi_query_work #35175

aep opened this issue May 11, 2021 · 2 comments
Labels
area: Modem bug The issue is a bug, or the PR is fixing a bug

Comments

@aep
Copy link

aep commented May 11, 2021

with an empty main, enabling the quectel-bg9x on esp32 crashes after receiving IMEI

removing modem_rssi_query_work stops it from crashing, so it's somewhere here

diff --git a/drivers/modem/quectel-bg9x.c b/drivers/modem/quectel-bg9x.c
index 12cacdc36e..85b0421a1c 100644
@@ -861,6 +861,7 @@ static void modem_rx(void)
  */
 static void modem_rssi_query_work(struct k_work *work)
 {
+    return;
        struct modem_cmd cmd  = MODEM_CMD("+CSQ: ", on_cmd_atcmdinfo_rssi_csq, 2U, ",");
        static char *send_cmd = "AT+CSQ";
        int ret;

this is my dts:

/dts-v1/;

#include <espressif/esp32.dtsi>

/ {
	model = "esp32";
	compatible = "espressif,esp32";

	aliases {
		uart-0 = &uart0;
		i2c-0 = &i2c0;
	};

	chosen {
		zephyr,sram = &sram0;
		zephyr,console = &uart0;
		zephyr,shell-uart = &uart0;
		zephyr,flash = &flash0;
	};
};

&cpu0 {
	clock-frequency = <ESP32_CLK_CPU_240M>;
};

&cpu1 {
	clock-frequency = <ESP32_CLK_CPU_240M>;
};

&uart0 {
	status = "okay";
	current-speed = <115200>;
	tx-pin = <1>;
	rx-pin = <3>;
};

&uart1 {
	status = "okay";
	current-speed = <115200>;

	tx-pin = <17>;
	rx-pin = <16>;

	quectel_bg9x: quectel_bg9x {
		compatible = "quectel,bg9x";
		label = "quectel,bg9x";
		mdm-power-gpios     = <&gpio1 1  GPIO_ACTIVE_HIGH>;
		mdm-reset-gpios     = <&gpio1 1  GPIO_ACTIVE_HIGH>;
		mdm-dtr-gpios       = <&gpio0 27 GPIO_ACTIVE_LOW>;
		//mdm-wdisable-gpios  = <&gpio1 0 GPIO_ACTIVE_HIGH>;
		status = "okay";
	};
};

&timer0 {
	status = "okay";
};

&timer1 {
	status = "okay";
};

&timer2 {
	status = "okay";
};

&timer3 {
	status = "okay";
};

&trng0 {
	status = "okay";
};

&flash0 {
	status = "okay";
	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;

		storage_partition: partition@9000 {
			label = "storage";
			reg = <0x00009000 0x00006000>;
		};
	};
};

I (29) boot: chip revision: 1
I (32) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (39) boot.esp32: SPI Speed      : 40MHz
I (44) boot.esp32: SPI Mode       : DIO
I (48) boot.esp32: SPI Flash Size : 4MB
I (53) boot: Enabling RNG early entropy source...
I (58) boot: Partition Table:
I (62) boot: ## Label            Usage          Type ST Offset   Length
I (69) boot:  0 nvs              WiFi data        01 02 00002000 00006000
I (77) boot:  1 phy_init         RF data          01 01 00008000 00001000
I (84) boot:  2 factory          factory app      00 00 00010000 00100000
I (92) boot: End of partition table
I (96) boot_comm: chip revision: 1, min. application chip revision: 0
I (103) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x011ac (  4524) map
I (114) esp_image: segment 1: paddr=0x000111d4 vaddr=0x3ffb0000 size=0x00040 (    64) load
I (121) esp_image: segment 2: paddr=0x0001121c vaddr=0x3ffb0040 size=0x0009c (   156) load
I (130) esp_image: segment 3: paddr=0x000112c0 vaddr=0x3ffb00dc size=0x000d8 (   216) load
I (139) esp_image: segment 4: paddr=0x000113a0 vaddr=0x3ffb01b4 size=0x008a4 (  2212) load
I (148) esp_image: segment 5: paddr=0x00011c4c vaddr=0x3ffb0a58 size=0x00078 (   120) load
I (156) esp_image: segment 6: paddr=0x00011ccc vaddr=0x3ffb0ad0 size=0x00100 (   256) load
I (165) esp_image: segment 7: paddr=0x00011dd4 vaddr=0x3ffb0bd0 size=0x00050 (    80) load
I (174) esp_image: segment 8: paddr=0x00011e2c vaddr=0x40080000 size=0x00400 (  1024) load
I (184) esp_image: segment 9: paddr=0x00012234 vaddr=0x40080400 size=0x05374 ( 21364) load
I (202) esp_image: segment 10: paddr=0x000175b0 vaddr=0x00000000 size=0x08a68 ( 35432)
I (215) esp_image: segment 11: paddr=0x00020020 vaddr=0x400d0020 size=0x03950 ( 14672) map
I (224) boot: Loaded app from partition at offset 0x10000                                                                                                  ̀
[00:00:00.473,000] <dbg> os.setup_thread_stack: stack 0x3ffe6140 for thread 0x3ffb1ae0: obj_size=2048 buf_start=0x3ffe6140  buf_size 2048 stack_ptr=0x3ffe6940
[00:00:00.473,000] <dbg> os.setup_thread_stack: stack 0x3ffe5940 for thread 0x3ffb1a30: obj_size=1024 buf_start=0x3ffe5940  buf_size 1024 stack_ptr=0x3ffe5d40
[00:00:00.473,000] <dbg> os.setup_thread_stack: stack 0x3ffe5d40 for thread 0x3ffb1a88: obj_size=1024 buf_start=0x3ffe5d40  buf_size 1024 stack_ptr=0x3ffe6140
[00:00:00.473,000] <dbg> os.setup_thread_stack: stack 0x3ffe4350 for thread 0x3ffb0c20: obj_size=1024 buf_start=0x3ffe4350  buf_size 1024 stack_ptr=0x3ffe4750
[00:00:00.473,000] <dbg> os.setup_thread_stack: stack 0x3ffe7940 for thread 0x3ffb1b40: obj_size=1024 buf_start=0x3ffe7940  buf_size 1024 stack_ptr=0x3ffe7d40
[00:00:00.473,000] <dbg> os.setup_thread_stack: stack 0x3ffe4750 for thread 0x3ffb18e8: obj_size=2048 buf_start=0x3ffe4750  buf_size 2048 stack_ptr=0x3ffe4f50
[00:00:00.473,000] <dbg> os.setup_thread_stack: stack 0x3ffe4f50 for thread 0x3ffb1960: obj_size=1040 buf_start=0x3ffe4f50  buf_size 1040 stack_ptr=0x3ffe5360
[00:00:00.473,000] <inf> modem_quectel_bg9x: Setting Modem Pins
[00:00:03.223,000] <inf> modem_quectel_bg9x: ... Done!
[00:00:03.223,000] <inf> modem_quectel_bg9x: Waiting for modem to respond
[00:00:05.699,000] <dbg> modem_cmd_handler: RECV
                                            52 44 59                                         |RDY
[00:00:05.699,000] <dbg> modem_cmd_handler.cmd_handler_process_rx_buf: match cmd [RDY] (len:3)
[00:00:05.699,000] <dbg> modem_cmd_handler: SENT DATA
                                            41 54 45 30                                      |ATE0
[00:00:05.703,000] <dbg> modem_cmd_handler: RECV
                                            4f 4b                                            |OK
[00:00:05.703,000] <dbg> modem_cmd_handler.cmd_handler_process_rx_buf: match cmd [OK] (len:2)
[00:00:05.753,000] <dbg> modem_cmd_handler: SENT DATA
                                            41 54 48                                         |ATH
[00:00:05.771,000] <dbg> modem_cmd_handler: RECV
                                            4f 4b                                            |OK
[00:00:05.771,000] <dbg> modem_cmd_handler.cmd_handler_process_rx_buf: match cmd [OK] (len:2)
[00:00:05.821,000] <dbg> modem_cmd_handler: SENT DATA
                                            41 54 2b 43 4d 45 45 3d  31                      |AT+CMEE= 1
[00:00:05.823,000] <dbg> modem_cmd_handler: RECV
                                            4f 4b                                            |OK
[00:00:05.823,000] <dbg> modem_cmd_handler.cmd_handler_process_rx_buf: match cmd [OK] (len:2)
[00:00:05.873,000] <dbg> modem_cmd_handler: SENT DATA
                                            41 54 2b 43 47 4d 49                             |AT+CGMI
[00:00:05.876,000] <dbg> modem_cmd_handler: RECV
                                            51 75 65 63 74 65 6c                             |Quectel
[00:00:05.876,000] <dbg> modem_cmd_handler.cmd_handler_process_rx_buf: match cmd [] (len:7)
[00:00:05.876,000] <inf> modem_quectel_bg9x: Manufacturer: Quectel
[00:00:05.876,000] <dbg> modem_cmd_handler: RECV
                                            4f 4b                                            |OK
[00:00:05.876,000] <dbg> modem_cmd_handler.cmd_handler_process_rx_buf: match cmd [OK] (len:2)
[00:00:05.926,000] <dbg> modem_cmd_handler: SENT DATA
                                            41 54 2b 43 47 4d 4d                             |AT+CGMM
[00:00:05.928,000] <dbg> modem_cmd_handler: RECV
                                            42 47 39 36                                      |BG96
[00:00:05.928,000] <dbg> modem_cmd_handler.cmd_handler_process_rx_buf: match cmd [] (len:4)
[00:00:05.928,000] <inf> modem_quectel_bg9x: Model: BG96
[00:00:05.929,000] <dbg> modem_cmd_handler: RECV
                                            4f 4b                                            |OK
[00:00:05.929,000] <dbg> modem_cmd_handler.cmd_handler_process_rx_buf: match cmd [OK] (len:2)
[00:00:05.979,000] <dbg> modem_cmd_handler: SENT DATA
                                            41 54 2b 43 47 4d 52

Backtrace:0x4000BE91:0x3FFE5240 0x4005681F:0x3FFE5260 0x400D21DD:0x3FFE5280 0x400D2313:0x3FFE52B0 0x400D170A:0x3FFE52D0 0x400D240A:0x3FFE5330 0x400D0553:0x3FFE5350
 
 [00:00:06.037,000] <dbg> modem_cmd_handler.cmd_handler_process_rx_buf: match cmd [] (len:15)
--- 7 messages dropped ---
[00:00:06.037,000] <inf> modem_quectel_bg9x: IMEI: 86844603xxxxxxxx
[00:00:06.037,000] <dbg> modem_cmd_handler: RECV
                                            4f 4b                                            |OK
[00:00:06.037,000] <dbg> modem_cmd_handler.cmd_handler_process_rx_buf: match cmd [OK] (len:2)
[00:00:06.087,000] <dbg> modem_cmd_handler: SENT DATA
                                            41 54 2b 51 49 43 53 47  50 3d 31 2c 31 2c 22 69 |AT+QICSG P=1,1,"i
                                            6f 74 2e 31 6e 63 65 2e  6e 65 74 22 2c 22 22 2c |ot.1nce. net","",
                                            20 22 22 2c 31                                   | "",1
[00:00:06.100,000] <dbg> modem_cmd_handler: RECV
                                            4f 4b                                            |OK
[00:00:06.100,000] <dbg> modem_cmd_handler.cmd_handler_process_rx_buf: match cmd [OK] (len:2)
[00:00:06.100,000] <dbg> modem_cmd_handler: SENT DATA
                                            41 54 2b 43 53 51                                |AT+CSQ
[00:00:06.102,000] <dbg> modem_cmd_handler: RECV
                                            2b 43 53 51 3a 20 39 39  2c 39 39                |+CSQ: 99 ,99
[00:00:06.102,000] <dbg> modem_cmd_handler.cmd_handler_process_rx_buf: match cmd [+CSQ: ] (len:11)
[00:00:06.102,000] <err> os:  ** FATAL EXCEPTION
[00:00:06.102,000] <err> os:  ** CPU 0 EXCCAUSE 28 (load prohibited)
[00:00:06.102,000] <err> os:  **  PC 0x4000be94 VADDR (nil)
[00:00:06.102,000] <err> os:  **  PS 0x60b20
[00:00:06.102,000] <err> os:  **    (INTLEVEL:0 EXCM: 0 UM:1 RING:0 WOE:1 OWB:11 CALLINC:2)
[00:00:06.102,000] <err> os:  **  A0 0x80056822  SP 0x3ffe5240  A2 0x17d6  A3 (nil)
[00:00:06.102,000] <err> os:  **  A4 0x17d6  A5 0x4000  A6 (nil)  A7 (nil)
[00:00:06.102,000] <err> os:  **  A8 (nil)  A9 (nil) A10 0xee60000 A11 0x40000000
[00:00:06.102,000] <err> os:  ** A12 0x60b20 A13 (nil) A14 0x2710 A15 (nil)
[00:00:06.102,000] <err> os:  ** LBEG 0x4000c46c LEND 0x4000c477 LCOUNT (nil)
[00:00:06.102,000] <err> os:  ** SAR 0x4
[00:00:06.117,000] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
[00:00:06.117,000] <err> os: Current thread: 0x3ffb1960 (unknown)
[00:00:06.350,000] <err> os: Halting system


@aep aep added the bug The issue is a bug, or the PR is fixing a bug label May 11, 2021
@aep aep changed the title quectel-bg9x crashes quectel-bg9x crashes in modem_rssi_query_work May 11, 2021
@aep
Copy link
Author

aep commented May 11, 2021

this is caused by #35176

@aep
Copy link
Author

aep commented May 11, 2021

root cause not in driver.

@aep aep closed this as completed May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Modem bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

No branches or pull requests

2 participants