Bus master

The pod talks to your board as a bus host: it reads a sensor chip, sends a CAN frame, types into a console. Part of Watch and drive.

Buses

BusPinsSpeedToolsNotes
I2CAny 2 LA pins10 kHz to 1 MHzi2c_open, i2c_transfer, i2c_scan, i2c_closeWrite, read, or write then read. Switch on a pull-up first (set_pull) or use external pull-ups.
SPIAny 4 LA pins190 kHz to 6 MHz, modes 0 to 3spi_transfer, spi_flash_info, spi_flash_read, spi_flash_programFull duplex. Also reads and programs a SPI NOR flash.
UARTRX and TX on 2 LA pinsAny baud, parity, 1 or 2 stop bitsuart_open, uart_write, uart_read, uart_closeSend text, wait for a regex. A one-wire (half-duplex) UART works too.
CAN, CAN FDThe pod CAN portUp to 8 Mbit/s data ratecan_open, can_write, can_read, can_respond, can_status, can_closeSwitchable 120 ohm termination. can_respond plays an ECU: it answers an id by itself.

Rules

  • Set the I/O voltage (1.8 or 3.3 V) first. The wiring profile gives the default pins.
  • One owner per pin: release GPIO channels before opening a bus. la_pins shows who owns what.
  • The I2C master needs gateware v55 or later. The pod never switches a pull-up by itself.
  • 5 V buses: see 5 V logic. RS-485 and Modbus: see UART devices.
  • Watch the same bus while you drive it: see Logic analyzer.

More