How to get a value of IO_MUX_04_REG
Posted: Fri Sep 07, 2018 12:15 pm
Hello All,
The code below that is for arduino IDE shows a correct value, but continues reboot when get the comment out lines work.
Could anybody tell me why?
Thank you.
---------------------------------------
volatile uint32_t* p_IO_MUX_04_REG; // cf. p70 esp32_technical_reference_manual_en.pdf
volatile uint32_t* p_IO_MUX_15_REG;
uint32_t IO_MUX_04_REG = 0;
uint32_t IO_MUX_15_REG = 0;
void printf(char *fmt, ...) {
char buf[256];
va_list args;
va_start(args, fmt);
vsnprintf(buf, 256, fmt, args);
va_end(args);
Serial.print(buf);
}
void setup() {
pinMode(4, INPUT);
pinMode(15, OUTPUT);
p_IO_MUX_04_REG = (volatile uint32_t*)(0x10 + 4*4);
p_IO_MUX_15_REG = (volatile uint32_t*)(0x10 + 4*15);
//IO_MUX_04_REG = *p_IO_MUX_04_REG;
//IO_MUX_15_REG = *p_IO_MUX_15_REG;
Serial.begin(2000000);
printf("IO_MUX_04_REG = %08x\n", IO_MUX_04_REG);
printf("IO_MUX_15_REG = %08x\n", IO_MUX_15_REG);
delay(10000);
}
void loop() {
}
---------------------------------------
The code below that is for arduino IDE shows a correct value, but continues reboot when get the comment out lines work.
Could anybody tell me why?
Thank you.
---------------------------------------
volatile uint32_t* p_IO_MUX_04_REG; // cf. p70 esp32_technical_reference_manual_en.pdf
volatile uint32_t* p_IO_MUX_15_REG;
uint32_t IO_MUX_04_REG = 0;
uint32_t IO_MUX_15_REG = 0;
void printf(char *fmt, ...) {
char buf[256];
va_list args;
va_start(args, fmt);
vsnprintf(buf, 256, fmt, args);
va_end(args);
Serial.print(buf);
}
void setup() {
pinMode(4, INPUT);
pinMode(15, OUTPUT);
p_IO_MUX_04_REG = (volatile uint32_t*)(0x10 + 4*4);
p_IO_MUX_15_REG = (volatile uint32_t*)(0x10 + 4*15);
//IO_MUX_04_REG = *p_IO_MUX_04_REG;
//IO_MUX_15_REG = *p_IO_MUX_15_REG;
Serial.begin(2000000);
printf("IO_MUX_04_REG = %08x\n", IO_MUX_04_REG);
printf("IO_MUX_15_REG = %08x\n", IO_MUX_15_REG);
delay(10000);
}
void loop() {
}
---------------------------------------