cancel
Showing results for 
Search instead for 
Did you mean: 

SPI example code for ST disco board

Jeevan Rudramurthy
Associate II
Posted on December 04, 2017 at 07:05

We are trying to communicate ST disco board with atmel board  using example code of SPI.

We have configured spi clock frequency 500000hz

clock phase and clock polarity as zero, in atmel board.

where to configure spi clock in ST board.

where to configure CS line and which pin num is used in STM32F769I disco board

5 REPLIES 5
S.Ma
Principal
Posted on December 04, 2017 at 08:35

Take a step back to explain a bit more as we can't guess the following:

- SPI: 3 or 4 wire interface?

- Which MCU is master / slave ?

I guess in STM32 Cube there are example of SPI for the corresponding STM Nucleo board. Usually there is a very basic code of master loop back slave by SPI.

If STM32 is master, NSS is generated by SW controlling the GPIO directly.

Then use DMA dual stream, one for TX (which will drive SCK as well) and one for RX (this is the one to look for generating the interrupt when block transfer has ended). Give time for the slave MCU to process and digest the message, so take some time between NSS high level duration.

Posted on December 07, 2017 at 05:21

We are trying ST as master and slave both,

its 4 wire line.

We connected between

ST Atmel

SCK SCK

MOSI MOSI

MISO MISO

x CS

x ---> don't know which pin to use in STM32F769NI Disco board ,for nucleo board i am not finding SPI examples.

we are using 5 mHZ spi clock frequency in ATlmel board,but i don't know where we need to configure theSPI clock in ST board and what SPI clock frequency its using and what SPI baudrate need to set.

how to use CS manually what is the necessity and when to use

SPI_NSS_SOFT

SPI_NSS_HARD_INPUT

SPI_NSS_HARD_OUTPUT

Output we have attached please look into it the NSS we are not getting properly either low or high.

when we made ST as Master.0690X0000060959QAA.png

________________

Attachments :

SPIExample.PNG : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hxgw&d=%2Fa%2F0X0000000b5F%2F1n2siXyFQMiqq2Db8YPyoZRBqNpZ75CWsC65CQ_vFDo&asPdf=false
Posted on December 07, 2017 at 12:54

Use 

SPI_NSS_SOFT and control NSS as if it is a normal GPIO, by SW.

Get NSS low before launching the transfer and wait that the transfer is really completed (RXNE completed and cell is not BUSY).

There should be SPI Examples for the corresponding Nucleo board.

For the wirering, it looks ok. Also, I recall there are 2 SPI modes, the general one and TI mode. Thanks to check how Atmel Slave SPI is configured to match.

Posted on December 08, 2017 at 09:33

how to make NSS low if you have any example code for disco board can you send it.

Posted on December 11, 2017 at 13:48

can i know what is the spi clock frequency we need to configure,

where we need to configure SPI clock frequency in ST disco board

In atmel board we are recieving 50000 hz spi clock frequncy