-
Notifications
You must be signed in to change notification settings - Fork 17
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 interrupts() and noInterrupts() not working correctly with SSD1306 OLED #729
Comments
Hello, thanks for reporting! Has this code been tested on actual hardware? In most cases, the issue is not a simulation issue, rather an issue with the code or the way a third party library works. The simulator implements both cores on the ESP32 (this is required for FreeRTOS to function correctly). |
I have the same issue with this https://wokwi.com/projects/388202397151520769. I'm sure it will run just fine on real hardware. But when simulated it will crash any complex interrupt. So this code is set up to play an alarm melody on boot, and that works just fine. Then it attaches interrupt to the button press on the rotary encoder and to the CLK where i detect left and right turn. Left and right work just fine playing a single tone, but the button press playing the alarm melody, it instantly crashes the simulation
|
Well, we need to be certain it works differently on actual hardware. The process for fixing bugs in the simulator is:
|
Yes, i copied the code from a running project, that a student gave me. It might be a racing condition in the simulation. display.display() only sends a short command over the I2C-Bus. I assume, the library uses a callback/interrupt when the transmission ends. In real hardware, this process might be finished (just) before noInterrupts() takes effect. In the simulation, the function probably is stuck waiting for the interrupt to happen... |
Just checked the problematic code in Wokwi and with real hardware
But now on the real hardware i get:
I see a problem here ;-) |
Thanks for checking! That's why we always want to check the same binary on the hardware. Unfortunately, source code is not enough for reproducible results - the underlying esp-idf framework evolves over time, the Arduino core for ESP32 is constantly changing, and third-party libraries may also changes. You can download the binary that is running inside Wokwi by pressing F1 in the code editor and then "Download Compiled Firmware". |
When i try to open your project, i see only a green custom chip instead of the PCF8575 and a message "loading wokwi-custom-board" instead of your cpu-module. |
Would love to test with physical hardware but i don't have everything delivered yet, so i can't test it currently
It's because I'm currently waiting for my PR to get approved, so I'm using my custom files for a ESP32-C3 board I have no clue regarding custom chip design, but I'm actually looking into it right now as i want to add the PCF8575 chip to the list. I found the code for it to work in another Wokwi project, so i borrowed it to play around, But i like the look of the actual board, so thats my next project I will add to Wokwi PR for new chips. I only think it's the MCU you can do custom graphics currently, but I'm not 100% sure on that. |
Describe the bug
When i disable interrupts on the ESP32 before display.display() the program hangs up
To Reproduce
Remove the comment in Line 330, place comment in line 341
https://wokwi.com/projects/388804995646001153
Expected behavior
the program should execute the display-functions, even if i disable external interrupts. The program works on real hardware (with Arduino 2.2.1)
Environment (please complete the following information):
Additional context
Instead of disabling the interrupts, i could also enable the button-interrupt only after the first polling-event....
Could this be an issue of having one or two CPUs?
The text was updated successfully, but these errors were encountered: