PWM documentation and/logic for kernel 4.9.XX

95 views
Skip to first unread message

Co M

unread,
Feb 21, 2018, 11:58:22 PM2/21/18
to BeagleBoard
Hi,

I am using C blacklib to handle some i2c and spi devices. Also I have few PWM's  P9_14 and 16 let's say.

I learned the hard way that P9_14 and P9_16 are to be    found in '48302200'. For P9_14 for example

/sys/devices/platform/ocp/48302000.epwmss/48302200.pwm/pwm/pwmchipX  



which is a link from

/sys/class/pwm/pwmchip3/



became available as pwm0 after echoing 0 to  /sys/class/pwm/pwmchip3/export

as

root@beaglebone:/sys/class/pwm/pwmchip3/pwm0# pwd
/sys/class/pwm/pwmchip3/pwm0
root@beaglebone
:/sys/class/pwm/pwmchip3/pwm0# ls -l
total
0
-rw-rw-r-- 1 root pwm 4096 Feb 22 03:14 capture
-rw-rw-r-- 1 root pwm 4096 Feb 22 03:14 duty_cycle
-rw-rw-r-- 1 root pwm 4096 Feb 22 03:14 enable
-rw-rw-r-- 1 root pwm 4096 Feb 22 03:14 period
-rw-rw-r-- 1 root pwm 4096 Feb 22 03:14 polarity
drwxrwxr
-x 2 root pwm    0 Feb 22 03:14 power
-rw-rw-r-- 1 root pwm 4096 Feb 22 03:14 uevent
root@beaglebone
:/sys/class/pwm/pwmchip3/pwm0#



The blacklib still doing old slot way of finding out which /sys/... files are  matching  for P9_14 pwm, going
from symbolic links to some hardcoded PXY->1,2,3 mapping finally to find out the /sys/class/.../pwm/period.. and such...

My question is:

   How do I determine which X,Y from /sys/class/pwm/pwmchipX/pwmY  maps to (X,Y) of a pwm pin PX_Y 

Thank you

 

James Fitzsimons

unread,
Feb 27, 2018, 4:09:31 AM2/27/18
to BeagleBoard
Hi there,

I've just gone through this myself, and you've already figured out all you need to know. The pwmchipX mapping can change on boot so you can't rely on the /sys/class/pwm structure. Figure out which address maps the epwmss device you want to use and navigate down the /sys/device tree as you have already posted. i.e. /sys/devices/platform/ocp/48302000.epwmss/48302200.pwm/pwm/pwmchipX  


FWIW I found the Technical Reference Manual for the AM335x which has all the addresses for the peripherals here https://blog.dest-unreach.be/wp-content/uploads/2017/07/AM335x-TRM.pdf - it doesn't seem to be on the TI site anymore, at least not that I could find.

HTH,
James Fitzsimons

evilwulfie

unread,
Feb 27, 2018, 5:57:22 AM2/27/18
to beagl...@googlegroups.com
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/4df438c2-3352-4a99-8f3f-044e50957571%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages