This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.


Part Number: PRU-SWPKG
Other Parts Discussed in Thread: TIDEP0073

Tool/software: Linux


I am trying to send a PWM signal using PRU on my BeagleBone Black through a GPIO.

Currently I have rpmsg-pru and pruss driver working correctly and I can play with any firmware/hands on lab without issues.

I would like to be able to control the period/duty cycle of my signal over the rpmsg channel created.

For example:

I would like something like :

echo `GPIO:PERIOD:DUTYCYCLE:ENABLE` > /dev/rpmsg-pru31

Then the PRU firmware will parse this command and send the correct PWM signal to the corresponding GPIO.

Currently I can toggle GPIOs (LEDs) using a simple command :

echo `GPIO:ENABLE` > /dev/rpmsg-pru31

I had a look at  but I did not understand quite the process. Do you have a simple PRU firmware that can achieve this behavior ?


  • Hello,

    What are you trying to accomplish with the PWM signals?

    Instead of sending signals through a GPIO, I would generally suggest configuring the eCAP module within the PRU-ICSS as a PWM output, using the PRU to control an output from the PWMSS (PWM Subsystem), or creating a PWM signal manually on one of the PRU output pins. PRU code is deterministic, so you can create precise output waveforms in 5ns increments.

  • Hi Nick, Thank you for your reply,

    For testing, I am trying to have PWM signals working on LEDs.

    I am more interested in generating my PWM signal manually from the PRU.

    Do you have some application note about this use case ?


  • an example using the PRU core to control the eCAP within the PRU-ICSS to output a PWM signal can be found in this TI design

    Notes: this e2e post might be helpful in interpreting the TI design. The firmware for PRU controlling eCAP is in sw/prupid_fw_1/PRU_IO_1.c of the software download. This example was written for Processor Linux SDK 2.0, so some parts of it will not work (e.g. RPMsg communication has gone through many updates. You can find the most recent examples of using RPMsg in the pru software support package at its git repo or in example-applications/pru-icss-xxx of your Processor Linux SDK). The PRU controlling eCAP part should not have changed, since that was based on register definitions, etc rather than drivers.

    You can still use the PRU to control the PWMSS, but you would need to disable it in the Linux device tree file so that Linux did not try to mess with it while the PRU was controlling it. I did not have the experience to be super helpful at the time of this post, but Matthijs van Duin helped that customer properly initialize PWMSS when controlling it from the PRU. For a general example of controlling something outside the PRU-ICSS with the PRU, take a look at the examples/am335x/PRU_ADC_onChip example in the pru software support package EITHER at the git repo above, OR in Processor Linux SDK 5.1 or later.

    For doing waveforms from the PRU itself, take a look at pru software support package examples/am335x/PRU_gpioToggle (which uses the PRU GPO pins, not the generic GPIO pins). A more complex example where the PRU implements a CLK, CS, SDI signals on GPO pins for a SPI protocol can be found at TIDA-01555 where the software is here. - it can also be found in example-applications/pru-adc-1.0 for AM335x Linux SDK 5.1 and later.