- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi All,
I am using Intel Galileo Gen 2 board using linux and I want to access available 6 channels of PWM interface. I have configured the PWM in Gen2 baord as below script file.
# !/bin/bash
echo -n "out" > /sys/class/gpio/gpio26/direction
echo -n "1" > /sys/class/gpio/gpio26/value
echo -n "out" > /sys/class/gpio/gpio27/direction
echo -n "0" > /sys/class/gpio/gpio27/value
echo -n "1" > /sys/class/gpio/gpio74/value
echo -n "1" > /sys/class/pwm/pwmchip0/pwm11/enable
echo -n "3000000" > /sys/class/pwm/pwmchip0/device/pwm_period
echo -n "1500000" > /sys/class/pwm/pwmchip0/pwm11/duty_cycle
while true; do
echo "Start"
echo -n "out" > /sys/class/gpio/gpio26/direction
echo -n "1" > /sys/class/gpio/gpio26/value
echo -n "out" > /sys/class/gpio/gpio27/direction
echo -n "0" > /sys/class/gpio/gpio27/value
echo -n "1" > /sys/class/gpio/gpio74/value
echo "Complete"
sleep 1
done
But when i run the above script on gen 2 board and by observe in Oscilloscope i have notice some below results
Period Duty_cycle Time
3000000 3000000 2.40ms
3000000 1500000 1.20ms
3000000 750000 0.64ms
3000000 375000 0.32ms
So, According to the above table, i should get Time 3ms, 1.5ms, 0.75ms and 0.375ms instead of above time, but the difference is very large. what may be the reason and is this right output or not? Also when period is 6000000 and duty cycle is 6000000, then also i am getting time as 2.4ms. in this case my duty cycle is of 6ms so should i get 6ms on CRO or 2.4ms is correct?
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi,
What image are you using? I made some tests and got different results. Correct me if I'm wrong but if you use a period of 3ms and a duty cycle of 100% then you should get a high pulse for the entire period, if you use 50% duty cycle you should get 1.5ms and so on.
I ran the code using 50%duty cycle and got 1.556ms. With 25% duty cycle I got 0.778ms. With 12.5% duty cycle I got 0.3737ms. So these values look pretty close to the theoric values. You can try with the code I'm using here https://github.com/MakersTeam/Galileo/blob/master/Arduino-Examples/setPWM_GalileoGen2.ino Galileo/setPWM_GalileoGen2.ino at master · MakersTeam/Galileo · GitHub
Sergio
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi,
What image are you using? I made some tests and got different results. Correct me if I'm wrong but if you use a period of 3ms and a duty cycle of 100% then you should get a high pulse for the entire period, if you use 50% duty cycle you should get 1.5ms and so on.
I ran the code using 50%duty cycle and got 1.556ms. With 25% duty cycle I got 0.778ms. With 12.5% duty cycle I got 0.3737ms. So these values look pretty close to the theoric values. You can try with the code I'm using here https://github.com/MakersTeam/Galileo/blob/master/Arduino-Examples/setPWM_GalileoGen2.ino Galileo/setPWM_GalileoGen2.ino at master · MakersTeam/Galileo · GitHub
Sergio

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page