Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By thuSkywalker
#27605 Found following example codes in hardware timer

Code: Select all#define REG_READ(_r)
#define WDEV_NOW()
(*(volatile uint32 *)(_r))
REG_READ(0x3ff20c00)
uint32 tick_now2 = 0;
void hw_test_timer_cb(void)
{
    static uint16 j = 0;
    j++;
   
    if( (WDEV_NOW() - tick_now2) >= 1000000 )
    {
    static u32 idx = 1;
        tick_now2 = WDEV_NOW();
        os_printf("b%u:%d\n",idx++,j);
        j = 0;
    }
}
void ICACHE_FLASH_ATTR user_init(void)
{
        hw_timer_init(FRC1_SOURCE,1);
        hw_timer_set_func(hw_test_timer_cb);
        hw_timer_arm(100);
}


Through some testing, I found that the 32-bit unsigned integer in address 0x3FF20C00 is not hardware timer related. It always increases every microsecond and seems(not tested) not reloading until reaches 0xFFFFFFFF.

The code here suggests it is MAC time, but I wish more detailed information about this register.
https://github.com/pvvx/esp8266web/blob ... add_func.h