I'm currently trying to write low level code in the C programming language for the interrupts.
ere exactly the isr is located or the jump address to it? We know from the Atmels that there is an “ISR” for every single interrupt, but how is it done with the esp32, especially with the c3?
Attached are the functions I have written so far on the subject of interrupt
The ESP32 is a much more complex device than the simpler Atmel processors used on Uno, Mega, etc. There are many interdependencies in the interrupt system. If you don't want to use the standard Arduino attachInterrupt() API, then you should APIs provided by Espressif. You can get an idea by looking at the code for attachInterrupt().
i have read a lot but I don't find the right way for me.
in datasheet for the esp32c3 I found address for the interrupts (see picture) how I can place my c function or reference or link to this place?
Just like in Your Other Thread, you're trying to program this very complex device at the wrong level. This is not a simple 8-bit micro. You should be using the Espressif APIs. That's why they are provided. Otherwise you'll run into problems like messing up the configuration set up by Espressif's startup code. What is your motivation for stubbornly trying to go another way?
these days microcontroller manufacturers such as Microchip, Espressif, STM, etc provide extensive libraries to support their products
unless there is a good reason to drop into low level code (e.g. to tune some particular operation) use the libraries provided
e.g. display times between changes in HIGH/LOW on GPIO2 of ESP32C3
// ESP32C3 - display times between changes on GPIO2
#define RXPIN 2
volatile int pin = 0; // logic pin value 1 or 0
volatile long timer = 0; // time of change
// interrupt handler
void IRAM_ATTR handleInterrupt2() {
pin = digitalRead(RXPIN); // read pin value
timer = millis(); // note time
}
void setup() {
Serial.begin(115200);
delay(2000);
Serial.println("\n\nESP32C3 - display times between changes on GPIO2");
pinMode(RXPIN, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(RXPIN), handleInterrupt2, CHANGE);
}
void loop() {
static int lastPin = -1;
// if had inperrupt on pin 2 display value and time
if (pin != lastPin) {
lastPin = pin;
Serial.print(timer);
Serial.print(' ');
Serial.println(pin);
}
}