diff --git a/boards/beaglev/fire/05-demos.rst b/boards/beaglev/fire/05-demos.rst index 5bf8e3bff163c5e3095562fbcc562b9bcbbe3208..45e44d6ba1132d8d8f856f28a3badf6746b6f92d 100644 --- a/boards/beaglev/fire/05-demos.rst +++ b/boards/beaglev/fire/05-demos.rst @@ -24,4 +24,5 @@ Demos demos-and-tutorials/gateware/customize-cape-gateware-verilog demos-and-tutorials/gateware/running-the-bitstream-builder-on-windows demos-and-tutorials/gateware/exploring-gateware-design-libero + demos-and-tutorials/gateware/comms-cape-gateware-usage demos-and-tutorials/gateware/axi-apb-interfaces-demo diff --git a/boards/beaglev/fire/demos-and-tutorials/gateware/comms-cape-gateware-usage.rst b/boards/beaglev/fire/demos-and-tutorials/gateware/comms-cape-gateware-usage.rst new file mode 100644 index 0000000000000000000000000000000000000000..0dd4a6da6df67fbff75692846ff2fc6451d949af --- /dev/null +++ b/boards/beaglev/fire/demos-and-tutorials/gateware/comms-cape-gateware-usage.rst @@ -0,0 +1,258 @@ +.. _beaglev-fire-comms-cape-gateware-usage: + +Comms Cape Gateware for BeagleV-Fire +##################################### + +The comms cape provides an array of communication protocols including + +* one RS485, +* one CAN, +* two analog 4-20 mA current loops, +* two 3A 50V interfaces allowing the control of high current loads. + +Cape schematics, layout, and mechanicals +**************************************** + +For the schematics, layout, and mechanicals of the cape, please refer to the `Comms Cape <https://openbeagle.org/beagleboard/capes/-/tree/master/beaglebone/Comms>`_ repository. + +Usage in Linux +************** + +CAN +=== + +.. todo:: Due to the current Linux kernel being on ``6.1``, only a UIO driver is available instead of a Socket CAN driver. This section will be updated once Linux kernel ``6.6`` is shipped for the beagleV-fire, with the Socket CAN driver. + +RS485 +===== + +The RS485 interface is connected to ``UART4`` on the BeagleV-Fire. It can be accessed using ``/dev/bone/uart/4`` in Linux. + +Sink drivers +============ + +The sink drivers are connected to the ``P9_15`` and ``P9_23`` GPIOs. They can be controlled by writing to the GPIOs by: + +.. code-block:: shell + + echo 425 > /sys/class/gpio/export + echo 431 > /sys/class/gpio/export + echo out > /sys/class/gpio/gpio425/direction + echo out > /sys/class/gpio/gpio431/direction + echo 1 > /sys/class/gpio/gpio425/value + echo 1 > /sys/class/gpio/gpio431/value + +Current loops +============= + +The current loops are connected to the ADC inputs of the BeagleV-Fire at pins ``P9_35`` and ``P9_36``. They can be accessed once QSPI is enabled in the comms cape device tree overlay. The current loops can be read by: + +.. code-block:: shell + + cat /sys/bus/iio/devices/iio:device0/in_voltage5_raw #Current Loop A + cat /sys/bus/iio/devices/iio:device0/in_voltage6_raw #Current Loop B + +Voltage to current conversion will have to be done in software. + +Pinout +****** + +The full pinout for the cape interface spec can be found `here <https://docs.beagleboard.org/latest/boards/capes/cape-interface-spec.html#id18>`_ . You can also see the pinout below, refer to the last column for comms-cape specific pins. + +P8 Header +========= + ++--------+----------------------------+-------+-------------+ +| Signal | Control | Irq # | Description | ++========+============================+=======+=============+ +| P8_1 | n/a | n/a | GND | ++--------+----------------------------+-------+-------------+ +| P8_2 | n/a | n/a | GND | ++--------+----------------------------+-------+-------------+ +| P8_3 | MSS GPIO_2[0] | 53 | User LED 0 | ++--------+----------------------------+-------+-------------+ +| P8_4 | MSS GPIO_2[1] | 53 | User LED 1 | ++--------+----------------------------+-------+-------------+ +| P8_5 | MSS GPIO_2[2] | 53 | User LED 2 | ++--------+----------------------------+-------+-------------+ +| P8_6 | MSS GPIO_2[3] | 53 | User LED 3 | ++--------+----------------------------+-------+-------------+ +| P8_7 | MSS GPIO_2[4] | 53 | User LED 4 | ++--------+----------------------------+-------+-------------+ +| P8_8 | MSS GPIO_2[5] | 53 | User LED 5 | ++--------+----------------------------+-------+-------------+ +| P8_9 | MSS GPIO_2[6] | 53 | User LED 6 | ++--------+----------------------------+-------+-------------+ +| P8_10 | MSS GPIO_2[7] | 53 | User LED 7 | ++--------+----------------------------+-------+-------------+ +| P8_11 | MSS GPIO_2[8] | 53 | User LED 8 | ++--------+----------------------------+-------+-------------+ +| P8_12 | MSS GPIO_2[9] | 53 | User LED 9 | ++--------+----------------------------+-------+-------------+ +| P8_13 | core_pwm[1] @ 0x41500000 | n/a | PWM_2:1 | ++--------+----------------------------+-------+-------------+ +| P8_14 | MSS GPIO_2[11] | 53 | User LED 11 | ++--------+----------------------------+-------+-------------+ +| P8_15 | MSS GPIO_2[12] | 53 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_16 | MSS GPIO_2[13] | 53 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_17 | MSS GPIO_2[14] | 53 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_18 | MSS GPIO_2[15] | 53 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_19 | core_pwm[0] @ 0x41500000 | n/a | PWM_2:0 | ++--------+----------------------------+-------+-------------+ +| P8_20 | MSS GPIO_2[17] | 53 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_21 | MSS GPIO_2[18] | 53 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_22 | MSS GPIO_2[19] | 53 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_23 | MSS GPIO_2[20] | 53 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_24 | MSS GPIO_2[21] | 53 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_25 | MSS GPIO_2[22] | 53 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_26 | MSS GPIO_2[23] | 53 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_27 | MSS GPIO_2[24] | 53 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_28 | MSS GPIO_2[25] | 53 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_29 | MSS GPIO_2[26] | 53 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_30 | MSS GPIO_2[27] | 53 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_31 | core_gpio[0] @ 0x41100000 | 126 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_32 | core_gpio[1] @ 0x41100000 | 127 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_33 | core_gpio[2] @ 0x41100000 | 128 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_34 | core_gpio[3] @ 0x41100000 | 129 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_35 | core_gpio[4] @ 0x41100000 | 130 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_36 | core_gpio[5] @ 0x41100000 | 131 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_37 | core_gpio[6] @ 0x41100000 | 132 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_38 | core_gpio[7] @ 0x41100000 | 133 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_39 | core_gpio[8] @ 0x41100000 | 134 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_40 | core_gpio[9] @ 0x41100000 | 135 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_41 | core_gpio[10] @ 0x41100000 | 136 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_42 | core_gpio[11] @ 0x41100000 | 137 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_43 | core_gpio[12] @ 0x41100000 | 138 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_44 | core_gpio[13] @ 0x41100000 | 139 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_45 | core_gpio[14] @ 0x41100000 | 140 | GPIO | ++--------+----------------------------+-------+-------------+ +| P8_46 | core_gpio[15] @ 0x41100000 | 141 | GPIO | ++--------+----------------------------+-------+-------------+ + +P9 Header +========= + ++--------+----------------------------+-------+-------------------------+ +| Signal | Control | Irq # | Description | ++========+============================+=======+=========================+ +| P9_1 | n/a | n/a | GND | ++--------+----------------------------+-------+-------------------------+ +| P9_2 | n/a | n/a | GND | ++--------+----------------------------+-------+-------------------------+ +| P9_3 | n/a | n/a | VCC 3.3V | ++--------+----------------------------+-------+-------------------------+ +| P9_4 | n/a | n/a | VCC 3.3V | ++--------+----------------------------+-------+-------------------------+ +| P9_5 | n/a | n/a | VDD 5V | ++--------+----------------------------+-------+-------------------------+ +| P9_6 | n/a | n/a | VDD 5V | ++--------+----------------------------+-------+-------------------------+ +| P9_7 | n/a | n/a | SYS 5V | ++--------+----------------------------+-------+-------------------------+ +| P9_8 | n/a | n/a | SYS 5V | ++--------+----------------------------+-------+-------------------------+ +| P9_9 | n/a | n/a | NC | ++--------+----------------------------+-------+-------------------------+ +| P9_10 | n/a | n/a | SYS_RSTN | ++--------+----------------------------+-------+-------------------------+ +| P9_11 | MMUART4 | 94 | UART4 RX <--- For RS485 | ++--------+----------------------------+-------+-------------------------+ +| P9_12 | core_gpio[1] @ 0x41200000 | 143 | GPIO | ++--------+----------------------------+-------+-------------------------+ +| P9_13 | MMUART4 | 94 | UART4 TX <--- For RS485 | ++--------+----------------------------+-------+-------------------------+ +| P9_14 | core_pwm[0] @ 0x41400000 | n/a | PWM_1:0 | ++--------+----------------------------+-------+-------------------------+ +| P9_15 | core_gpio[4] @ 0x41200000 | 146 | GPIO | ++--------+----------------------------+-------+-------------------------+ +| P9_16 | core_pwm[1] @ 0x41400000 | n/a | PWM_1:1 | ++--------+----------------------------+-------+-------------------------+ +| P9_17 | MSS SPI0 | 54 | SPI0 CS | ++--------+----------------------------+-------+-------------------------+ +| P9_18 | MSS SPI0 | 54 | SPI0 MOSI | ++--------+----------------------------+-------+-------------------------+ +| P9_19 | MSS I2C0 | 58 | I2C0 SCL | ++--------+----------------------------+-------+-------------------------+ +| P9_20 | MSS I2C0 | 58 | I2C0 SDA | ++--------+----------------------------+-------+-------------------------+ +| P9_21 | MSS SPI0 | 54 | SPI0 MISO | ++--------+----------------------------+-------+-------------------------+ +| P9_22 | MSS SPI0 | 54 | SPI0 SCLK | ++--------+----------------------------+-------+-------------------------+ +| P9_23 | core_gpio[10] @ 0x41200000 | 152 | GPIO | ++--------+----------------------------+-------+-------------------------+ +| P9_24 | CAN_1_RXBUS | n/a | CAN RX <--- For CAN | ++--------+----------------------------+-------+-------------------------+ +| P9_25 | CAN_1_TX_EBL | 154 | CAN TX EBL | ++--------+----------------------------+-------+-------------------------+ +| P9_26 | CAN_1_TXBUS | n/a | CAN TX | ++--------+----------------------------+-------+-------------------------+ +| P9_27 | core_gpio[14] @ 0x41200000 | 156 | GPIO | ++--------+----------------------------+-------+-------------------------+ +| P9_28 | MSS SPI1 | 55 | SPI1 CS | ++--------+----------------------------+-------+-------------------------+ +| P9_29 | MSS SPI1 | 55 | SPI1 MISO | ++--------+----------------------------+-------+-------------------------+ +| P9_30 | core_gpio[17] @ 0x41200000 | 159 | GPIO | ++--------+----------------------------+-------+-------------------------+ +| P9_31 | MSS SPI1 | 55 | SPI1 SCLK | ++--------+----------------------------+-------+-------------------------+ +| P9_32 | n/a | n/a | VDD ADC | ++--------+----------------------------+-------+-------------------------+ +| P9_33 | n/a | n/a | ADC input 4 | ++--------+----------------------------+-------+-------------------------+ +| P9_34 | n/a | n/a | AGND | ++--------+----------------------------+-------+-------------------------+ +| P9_35 | n/a | n/a | ADC input 6 | ++--------+----------------------------+-------+-------------------------+ +| P9_36 | n/a | n/a | ADC input 5 | ++--------+----------------------------+-------+-------------------------+ +| P9_37 | n/a | n/a | ADC input 2 | ++--------+----------------------------+-------+-------------------------+ +| P9_38 | n/a | n/a | ADC input 3 | ++--------+----------------------------+-------+-------------------------+ +| P9_39 | n/a | n/a | ADC input 0 | ++--------+----------------------------+-------+-------------------------+ +| P9_40 | n/a | n/a | ADC input 1 | ++--------+----------------------------+-------+-------------------------+ +| P9_41 | core_gpio[19] @ 0x41200000 | 161 | GPIO | ++--------+----------------------------+-------+-------------------------+ +| P9_42 | core_pwm[0] @ 0x41000000 | n/a | PWM_0:0 | ++--------+----------------------------+-------+-------------------------+ +| P9_43 | n/a | n/a | GND | ++--------+----------------------------+-------+-------------------------+ +| P9_44 | n/a | n/a | GND | ++--------+----------------------------+-------+-------------------------+ +| P9_45 | n/a | n/a | GND | ++--------+----------------------------+-------+-------------------------+ +| P9_46 | n/a | n/a | GND | ++--------+----------------------------+-------+-------------------------+