Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

According to the SOC specification, most of the pins can be used as GPIO or as alternative function pins.

  • The pin P45_2 can be used as GPIO.

  • The pins P44_3, P44_0, P44_2, and P44_1 can be used as GPIOs by default. Enable the spi1 node in the devise tree to use them as SPI.

  • The By default, the pins P41_0, P41_1, P40_01, and P40_0 are used as uart ttySC1 by default. Disable the scif1 node in the devise tree to use them as GPIOs.

  • The pins P40_1, and P40_0 Can be used as CANFD RX/TX. Disable the scif1 node and enable canfd node in the devise tree to use them as CANFD.

  • I2C0_SCL and I2C0_SDA can’t be used as GPIOs, only as I2C pins.

...

The GPIO number can be calculated using the function bellowbelow:
XX = linux Linux gpio number = <GPIO_controll_base> + <GPIO_Bank> * 8 + <GPIO_Bit>
XX = 120 <GPIO_Bank> * 8 + <gpio_bit>

Example: to To calculate the GPIO number of mikroBus J8 [pin 2] (RST)
Pad Name: P45_2 → {GPIO_Bank= 45; GPIO_Bit = 2}

XX = 120 + ( 45) * 8 + 2 = 120 + 362 = 482

...

To use it, you can use the default utilities:

Code Block
# stty -F /dev/ttySC1 9600
# echo "test string" > /dev/ttySC1

You can also can use picocomPicocom, minicom, screen, etc.

CANFD

The CANFD RX/TX pins are available on P40_1 and P40_0. These pins conflict with SCIF1 RX/TX. To enable CANFD, the scif1 node needs to be disabled, and the canfd node needs to be enabled in the dts.

Code Block
&canfd {
	status = "okay";
};

&scif1 {
	status = "disabled";
};

The CANFD will be available with the /dev/can0 interface.

Basic CAN usage:

Code Block
# ip link set can0 type can bitrate 1000000 dbitrate 4000000 fd on
# ip link set up can0
# candump can0
Info

Note: this CANFD controller supports a nominal bit rate: max. 1Mbps, data bit rate: max. 4Mbps

Warning

For the electrical connection, a CANFD transceiver should be used. Do not connect the RX/TX pins to the CAN_H/CAN_L lines directly; this will damage the SOM.

I2C

The I2C0_SCL and I2C0_SDA pins can be utilized as an I2C0 connection and are available via /dev/i2c-0.

...

Code Block
$ i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- UU -- -- -- UU UU -- UU 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: UU -- -- -- -- -- -- UU -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --       
Infonote

Note: The I2C0 bus is used for many devices on the board. Be careful connecting to this pin something that can fault the I2C bus.

...

  • i2c-tools utilities

  • Add device to i2c0 node in the dts

  • Also possible that the kernel will bind the driver automatically during the i2c bus scan

SPI

The mikroBUS connector's SPI pins of the mikroBUS connector are connected to the SOC's SPI1 interface of the SOC. To use them, configure the spi1 node in the dts first.

The Depending on the task, the spi1 node can be configured as a specific or dummy SPI device, depending on the task.

Here is an example of the dummy device configuration:

Code Block
&spi1 {
	status = "okay";
	spidev@0spidevice@0 {
		compatible = "linux,spidev";
		reg = <0>;
		spi-max-frequency = <500000><12000000>;
	};
};

After this configuration, the SPI would be accessible via the /dev/spidev0.0 device and can be used with the spidev_test utility or tools that can work with spidev (for example, flashrom).

To fully use SPI, replace the spidev node with a specific device node and use a particular driver.

...