esp-32s1 reading RTC timer through ULP, getting garbage.
Posted: Fri Jul 16, 2021 8:54 pm
- read_RTC_time:
- WRITE_RTC_REG(RTC_CNTL_TIME_UPDATE_REG, RTC_CNTL_TIME_UPDATE_S, 1,1)
- wait_RTC_update:
- READ_RTC_REG(RTC_CNTL_TIME_UPDATE_REG, RTC_CNTL_TIME_VALID_S, 1)
- jumpr wait_RTC_update, 0, eq
- READ_RTC_REG(RTC_CNTL_TIME0_REG+2, 0, 16)
- move r1, last_measurement_time
- st r0, r1, 0
- uint32_t* time0 = (uint32_t *) 0x3FF48010;
- printf("last_measurement_time: %X, current_time: %X\n", ulp_last_measurement_time & 0xFFFF, (*time0 & 0xFFFF0000) >> 16);