PWM using eCAP module in PRU-ICSS

Hi,

I wanted to use PRU-ICSS’s eCap module to generate PWM signals, It is something I want to implement in my GSoC project. I referred to AM335x TRM section 15.3, It has a detailed description of how to use ECAP to generate PWM signals at section 15.3.3.5.

Since pru_ecap.h was missing bit fields required to use PWM mode, as described in the TRM (15.3.3.5.1) I defined those required bit fields from register descriptions in the TRM (15.3.4). Here’s the new header I defined: https://github.com/VedantParanjape/pru-ecap-pwm/blob/master/include/am335x/pru_ecap.h

According to the register value (Table 15-100 and Example 15-13 of the TRM) needed to be set to get it working, I set the registers in my code. Here is my main code which drives the eCap module to generate PWM: https://github.com/VedantParanjape/pru-ecap-pwm/blob/master/main0.c

I am using pru-gcc version:

pru-gcc (GCC) 10.0.1 20200315 (experimental)
Copyright © 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Command to compile:

pru-gcc main0.c -o pwm -I./inlude/ -I./include/am335x/ -mmcu=am335x.pru0

Command to load binary and start PRU:
cp pwm /lib/firmware/am335x-pru0-fw

config-pin p9.42 pru_ecap

echo start > /sys/class/remoteproc/remoteproc0/state

When I load the binary, it loads without any issue, but i fail to get output on p9.42 pin, which is the pr1_ecap pin. I check with a multimeter, It shows Nada, zero Volts.

I am using a BeagleBone Black Wireless:

Linux beaglebone 4.19.94-ti-r45 #1buster SMP PREEMPT Thu Jun 18 19:18:41 UTC 2020 armv7l GNU/Linux

This the output on running (sudo show-pins | sort) https://pastebin.com/r2128R9b

This is my uEnv.txt: https://pastebin.com/99qxs8NN

Regards,
Vedant Paranjape

1 Like