Hello people,
I think a clock 2.66MHz would be too slow which is generated by a code shown below, under the condition of 240MHz CPU.
Q1. Is it too slow?
Q2. If so, could anybody show source code for faster?
Thank you.
void test(void)
{
gpio_set_direction(22, GPIO_MODE_OUTPUT);
gpio_set_direction(23, GPIO_MODE_OUTPUT); // LED
PORT |= (1 << 23);
vTaskDelay(1000 / portTICK_RATE_MS);
PORT &= ~(1 << 23);
portMUX_TYPE mutex = portMUX_INITIALIZER_UNLOCKED;
portENTER_CRITICAL(&mutex);
tag_loop:
PORT |= (1 << 22);
PORT &= ~(1 << 22);
goto tag_loop;
portEXIT_CRITICAL(&mutex);
}
void app_main()
{
test();
}
Fastest clock generated by GPIO
Re: Fastest clock generated by GPIO
There are many topics about this, for a clock you can use ledc. If you are trying to do something else you can use rmt, ulp, or high level ints.
Re: Fastest clock generated by GPIO
I get 10mhz doing this.
Code: Select all
void app_main()
{
gpio_pad_select_gpio(BLINK_GPIO);
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
while (1)
{
GPIO.out_w1ts = (1 << BLINK_GPIO);
GPIO.out_w1tc = (1 << BLINK_GPIO);
}
}
Re: Fastest clock generated by GPIO
Thank you for your advice. I've got 9.908MHz.
Who is online
Users browsing this forum: No registered users and 75 guests