Is it possible to read I2C data in ISR?

ahue32
Posts: 16
Joined: Mon Nov 06, 2017 10:09 am

Is it possible to read I2C data in ISR?

Postby ahue32 » Tue Nov 28, 2017 8:32 am

In my project I'm using the Adafruit 2,8" cap touch display. It has an interrupt pin which triggers, when the touch screen is touched. Now I tried to use it with an Arduino Nano and had the problem that with the Arduino it is not possible to get I2C data from inside a ISR.

My question now is, is this possible with the ESP32? Can I access the I2C port while in an interrupt from another source? If yes, what would be necessary for that?

Thank you for your help!

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Is it possible to read I2C data in ISR?

Postby kolban » Sun Mar 11, 2018 12:35 am

I'm going to hazard a guess that the philosophy of an ISR (Interrupt Service Routine) is to do as little work as possible and get out as fast as possible. Would it be possible to have your ISR solely "recognize" that something has triggered an interrupt and then post a semaphore or queue entry and then return from the ISR?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Who is online

Users browsing this forum: No registered users and 93 guests