Page 1 of 1

[AT91SAM7X] PAL config in SPI driver

Posted: Fri Mar 09, 2012 2:42 pm
by Florian
Hi Giovanni,
I tried to use the SPI_LLD driver for the AT91SAM7X µC. As I see, the slave select lines are not set by the hardware SPI controller but by the software driver using the PAL module. I wondered where the PAL configuration is done for that lines and indeed the CS didn't work instantly.
When I insert the following line to spi_lld_start, it runs properly.

Code: Select all

void spi_lld_start(SPIDriver *spip) {
// ... (below the #endif)
  /* configure SS line as output */
  palSetPadMode(spip->config->ssport, spip->config->sspad, PAL_MODE_OUTPUT_PUSHPULL);
  /* Configuration.*/
// ...
}

Maybe you wanna add this to the SAM7 SPI_LLD driver, too? Or did I maybe missconfigure something?

Regards,
Florian

Re: [AT91SAM7X] PAL config in SPI driver

Posted: Fri Mar 09, 2012 2:48 pm
by Giovanni
Hi,

The configuration is assumed to be done outside the driver, usually it is done statically in your board.h file. If your board assigns several pins as CS then you want them configured immediately not when the SPI driver is started, also, they have to be configured regardless the driver is started or not.

Giovanni

Re: [AT91SAM7X] PAL config in SPI driver

Posted: Fri Mar 09, 2012 4:25 pm
by Florian
well, that's true of course. Then I will do that in board.h or board.c as well.