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

Reboot during exchange_command #1

Open
MagTun opened this issue Dec 3, 2018 · 6 comments
Open

Reboot during exchange_command #1

MagTun opened this issue Dec 3, 2018 · 6 comments

Comments

@MagTun
Copy link

MagTun commented Dec 3, 2018

Hi,
I tried your library with a NodeMCU Lolin v3 and it keeps restarting.

I have added a debug, so I know that read_temp_co2 start and exchange_command start but it seems that exchange_command never ends.
Here is what I get in the serial monitor:

Soft WDT reset

ctx: cont 
sp: 3ffffce0 end: 3fffffd0 offset: 01b0

>>>stack>>>
3ffffe90:  3ffefa24 000001f2 3ffffebd 00000028  
3ffffea0:  3ffef768 00000008 3ffffeb0 402075bc <
3ffffeb0:  63786528 676e6168 6f635f65 6e616d6d  
3ffffec0:  65202964 61686378 5f65676e 6d6d6f63  
3ffffed0:  20646e61 0a646e65 3fff1400 401006a8  
3ffffee0:  00335116 4bc6a7f0 00335116 00000000  
3ffffef0:  00335116 00000000 00418937 00000000  
3fffff00:  00000001 00000277 40106669 4bc6a7f0  
3fffff10:  00000000 ff000000 3ffefa48 3fffff69  
3fffff20:  000f3093 00000008 3fffff68 40208878  
3fffff30:  3ffe89d8 3ffef768 3fffff7c 3ffef728  
3fffff40:  3fffdad0 00000000 3ffef768 40202a9e  
3fffff50:  1101a8c0 00ffffff 3ffefa48 40207a08  
3fffff60:  008601ff 00000000 3ffefa79 40202934  
3fffff70:  40208ac8 1101a8c0 00000000 00000000  
3fffff80:  00000000 00000000 3ffefa48 40202848  
3fffff90:  00000251 1101a8c0 3ffefa48 3ffefb20  
3fffffa0:  3fffdad0 00000000 3ffefa48 3ffefb20  
3fffffb0:  3fffdad0 00000000 3ffefb18 4020830c  
3fffffc0:  feefeffe feefeffe 3ffe85e8 40100739  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
vbb28d4a3
~ld
MHZ19 ESP reader
@bertrik
Copy link
Owner

bertrik commented Dec 3, 2018

When I look at the code now, I see that there is no way to let the microcontroller know that we're still alive. If the sensor is non-responsive, it may take up to 3000 ms until we conclude that we get no reply. This may be too long for the built-in watchdog to conclude that the software hangs.

Can you perhaps try adding a yield(); in the loop, at line #44 ?
Or just check out the branch named 'yield' from this archive.

@MagTun
Copy link
Author

MagTun commented Dec 4, 2018

Thanks for your reply!

@Dezorian
Copy link

Dezorian commented Apr 12, 2021

Hi, i've come here to chip in on the problem :-) . I'm using a D1 Mini (knockoff) and having the same problems. The weird thing is. It has worked for more that 3 months. I'm using it in combination with ESPHome. It took me quite some to narrow it down to the mhz19. I get the exact same error:

rst cause:2, boot mode:(3,6)

I have tried it on a fresh ESP8266, but it keeps having the same issue when using the mhz19 lib.

@Dezorian
Copy link

Dezorian commented Apr 15, 2021

I have now tried an 'original' D1 Mini, and it has the same problems:

When flashed it starts with this weird output:

←[32mINFO Successfully uploaded program.←[0m
←[32mINFO Starting log output from COM8 with baud rate 115200←[0m
[21:30:38];d l\x9c\x9e< \x8cl\xe0|☻♦♦♀\x8c♦d\xec♦#<\xc7\xc3♥\xe4↕\xdb{\x93#\xc4♦c\xc4\xfbgo\x9edgn\xdc\xe3\xe4♀#∟p\x8c\x8fls$;dp\xf3o\xe0►♥♀♦\x83♀l♦\x84\x9c♦♦♀c♦'\xe3<♥\xe4l\x87♦\xc7c\x8c\xfb'g\xe7 $\x8c\x87$ ♥\xd8←←go♦d`♥♥g{\x87\x9b\x93g♦♦c♥$ ♥;\x9b\x93o♦♦b♥$ ♥\xdc#♦♀\x87∟♥\x93l;\x9b`♥\xfc\xc3n\xdc♥[I][logger:166]: Log initialized
[21:30:51][C][ota:366]: There have been 0 suspected unsuccessful boot  

and after a while it comes up with this:

[21:32:38] ets Jan  8 2013**,rst cause:4, boot mode:(3,6)**
[21:32:38]
[21:32:38]wdt reset
[21:32:38]load 0x4010f000, len 3584, room 16
[21:32:38]tail 0
[21:32:38]chksum 0xb0
[21:32:38]csum 0xb0
[21:32:38]v2843a5ac
[21:32:38]~ld
[21:32:38][I][logger:166]: Log initialized

When checking the output with putty, the following is visible. I've tried this attached with MHZ19 and unattached. The output is the same. This is the output with the unattached MHZ19.

[D][mhz19:075]: MHZ19 Disabling automatic baseline calibration
▒y▒[C][ssd1306_i2c:010]: Setting up I2C SSD1306...
[W][i2c:070]: Received NACK on transmit of address 0x3C
[E][component:092]: Component was marked as failed.
[C][wifi:033]: Setting up WiFi...
[D][wifi:324]: Starting scan...
▒▒y[E][uart_esp8266:167]: Reading from UART timed out at byte 0!
[W][mhz19:034]: Reading data from MHZ19 failed!
[D][wifi:339]: Found networks:
[I][wifi:385]: - 'XXXXXXXXXXXXXXX' (XXXXXXXXXXXXXXX) ▂▄▆█
[D][wifi:386]:     Channel: 13
[D][wifi:387]:     RSSI: -43 dB
[....]
[D][wifi:389]: - 'XXXXXXXXXXXXXXX' (XXXXXXXXXXXXXXX) ▂▄▆█
[D][wifi:389]: - 'XXXXXXXXXXXXXXX' (XXXXXXXXXXXXXXX:
                                          --------------- CUT HERE FOR EXCEPTION DECODER ---------------

Soft WDT reset

>>>stack>>>

ctx: cont
sp: 3ffff340 end: 3fffffc0 offset: 01a0
3ffff4e0:  00000004 000001e1 3fff2924 40229940
3ffff4f0:  3fff29ed 00000000 413a4446 40220ff9
3ffff500:  3fff29c1 3fffc6fc 1651cfa0 3ffe9d5f
3ffff510:  4021d16c 3fff104c 3ffea7cb 3ffe9d5f
3ffff520:  4021d16c 3fff104c 3fff2983 4021d178
3ffff530:  4021d16c 3fff104c 3fff2983 4021d5c1
3ffff540:  00000005 3fff2983 3fff104c 4021d791
3ffff550:  00000002 3fff2983 3fff2924 402069a4
3ffff560:  3ffe9d5f 00000185 3fff2424 4020689a
3ffff570:  3ffff610 3ffff600 00000010 3ffe9d5f
3ffff580:  00000005 0000001f 3fff2924 40206b1c
3ffff590:  00000185 4025fa68 3fff2424 4020b24b
3ffff5a0:  0000001c 0000000e 3fff4b30 3ffff688
3ffff5b0:  3fff493c 3fff4824 3fff2d54 4020e544
3ffff5c0:  3ffff610 3ffff600 00000010 4020a820
3ffff5d0:  00000b48 00000169 00000169 4020e570
3ffff5e0:  3ffff610 3ffff600 00000010 3ffff600
3ffff5f0:  3ffff610 3ffff600 00000010 401015ab
3ffff600:  3fff4824 0000a2f1 000000e4 00000075
3ffff610:  3fff4360 3ffff688 3fff2d54 4020a19f
3ffff620:  3fff2424 3fff4824 3fff2d54 4020b6da
3ffff630:  3ffff640 000000ab 00000010 ffffffff
3ffff640:  3b305b1b e26d3333 96e28296 305b1b84
3ffff650:  6d37333b e28696e2 5b1b8896 ff006d30
3ffff660:  00000000 4bc6a7f0 9fbe76c8 00000000
3ffff670:  00000000 00000000 4bc6a7f0 00000000
3ffff680:  00000000 4020e920 373a3445 43443a35
3ffff690:  3a31433a 413a4446 a1ca0042 00000000
3ffff6a0:  00000000 00000000 4bc6a7f0 00000000
3ffff6b0:  00000000 00000000 40100cb8 0000187a
3ffff6c0:  00000000 00000009 3fff0cf4 00000000
3ffff6d0:  3fff4b30 3fff2730 3ffff640 3fff227c
3ffff6e0:  007a1200 1de1af88 3fff3100 00000100
3ffff6f0:  3fff2d54 0000187a 3fff2d54 4020bae4
3ffff700:  0000187a 00000009 3fff0cf4 4022296c
3ffff710:  3fff2d54 00000009 3fff0cf4 40222a01
3ffff720:  3fff2d54 00000009 3fff0cf4 4020da98
3ffff730:  3fff22ec 0000000a 3ffff780 4022ead5
3ffff740:  00000100 00000000 00000000 4020f222
3ffff750:  00000000 3fff3a74 00000000 3fff0d9c
3ffff760:  3fff0d84 3fff398c 00000000 40210d1c
3ffff770:  00000004 00000009 feefeffe feefeffe
3ffff780:  3fff3ccc 3fff3cd0 4020f1f8 4020f278
3ffff790:  00000003 00000000 3ffe9d25 4025bdfc
3ffff7a0:  00000000 00000001 00000004 00000008
3ffff7b0:  3ffea768 4025be04 00000000 00000001
3ffff7c0:  00000005 00000008 3ffea5df 4025be0c
3ffff7d0:  00000000 00000001 00000009 00000008
3ffff7e0:  3ffe87d6 4025be1c 00000000 00000001
3ffff7f0:  00000004 0000000a 3ffe87e9 4025be26
3ffff800:  00000000 00000001 00000004 0000000a
3ffff810:  3ffea5e1 4025be30 00000000 00000003
3ffff820:  00000006 00000006 3ffea5e3 4025be36
3ffff830:  00000000 00000008 00000003 00000003
3ffff840:  3ffeaed6 4025be39 00000000 00000005
3ffff850:  00000004 00000004 3ffea49d 4025be3d
3ffff860:  00000000 00000008 00000003 00000001
3ffff870:  3ffea7a1 4025be3e 00000000 00000001
3ffff880:  00000006 00000008 3ffe9aa8 4025be46
3ffff890:  00000000 00000001 00000006 00000008
3ffff8a0:  3ffe87c0 4025be4e 00000000 00000001
3ffff8b0:  00000006 00000008 3ffea5dd 4025be56
3ffff8c0:  00000000 00000001 00000006 00000008
3ffff8d0:  3ffe9c57 4025be5e 00000000 00000001
3ffff8e0:  00000006 00000008 3ffea551 4025be66
3ffff8f0:  00000000 00000001 00000006 00000008
3ffff900:  3ffea451 4025be6e 00000000 00000001
3ffff910:  00000006 00000008 3ffea5e5 4025be76
3ffff920:  00000000 00000001 00000006 00000008
3ffff930:  3ffe9c71 4025be7e 00000000 00000001
3ffff940:  00000006 00000008 3ffe9b3c 4025be86
3ffff950:  00000000 00000001 00000006 00000008
3ffff960:  3ffea521 4025be8e 00000000 00000003
3ffff970:  00000003 00000006 3ffea03d 4025be94
3ffff980:  00000000 00000001 00000007 00000008
3ffff990:  3ffea5e7 4025be9c 00000000 00000001
3ffff9a0:  00000007 00000008 3ffea533 4025bea4
3ffff9b0:  00000000 00000001 00000006 00000008
3ffff9c0:  3ffea790 4025beac 00000000 00000001
3ffff9d0:  00000008 00000008 3ffe96b2 4025beb4
3ffff9e0:  00000000 00000001 00000006 00000008
3ffff9f0:  3ffe96e9 4025bebc 00000000 00000001
3ffffa00:  00000006 00000008 3ffeaec1 4025bec4
3ffffa10:  00000000 00000001 00000008 00000008
3ffffa20:  3ffea78b 4025becc 00000000 00000001
3ffffa30:  00000008 00000008 3ffe87d3 4025bed4
3ffffa40:  00000000 00000001 00000004 00000008
3ffffa50:  3ffea5e9 4025bedc 00000000 00000001
3ffffa60:  00000004 00000008 3ffea841 4025bee4
3ffffa70:  00000000 00000001 00000006 00000008
3ffffa80:  3ffe9622 4025beec 00000000 00000001
3ffffa90:  00000005 00000008 3ffeae3a 4025bef4
3ffffaa0:  00000000 00000001 0000000a 00000008
3ffffab0:  3ffe95e6 4025bf04 00000000 00000001
Rf▒)
▒8▒L

    j▒+ښ▒jmum▒▒▒▒9:075]: MHZ19 Disabling automatic baseline calibration

The only thing I can think of is that the memory is too small for D1 Mini? But until now, it worked great. It might be that an update of platformIO or EspHome have increased the size? But it should already stop flashing before the size is to large right?

@bertrik
Copy link
Owner

bertrik commented Apr 15, 2021

I don't know what could be the problem to be honest. Some time ago, I added a missing yield() in the response-processing loop, that could explain reboots (in case the mhz19 does not respond), but I fixed that.
Also I did some refactoring some time ago, this actually made things a bit easier I think.

Are you using the most recent version?

@Dezorian
Copy link

I'm using it through EspHome. Not sure if they are using the same base code with the mentioned fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants