1. Galileo Gen2 hardware design limits a regular PWM's frequency up to 1526 Hz.
2. usleep does not allow to have a stability.
3. Using a lightweight Linux version like https://www.zephyrproject.org/ instead of intel-iot-devkit-egclib may provide a better stability.
4. It is better to use an external PWM chip with Gen2. For example like https://datasheets.maximintegrated.com/en/ds/MAX31790.pdf
Thanks for the answer, xbolshe. I'll discuss with my research group these points.
Another question i have is if it's possible to access the GPIO's registers directly. If it is, how I do that? Via assembly code?
yes, it is possible. But it will be a little bit harder because of a pin multiplexing.
Actually a language does not matter: Assembler or C.
It is more important to have an experience with a hardware and Linux kernel.
One more way is own PWM kernel driver.
About the mutilplexing:
I could work on the multiplexers in a more high-level language approach, like Linux Shell and then using C/Assembly for specifically work with the GPiO pin and interruptions. Do you think it could work?
This message was posted on behalf of Intel Corporation
If you’re interesting in muxing configuration in Linux you can check http://download.springer.com/static/pdf/456/chp%253A10.1007%252F978-1-4302-6838-3_14.pdf?originUrl=http%3A%2F%2Flink.springer.com%2Fchapter%2F10.1007%2F978-1-4302-6838-3_14&token2=exp=1464384525~acl=%2Fstatic%2Fpdf%2F456%2Fchp%25253A10.1007%25252F978-1-4302-6838-3_14.pdf%3ForiginUrl%3Dhttp%253A%252F%252Flink.springer.com%252Fchapter%252F10.1007%252F978-1-4302-6838-3_14*~hmac=eab3432092c2dc9f01f7ac8feb57d81599660b14b1a2254f3cbb2b6990b7d18d .
There are also some examples in C and other programming languages, on how to do interrupts. Check https://github.com/intel-iot-devkit/mraa/tree/master/examples for more information.