Page 1 of 1
Can the ESP32 interupt and read port within 1us?
Posted: Mon Jul 05, 2021 6:26 pm
by equant
Can the ESP32 read the databus in less than a nanosecond after a external interrupt is triggered?
I have an Apple II that operates at 1 MHz. When the DEVSEL line on the Apple II goes low, I want to read the databus. I have tried this with the arduino ide, but it doesn't work and I believe this is because the read happens too late (even when using REG_READ(GPIO_IN1_REG))
I would like to know: if I use the ESP IDF to write the code, should it be possible for the ESP32 to respond to a pin interrupt and read the data bus within a 1us clock cycle, or is this task not realistic for an ESP32?
Thanks,
Nathan
Re: Can the ESP32 interupt and read port within 1us?
Posted: Wed Jul 07, 2021 6:49 am
by pratik2440
In my experience this is not realistic. The response time (time from interrupt source changing to user ISR execution) is around 2 us.
That time is not exactly the same either, it seems to change every time with some variance.
For your application, it would be best to hook up an STM32 or something (cheapest one you can find) and have it capture the data to send over to ESP32. That's what I have done for similar applications before (data acquisition, logic state capture of large parallel buses, etc).
Re: Can the ESP32 interupt and read port within 1us?
Posted: Sat Jul 10, 2021 10:25 am
by PaulShaw
I think you can use PULSE_CNT to try
Re: Can the ESP32 interupt and read port within 1us?
Posted: Sat Jul 10, 2021 8:01 pm
by tommeyers
You might not find the timing to be fast enough nor precise enough.
Consider 74ls373 to latch the value to be processed by software.
You may not want to use he but the timing it offers may be what is necessary.
I used that device to connect my coverage analysis hardware to an address bus.
Tom
Re: Can the ESP32 interupt and read port within 1us?
Posted: Sun Jul 11, 2021 7:30 pm
by equant
Thanks everyone for the feedback. I appreciate it, and the suggestions for alternate methods of doing what I need. Cheers!
Re: Can the ESP32 interupt and read port within 1us?
Posted: Mon Jul 12, 2021 4:35 pm
by therealergo
It might also be worth trying ESP32's assembly high-level interrupts. I've never used them personally, but they can allegedly give interrupt latencies that are significantly lower than the ~2us for regular ESP32 C interrupts.
See:
viewtopic.php?t=422
See:
https://docs.espressif.com/projects/esp ... rupts.html
Re: Can the ESP32 interupt and read port within 1us?
Posted: Tue Jul 13, 2021 7:37 pm
by equant
This is what I was sort of wondering about. It seems like a big leap from using the arduino ide (what I've used) to assembly language with the esp-idf, and I didn't want to go down that route if it wasn't going to be possible to reduce the interrupt latency down to what I needed. I think ultimately it's probably easier to use an STM32 to do the data bus stuff, with an ESP32 attached as suggested, but I'm interested in learning and attempting the low level approach entirely on the ESP32. I've installed the ESP-IDF, and now I supposed I'll have to do a bit of reading. Thanks for the links.
PS - Another approach I've considered is having the Apple II and the ESP32 swap bytes using dual-port ram.