Page 1 of 1

Spi driver initialization

Posted: Sat Jun 22, 2013 1:14 pm
by donmichael
Hi.

I've been trying to use spi on STM32VL Discovery. As I was going through some sample codes, some of them just initialize using configuration file and then calling spistart. But some other explicitly set the individual pins using palSetPadMode and then calling the spistart. Do I need to explicitly set the pad modes or does the spistart do it internally?

Thanks in Advance.

Re: Spi driver initialization

Posted: Sat Jun 22, 2013 2:44 pm
by Giovanni
Hi,

spiStart() (and any other peripheral-related function) does not change the pin settings internally. The default state of pins is defined in the file board.h, if you need a setup different from the default then you can:
a) change the board.h file.
b) create new board files specific for your application.
c) reconfigure the pins at runtime like in that demo.

Usually in board.h all unused pins are set to a safe state except those connected to some on-board device, those are set to the expected mode.

Giovanni

Re: Spi driver initialization

Posted: Sat Jun 22, 2013 3:56 pm
by donmichael
Thanx man.
Got it...