Can the ESP32 interupt and read port within 1us?

equant
Posts: 3
Joined: Mon Jul 05, 2021 6:14 pm

Can the ESP32 interupt and read port within 1us?

Postby equant » Mon Jul 05, 2021 6:26 pm

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

pratik2440
Posts: 25
Joined: Mon Jun 28, 2021 4:55 am

Re: Can the ESP32 interupt and read port within 1us?

Postby pratik2440 » Wed Jul 07, 2021 6:49 am

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).
Hobbyist and electronic design consultant! (https://PCBArtists.com/)

PaulShaw
Posts: 13
Joined: Tue Apr 24, 2018 8:54 am

Re: Can the ESP32 interupt and read port within 1us?

Postby PaulShaw » Sat Jul 10, 2021 10:25 am

I think you can use PULSE_CNT to try

tommeyers
Posts: 184
Joined: Tue Apr 17, 2018 1:51 pm
Location: Santiago, Dominican Republic

Re: Can the ESP32 interupt and read port within 1us?

Postby tommeyers » Sat Jul 10, 2021 8:01 pm

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
IT Professional, Maker
Santiago, Dominican Republic

equant
Posts: 3
Joined: Mon Jul 05, 2021 6:14 pm

Re: Can the ESP32 interupt and read port within 1us?

Postby equant » Sun Jul 11, 2021 7:30 pm

Thanks everyone for the feedback. I appreciate it, and the suggestions for alternate methods of doing what I need. Cheers!

therealergo
Posts: 8
Joined: Wed Jun 30, 2021 6:16 pm

Re: Can the ESP32 interupt and read port within 1us?

Postby therealergo » Mon Jul 12, 2021 4:35 pm

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

equant
Posts: 3
Joined: Mon Jul 05, 2021 6:14 pm

Re: Can the ESP32 interupt and read port within 1us?

Postby equant » Tue Jul 13, 2021 7:37 pm

therealergo wrote:
Mon Jul 12, 2021 4:35 pm
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
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.

Who is online

Users browsing this forum: No registered users and 39 guests