Forum Discussion
Altera_Forum
Honored Contributor
14 years agoSPI and uClinux
Hi all, I have a design in which I have to use SPI in order to communicate with an external PIC. I find that it is not enough to select SPI driver in uClinux kernel configuration because when I...
Altera_Forum
Honored Contributor
14 years ago --- Quote Start --- Ok, reading documentation in Linux kernel I find that if I want to use open() and write() function within my software I need to write a protocol driver or simply use spidev driver. I added in config.c the following code
static struct spi_board_info nios2_spi_devices = {
.modalias = "spidev",
.max_speed_hz = 173.3 * 1000,
.bus_num = 1,
.chip_select = 0,
.irq = na_spi_irq,
.mode = SPI_MODE_0,
};
and I did what is described in spidev documentation, but I am still not able to have spidev1.0 in /dev directory. Can anyone help me? --- Quote End --- You need to do three things 1. you need to add your spi device driver like altera_spi in config.c 2. you need to add spi_board_info, bus_num should match with step1 3. Make sure your spi device (altera_spi) probe did not returned error with unsupported mode Point to note is spidev is not spi hardware driver, it is spi user level driver and need to be linked to actual driver with bus_num I will post snippet of my code asap