ESP32 high level interrupt memory access issue

haydend
Posts: 5
Joined: Fri Nov 26, 2021 11:37 am

ESP32 high level interrupt memory access issue

Postby haydend » Mon Dec 06, 2021 10:45 am

Hello All,

Looking for some help on an issue I'm having with using high level interrupts and memory access inconsistencies.

In a HLI level 5, I'm trying to get the GPIO_STATUS_REG value but the program kept returning 0. Then randomly I added a few lines of code, that simple increments a variable and suddenly GPIO_STATUS_REG = 262144, what I expected. I'm hoping someone may be able to tell me what's going on in the background here. Is it a memory timing issue? Did some cache fill up to a trigger point where it finally executed my memory access? Am I using L32i incorrectly?

I've managed to capture a consistent way of showing the issue. I wonder if other people will experience the same. My issue can be found here, https://github.com/HaydenDekker/ls-t-gp ... -int-alloc

In this example, I get my expected results, when applying 3.3v to pin 18 and then pin 19.

VECTOR INTERRUPT VAL 2147581952. VECTOR INTENABLE value 2466250820. GPIO_STATUS_REG. 262144. DPORT_APP_GPIO_INTERRUPT_MAP_REG. 31. ISR runs total 679.

VECTOR INTERRUPT VAL 2147581952. VECTOR INTENABLE value 2466250820. GPIO_STATUS_REG. 524288. DPORT_APP_GPIO_INTERRUPT_MAP_REG. 31. ISR runs total 694.

But after removing/commenting out lines 55 to 59 in highint5.S this causes GPIO_STATUS_REG = 0. And I can't work out why and what I'm going wrong. The code I remove is totally unrelated to the code getting GPIO_STATUS_REG.

Code: Select all

    //movi    a14, isr_runs_total
    //l32i    a15, a14, 0
    //addi    a15, a15, 1
    //s32i    a15, a14, 0
    //memw
Thankyou for you help.

For reference, it's built on Darth Clouds example here, https://github.com/darthcloud/esp32_hig ... aster/main

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: ESP32 high level interrupt memory access issue

Postby ESP_igrr » Mon Dec 06, 2021 9:27 pm

One issue I see with the code (https://github.com/HaydenDekker/ls-t-gp ... highint5.S) is that you are overwriting register values — a14, a15, a7 — without restoring them to their original values before the interrupt handler. This probably means that these registers in the context of the task running right before an interrupt will get overwritten.

(this might not be the cause of the "0" values you are seeing, but this may also cause the program to crash or behave in really odd ways)

haydend
Posts: 5
Joined: Fri Nov 26, 2021 11:37 am

Re: ESP32 high level interrupt memory access issue

Postby haydend » Tue Dec 07, 2021 8:18 am

Thanks for your reply,

Unfortunately that suggestion did not resolve my issue. Please see the updated code base where I've stored and restored the registers I use.

hmm. Any more ideas? Am I in the right forum to?

I'm thinking I need to isolate the issue a bit more. I reckon it has to be in the s32i to the volatile memory rather than the l32i from peripheral memory.

Thanks agian.

haydend
Posts: 5
Joined: Fri Nov 26, 2021 11:37 am

Re: ESP32 high level interrupt memory access issue

Postby haydend » Tue Dec 07, 2021 9:10 am

In this commit, https://github.com/HaydenDekker/ls-t-gp ... ad13625e60

I've removed line 64 and in line 65 I'm using the peripheral GPIO interrupt status to clear itself.

The issue is still present which proves my error is in attempting to set the volatile memory, and not in accessing the peripheral register.

These two results are incorrect,

VECTOR INTERRUPT VAL 98304.
GPIO_STATUS_REG. 0.

Who is online

Users browsing this forum: No registered users and 29 guests