Yet Another BBB/4.1/PWM question

Hi all,

I am in the process of porting the BBB software I have running on a 3.8.13 kernel, to 4.1.6. The target device is a bloated IR transmitter and as such I let it generate a carrier and modulation signal which I ‘and’ externally to create the IR signal. The modulation is done from a timer interrupt (bitbanging a 2400 baud UART) which already seems to be working, the carrier is generated from PWM. On the 3.8 kernel it was quite easy to get this done with the cape manager, and I think I am really close, the only thing that is missing is the signal on the pins.

I have started from scratch, using the directions given at eewiki. I have built a kernel with a config that is almost identical to the defconfig (configs for compiler prefix, initramfs, stackprotector and the driver for the bitbanged UART differ), compiled u-boot, created my own root image which is basically just busybox with all its symlinks, the device tree descriptions (freshly compiled with dtc 1.4.1.something, latest version from git), the modules directory is placed outside the rootimg, with a symlink placing it in /lib. I have a very thin startup sequence which mounts a few filesystems (sysfs, procfs, debugfs) and then gives me a shell.

So far, so good, but then we try to get PWM to work.

After a fresh reboot I would first insmod the pwm kernel modules: pwm-tiehrpwm.ko and pwm-tiehrp.ko. When I then load the PWM device tree (echo am33xx_pwm > slots in /sys/devices/platform/bone_capemgr), the pwmchipX links appear in /sys/class/pwm. I load a number of dtbo’s for individual PWMs, so I get this:

/sys/devices/platform/bone_capemgr # cat slots
0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1
4: P-O-L- 0 Override Board Name,00A0,Override Manuf,am33xx_pwm
5: P-O-L- 1 Override Board Name,00A0,Override Manuf,bone_pwm_P8_13
6: P-O-L- 2 Override Board Name,00A0,Override Manuf,bone_pwm_P8_19
7: P-O-L- 3 Override Board Name,00A0,Override Manuf,bone_pwm_P9_14
8: P-O-L- 4 Override Board Name,00A0,Override Manuf,bone_pwm_P9_16
9: P-O-L- 5 Override Board Name,00A0,Override Manuf,bone_pwm_P9_21
10: P-O-L- 6 Override Board Name,00A0,Override Manuf,bone_pwm_P9_22
11: P-O-L- 7 Override Board Name,00A0,Override Manuf,bone_pwm_P9_42

Then I enable the pwm (cat X > export in the pwmchipX dir), set the period and duty cycle, start the pwm (echo 1 > enable) and… nothing happens on the outside. I have a logic analyser on all PWM pins and none of them responds. All stay low except for P9_21 and P9_22 which remain high. I can manipulate the pins by setting them in GPIO/output mode (through sys/class/gpio).

I have used all the dts files that came when I followed the eewiki instructions, except the am33xx_pwm, which came from the old 3.8.13 solution. I have compiled the dts files with the latest version of dtc, but not as suggested by eewiki. Compiling on target (as suggested by eewiki) was not an option for me (with the minimal root image) so I compiled them on my i686/Debian machine.

For me there are two likely suspects: either the kernel modules do not connect well with whatever the cape manager is doing, or something is keeping the pins in a mode such that it is disconnected from the PWM peripheral. Something I am also wondering about is whether I should pass parameters when loading the kernel modules.

I hope someone here can help me out. Thanks in advance. :slight_smile:

It turns out I did not use the correct dts files. There is a fair chance that the problem is in that area. The challenge is to get the right version of dtc, because the one I have, does not work well with the preprocessor directives as used by the files from bb.org_overlays. The tooling in this package only works on target, which is really a nuisance for me.