In the Galileo Release Notes: https://communities.intel.com/docs/DOC-21837
Page 9, Section 1.7.12
It shows the Arduino pin and Cypress PWM port.
Now take a look at the IO Mapping: https://communities.intel.com/docs/DOC-21920
It shows that GPORT0_BIT4_PWM7 is Linux GPIO ID 20.
Try using gpio20 instead of gpio30 that might be the issue.
Hello Intel_jEspinoza, still not working. In the IO Mapping Document, the Arduino IDE ID column corresponds to the pins of Arduino? because IO3 is GPORT0_BIT2_PWM3, but can not find the port in the table of MUX ... and in Linux, what PWM corresponds with this? Thanks a lot!
1 of 1 people found this helpful
We have validated with a Voltmeter that the PWM on PWM3 is working. We followed your steps from the original post which they are correct. When we change the duty_cycle the voltage changes proportionally. We could not validate it with a speaker because we dont have an amplifier/shield because the current is so low that the speaker drained the current. How are you testing this?
The Arduino IDE ID column is referring to the physical pins on the Galileo. I know the mux table is a bit confusing but GPORT0_BIT2_PWM3 is on the second column, second to last row. The mux for PWM3 is GPIO30.
For validate I use an oscilloscope. Are you using the Linux SD version? I have seen in some web pages that in the SPI-Linux works correctly... but I not found examples for SD Linux version. This night I try again. Thanks.
Hi Pablo _ESP,
I have validated the PWM on PWM3 with an oscilloscope. I used the Linux Image for SD for Galileo. I set the period to 1000000ns (1ms) and the duty cycle to 500000ns (.5ms). The image bellow shows the results with the duty cycle at 50%.
Then I set the period to 1000000ns (1ms) and the duty cycle to 250000ns (.25ms). The image bellow shows the results with the duty cycle at 25%.
Did you try to enable the corresponding GPIO device of the Pin 3 first? (After the correct mux setting, but before exporting the pwm device)
echo "18" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio18/direction
echo "strong" > /sys/class/gpio/gpio18/drive
echo "1" > /sys/class/gpio/gpio18/value
echo "18" > /sys/class/gpio/unexport
(I'm not sure, if 18 is the right one or is 15 is correct)
thanks!! I thought that the gpio18 is configured by the CYPRESS. thank you very much to both!!! I put here the correct steps to activate de PWM3 output from SD-Linux
login as: root
root@clanton:~# echo "out" > /sys/class/gpio/gpio30/direction
root@clanton:~# echo "1" > /sys/class/gpio/gpio30/value
root@clanton:~# echo "out" > /sys/class/gpio/gpio18/direction
root@clanton:~# echo "1" > /sys/class/gpio/gpio18/value
root@clanton:~# echo "strong" > /sys/class/gpio/gpio18/drive
root@clanton:~# echo "1" > /sys/class/pwm/pwmchip0/pwm3/enable
root@clanton:~# echo "1000000" > /sys/class/pwm/pwmchip0/pwm3/period
root@clanton:~# echo "50000" > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
in Linux SD version, the export command is not necessary.
Thanks a lot!