Linux_HAL_Essentials: Add (UAV)CAN support

This commit is contained in:
mirkix 2015-04-07 18:41:21 +00:00 committed by Andrew Tridgell
parent 8335399525
commit 2e04effd4d
3 changed files with 254 additions and 209 deletions

View File

@ -4,194 +4,218 @@
/* Device tree file for BBBMINI */
/ {
compatible = "ti,beaglebone", "ti,beaglebone-black";
compatible = "ti,beaglebone", "ti,beaglebone-black";
part-number = "BB-BBBMINI";
version = "00A0";
part-number = "BB-BBBMINI";
version = "00A0";
exclusive-use =
exclusive-use =
/* PRU RCInput */
"P8.15", /* pru1: pr1_ecap0_ecap_capin, PPM-sum, SBUS, DSM */
/* PRU RCInput */
"P8.15", /* pru1: pr1_ecap0_ecap_capin, PPM-sum, SBUS, DSM */
/* PRU RCOutput */
"P8.28", /* pru1: pr1_pru1_pru_r30_10, CH_1 */
"P8.27", /* pru1: pr1_pru1_pru_r30_8, CH_2 */
"P8.30", /* pru1: pr1_pru1_pru_r30_11, CH_3 */
"P8.29", /* pru1: pr1_pru1_pru_r30_9, CH_4 */
"P8.40", /* pru1: pr1_pru1_pru_r30_7, CH_5 */
"P8.39", /* pru1: pr1_pru1_pru_r30_6, CH_6 */
"P8.42", /* pru1: pr1_pru1_pru_r30_5, CH_7 */
"P8.41", /* pru1: pr1_pru1_pru_r30_4, CH_8 */
"P8.44", /* pru1: pr1_pru1_pru_r30_3, CH_9 */
"P8.43", /* pru1: pr1_pru1_pru_r30_2, CH_10 */
"P8.46", /* pru1: pr1_pru1_pru_r30_1, CH_11 */
"P8.45", /* pru1: pr1_pru1_pru_r30_0, CH_12 */
/* PRU RCOutput */
"P8.28", /* pru1: pr1_pru1_pru_r30_10, CH_1 */
"P8.27", /* pru1: pr1_pru1_pru_r30_8, CH_2 */
"P8.30", /* pru1: pr1_pru1_pru_r30_11, CH_3 */
"P8.29", /* pru1: pr1_pru1_pru_r30_9, CH_4 */
"P8.40", /* pru1: pr1_pru1_pru_r30_7, CH_5 */
"P8.39", /* pru1: pr1_pru1_pru_r30_6, CH_6 */
"P8.42", /* pru1: pr1_pru1_pru_r30_5, CH_7 */
"P8.41", /* pru1: pr1_pru1_pru_r30_4, CH_8 */
"P8.44", /* pru1: pr1_pru1_pru_r30_3, CH_9 */
"P8.43", /* pru1: pr1_pru1_pru_r30_2, CH_10 */
"P8.46", /* pru1: pr1_pru1_pru_r30_1, CH_11 */
"P8.45", /* pru1: pr1_pru1_pru_r30_0, CH_12 */
/* SPI0 */
"P9.22", /* spi0: spi0_sclk, SPI0_SCLK */
"P9.21", /* spi0: spi0_d0, SPI0_MISO */
"P9.18", /* spi0: spi0_d1, SPI0_MOSI */
"P9.17", /* spi0: spi0_cs0, CS0 */
/* SPI0 */
"P9.22", /* spi0: spi0_sclk, SPI0_SCLK */
"P9.21", /* spi0: spi0_d0, SPI0_MISO */
"P9.18", /* spi0: spi0_d1, SPI0_MOSI */
"P9.17", /* spi0: spi0_cs0, CS0 */
/* SPI1 */
"P9.31", /* spi1: spi1_sclk, SPI1_SCLK */
"P9.29", /* spi1: spi1_d0, SPI1_MISO */
"P9.30", /* spi1: spi1_d1, SPI1_MOSI */
"P9.28", /* spi1: spi1_cs0, MPU9250 CS0 */
"P9.42", /* spi1: spi1_cs1, MS5611 CS1 */
/* SPI1 */
"P9.31", /* spi1: spi1_sclk, SPI1_SCLK */
"P9.29", /* spi1: spi1_d0, SPI1_MISO */
"P9.30", /* spi1: spi1_d1, SPI1_MOSI */
"P9.28", /* spi1: spi1_cs0, MPU9250 CS0 */
"P9.42", /* spi1: spi1_cs1, MS5611 CS1 */
/* UART4 */
"P9.11", /* uart4: uart4_rxd */
"P9.13", /* uart4: uart4_txd */
/* UART4 MAVLink */
"P9.11", /* uart4: uart4_rxd */
"P9.13", /* uart4: uart4_txd */
/* UART5 GPS */
"P8.38", /* uart5: uart5_rxd */
"P8.37", /* uart5: uart5_txd */
/* UART5 GPS */
"P8.38", /* uart5: uart5_rxd */
"P8.37", /* uart5: uart5_txd */
/* CAN1 */
"P9.24", /* can1: dcan1_rx */
"P9.26", /* can1: dcan1_tx */
/* Hardware in use */
"pru1",
"spi0",
"spi1",
"uart4",
"uart5";
/* Hardware in use */
"pru1",
"spi0",
"spi1",
"uart4",
"uart5",
"can1";
fragment@0 {
target = <&am33xx_pinmux>;
__overlay__ {
fragment@0 {
target = <&am33xx_pinmux>;
__overlay__ {
pru_pru_pins: pinmux_pru_pru_pins {
pinctrl-single,pins = <
0x03c 0x35 /* ecap0_in_pwm0_out.pr1_ecap0_ecap_capin, MODE5 | INPUT_PULLUP | PRU, PPM-sum, SBUS, DSM */
pru_pru_pins: pinmux_pru_pru_pins {
pinctrl-single,pins = <
0x03c 0x35 /* ecap0_in_pwm0_out.pr1_ecap0_ecap_capin, MODE5 | INPUT_PULLUP | PRU, PPM-sum, SBUS, DSM */
0x0e8 0x25 /* lcd_pclk.pr1_pru1_pru_r30_10, MODE5 | OUTPUT | PRU, CH_1 */
0x0e0 0x25 /* lcd_vsync.pr1_pru1_pru_r30_8, MODE5 | OUTPUT | PRU, CH_2 */
0x0ec 0x25 /* lcd_ac_bias_en.pr1_pru1_pru_r30_11, MODE5 | OUTPUT | PRU, CH_3 */
0x0e4 0x25 /* lcd_hsync.pr1_pru1_pru_r30_9, MODE5 | OUTPUT | PRU, CH_4 */
0x0bc 0x25 /* lcd_data7.pr1_pru1_pru_r30_7, MODE5 | OUTPUT | PRU, CH_5 */
0x0b8 0x25 /* lcd_data6.pr1_pru1_pru_r30_6, MODE5 | OUTPUT | PRU, CH_6 */
0x0b4 0x25 /* lcd_data5.pr1_pru1_pru_r30_5, MODE5 | OUTPUT | PRU, CH_7 */
0x0b0 0x25 /* lcd_data4.pr1_pru1_pru_r30_4, MODE5 | OUTPUT | PRU, CH_8 */
0x0ac 0x25 /* lcd_data3.pr1_pru1_pru_r30_3, MODE5 | OUTPUT | PRU, CH_9 */
0x0a8 0x25 /* lcd_data2.pr1_pru1_pru_r30_2, MODE5 | OUTPUT | PRU, CH_10 */
0x0a4 0x25 /* lcd_data1.pr1_pru1_pru_r30_1, MODE5 | OUTPUT | PRU, CH_11 */
0x0a0 0x25 /* lcd_data0.pr1_pru1_pru_r30_0, MODE5 | OUTPUT | PRU, CH_12 */
>;
};
0x0e8 0x25 /* lcd_pclk.pr1_pru1_pru_r30_10, MODE5 | OUTPUT | PRU, CH_1 */
0x0e0 0x25 /* lcd_vsync.pr1_pru1_pru_r30_8, MODE5 | OUTPUT | PRU, CH_2 */
0x0ec 0x25 /* lcd_ac_bias_en.pr1_pru1_pru_r30_11, MODE5 | OUTPUT | PRU, CH_3 */
0x0e4 0x25 /* lcd_hsync.pr1_pru1_pru_r30_9, MODE5 | OUTPUT | PRU, CH_4 */
0x0bc 0x25 /* lcd_data7.pr1_pru1_pru_r30_7, MODE5 | OUTPUT | PRU, CH_5 */
0x0b8 0x25 /* lcd_data6.pr1_pru1_pru_r30_6, MODE5 | OUTPUT | PRU, CH_6 */
0x0b4 0x25 /* lcd_data5.pr1_pru1_pru_r30_5, MODE5 | OUTPUT | PRU, CH_7 */
0x0b0 0x25 /* lcd_data4.pr1_pru1_pru_r30_4, MODE5 | OUTPUT | PRU, CH_8 */
0x0ac 0x25 /* lcd_data3.pr1_pru1_pru_r30_3, MODE5 | OUTPUT | PRU, CH_9 */
0x0a8 0x25 /* lcd_data2.pr1_pru1_pru_r30_2, MODE5 | OUTPUT | PRU, CH_10 */
0x0a4 0x25 /* lcd_data1.pr1_pru1_pru_r30_1, MODE5 | OUTPUT | PRU, CH_11 */
0x0a0 0x25 /* lcd_data0.pr1_pru1_pru_r30_0, MODE5 | OUTPUT | PRU, CH_12 */
>;
};
bb_spi0_pins: pinmux_bb_spi0_pins {
pinctrl-single,pins = <
0x150 0x30 /* spi0_sclk.spi0_sclk, MODE0 | INPUT_PULLUP | SPI0_SCLK P9_22 */
0x154 0x30 /* spi0_d0.spi0_d0, MODE0 | INPUT_PULLUP | SPI0_MISO P9_21 */
0x158 0x10 /* spi0_d0.spi0_d1, MODE0 | OUTPUT_PULLUP | SPI0_MOSI P9_18 */
0x15c 0x10 /* spi0_cs0.spi0_cs0, MODE0 | OUTPUT_PULLUP | SPI0_CS0 P9_17 */
>;
};
bb_spi0_pins: pinmux_bb_spi0_pins {
pinctrl-single,pins = <
0x150 0x30 /* spi0_sclk.spi0_sclk, MODE0 | INPUT_PULLUP | SPI0_SCLK P9_22 */
0x154 0x30 /* spi0_d0.spi0_d0, MODE0 | INPUT_PULLUP | SPI0_MISO P9_21 */
0x158 0x10 /* spi0_d0.spi0_d1, MODE0 | OUTPUT_PULLUP | SPI0_MOSI P9_18 */
0x15c 0x10 /* spi0_cs0.spi0_cs0, MODE0 | OUTPUT_PULLUP | SPI0_CS0 P9_17 */
>;
};
bb_spi1_pins: pinmux_bb_spi1_pins {
pinctrl-single,pins = <
0x190 0x33 /* mcasp0_aclkx.spi1_sclk, MODE3 | INPUT_PULLUP | SPI1_SCLK P9_31 */
0x194 0x33 /* mcasp0_fsx.spi1_d0, MODE3 | INPUT_PULLUP | SPI1_MISO P9_29 */
0x198 0x13 /* mcasp0_axr0.spi1_d1, MODE3 | OUTPUT_PULLUP | SPI1_MOSI P9_30 */
0x19c 0x13 /* mcasp0_ahclkr.spi1_cs0, MODE3 | OUTPUT_PULLUP | MPU9250 CS0 P9_28 */
0x164 0x12 /* ecap0_in_pwm0_out.spi1_cs1, MODE2 | OUTPUT_PULLUP | MS5611 CS1 P9_42 */
bb_spi1_pins: pinmux_bb_spi1_pins {
pinctrl-single,pins = <
0x190 0x33 /* mcasp0_aclkx.spi1_sclk, MODE3 | INPUT_PULLUP | SPI1_SCLK P9_31 */
0x194 0x33 /* mcasp0_fsx.spi1_d0, MODE3 | INPUT_PULLUP | SPI1_MISO P9_29 */
0x198 0x13 /* mcasp0_axr0.spi1_d1, MODE3 | OUTPUT_PULLUP | SPI1_MOSI P9_30 */
0x19c 0x13 /* mcasp0_ahclkr.spi1_cs0, MODE3 | OUTPUT_PULLUP | MPU9250 CS0 P9_28 */
0x164 0x12 /* ecap0_in_pwm0_out.spi1_cs1, MODE2 | OUTPUT_PULLUP | MS5611 CS1 P9_42 */
0x1a0 0x30 /* Mcasp0_aclkr P9_42 */
>;
};
0x1a0 0x30 /* Mcasp0_aclkr P9_42 */
>;
};
bb_uart4_pins: pinmux_bb_uart4_pins {
pinctrl-single,pins = <
/* UART4 pins */
0x070 0x26 /* lcd_data9.uart4_rxd | MODE6 P9.11 */
0x074 0x06 /* lcd_data8.uart4_txd | MODE6 P8.13 */
>;
};
bb_uart4_pins: pinmux_bb_uart4_pins {
pinctrl-single,pins = <
0x070 0x26 /* lcd_data9.uart4_rxd | MODE6 P9.11 */
0x074 0x06 /* lcd_data8.uart4_txd | MODE6 P8.13 */
>;
};
bb_uart5_pins: pinmux_bb_uart5_pins {
pinctrl-single,pins = <
/* UART5 GPS pins */
0x0C4 0x24 /* lcd_data9.uart5_rxd | MODE4 P8.38 */
0x0C0 0x04 /* lcd_data8.uart5_txd | MODE4 P8.37 */
>;
};
};
};
bb_uart5_pins: pinmux_bb_uart5_pins {
pinctrl-single,pins = <
0x0C4 0x24 /* lcd_data9.uart5_rxd | MODE4 P8.38 */
0x0C0 0x04 /* lcd_data8.uart5_txd | MODE4 P8.37 */
>;
};
dcan1_pins_s0: dcan1_pins_s0 {
pinctrl-single,pins = <
0x180 0x12 /* d_can1_tx, SLEWCTRL_FAST | INPUT_PULLUP | MODE2 */
0x184 0x32 /* d_can1_rx, SLEWCTRL_FAST | RECV_ENABLE | INPUT_PULLUP | MODE2 */
>;
};
};
};
fragment@1 {
target = <&pruss>;
__overlay__ {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pru_pru_pins>;
};
};
fragment@2 {
target = <&spi0>;
__overlay__ {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bb_spi0_pins>;
#address-cells = <1>;
#size-cells = <0>;
spi0_0 {
#address-cells = <1>;
#size-cells = <0>;
spi-max-frequency = <24000000>;
reg = <0>;
compatible = "spidev";
};
};
fragment@1 {
target = <&pruss>;
__overlay__ {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pru_pru_pins>;
};
};
fragment@3 {
target = <&spi1>;
__overlay__ {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bb_spi1_pins>;
fragment@2 {
target = <&spi0>;
__overlay__ {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bb_spi0_pins>;
#address-cells = <1>;
#size-cells = <0>;
#address-cells = <1>;
#size-cells = <0>;
cs-gpios = <&gpio4 17 0>, <&gpio1 7 0>;
spi1_0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;
spi-max-frequency = <24000000>;
compatible = "spidev";
};
spi1_1 {
#address-cells = <1>;
#size-cells = <0>;
reg = <1>;
spi-max-frequency = <24000000>;
compatible = "spidev";
};
};
};
fragment@4 {
target = <&uart5>;
__overlay__ {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bb_uart4_pins>;
};
spi0_0 {
#address-cells = <1>;
#size-cells = <0>;
spi-max-frequency = <24000000>;
reg = <0>;
compatible = "spidev";
};
};
};
fragment@3 {
target = <&spi1>;
__overlay__ {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bb_spi1_pins>;
#address-cells = <1>;
#size-cells = <0>;
cs-gpios = <&gpio4 17 0>, <&gpio1 7 0>;
spi1_0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;
spi-max-frequency = <24000000>;
compatible = "spidev";
};
spi1_1 {
#address-cells = <1>;
#size-cells = <0>;
reg = <1>;
spi-max-frequency = <24000000>;
compatible = "spidev";
};
};
};
fragment@4 {
target = <&uart5>;
__overlay__ {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bb_uart4_pins>;
};
};
fragment@5 {
target = <&uart6>;
__overlay__ {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bb_uart5_pins>;
};
};
fragment@6 {
target = <&dcan1>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&dcan1_pins_s0>;
};
};
fragment@5 {
target = <&uart6>;
__overlay__ {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bb_uart5_pins>;
};
};
};

View File

@ -9,57 +9,78 @@ To rebuild the dtbo file type `make` and than `make install`to copy the dtbo fil
## Pin assigment
### RCInput
BBB | RC Receiver | Remark
------------ | ------------- | -------------
P8.15 RC_IN | RC Out (Spektrum / PPM-sum)
BBB | RC Receiver | I/O | Remark
------------ | ------------- | ------------- | -------------
P9.01 DGND | GND | |
P9.03 VDD_3V3 | VDD | |
P8.15 RC_IN | RC Out | IN | 3.3 Volt (Spektrum / PPM-sum)
### RCOutput
BBB | ESC / Servo | Remark
------------ | ------------- | -------------
P8.28 | RC_OUT_CH_1 | Use level shifter 3.3 Volt to 5 Volt
P8.27 | RC_OUT_CH_2 | Use level shifter 3.3 Volt to 5 Volt
P8.30 | RC_OUT_CH_3 | Use level shifter 3.3 Volt to 5 Volt
P8.29 | RC_OUT_CH_4 | Use level shifter 3.3 Volt to 5 Volt
P8.40 | RC_OUT_CH_5 | Use level shifter 3.3 Volt to 5 Volt
P8.39 | RC_OUT_CH_6 | Use level shifter 3.3 Volt to 5 Volt
P8.42 | RC_OUT_CH_7 | Use level shifter 3.3 Volt to 5 Volt
P8.41 | RC_OUT_CH_8 | Use level shifter 3.3 Volt to 5 Volt
P8.44 | RC_OUT_CH_9 | Use level shifter 3.3 Volt to 5 Volt
P8.43 | RC_OUT_CH_10 | Use level shifter 3.3 Volt to 5 Volt
P8.46 | RC_OUT_CH_11 | Use level shifter 3.3 Volt to 5 Volt
P8.45 | RC_OUT_CH_12 | Use level shifter 3.3 Volt to 5 Volt
### RCOutput
BBB | ESC / Servo | I/O | Remark
------------ | ------------- | ------------- | -------------
P8.01 DGND | GND |
P8.28 | RC_OUT_CH_1 | OUT | 3.3 Volt
P8.27 | RC_OUT_CH_2 | OUT | 3.3 Volt
P8.30 | RC_OUT_CH_3 | OUT | 3.3 Volt
P8.29 | RC_OUT_CH_4 | OUT | 3.3 Volt
P8.40 | RC_OUT_CH_5 | OUT | 3.3 Volt
P8.39 | RC_OUT_CH_6 | OUT | 3.3 Volt
P8.42 | RC_OUT_CH_7 | OUT | 3.3 Volt
P8.41 | RC_OUT_CH_8 | OUT | 3.3 Volt
P8.44 | RC_OUT_CH_9 | OUT | 3.3 Volt
P8.43 | RC_OUT_CH_10 | OUT | 3.3 Volt
P8.46 | RC_OUT_CH_11 | OUT | 3.3 Volt
P8.45 | RC_OUT_CH_12 | OUT | 3.3 Volt
### SPI0
BBB | Sensor | Remark
------------ | ------------- | -------------
P9.22 | SPI0_SCLK | not used
P9.21 | SPI0_MISO | not used
P9.18 | SPI0_MOSI | not used
P9.17 | SPI0_CS | not used
### IMU MPU-9250
BBB | MPU-9250 | I/O | Remark
------------ | ------------- | ------------- | -------------
P9.01 DGND | GND | |
P9.03 VDD_3V3 | VDD | |
P9.28 MPU9250_CS | MPU9250_CS | OUT | 3.3 Volt
P9.29 SPI1_MISO | MISO / SD0 | IN | 3.3 Volt
P9.30 SPI1_MOSI | MOSI / SD1 | OUT | 3.3 Volt
P9.31 SPI1_SCLK | SCLK / SCL | OUT | 3.3 Volt
### SPI1
BBB | Sensor | Remark
------------ | ------------- | -------------
P9.31 | SPI1_SCLK | MPU9250, MS5611
P9.29 | SPI1_MISO | MPU9250, MS5611
P9.30 | SPI1_MOSI | MPU9250, MS5611
P9.28 | SPI1_CS0 | MPU9250 CS
P9.19 | SPI1_CS1 | MS5611 CS
### UART4
BBB | Sensor | Remark
------------ | ------------- | -------------
P9.11 UART4_RXD | not used
P9.13 UART4_TXD | not used
### Baro MS 5611
BBB | MS 5611 | I/O | Remark
------------ | ------------- | ------------- | -------------
P9.01 DGND | GND | |
P9.03 VDD_3V3 | VDD | |
P9.29 SPI1_MISO | MISO / SDO | IN | 3.3 Volt
P9.30 SPI1_MOSI | MOSI / SD1 | OUT | 3.3 Volt
P9.31 SPI1_SCLK | SCLK / SCL | OUT | 3.3 Volt
P9.42 MS5611_CS | MS5611_CS | OUT | 3.3 Volt
### UART4 MAVLink radio module
Baudrate 57600, 8, n, 1
BBB | Radio | I/O | Remark
------------ | ------------- | ------------- | -------------
P9.01 DGND | GND |
P9.13 TX | RADIO_RX | OUT | 3.3 Volt
P9.11 RX | RADIO_TX | IN | 3.3 Volt
### UART5 GPS
Baudrate 38400, 8, n, 1
38400,8,n,1
BBB | GPS | I/O | Remark
------------ | ------------- | ------------- | -------------
P8.01 DGND | GND |
P8.37 TX | GPS_RX | OUT | 3.3 Volt
P8.38 RX | GPS_TX | IN | 3.3 Volt
BBB | Sensor | Remark
------------ | ------------- | -------------
P8.38 UART5_RXD | GPS_TXD |
P8.37 UART5_TXD | GPS_RXD |
### CAN1 UAVCAN
You have to use a CAN transceiver (e.g. MCP 2562-E/P) for CAN datatransfer.
BBB | I/O | Remark
------------ | ------------- | -------------
P9.24 RX | IN | 3.3 Volt
P9.26 TX | OUT | 3.3 Volt
### Sound (PWM)