I try to interface my ADS7843 touchpad controller over SPI1, but it looks like I am doing something horrible wrong at the SPI part. When I write something using spiSend() or spiExchange() I cannot see any clock on my SPI_SCK (PORTA.5).
Here is my code:
Code: Select all
#include "touchpad.h"
static const SPIConfig spicfg = {
NULL,
GPIOC,
GPIOC_TP_CS,
SPI_CR1_DFF
};
void tpInit(void) {
spiStart(&SPID1, &spicfg);
}
// just for testing the SPI output
void tpTest(void) {
uint8_t tx;
TP_CS(0);
palClearPad(GPIOD, GPIOD_LED3);
spiSend(&SPID1, 1, &tx);
palSetPad(GPIOD, GPIOD_LED3);
TP_CS(1);
}
uint32_t tpReadX(void) {
uint8_t tx, rx;
TP_CS(0);
tx = 0x9b;
spiExchange(&SPID1, 1, &tx, &rx);
TP_CS(1);
return rx;
}
uint32_t tpReadY(void) {
uint8_t tx, rx;
TP_CS(0);
tx = 0xd8;
spiExchange(&SPID1, 1, &tx, &rx);
TP_CS(1);
return rx;
}Well, when I run tpTest() in a loop, the LED flashes (to indicate that it dosen't crash or something), but nothing happens on the SPI1_CSK line or any of the other SPI1_MISO/MOSI lines.
I have really no clue what I am doing wrong. I did everything exactly like I read it in the documentation. No callback function when using manual CS lines etc. etc.
tpInit() gets called too.
I have SPI1 enabled in mcuconfig.h
Thanks for the help.
~ Tectu
