Skip to content
Browse files

o added flag _DISABLE_PWM_TIMERS to disable the pwm timers control wh…

…ich in some kernels is not supported.

o updated with latest installation instructions.

(context: )
  • Loading branch information...
lromor authored and hzeller committed Feb 2, 2018
1 parent da00a9d commit 01f1e358fd272a50db51c019309c5e62e0ca03c8
Showing with 41 additions and 1 deletion.
  1. +3 −0 Makefile
  2. +23 −0
  3. +5 −1 src/Makefile
  4. +10 −0 src/
@@ -14,6 +14,9 @@
# Currently supported BUMPS, CRAMPS, and VGEN5

# Disable PWM timers. See

# In case you cross compile this on a different architecture, uncomment this
# and set the prefix of the compiler binary.
#export CROSS_COMPILE?=arm-arago-linux-gnueabi-
@@ -29,6 +29,7 @@ socket (you can just telnet to it for an interactive session, how cool is that?)

## Install
### System configuration

In order to run BeagleG on your BeagleBone you will need to be sure
that uio_pruss kernel module has been installed and loaded in the kernel.
You can easily test if the module it's available by running:
@@ -53,6 +54,28 @@ yet. You can see that if you ask `uname -r` returns something like
In that case, you will need to
[change your kernel version]( to a bone prefix one (e.g. `4.4.14-bone`).

#### Newer kernels
Newest beagleboard kernels support both remoteproc and uio_pruss modules.
In order to use the uio_pruss one simply follow the directives that you can find inside `/boot/uEnv.txt`:

###pru_rproc (4.4.x-ti kernel)
###pru_uio (4.4.x-ti & mainline/bone kernel)

Some 4.4 linux kernel versions do not have the timers drivers enabled.
In order to be able to use the PWM you would need to recompile the kernel with

In order to use BeagleG **without** the PWM TIMERS support, you can compile beagleg with:

### Build
To build, we need the BeagleG code and the PRU assembler with supporting library.
The BeagleG repository is set up in a way that the PRU assembler is checked out via
@@ -9,6 +9,10 @@
# Currently supported BUMPS, CRAMPS, and VGEN5

# Additional macros, for example to disable the pwm support simply add

# In case you cross compile this on a different architecture, uncomment this
# and set the prefix. Or simply set the environment variable.
@@ -46,7 +50,7 @@ CFLAGS+=-Wall -I. -I$(INCDIR_APP_LOADER) -I$(CAPE_INCLUDE) -D_XOPEN_SOURCE=500 $
# We use c++11, but it looks like that even the latest
# bone-debian-7.11-lxde-4gb-armhf-2016-06-16-4gb image has an ancient 4.6.3
# compiler that still referred to that standard as c++0x
CXXFLAGS+=-std=c++0x $(CFLAGS)

LDFLAGS+=-lpthread -lm
@@ -120,11 +120,16 @@ bool HardwareMapping::InitializeHardware() {
Log_error("Couldn't mmap() GPIO ranges.\n");
return false;

Log_info("PWM timers are disabled.\n");
if (!pwm_timers_map()) {
Log_error("Couldn't mmap() TIMER ranges.\n");
return false;

// The PWM_*_GPIO pins can produce PWM signals if they are mapped to one
// of the TIMER pins and the dts set the pins to the correct mode (0x02).
// If they are mapped to other pins, or the mode is wrong (0x07), they will
@@ -141,6 +146,7 @@ bool HardwareMapping::InitializeHardware() {
pwm_timer_set_freq(PWM_2_GPIO, 0);
pwm_timer_set_freq(PWM_3_GPIO, 0);
pwm_timer_set_freq(PWM_4_GPIO, 0);

is_hardware_initialized_ = true;
@@ -207,6 +213,9 @@ void HardwareMapping::SetAuxOutputs() {

void HardwareMapping::SetPWMOutput(LogicOutput type, float value) {
if (!is_hardware_initialized_) return;
const uint32_t gpio = output_to_pwm_gpio_[type];
if (value <= 0.0) {
@@ -215,6 +224,7 @@ void HardwareMapping::SetPWMOutput(LogicOutput type, float value) {
pwm_timer_set_duty(gpio, value);
pwm_timer_start(gpio, true);

std::string HardwareMapping::DebugMotorString(LogicAxis axis) {

0 comments on commit 01f1e35

Please sign in to comment.
You can’t perform that action at this time.