# SPI0 For ROM-5722

**URL:** <https://forum.aim-linux.advantech.com/t/spi0-for-rom-5722/877>\
**Category:** Technical Supports\
**Created:** [October 31, 2024, 4:40pm UTC](https://forum.aim-linux.advantech.com/t/spi0-for-rom-5722/877 "2024-10-31T16:40:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NewToLinux](https://avatars.discourse-cdn.com/v4/letter/n/8e7dd6/32.png) [@NewToLinux](https://forum.aim-linux.advantech.com/u/NewToLinux)\
**Post date:** [October 31, 2024, 4:40pm UTC](https://forum.aim-linux.advantech.com/t/spi0-for-rom-5722/877/1 "2024-10-31T16:40:02Z")

</div>

Could somebody explain to me how i use the SPI bus on the ROM-5722? My knowledge of Linux is very basic and I would really appreciate some help. I only want to do a very basic read and write.

I’ve run ls \dev\ to view the devices available but I can’t see any SPI devices. If i look in the /sys/bus/ directory i can see mtd0 but i think this is for the QPSI NOR flash on the SoM.

I can see the spidev driver available but i don’t know how to assign it the SPI bus, which bus i need to assign it to or why this isn’t part of the provided image.

Any help would be hugely appreciated.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Jems\_Cheng](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@Jems\_Cheng](https://forum.aim-linux.advantech.com/u/Jems_Cheng)\
**Post date:** [November 1, 2024, 2:19am UTC](https://forum.aim-linux.advantech.com/t/spi0-for-rom-5722/877/2 "2024-11-01T02:19:01Z")

</div>

Hi~

Please check there is a document in the kernel source about SPI, ROM5722 dts and the spidevtool that you can reference first.

The steps to enable SPI:

1. config in kernel configuration:
2. config in device tree:
3. rebuild kernel dtb file
4. Run the test

Config kernel:  
The Linux kernel has enabled SPI\_IMX and SPI\_SPIDEV  
SPI\_IMX:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/aim_linux/original/2X/3/3b65e34c215fb27e2e2305c989f12da498ef8280.png)  
SPIDEV:  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/aim_linux/original/2X/0/0603a6f7aa26fa6eff6708fc9ede8c4919196c45.png)

Config devicetree:  
[linux-imx/Documentation/devicetree/bindings/spi/spi-controller.yaml at adv\_5.4.70\_2.3.0 · ADVANTECH-Corp/linux-imx](https://github.com/ADVANTECH-Corp/linux-imx/blob/adv_5.4.70_2.3.0/Documentation/devicetree/bindings/spi/spi-controller.yaml)  
[linux-imx/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt at adv\_5.4.70\_2.3.0 · ADVANTECH-Corp/linux-imx](https://github.com/ADVANTECH-Corp/linux-imx/blob/adv_5.4.70_2.3.0/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt)

ROM-5722 dts: there is some description in the dts file for the SPI.  
[linux-imx/arch/arm64/boot/dts/freescale/recovery-imx8mp-rom5722-a1.dts at adv\_5.4.70\_2.3.0 · ADVANTECH-Corp/linux-imx](https://github.com/ADVANTECH-Corp/linux-imx/blob/adv_5.4.70_2.3.0/arch/arm64/boot/dts/freescale/recovery-imx8mp-rom5722-a1.dts)

 ![image](https://us1.discourse-cdn.com/flex016/uploads/aim_linux/original/2X/7/71928b90a88c0a4c9b3bead6308a831b9b742b03.png)

SPIDEVTOOL:  
[linux-imx/tools/spi at adv\_5.4.70\_2.3.0 · ADVANTECH-Corp/linux-imx](https://github.com/ADVANTECH-Corp/linux-imx/tree/adv_5.4.70_2.3.0/tools/spi)

Rebuild kernel and dtb file:  
Yocto 3.0 (version A) BSP user guide:  
[Yocto Linux BSP Ver.A User Guide for iMX8 series -Yocto 3.0 - ESS-WIKI](https://ess-wiki.advantech.com.tw/view/IoTGateway/BSP/Linux/iMX8/Yocto_LBVA_User_Guide)  
Setting up SDK:  
[Yocto Linux BSP Ver.A User Guide for iMX8 series -Yocto 3.0 - ESS-WIKI](https://ess-wiki.advantech.com.tw/view/IoTGateway/BSP/Linux/iMX8/Yocto_LBVA_User_Guide#Setting_up_SDK)  
Config and build kernel and deb:  
[Yocto Linux BSP Ver.A User Guide for iMX8 series -Yocto 3.0 - ESS-WIKI](https://ess-wiki.advantech.com.tw/view/IoTGateway/BSP/Linux/iMX8/Yocto_LBVA_User_Guide#Config_kernel)

---

<div class="post-metadata">

**Author:** ![NewToLinux](https://avatars.discourse-cdn.com/v4/letter/n/8e7dd6/32.png) [@NewToLinux](https://forum.aim-linux.advantech.com/u/NewToLinux)\
**Post date:** [November 4, 2024, 10:33am UTC](https://forum.aim-linux.advantech.com/t/spi0-for-rom-5722/877/3 "2024-11-04T10:33:09Z")

</div>

I appreciate your help, but i wasn’t able to understand this, or get the SPI bus working. I’m not really sure how to check the configuration in the device tree or what I’d be looking for. I though it would be simpler to just enable the SPI bus.
