Esp32S3 : Use of General Purpose Timer
Posted: Mon Sep 23, 2024 1:33 pm
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,
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,