Spi driver initialization

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: RoccoMarco, barthess

donmichael
Posts: 6
Joined: Sun May 26, 2013 10:04 am

Spi driver initialization

Postby donmichael » Sat Jun 22, 2013 1:14 pm

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.

User avatar
Giovanni
Site Admin
Posts: 14458
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Spi driver initialization

Postby Giovanni » Sat Jun 22, 2013 2:44 pm

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

donmichael
Posts: 6
Joined: Sun May 26, 2013 10:04 am

Re: Spi driver initialization

Postby donmichael » Sat Jun 22, 2013 3:56 pm

Thanx man.
Got it...


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 14 guests