Robot Control Library


C interface for the Sitara pinmux helper driver.


On the Robotics Cape, we allow changing the pinmux on the SPI, GPS, and UART1 headers in case you wish to expose GPIO, CAN, or PWM functionality. We use the GPIO number to identify the pins even though they may be used for things other than GPIO as this provides consistency with the GPIO functions which will likely be used. A list of defines are also given here to make your code easier to read and to indicate which pins are available for pinmuxing.

Not all pinmux modes are available on each pin. However, every pin can be configured as a GPIO output, or input with either an internal pullup (PU) or pulldown (PD) resistor.

The GPS header pins 3 and 4 can be configured to PWM mode which breaks out channels A and B of PWM subsystem 0 which are not used by the motor drivers and so are free for the user to do with as they please. They default to UART mode for communicating with GPS receivers and can also be used in any GPIO mode.

The UART1 header pins 3 and 4 also default to UART mode and can be used in any GPIO mode. However, they also break out the CAN bus RX and TX lines. However, to use CAN bus you also need to set up a CAN-PHY IC yourself.

All SPI pins can be used for SPI or GPIO. If you intend to use these pins for pure GPIO use then use the set_pinmux_mode() function described here. Note that when configuring the SPI slave select lines for manual or automatic mode as described in the SPI section of this manual, the rc_spi_init function uses this pinmux mode in the backend to set up the pin for you.

The beaglebone Blue additionally has 2 GPIO headers, GP0 & GP1, with 3.3v, ground, and 4 GPIO signals broken out on each. All 4 signal pins on GP0 can be configured as one of the 3 different GPIO modes, and so can pins 3 and 4 of GP1. Pins 5 and 6 of the GP1 header are fixed in output mode and are tied to the Red and Green LED signals in case those signals wish to be extended to lights outside of a robot's case.


typedef enum rc_pinmux_mode_t rc_pinmux_mode_t


int rc_pinmux_set (int pin, rc_pinmux_mode_t mode)
 sets once of the pins defined in this header to a particular mode More...
int rc_pinmux_set_default (void)
 puts everything back to standard More...

Configurable pins shared between Robotics Cape and BeagleBone Blue

#define DSM_HEADER_PIN   30
 P9.11, normally DSM UART4. More...
#define GPS_HEADER_PIN_3   2
 P9_22, normally GPS UART2 RX. More...
#define GPS_HEADER_PIN_4   3
 P9_21, normally GPS UART2 TX. More...
#define UART1_HEADER_PIN_3   14
 P9_26, normally UART1 RX. More...
#define UART1_HEADER_PIN_4   15
 P9_24, normally UART1 TX. More...
#define SPI_HEADER_PIN_3   112
 P9_30, normally SPI1 MOSI. More...
#define SPI_HEADER_PIN_4   111
 P9_29, normally SPI1 MISO. More...
#define SPI_HEADER_PIN_5   110
 P9_31, normally SPI1 SCLK. More...

Configurable pins for Robotics Cape only

#define CAPE_SPI_PIN_6_SS1   113
 P9_28, normally SPI mode. More...
#define CAPE_SPI_PIN_6_SS2   49
 P9_23, normally GPIO mode. More...

Configurable pins for BeagleBone Blue only

#define BLUE_SPI_PIN_6_SS1   29
 gpio 0_29 pin H18 More...
#define BLUE_SPI_PIN_6_SS2   7
 gpio 0_7 pin C18 More...
#define BLUE_GP0_PIN_3   57
 gpio 1_25 pin U16 More...
#define BLUE_GP0_PIN_4   49
 gpio 1_17 pin P9.23 More...
#define BLUE_GP0_PIN_5   116
 gpio 3_20 pin D13 More...
#define BLUE_GP0_PIN_6   113
 gpio 3_17 pin P9_28 More...
#define BLUE_GP1_PIN_3   98
 gpio 3_2 pin J15 More...
#define BLUE_GP1_PIN_4   97
 gpio 3_1 pin H17 More...

Macro Definition Documentation


#define DSM_HEADER_PIN   30

P9.11, normally DSM UART4.


#define GPS_HEADER_PIN_3   2

P9_22, normally GPS UART2 RX.


#define GPS_HEADER_PIN_4   3

P9_21, normally GPS UART2 TX.


#define UART1_HEADER_PIN_3   14

P9_26, normally UART1 RX.


#define UART1_HEADER_PIN_4   15

P9_24, normally UART1 TX.


#define SPI_HEADER_PIN_3   112

P9_30, normally SPI1 MOSI.


#define SPI_HEADER_PIN_4   111

P9_29, normally SPI1 MISO.


#define SPI_HEADER_PIN_5   110

P9_31, normally SPI1 SCLK.


#define CAPE_SPI_PIN_6_SS1   113

P9_28, normally SPI mode.


#define CAPE_SPI_PIN_6_SS2   49

P9_23, normally GPIO mode.


#define BLUE_SPI_PIN_6_SS1   29

gpio 0_29 pin H18


#define BLUE_SPI_PIN_6_SS2   7

gpio 0_7 pin C18


#define BLUE_GP0_PIN_3   57

gpio 1_25 pin U16


#define BLUE_GP0_PIN_4   49

gpio 1_17 pin P9.23


#define BLUE_GP0_PIN_5   116

gpio 3_20 pin D13


#define BLUE_GP0_PIN_6   113

gpio 3_17 pin P9_28


#define BLUE_GP1_PIN_3   98

gpio 3_2 pin J15


#define BLUE_GP1_PIN_4   97

gpio 3_1 pin H17

Enumeration Type Documentation

◆ rc_pinmux_mode_t

Gives options for pinmuxing. Not every mode if available on each pin. Refer to the official BeagleBone pin table for which to use.


Function Documentation

◆ rc_pinmux_set()

int rc_pinmux_set ( int  pin,
rc_pinmux_mode_t  mode 

sets once of the pins defined in this header to a particular mode

[in]pinThe pin
[in]modeThe mode
0 on success, -1 on failure

◆ rc_pinmux_set_default()

int rc_pinmux_set_default ( void  )

puts everything back to standard

0 on success, -1 on failure