-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
Compiler -O2 or -Os creates bad code for system/ulp/ulp_riscv/i2c example (IDFGH-11033) #12214
Comments
To make sure: this is on the XTENSA core, main processor on an ESP32-S3-PICO-1 chip, not on the ULP, In addition, reading and writing multiple bytes at once does not work either. |
@aircable Thanks for reporting this. I'll test on my side and follow up on this one. |
I think I have a patch that should fix your problem with compiling on non OG optimizations (at least it worked for me locally): 0001-fix-ulp-i2c-fixed-ulp-i2c-not-working-from-main-cpu-.zip Would be great if you could try the patch and check if it works for you as well!
Was this issue related to optimization as well or more a generic issue? I was unable to reproduce this one. |
Hi Marius, thanks for looking into this. I can confirm that the fix works now. I have tested with -O2 (performance) and communication with the I2C chip is working. The multiple read/write has a problem independently of the GCC optimization. It never worked.
Code to reproduce:
BTW, any chance the RMT hardware has the same compiler optimization problem? I'm still trying to track that one down. I use this for the serial LED strips. |
Good to hear, I've submitted an internal MR to fix this problem and close this issue.
To better track this as a separate bug/issue I've split this into #12235
Possibly, but hard to tell without more info. Would be great if you could open a new issue for this one as well, with some more description, and we can find someone responsible for RMT to take a look at it. |
…h 0S or O2 Compiler would optimize register write to use s8i which do not work for IO registers Closes #12214
…h 0S or O2 Compiler would optimize register write to use s8i which do not work for IO registers Closes espressif#12214
…h 0S or O2 Compiler would optimize register write to use s8i which do not work for IO registers Closes espressif#12214
Answers checklist.
IDF version.
master 5.2.2
Operating System used.
Linux
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
None
Development Kit.
ESP32S3-PICO-1
Power Supply used.
External 3.3V
What is the expected behavior?
I2C example uses the RTC I2C hardware to communicate with chips.
That works when compiled with option debug or -O0. With performance optimization -O2 or even size optimization -Os it can no longer communicate.
What is the actual behavior?
Initializing RTC I2C ...
E (298) ulp_riscv_i2c: Write Failed!
E (298) ulp_riscv_i2c: RTC I2C Interrupt Raw Reg 0x154
E (302) ulp_riscv_i2c: RTC I2C Status Reg 0x35ff0009
ERROR: Cannot communicate with I2C sensor
Steps to reproduce.
standard example examples/system/ulp/ulp_riscv/i2c
unmodified
Debug Logs.
No response
More Information.
No response
The text was updated successfully, but these errors were encountered: