Hi,
I am doing my first project (learning phase for now) with ESP WROOM 32. I am using ESPIDF framework on visual studio code, but I still consider a good practise to learn direct register operations, not only blindly using built-in commands (especially for GPIO). I have been reading the datasheet for quite some time, but I can not implement what is written there: https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf
Page 52, 4.3.3 Simple GPIO Output (I tried to do this) The compiler treats register names as undeclared functions. I know that there is definitely a way to perform the direct register read or write somehow... Is it just my faulty syntax or do you have to dig deeper into the framework? I really hope that you still have the choice to use build-in functions and register manipulation as well. Thank you in advance for any help reaching the bare register directly...
My code:
I am doing my first project (learning phase for now) with ESP WROOM 32. I am using ESPIDF framework on visual studio code, but I still consider a good practise to learn direct register operations, not only blindly using built-in commands (especially for GPIO). I have been reading the datasheet for quite some time, but I can not implement what is written there: https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf
Page 52, 4.3.3 Simple GPIO Output (I tried to do this) The compiler treats register names as undeclared functions. I know that there is definitely a way to perform the direct register read or write somehow... Is it just my faulty syntax or do you have to dig deeper into the framework? I really hope that you still have the choice to use build-in functions and register manipulation as well. Thank you in advance for any help reaching the bare register directly...
My code:
C:
#include <stdio.h>
#include <stdint.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
//I want to toggle GPIO pin 2
void app_main() {
GPIO_FUNC2_OUT_SEL_CFG_REG = 0x100; //This step is provided in the datasheet
while (1) {
GPIO_OUT_DATA |= (1 << 2);
vTaskDelay(1000 / portTICK_PERIOD_MS);
GPIO_OUT_DATA &= ~(1 << 2);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}