Question about SPI
Posted: Fri Jun 01, 2012 7:23 am
Hello Folks,
I need your help here: I try to use the ADS7843 Touchpad controller on my TFT LCD Module. Here's the timing diagram:

From my understanding, I have to do the following:
What is the easiest way to do that using ChibiOS SPI driver? I also have trouble with the SPI configuration. In CR1 there are the bits BIDIMODE and BIDIOE. I don't think that I have to change the BIDIOE myself when writing/reading.
What I tried:
Thanks for your help.
I need your help here: I try to use the ADS7843 Touchpad controller on my TFT LCD Module. Here's the timing diagram:

From my understanding, I have to do the following:
Code: Select all
spiSend(0x90) // for read out X-Axis
foo = spiReceive()
spiSend(0x00)
result = spiReceive()
spiSend(0x00)
result = (result << 8) | spiReceive()What is the easiest way to do that using ChibiOS SPI driver? I also have trouble with the SPI configuration. In CR1 there are the bits BIDIMODE and BIDIOE. I don't think that I have to change the BIDIOE myself when writing/reading.
What I tried:
Code: Select all
static void spicb(SPIDriver *spip);
static const SPIConfig spicfg = {
NULL,
GPIOC,
TP_CS,
SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0,
};
void tpInit(void) {
spiStart(&SPID1, &spicfg);
}
uint16_t tpReadX(void) {
uint16_t rx;
SET_CS(0);
spiSend(&SPID1, 1, 0x90);
spiReceive(&SPID1, 1, &rx);
spiSend(&SPID1, 1, 0x00);
spiReceive(&SPID1, 1, &rx);
spiSend(&SPID1, 1, 0x00);
spiReceive(&SPID1, 1, &rx); // I know I'd have to shift here
SET_CS(1);
}Thanks for your help.