LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   SPI driver with two devices sharing the same CS (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/spi-driver-with-two-devices-sharing-the-same-cs-4175450265/)

domenicocelentano 02-15-2013 07:28 AM

SPI driver with two devices sharing the same CS
 
I'm developing on a AM1808 based board (w sdk 5.03.02.00) an I want to use the AD7682 shared with an LCD.

I modified the board configration file in this way in order to use the same CS with two devices:

static struct spi_board_info da850_k5_spi_info[] = {

[0] = {

.modalias = "ili934", /* spidev */

.mode = SPI_MODE_0,

.max_speed_hz = 5000000,

.bus_num = 1,

.chip_select = 2,

},

............................

............................

[3] = {

.modalias = "hx8238",

.mode = SPI_MODE_0,

.max_speed_hz = 5000000,

.bus_num = 1,

.chip_select = 2,

}

}

The kernel start correctly but I have the following message: "spi_davinci spi_davinci.1: chipselect 2 already in use"

I wanto to comunicate with the LCD only at startup. After that I close the LCD driver and start to comunicate with the AD7682 driver.
Is there a way to do this?

Thanks everyone in advance.

gdejonge 02-20-2013 05:50 PM

Sorry, but you can't share the cs line directly. That's the whole point of chip select. Both chips would be active at the same time and the results would be unpredictable. A possible option could be connecting one of the chips through an inverter chip. In this case only one of the chips would be active at any given moment.
Somthing like this:
Code:

|
|------------- cs
|
|-------|>o--- cs



All times are GMT -5. The time now is 05:59 PM.