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

ESP32-S3 I2C System Reset Bug (IDFGH-7306) #8894

Closed
3 tasks
hasankarainfo opened this issue May 4, 2022 · 24 comments
Closed
3 tasks

ESP32-S3 I2C System Reset Bug (IDFGH-7306) #8894

hasankarainfo opened this issue May 4, 2022 · 24 comments
Assignees
Labels
Awaiting Response awaiting a response from the author Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@hasankarainfo
Copy link

hasankarainfo commented May 4, 2022

Environment

  • Development Kit: custom
    static gpio_num_t i2c_gpio_sda = 40;
    static gpio_num_t i2c_gpio_scl = 39;

  • Module or chip used: ESP32-S3-WROOM-1-N8R2

  • IDF version "cpu_start: ESP-IDF: v5.0-dev-2586-ga82e6e63d9-dirty"

  • Build System: idf.py

  • Compiler version esp-2021r2-patch3-8.4.0

  • Operating System: Windows

  • environment type: ESP Command Prompt.

  • Using an IDE?: Eclipse

  • Power Supply: USB

Problem Description

-System resets when a problem occurs even in simple faults in i2c
-The problem also occurs when I short-circuit sda and scl.

Expected Behavior

I am trying to upgrade my project, which is designed according to esp32-wroom and works without any problems, to esp32s3.

Device list I added dynamically in esp32 working without any problem: m24c64 + pcf8563+ scd30 + sgp40 + shtc3 + 2lps22df + 3mcp96rl01 + si7021. It also passes the short-circuit test without any problems. When the short circuit is removed, it continues to communicate.

When I use esp32s3, the system continues to work as long as there is no communication problem. However, the system is reset when any problem or short circuit occurs during communication with any device.

Doesn't matter if optimization is on or off. Doesn't matter if psram is on or off. Doesn't matter whether freertos is always running on the first core, active or deactivated. Doesn't matter if peripheral drivers are on iram or not. Other versions I tried, 4.3.2 | 4.4 | 4.4.1 same result.

I also tried sda and scl pins on io8 and io9 but still no difference.

The other thing I tried is the "i2c_tools" project that I created with the new idf version. When I just change the sda and scl pins and run the same tests, the result is still the same.

Below is the output of my test in the i2c_tools project.

Step1: at first i run i2cdetect command with healthy connection and it finds devices

entry 0x403b61d8                                                              
�[0;32mI (97) cpu_start: Pro cpu up.�[0m                                      
�[0;32mI (97) cpu_start: Starting app cpu, entry point is 0x403753ac�[0m      
�[0;32mI (75) cpu_start: App cpu up.�[0m                                      
�[0;32mI (111) cpu_start: Pro cpu start user code�[0m                         
�[0;32mI (111) cpu_start: cpu freq: 160000000 Hz�[0m                          
�[0;32mI (111) cpu_start: Application information:�[0m                        
�[0;32mI (114) cpu_start: Project name:     i2c_s3�[0m                        
�[0;32mI (119) cpu_start: App version:      1�[0m                             
�[0;32mI (123) cpu_start: Compile time:     May  4 2022 11:38:38�[0m          
�[0;32mI (129) cpu_start: ELF file SHA256:  48dde03a7963d38d...�[0m           
�[0;32mI (135) cpu_start: ESP-IDF:          v5.0-dev-2586-ga82e6e63d9-dirty�[0m
�[0;32mI (142) heap_init: Initializing. RAM available for dynamic allocation:�[0m                                                                             
�[0;32mI (150) heap_init: At 3FC97EF0 len 00048110 (288 KiB): D/IRAM�[0m      
�[0;32mI (156) heap_init: At 3FCE0000 len 0000EE34 (59 KiB): STACK/DRAM�[0m   
�[0;32mI (163) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM�[0m         
�[0;32mI (169) heap_init: At 600FE028 len 00001FD8 (7 KiB): RTCRAM�[0m        
�[0;32mI (176) spi_flash: detected chip: generic�[0m                          
�[0;32mI (180) spi_flash: flash io: dio�[0m                                   
�[0;33mW (184) spi_flash: Detected size(8192k) larger than the size in the binary image header(4096k). Using the size in the binary image header.�[0m         
�[0;32mI (197) sleep: Configure to isolate all GPIO pins in sleep state�[0m   
�[0;32mI (204) sleep: Enable automatic switching of GPIO sleep configuration�[0m
                                                                              
�[0;32mI (211) cpu_start: Starting scheduler on PRO CPU.�[0m                  
�[0;32mI (0) cpu_start: Starting scheduler on APP CPU.�[0m                    
�[5n                                                                          
 ==============================================================              
 |             Steps to Use i2c-tools                         |               
 |                                                            |               
 |  1. Try 'help', check all supported commands               |               
 |  2. Try 'i2cconfig' to configure your I2C bus              |               
 |  3. Try 'i2cdetect' to scan devices on the bus             |               
 |  4. Try 'i2cget' to get the content of specific register   |               
 |  5. Try 'i2cset' to set the value of specific register     |               
 |  6. Try 'i2cdump' to dump all the register (Experiment)    |               
 |                                                            |               
 ==============================================================

pe 'help' to get the list of commands.                                     
e UP/DOWN arrows to navigate through command history.                        
ess TAB when typing command name to auto-complete.                           
Your terminal application does not support escape sequences.
Line editing and history features are disabled.
Windows, try using Putty instead.
                                           
i2c-tools> i2cdetect
   0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
: 00 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
: 50 51 -- -- -- -- -- -- -- 59 -- -- -- -- -- -- 
: -- 61 62 -- -- -- -- -- -- -- -- -- -- -- -- -- 
: 70 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 

Step 2: I short-circuit and run the i2cdetect command

i2c-tools> i2cdetect
   0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: UU UU Guru Meditation Error: Core  0 panic'ed (Interrupt wdt timeout on CPU0). 
Core  0 register dump:          
PC      : 0x4037765f  PS      : 0x00050034  A0      : 0x40376d8d  A1      : 0x3fc95330                                                                        
A2      : 0x3fce9010  A3      : 0x00000000  A4      : 0x00000004  A5      : 0x4037c348                                                                        
A6      : 0x00060323  A7      : 0x00000000  A8      : 0x00000000  A9      : 0x3fc95300                                                                        
A10     : 0x00000000  A11     : 0x3fc95338  A12     : 0x00000000  A13     : 0x00000000                                                                        
A14     : 0x3fce90d4  A15     : 0x00060021  SAR     : 0x00000012  EXCCAUSE: 0x00000005                                                                        
EXCVADDR: 0x00000000  LBEG    : 0x40056f5c  LEND    : 0x40056f72  LCOUNT  : 0xffffffff                                                                        
Core  0 was running in ISR context:                                           
EPC1    : 0x4202e267  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x4037765f                                                                        Backtrace:0x4037765c:0x3fc953300x40376d8a:0x3fc95370 0x400559dd:0x3fce79f0  |<-CORRUPTED                                                                      
Core  1 register dump:                                                        
PC      : 0x42002a0e  PS      : 0x00060c34  A0      : 0x8037da08  A1      : 0x3fcf56c0                                                                        
A2      : 0x00000008  A3      : 0x00000001  A4      : 0x00000001  A5      : 0x00000001                                                                        
A6      : 0x3fc9763c  A7      : 0x3fc9763c  A8      : 0x3fc97470  A9      : 0x3fc97434                                                                        
A10     : 0x00000000  A11     : 0x3fcf2a18  A12     : 0x8037f715  A13     : 0x3fcf14f0                                                                        
A14     : 0x00060023  A15     : 0x00000000  SAR     : 0x00000000  EXCCAUSE: 0x00000005                                                                        
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  
Backtrace:0x42002a0b:0x3fcf56c00x4037da05:0x3fcf56e0 0x4037f45d:0x3fcf5700 
ELF file SHA256: 48dde03a7963d38d
Rebooting...
x<ðøESP-ROM:esp32s3-20210327

Other items if possible

  • sdkconfig file (attach the sdkconfig file from your project folder)
  • elf file in the build folder (note this may contain all the code details and symbols of your project.)
  • coredump (This provides stacks of tasks.)
@espressif-bot espressif-bot added the Status: Opened Issue is new label May 4, 2022
@github-actions github-actions bot changed the title ESP32-S3 I2C System Reset Bug ESP32-S3 I2C System Reset Bug (IDFGH-7306) May 4, 2022
@hasankarainfo
Copy link
Author

https://ibb.co/k2FtM1N
Also, while debugging, when I paused after the code panicked, I found that the relevant line where the code crashed was line 527, "i2c.c".

"xQueueSendFromISR(p_i2c->cmd_evt_queue, &evt, &HPTaskAwoken);"

@o-marshmallow
Copy link
Collaborator

Hi @hasankarainfo ,

I saw a similar issue due to that line too in the driver, can you try the fix provided here: #8770 (comment)

@dhalbert
Copy link

dhalbert commented May 13, 2022

@o-marshmallow I am seeing the same Guru Meditation error on the ESP32-S3, in these circumstances:

When I use a different I2C device (MSA311), and the test program in https://github.com/dhalbert/i2c_delay, used in #8770, I don't see these problems.

Here is a new test program, specifically for the LC709203F (it does some setup of the device): https://github.com/dhalbert/i2c_s3_stretch
This program works fine on S2 boards, but fails on S3, and gives output like this over and over, failing cyclically:

Rebooting...
�ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0xb (SPI_FAST_FLASH_BOOT)
Saved PC:0x40375744
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd0108,len:0x1660
load:0x403b6000,len:0xbb8
load:0x403ba000,len:0x2f74
entry 0x403b6254
I (29) boot: ESP-IDF v4.4.1-126-g944c01eef4 2nd stage bootloader
I (29) boot: compile time 20:23:23
I (29) boot: chip revision: 0
I (32) boot.esp32s3: Boot SPI Speed : 80MHz
I (37) boot.esp32s3: SPI Mode       : DIO
I (42) boot.esp32s3: SPI Flash Size : 2MB
I (46) boot: Enabling RNG early entropy source...
I (52) boot: Partition Table:
I (55) boot: ## Label            Usage          Type ST Offset   Length
I (63) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (70) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (78) boot:  2 factory          factory app      00 00 00010000 00100000
I (85) boot: End of partition table
I (89) esp_image: segment 0: paddr=00010020 vaddr=3c020020 size=08918h ( 35096) map
I (104) esp_image: segment 1: paddr=00018940 vaddr=3fc91d60 size=02718h ( 10008) load
I (108) esp_image: segment 2: paddr=0001b060 vaddr=40374000 size=04fb8h ( 20408) load
I (119) esp_image: segment 3: paddr=00020020 vaddr=42000020 size=18d98h (101784) map
I (141) esp_image: segment 4: paddr=00038dc0 vaddr=40378fb8 size=08da4h ( 36260) load
I (150) esp_image: segment 5: paddr=00041b6c vaddr=50000000 size=00010h (    16) load
I (155) boot: Loaded app from partition at offset 0x10000
I (155) boot: Disabling RNG early entropy source...
I (170) cpu_start: Pro cpu up.
I (170) cpu_start: Starting app cpu, entry point is 0x403751c0
I (148) cpu_start: App cpu up.
I (184) cpu_start: Pro cpu start user code
I (184) cpu_start: cpu freq: 160000000
I (184) cpu_start: Application information:
I (187) cpu_start: Project name:     i2c-s3-stretch
I (193) cpu_start: App version:      1
I (197) cpu_start: Compile time:     May 12 2022 20:34:25
I (203) cpu_start: ELF file SHA256:  c667398f33a2a54e...
I (209) cpu_start: ESP-IDF:          v4.4.1-126-g944c01eef4
I (215) heap_init: Initializing. RAM available for dynamic allocation:
I (223) heap_init: At 3FC94E70 len 0004B190 (300 KiB): D/IRAM
I (229) heap_init: At 3FCE0000 len 0000EE34 (59 KiB): STACK/DRAM
I (236) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (242) heap_init: At 600FE000 len 00002000 (8 KiB): RTCRAM
I (249) spi_flash: detected chip: gd
I (253) spi_flash: flash io: dio
W (256) spi_flash: Detected size(8192k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (270) sleep: Configure to isolate all GPIO pins in sleep state
I (276) sleep: Enable automatic switching of GPIO sleep configuration
I (284) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (304) i2c-s3-stretch: I2C initialized successfully
E (304) i2c-s3-stretch: get_cell_voltage write/read: ESP_ERR_TIMEOUT
E (1314) i2c-s3-stretch: get_cell_voltage write/read: EGuru Meditation Error: Core  0 panic'ed (Interrupt wdt timeout on CPU0). 

Core  0 register dump:
PC      : 0x403772a1  PS      : 0x00050034  A0      : 0x4037690d  A1      : 0x3fc928f0  
A2      : 0x3fce0734  A3      : 0x00000000  A4      : 0x00000004  A5      : 0x4037a1b8  
A6      : 0x00000000  A7      : 0x00000045  A8      : 0x00000001  A9      : 0x3fc928c0  
A10     : 0x00000000  A11     : 0x3fc928fc  A12     : 0x00000000  A13     : 0x00000000  
A14     : 0x3fce0848  A15     : 0x00060021  SAR     : 0x00000004  EXCCAUSE: 0x00000005  
EXCVADDR: 0x00000000  LBEG    : 0x40056f5c  LEND    : 0x40056f72  LCOUNT  : 0xffffffff  
Core  0 was running in ISR context:
EPC1    : 0x42017ec3  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x403772a1


Backtrace:0x4037729e:0x3fc928f00x4037690a:0x3fc92930 0x42003f68:0x3fcf3930 0x42002b59:0x3fcf3950 0x420026f3:0x3fcf3970 0x4200ace5:0x3fcf3990 0x4201273e:0x3fcf39b0 0x420127c6:0x3fcf39d0 0x4200a7d1:0x3fcf3a00 0x42015c99:0x3fcf3a30 0x420114df:0x3fcf3a50 0x42011655:0x3fcf3d60 0x42018d9d:0x3fcf3d90 0x4037fff9:0x3fcf3dc0 0x4200568b:0x3fcf3e10 0x4200570d:0x3fcf3e40 0x42018bc9:0x3fcf3e70 0x4037cd6d:0x3fcf3e90 


Core  1 register dump:
PC      : 0x420180ba  PS      : 0x00060334  A0      : 0x82001eb6  A1      : 0x3fcf4e50  
A2      : 0x00000000  A3      : 0x3fcf2fd4  A4      : 0x8037d025  A5      : 0x3fcf1ac0  
A6      : 0x00060023  A7      : 0x00000000  A8      : 0x820095ee  A9      : 0x3fcf4e20  
A10     : 0x00000000  A11     : 0x00000008  A12     : 0x00000019  A13     : 0x3c020129  
A14     : 0x0000000c  A15     : 0xfffffff6  SAR     : 0x00000000  EXCCAUSE: 0x00000005  
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  


Backtrace:0x420180b7:0x3fcf4e500x42001eb3:0x3fcf4e70 0x4037b83d:0x3fcf4e90 0x4037cd6d:0x3fcf4eb0 




ELF file SHA256: c667398f33a2a54e

Here is a Saleae trace:
ESP32-S3-I2C-failure-CL709203F.sal.zip
Viewable with Saleae Logic, downloadable from here: https://www.saleae.com/downloads/

Here are some screenshots:
image

detail of the toggling on the right above:
image
write just before clock stretch:
image

I mentioned this in #8741 (comment), but the example above is much better.

@hasankarainfo
Copy link
Author

hi @o-marshmallow. When I updated the relevant lines, it didn't work. Same problem is continue. Below is the updated version of the i2c file.

i2c.zip

@o-marshmallow
Copy link
Collaborator

Hi guys,

Sorry for the delay of response. I had a try on my end with an ESP32-S3 and when shorting SCL and SDA I got this:

i2c-tools> i2cdetect
   0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
: UU UU UU UU UU UU UU UU UU UU UU UU UU UU UU UU
: UU UU UU UU UU UU UU UU UU UU UU UU UU UU UU UU 
: UU UU UU UU UU UU UU UU UU UU UU UU UU UU UU UU
: UU UU UU UU UU UU UU UU UU UU UU UU UU UU UU UU
: UU UU UU UU UU UU UU UU UU UU UU UU UU UU UU UU 
: UU UU UU UU UU UU UU UU UU UU UU UU UU UU UU UU
: UU UU UU UU UU UU UU UU UU UU UU UU UU UU UU UU
: UU UU UU UU UU UU UU UU UU UU UU UU UU UU UU UU

I didn't get the panic like you did.

What I did next is to try clock stretching. I don't have any device that does clock stretching, so I used another ESP32 to simulate a device doing clock stretching:
clockstrectching

I didn't get the toggling afterwards. I will continue investigating.

@hasankarainfo The zip you uploaded seems corrupted, I cannot extract the file inside.
Out of curiosity, how did you set up your I2C bus? Which frequency? Do you have external pull-ups? How big are they?

@dhalbert
Copy link

The zip you uploaded seems corrupted, I cannot extract the file inside.

I looked at the header a while ago, and I think it's an RAR file.

@o-marshmallow
Copy link
Collaborator

@dhalbert Oh indeed, works better now, thanks!

@hasankarainfo
Copy link
Author

Since the github does not accept rar, I changed the extension to zip.
I remember that the i2c_tools project was not able to use the signal line at all in its default pin numbers.

static gpio_num_t i2c_gpio_sda = 40;
static gpio_num_t i2c_gpio_scl = 39;

can you try this ?

@o-marshmallow
Copy link
Collaborator

Hi @hasankarainfo ,

I did use pin 39 and 40 successfully, no problem. I just cleaned my repo and checked out your commit: a82e6e63d9. I happen to get the issue when I short-circuit the bus and then I re-connect is correctly (to the pull-ups), without powering of the board during the manipulation, but I feel it's a bit random.

Interestingly, I don't get this problem on the latest master, commit a82e6e63d9, can you have a try with that commit?

@hasankarainfo
Copy link
Author

Today, I tried removing idf and doing master checkout again. same result.

However, I realized that I missed an important detail about the test. Keeping it short-circuited throughout the test, does not cause the problem to occur.

Step1: 
sda-scl make short circuit

Step2:
>>i2cdetect

Step3:
the following see in console
"0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f"
"00: UU UU UU UU UU"

Step4:
sda-scl remove short circuit

Step5:
Sys reset...
"00: UU UU UU UU UU UU ESP-ROM:esp32s3-20210327"

@o-marshmallow
Copy link
Collaborator

@hasankarainfo That's exactly what I noticed in my case too with the commit you are using. For some reasons I can't reproduce it with the latest master

@mythbuster5
Copy link
Collaborator

Yeah.. I saw your issue and I have merged 0b00831 into master. Which can solve the short circuit issue on master. @hasankarainfo

@espressif-bot espressif-bot added Status: In Progress Work is in progress and removed Status: Opened Issue is new labels May 30, 2022
@dhalbert
Copy link

dhalbert commented Jun 5, 2022

I adapted 0b00831 to ESP-IDF v4.4.1, but I am still seeing the same clock stretch issue mentioned above in #8894 (comment). If you want me to open a new issue for that, I can do so.

@mythbuster5
Copy link
Collaborator

I adapted 0b00831 to ESP-IDF v4.4.1, but I am still seeing the same clock stretch issue mentioned above in #8894 (comment). If you want me to open a new issue for that, I can do so.

You can still see the timeout after the fix?

@dhalbert
Copy link

You can still see the timeout after the fix?

Yes, I still see the same thing I saw in #8894 (comment), with SDA going high after a while, when testing with the LC709203F. Have you backported this fix to v4.4? Could you get an LC709203F to test with?

@mythbuster5
Copy link
Collaborator

The fix will go into 4.4.2. And I can't get LC709203F currently... Emm it's so odd that can't solve with that commit. The thing you can make it sure first is to check SOC_I2C_SUPPORT_HW_FSM_RST under esp32s3/include/soc/soc_caps.h has been disabled?

BTW, I'm curious that are you using wifi or BLE with it together?

dhalbert added a commit to dhalbert/esp-idf that referenced this issue Jun 15, 2022
@dhalbert
Copy link

@mythbuster5

I did some more testing. I adapted your 0b00831 commit to v4.4.1 with this patch:
v44-i2c-patch.txt. That patch is in this fork branch: https://github.com/dhalbert/esp-idf/tree/0b00831-adapted-to-v4.4.

I rebuilt my test program (https://github.com/dhalbert/i2c_s3_stretch) against the current master of https://github.com/espressif/esp-idf/. As you hoped, it does seem to fix the problem. Before your patch, the test program demonstrated the bug.

I also tested my test program with https://github.com/dhalbert/esp-idf/tree/0b00831-adapted-to-v4.4. That also worked. So I think my adaptation of your patch is OK. As you mentioned, SOC_I2C_SUPPORT_HW_FSM_RST under esp32s3/include/soc/soc_caps.h has been disabled.

But unfortunately when I tested my adapted patch against CircuitPython, I still see the problem. In #8770, I was able to replicate the CircuitPython problem by adding a second task to a simple ESP-IDF program, to simulate what CircuitPython was doing with tasks. But that didn't work here. https://github.com/dhalbert/i2c_s3_stretch has some commented-out code to add the second task, and uncommenting that still does not cause the problem.

So I will work on this some more, seeing just what might be different in the CircuitPython case. If the 4.4.2 release is imminent, I could test CircuitPython against that.

@espressif-bot espressif-bot added Status: Reviewing Issue is being reviewed Awaiting Response awaiting a response from the author and removed Status: In Progress Work is in progress labels Jun 27, 2022
@espressif-bot espressif-bot added Resolution: Done Issue is done internally Status: Done Issue is done internally and removed Status: Reviewing Issue is being reviewed labels Jul 12, 2022
@dhalbert
Copy link

dhalbert commented Aug 23, 2022

Update: I tested again today with the tip of release/v4.4 (2bce0a1), which is past 4.4.2, and am still seeing the problem.

@AxelLin
Copy link
Contributor

AxelLin commented Dec 23, 2022

@dhalbert
Check if this helps: #9777 (comment)

@hasankarainfo
Copy link
Author

i will deal with it soon

@dhalbert
Copy link

@AxelLin Thank you! I will test this soon.

@hasankarainfo
Copy link
Author

Hello after a long time. Today I had the opportunity to do the relevant tests again.

Some test conditions;

Development Kit: custom
static gpio_num_t i2c_gpio_sda = 42;
static gpio_num_t i2c_gpio_scl = 41;
static uint32_t i2c_frequency = 10000;
static i2c_port_t i2c_port = I2C_NUM_0;
Module or chip used: ESP32-S3-WROOM-1-N16R8
IDF version "ESP-IDF: v5.0"
Compiler version esp-2022r1-11.2.0
Operating System: Windows
Using an IDE: VSCODE

20230114_005623

As in the picture, the result when I scan:

i2c-tools> i2cdetect
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: 00 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- 59 -- -- -- 5d -- --
60: -- 61 -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: 70 -- -- -- -- -- -- -- -- -- -- -- -- -- UU --
i2c-tools>

When the dat and clk pins are short-circuited, when I start the scan and remove the short-circuit when I come to the 5th address, the result is:

i2c-tools> i2cdetect
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: UU UU UU UU UU UU UU -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- 59 -- -- -- 5d -- --
60: -- 61 -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: 70 -- -- -- -- -- -- -- -- -- -- -- -- -- UU --
i2c-tools>

The result is satisfactory for me. Thanks to everyone who took an interest in the issue and contributed to the fix.

@BeatArnet
Copy link

Thank you, reading the battery voltage now works without a workaround.

@dhalbert
Copy link

dhalbert commented Nov 5, 2023

I retested in CircuitPython with an LC709203F after we upgraded to ESP-IDF v5.1, and it seems to work much better now. Not sure what has been fixed in 5.1, but that's good to see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Response awaiting a response from the author Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

8 participants