Hi,
I need to interface a DAC with SPI interface http://ww1.microchip.com/downloads/en/DeviceDoc/21697F.pdf to BBB.
First question is which one (SPI) to select from device tree overlays (as there is a few and I don’t know the differences between them)
root@beaglebone:~# cd /lib/firmware
root@beaglebone:/lib/firmware# ls SPI
ADAFRUIT-SPI0-00A0.dtbo BB-SPIDEV0-00A0.dtbo BB-SPIDEV1A1-00A0.dtbo
ADAFRUIT-SPI1-00A0.dtbo BB-SPIDEV1-00A0.dtbo
I started with spidev0 and have
root@beaglebone:~# ls /dev/spi
/dev/spidev1.0 /dev/spidev1.1
Is this one conflicting with HDMI?
When I try in my C program:
// for serial
//const char *portname = “/dev/ttyO1”;
const char *portname = “/dev/ttyUSB0”;
const char *spiname = “/dev/spidev1.0”;
char sbuf[40];
int fd, SPIhandle;
…
// for spidev1.0
SPIhandle = open (spiname, O_RDWR | O_NOCTTY | O_SYNC);
if (SPIhandle < 0)
{
printf(“Error while opening SPI port …\n”); // Just if you want user interface error control
} else
printf(“using %s\n”, spiname);
// end of for spidev1.0
After compiling I have:
“error: ‘spidev’ does not name a type”
This should be included in a C project, so I can not use Python.
Can someone point me into the right directions, please
Jan