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.
Spi driver initialization
Moderators: RoccoMarco, barthess
- 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
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
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
-
- Posts: 6
- Joined: Sun May 26, 2013 10:04 am
Who is online
Users browsing this forum: No registered users and 14 guests