cancel
Showing results for 
Search instead for 
Did you mean: 

Usage of SPI1 and SPI2 on STM32L-Discovery

gavin2
Associate II
Posted on May 30, 2012 at 18:19

Hi,

I am trying to understand the operation of the STM32L-Discovery with the aim of setting up SPI transactions between two

STM32L-Discovery

devices.

When I look at the specs:

1) SPI1:

SPI1 is defined on PA4, PA5, PA6 and PA7. The signals PA4 and PA5 are available externally down the LHS of the board. PA6 and PA7 however, are tied to the slider and do not appear to be available externally. 

Does this mean that I will not be able to use SPI1 to send/receive signals to another STM32L-Discovery device because PA6 (MISO) and PA7 (MOSI) are always internal signals on the board?

2) SPI2:

SPI2 is defined on PB12, PB13, PB14 and PB15. All of these signals are available externally down the LHS of the board. However, for the default example/operation, which came with the board, these signals are tied to the LCD (SEG12-SEG15). Please refer to Figure 14 of UM1079

Does this mean that I can use SPI2 to pass signals in/out of the device but I will have to strip out the PB12-PB15 signals from the LCD, i.e I will have to change the operation of the LCD to not use SEG12-SEG15?

I have just begun work on this device for the first time, so I would be very grateful for any help.

Thanks in advance

4 REPLIES 4
Posted on May 30, 2012 at 20:32

If you go through the manual you will note that the SPI1 interface can come out of numerous pins, and you can cherry pick which using the AF mux. There shouldn't be any preclusion on picking pins on multiple GPIO banks (some from A, B or E), just make sure each is clocked.

SPI1_NSS  PA4, PE12, PA15

SPI1_SCK PA5, PE13, PB3

SPI1_MISO  PA6, PE14, PA11, PB4

SPI1_MOSI  PA7,PE15,PA12,PB5

Less options with SPI2

SPI2_NSS PB12, PD0

SPI2_SCK PB13, PD1

SPI2_MISO PB14,PD3

SPI2_MOSI PB15,PD4

Now whether you can wrestle all the pins out you need, I don't know, you'll have to review that, and remove external circuitry if required.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
gavin2
Associate II
Posted on May 31, 2012 at 00:58

Hi clive1,

Thank you very much for your reply. Unfortunately, this has kind of confused me more ...

Just to be totally clear, I am using the STM32L-Discovery board (STM32L152RBT6, LQFP64 package)

Firstly, where are you reading that the SPI can come out on numerous pins? Which document is this in? The reference I have been reading (UM1079, Section 5, Extension Connectors, table 7) appear to say that SPI1 can only be used on PA4-PA7.

Secondly, PE14 and PE15 do not exist as pins on the Discovery board. How do I physically probe these with an oscilloscope? This is also the case for some of the other pin options that you mentioned, e.g PD3 and PD4.

Thanks you again for your reply. As a newbie, I am sure I am just missing some obvious pieces of the jigsaw puzzle. If you could clarify the above, it would be much appreciated.

Regards

Posted on May 31, 2012 at 01:29

Refer to Table 4

http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00277537.pdf

The available pins will depend on the package the specific part on the STM32L-Discovery uses. Looks to be a 64-pin part.

You may of course be further constrained by what the board has wired up, and if you can remove the LCD Glass, etc. You could also consider other eval boards, using higher pin count derivatives of the part, of a different family of parts.

If you design a board you will need to go through an exercise of figuring out what functionality you want, and which pins can deliver that, and the package size and memory requirements. The nature of the part, and general purpose design, will mean not all peripherals can be used or escape the part at once.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
gavin2
Associate II
Posted on June 04, 2012 at 17:12

Hi clive1,

Thanks for your input. It has been very helpful. It seems like my undersanding has been correct but you have help me confirm this.

Currently looking at resource options/other eval boards.

Regards