someweisguy / esp_dmx

Espressif ESP32 implementation of ANSI-ESTA E1.11 DMX-512A and E1.20 RDM
MIT License
335 stars 35 forks source link

Interrupt conflict #119

Closed particlerain closed 8 months ago

particlerain commented 8 months ago

Hello,

you made a stable dmx availability for esp32 . Thanks for that.

Unfortunately there is an issue when i use eeprom and i2c LCD for storing the DMX start adress etc. Everything works fine when there is signal on pin 16. But as soon as i remove the DMX rx cable on pin16 , the LCD and buttons don't react anymore. I need to find a solution for this, as accessing the LCD via the buttons and the settings only when there is DMX signal, is not an option. I tried your suggestion with giving a "0" for the wait_ticks. But i also got glitches in the received packets. Tried also with your suggestion with ESP flags 1 to 6 while calling the driver in Setup. I only could set between Flag 1 and 2. And that didnt fix the issue. After Flag3 it did not receive DMX packets anymore. I also tried with dmx_driver_disable() as soon a button is pressed so it could work out the setting stuff without receiving enabled. But it did not work either. With no cable attached to the RX pin 16 , i can't do any other tasks and this is annoying. Could you please give me an advice on what else i could do ?

Edit: I am using esp_dmx v3.1 Arduino ide 1.8.19 ESP32 core 2.0.5

Btw is there an option in your code ( which i did not see where) to define that the driver should be used in IRAM? I guess its the default ? Or should we define it somehere?

someweisguy commented 8 months ago

Thanks for the praise and thank you for submitting this issue. And thank you for the excellent troubleshooting you have done so far.

I only could set between Flag 1 and 2. And that didnt fix the issue. After Flag3 it did not receive DMX packets anymore.

This sounds right to me. I don't recall exactly how this behavior is supposed to work off the top of my head but this sounds about right. If I recall correctly, any interrupts above flag 3 must be written in assembly. The interrupt service routine for this library is written in C. The Assembly/C interrupt flag behavior is a quirk of the hardware, not something that this library defines.

Btw is there an option in your code ( which i did not see where) to define that the driver should be used in IRAM? I guess its the default ? Or should we define it somehere?

Due to the way Arduino works, your version of Arduino will automatically place the DMX driver in IRAM. This may change when Arduino officially supports ESP-IDF v5.1 but the current version you are using will place the driver in IRAM. On Arduino, this setting is not able to be changed.

Is there any code that you are able to share? I think that is the next step that will be needed to help with this issue.