The fastest frequency we were able to get was 13.97kHz with this commands:
echo -n "3" > /sys/class/pwm/pwmchip0/export
echo -n "1" > /sys/class/pwm/pwmchip0/pwm3/enable
echo -n "62500" > /sys/class/pwm/pwmchip0/pwm3/period
echo -n "31250" > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
Remember you can also use this commands in the IDE with the function system(), in case you prefer using the Arduino side. The usage of this function would be like this, for example
system("echo 3 >/sys/class/pwm/pwmchip0/export");
Aren't there limitations with the I/O output frequency though? ore are the PWM pins able to switch at that frequency?
We tried in the IDE with the fastgpio configurations and we got up to 2 MHz. The tests were done on pin 2 and 3, but we got a better looking square signal in the pin 3 due to the PWM on that pin and the pin 2. If you need more information on it you can check this post https://communities.intel.com/message/213625#213625 . The test we’ve done on Linux side were done on pin 3 and 13.97 kHz was the max value of frequency we could set. We tried by reducing the period of the signal but the pins didn’t responded.
What about the SPI bus? It is claimed in the datasheet that it defaults to 4 Mhz. Can the I/O pins (11,12,13) and the ICSP pins handle that frequency?