I recently got my ESP32 (it's Rev0, I already checked that) and it runs fine, except that I don't get why the maximum toggle frequency for GPIOs seems to be 4 MHz. Is this really the maximum (the peripheral bus clock rate is 80MHz, so shouldn't it be 40MHz?)? Or are now the slow register-adresses (as mentioned in the ECO pdf) standard?
Im running the latest IDF (from github) and my project is based on the esp-idf-template (again form github).
My Toggle-function runs on Core1 (as a thread pinned to it).
I use GPIO.out_w1ts and GPIO.w1tc to set/clear the GPIO.
I have tried to simplify the code code as far as possible eliminate any "codelogic-errors".
The critical code section:
Code: Select all
void toggle(void *pvParameter) {
printf("toggle called.\n");
portDISABLE_INTERRUPTS();
while (1) {
GPIO.out_w1ts |= (1 << GPIO_NUM_23);
__asm__ __volatile__("nop;nop;nop;nop;nop;nop;nop;"); // Bug workaround (I found this snippet somewhere in this forum)
GPIO.out_w1tc |= (1 << GPIO_NUM_23);
__asm__ __volatile__("nop;nop;nop;nop;nop;nop;nop;");
}
// GPIO.out doesn't make any difference
/* ... */
portENABLE_INTERRUPTS();
}
So why do I want to Toggle a GPIO as fast as possible? Why not...
I'm trying to get data as fast as possible into 4 x 8 D-FlipFlops (4 x 74ahct574), so I have 8 data lines and 4 clock lines.
Im new to ESP32 so I don't exactly know yet, how some of the peripherals/DMA work, so I thought this would be a good start
I am thankful for any help and maybe you can point me in the right direction to solve my problem.
PS: I'm sorry for any spelling/grammar errors, I'm not a native speaker.