RTEMS on BeagleBone Black Wireless – Part 2

In the last post I said I was ready to start work on the eQEP driver. Well… it turned out I was a little premature declaring victory on that.

I discovered that although PWM output on P8_13 (EHRPWM2B) was working just fine, when I modified the code to use P9_14 it stopped working. After a bit more testing I discovered that all the other PWM outputs were working correctly, but P9_14 and P9_16 were a no go.

I initially went down the wrong path thinking that PWMSS1 hadn’t been initialised properly, and managed to waste an evening thinking I need to initialise it with a FDT. If I’d stopped to think things through a bit more I would have realised none of the other PWMSS modules required a FDT to set them up as the RTEMS Beaglebone PWM driver does all the hardware configuration required.

Once I got that clear in my head I worked my way through the code and found a bug in the driver. The registers that set the pin mux mode for header pins P9_14 and P9_16 were not being calculated correctly and so those pins weren’t being muxed for PWM output. I’ve submitted the following patch to the RTEMS developer list so here’s hoping that gets accepted.

bsps/arm/beagle/pwm/pwm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bsps/arm/beagle/pwm/pwm.c b/bsps/arm/beagle/pwm/pwm.c
index 0bc5d125bf..9a346995aa 100644
--- a/bsps/arm/beagle/pwm/pwm.c
+++ b/bsps/arm/beagle/pwm/pwm.c
@@ -102,9 +102,9 @@ bool beagle_pwm_pinmux_setup(bbb_pwm_pin_t pin_no, BBB_PWMSS pwm_id)
        } else if (pin_no == BBB_P8_36_1A) {
          REG(AM335X_PADCONF_BASE + BBB_CONTROL_CONF_LCD_DATA(10)) = BBB_MUXMODE(BBB_P8_36_MUX_PWM);
        } else if (pin_no == BBB_P9_14_1A) {
-         REG(AM335X_PADCONF_BASE + BBB_CONTROL_CONF_GPMC_AD(2)) = BBB_MUXMODE(BBB_P9_14_MUX_PWM);
+         REG(AM335X_PADCONF_BASE + BBB_CONTROL_CONF_GPMC_AD(18)) = BBB_MUXMODE(BBB_P9_14_MUX_PWM);
        } else if (pin_no == BBB_P9_16_1B) {
-         REG(AM335X_PADCONF_BASE + BBB_CONTROL_CONF_GPMC_AD(3)) = BBB_MUXMODE(BBB_P9_16_MUX_PWM);
+         REG(AM335X_PADCONF_BASE + BBB_CONTROL_CONF_GPMC_AD(19)) = BBB_MUXMODE(BBB_P9_16_MUX_PWM);
        } else {
          is_valid = false;
         }
--

Now I really am ready to start working on the eQEP driver!

One thought on “RTEMS on BeagleBone Black Wireless – Part 2

  1. Pingback: RTEMS on BeagleBone Black Wireless – Part 3 | Jamesfitzsimons.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s