Cannot change registers by pointers

Hello! I'm trying to use timers and change prescaler and clock source of CPU by pointers on ESP-WROOM-32 but when I check changes by oscilloscope it does not work. Neither timers nor SYSCON or RTC.

The example of code I'm trying:

#define  RTC_CNTL_CLK_CONF_REG      *((uint32_t*)0x3FF48070) 
#define  DPORT_CPU_PER_CONF_REG     *((uint32_t*)0x3FF0003C) 
#define  SYSCON_SYSCLK_CONF_REG     *((uint32_t*)0x3FF66000)

#define  RTC_SOC_SEL_SHIFT      27

void setup() {
  RTC_CNTL_CLK_CONF_REG |= 3 << RTC_SOC_SEL_SHIFT;
  DPORT_CPU_PER_CONF_REG = 1;
  SYSCON_SYSCLK_CONF_REG = 9;
}

How to resolve this problem?

I know that there is already written in Arduino libraries functions for that but I just can't find libraries and headers that allow to change CPU clock source and XTAL or PLL prescaler.

And timers are also suitable for my purposes but they does not work even if I use standard esp32-hal-timer.h functions for making delays.

Thank you!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.