# Interfaces and Pinout The V6 board uses two MCUs with the same pin assignment. Each MCU manages two CAN/CAN FD interfaces, two RS485 interfaces, one USB interface, and one external SPI slave interface. ## Whole-Board Interface Mapping | Host entry point | Interfaces managed by the current MCU | Common board names | | --- | --- | --- | | First MCU USB / SPI CS0 | Local first and second channels | CAN1, CAN2, RS485-1, RS485-2 | | Second MCU USB / SPI CS1 | Local first and second channels | CAN3, CAN4, RS485-3, RS485-4 | USB and SPI commands may use whole-board Channel numbers: - `Channel 1/3` selects the first interface on the current MCU. - `Channel 2/4` selects the second interface on the current MCU. - `Channel 0` selects both interfaces of the same type on the current MCU. Replies use local numbering and therefore only report `Channel 1` or `Channel 2`. For example, a reply from the first bus on the second MCU is marked Channel 1 even if the transmit command used Channel 3. ## Pins on Each MCU | Function | MCU pins | Description | | --- | --- | --- | | FDCAN1 RX / TX | `PB8` / `PB9` | First local CAN/CAN FD | | FDCAN2 RX / TX | `PB12` / `PB13` | Second local CAN/CAN FD | | RS485-A TX / RX / RE | `PB6` / `PB7` / `PB5` | USART1, first local RS485 | | RS485-B TX / RX / RE | `PD5` / `PD6` / `PD3` | USART2, second local RS485 | | External SPI CS / SCK / MISO / MOSI | `PA15` / `PC10` / `PC11` / `PC12` | SPI3 slave for an external host | | Internal SPI CS / SCK / MISO / MOSI | `PA4` / `PA5` / `PA6` / `PA7` | SPI1 link between the two MCU devices | | Debug UART TX / RX | `PD8` / `PD9` | USART3 | | I2C SCL / SDA | `PC6` / `PC7` | I2C4 | | ADC input 1 / 2 | `PB1` / `PE9` | ADC3 | | LED1 / LED2 | `PC4` / `PC5` | Active low | | USB DM / DP | `PA11` / `PA12` | USB composite device | | SWDIO / SWCLK | `PA13` / `PA14` | ST-LINK programming and debugging | These pins are used by the factory firmware. Before adding peripherals, make sure they do not conflict with CAN, RS485, USB, SPI, or the internal MCU link. ## SocketCAN Interfaces Each MCU exposes two `gs_usb` channels. A complete board normally appears as four Linux `canX` interfaces: | MCU | gs_usb channels | Physical interfaces | | --- | ---: | --- | | First MCU | 0 / 1 | CAN1 / CAN2 | | Second MCU | 0 / 1 | CAN3 / CAN4 | Linux assigns `can0`, `can1`, and later names by enumeration order, so they may not match board silkscreen on every host. Confirm the mapping before production use as described in [SocketCAN](socketcan). ## External SPI Settings | Item | Value | | --- | --- | | Role | Slave | | SPI mode | Mode 0 | | Bit order | MSB First | | Data width | 8 bit | | CRC-8 polynomial | `0x07` | | `SHORT` | 23 bytes including the final CRC byte | | `LONG` | 73 bytes including the final CRC byte | Factory default is `SHORT`. Switch to `LONG` only when SPI must carry CAN FD or more than 18 bytes of RS485 data. ## Wiring Notes - Place suitable termination at both ends of a CAN/CAN FD bus and do not swap CAN_H and CAN_L. - RS485 A/B naming differs among manufacturers; if communication fails, check the transceiver labels. - USB, SPI hosts, and external devices should share a reference ground. - The two MCU devices have separate USB and SWD connectors; verify the selected side before updating or debugging. - Follow the schematic for your exact board version for connector and power definitions.