I am trying to make a highspeed counter with the ESP32. I am using the espressif PCNT example described in the Espressif PCNT function. (can’t post a link, new user)
The PCNT function says it can count pulses with a pulse duration longer than 12.5 ns using this function my pulses are 20 ns long. I got that to work but I need to “bin” the count’s every 500 ns for 400 microsecond blocks, 800 separate bins. Then do some data analysis on the data. So I need to trigger the xQueueReceive function every 500 ns. I realize this is really fast and will tax the CPU greatly and might have some errors but I am not doing anything else with this processor and want to test this and see what the error is before I decide to use a different chip with a faster processor. Maybe a Teensy 4.0.
res = xQueueReceive(pcnt_evt_queue, &evt, 1 / portTICK_PERIOD_MS);
The fastest I can make the xQueueReceive is 1 millisecond, portTICKPERIOD_MS is too slow. Is there a way to tap into the ESP.cycleclock() to use the 240 MHz clock ticks? or change the portTICK_PERIOD_MS to a different period?