About beaglebone SPI application

I have developed a simple SPI application on the BeagleBone Black using RTEMS. In my code, I attempt to access SPI0 using the open() system call with the device path defined as:

#define SPI_DEV "/dev/spi0"

The system is booted via U-Boot following the RTEMS user manual, targeting the arm/beagleboneblack BSP. However, when I run the application, I encounter the following error:

SPI open failed: No such file or directory (errno: 2)

This indicates that the device node /dev/spi0 is not present in the system.

I suspect that this issue may be caused by SPI not being enabled in the device tree (.dts/.dtb), or that the device path I am using is not correct for RTEMS. I would like clarification on the following points:

  • Does SPI need to be explicitly enabled in the device tree for RTEMS on the BeagleBone Black?
  • Are there any additional BSP configuration or driver initialization steps required to ensure the SPI device is registered and accessible under /dev?

I’m just starting with the RTEMS. But i dont understand how actually RTEMS get device like using this /dev/i2c0, for beaglebone. I have tried to create application the way its in manual.
But there is no explicit way to use spi with /dev method.
I also opened /bsps/beaglebone/spi.c but i didnt see #define PATH_LEN (strlen("/dev/i2c-xx") + 1) which is bbb-i2c. c like statement in Spi.c.

If you look in bsps/arm/beagle/include/bsp/spi.h you should find the call bsp_register_spi() and the helper call bbb_register_spi_0(). The second call should add the /dev/spi-0 node for you. See the node path at the top of that header.

You need to add the call in your Init task before you attempt to the use the SPI device.

1 Like