I have a Heltec WiFi kit, and I am using the Remote Control peripheral to generate a PPM output pulse stream. As part of the configuration I set the clock divider to 80 which should give me a one microsecond tick size (80MHz clock), but instead I got a tick size of roughly 1.5us.
After much searching I learned that there is a parameter to set the crystal frequency, which can be either 40MHz or 26MHz. It seems mine is 26MHz variety, but the default is 40MHz, hence the discrepancy. I have also seen an error message in the output (after I changed the baud rate to 74880 (115200 * 26 / 40) as noted in an old post on the same topic). I also changed my clock divider to 52 (80 * 26 / 40) which gave me the required 1us tick size. So it works, bu it’s a workaround.
After more research I found that the frequency is defined in sdkconfig.h. I tried changing it in the files defined for the project, but it was immediately overwritten again next time I compiled the project, and reset to 40.
I found another sdkconfig.h file here ~/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/config/sdkconfig.h (but there isn’t one in framework-espidf, which is the framework I am using), and updated it to 26 there, but again the values in the sdkconfig.h files generated for the project were set to 40.
I have also installed the esp development tool, and used the idf.py menuconfig command to set the default frequence to 26. This has worked for the esp tool, as I can compile and upload the program, with a clock divider = 80, and it generates a 1us tick size as expected. I should mention that it also appears to work in PlatformIO using the arduinoespresiff32 framework, but I’ve run into some other problems there.
So how do I set the frequency to 26 when using the espidf framework?
Thanks, Ian