Page 1 of 1

Esp32S3 : Use of General Purpose Timer

Posted: Mon Sep 23, 2024 1:33 pm
by ThomasESP32
Good afternoon,

I am using an Esp32S3 Wroom 1U device in order to create a program.
In my application, I want to create a timer using the General Purpose Timer API.

Using the following lines :

uint64_t RawCount = 0;
gptimer_handle_t gptimer = NULL;
gptimer_config_t timer_config = {
.clk_src = GPTIMER_CLK_SRC_DEFAULT,
.direction = GPTIMER_COUNT_UP,
.resolution_hz = 1 * 1000 * 1000, // 1MHz, 1 tick = 1us
};

gptimer_new_timer(&timer_config, &gptimer);
gptimer_enable(gptimer);
gptimer_start(gptimer);

I managed to create the timer and using the following line :

gptimer_get_raw_count(gptimer, &RawCount);

I managed to read the current counter in us.

My problem is that I would like to read the counter value from the RISC-V ULP program.
Could you please tell me if I have access to the API from the RISC-V ULP Copro ?
Can I use the method : gptimer_get_raw_count(gptimer, &RawCount); from the ULP ?

If the answer is no, how can I read the counter value from the registers manually ?
This question because I don't know if the API has started the T0 or T1 from Group 0 or Group 1...

Thank you for your help,
best regards,

Re: Esp32S3 : Use of General Purpose Timer

Posted: Mon Sep 23, 2024 2:51 pm
by MicroController
ThomasESP32 wrote:
Mon Sep 23, 2024 1:33 pm
My problem is that I would like to read the counter value from the RISC-V ULP program.
Could you please tell me if I have access to the API from the RISC-V ULP Copro ?
Can I use the method : gptimer_get_raw_count(gptimer, &RawCount); from the ULP ?
No.
If the answer is no, how can I read the counter value from the registers manually ?
You can't.
S3 TRM:
ULP coprocessor can access the modules in RTC domain via RTC registers.
The ULP cannot access any registers or peripherals which are not (accessed via) RTC registers.