cancel
Showing results for 
Search instead for 
Did you mean: 

Connection via SPI interface

m.asada
Associate II

According to UM2237, the Connect command in the CLI (command line interface) supports SPI, but what is the device used to connect the Nucleo board to the PC? How does the device look like from the PC side (device manager)?

---> start (added to question on 10/09/2021)

I purchased the STLINK-V3SET and tried it with the STM32CubeProgrammer, but I cannot establish a connection with the device via SPI.

The board I am using is NUCLEO-L4R5ZI, and the following are the pins that are connected to it:

(1) STLINK, CN5, Pin#1(SPI_NSS) to NUCLEO, CN12, Pin#16(PB12, NSS)

(2) STLINK, CN5, Pin#3(SPI_MOSI) to NUCLEO, CN12, Pin#26(PB15, MOSI)

(3) STLINK, CN5, Pin#5(SPI_MISO) to NUCLEO, CN12, Pin#28(PB14, MISO)

(4) STLINK, CN5, Pin#7(SPI_SCK) to NUCLEO, CN12, Pin#30(PB13, SCK)

(5) NUCLEO, CN11, Pin#5(VDD) to NUCLEO CN11, Pin#7(PH3-BOOT0)

I operated as follows:

(a) Press RESET button on NUCLEO to start STM32 Bootloader

(b) Select SPI as Port in STM32CubeProgrammer and press Connect button

(c) Failed to establish connection

The following is the log obtained by STM32CubeProgrammer:

15:59:17:352 : STLinkUSBDriver.dll loaded

15:59:17:358 : ST-LINK FW : V3J8M1

15:59:17:359 : Voltage   : 0.00V

15:59:17:359 : Bridge freq : 48000 KHz

15:59:17:359 : SPI connection parameters

15:59:17:360 : Baudrate  : 24000 KHz

15:59:17:360 : mode    : MASTER

15:59:17:360 : direction  : 2LINES_FULLDUPLEX

15:59:17:360 : dataSize  : 8B

15:59:17:360 : Format   : MOTOROLA

15:59:17:361 : nsspulse  : NO_PULSE

15:59:17:361 : nss     : SOFT

15:59:17:361 : delay    : FEW_MICROSEC

15:59:17:361 : cpha    : 1EDGE

15:59:17:361 : cpol    : LOW

15:59:17:362 : firstbit  : MSB

15:59:17:362 : crc     : DISABLE

15:59:23:924 : Timeout error!

15:59:23:924 : Error: ST-LINK error (BRG_TARGET_CMD_TIMEOUT)

15:59:23:924 : Error: Establishing connection with the device failed

I have tried changing the baud rate and other parameters, but cannot connect.

Is there any documentation that describes in detail how to connect via SPI using the STM32CubeProgrammer?

<--- end (added to question on 10/09/2021)

1 ACCEPTED SOLUTION

Accepted Solutions
m.asada
Associate II

On page 37 of AN2606, along with the diagram, there is the following statement:

To use the SPI bootloader, connect the host (master) and the desired SPIx interface (slave) together via the MOSI, MISO and SCK pins. The NSS pin must be connected to GND. A pull-down resistor must be connected to the SCK line.

The evaluation board did not solve this problem, but the board we created worked fine with the connections as per AN2606.

View solution in original post

7 REPLIES 7
TDK
Guru

To use the SPI interface, you need to have a separate SPI device available which can talk to it. FTDI has some USB to SPI devices you could use.

The only way a chip will show up in the device manager is in USB DFU mode. If you're using a programmer, the programmer will show up and allow you to use the SWD interface.

If you feel a post has answered your question, please click "Accept as Solution".

Thank you TDK for your answer.

After reading "8.4.4 Bridge functions (STLINK-V3MODS only)" in UM2502, I understood that STLINK-V3MODS is required to communicate with the target bootloader via SPI.

I will get the STLINK-V3MODS and try to run it. Thank you very much.

m.asada
Associate II

0693W00000DmvjVQAR.png 

Additional information.

I tried it in the CLI and the result was the same.

Attached is an image of the connection between the NUCLEO board and the STLINK-V3SET, and a log file obtained by CLI.

MISO (NUCLEO CN12 pin#28 PB14) is connected to User LD3 (red user LED) of NUCLEO, and LD3 flashes when SPI Connect is attempted.

From this, it seems that STM32 bootloader is responding to the command, but STM32CubeProgrammer is not receiving the response.

Please give me some advice. I'm very confused.

TDK
Guru

Why do you want to talk to the bootloader over SPI? Surely there are easier ways of programming the chip.

You'll need to ensure the device is in bootloader mode and that no other supported bootloader interfaces are active at the same time.

I'm not familiar with the SPI features of the STLINK-V3SET.

If you feel a post has answered your question, please click "Accept as Solution".
m.asada
Associate II

Thank you TDK for your answer.

> Why do you want to talk to the bootloader over SPI?

The size of the firmware is 1.3 Mbytes and I want to determine the interface with the fastest communication speed that can be selected for writing the farm to the on-board STM32.

In the STM32CubeProgrammer user manual (UM2237), it says that writing the farm via SPI is supported, so we want to run it and measure the time it takes to write the farm.

Zxing.1
Associate

Do you solve it ?I have the same problem ​,do you know how to solve it?

m.asada
Associate II

On page 37 of AN2606, along with the diagram, there is the following statement:

To use the SPI bootloader, connect the host (master) and the desired SPIx interface (slave) together via the MOSI, MISO and SCK pins. The NSS pin must be connected to GND. A pull-down resistor must be connected to the SCK line.

The evaluation board did not solve this problem, but the board we created worked fine with the connections as per AN2606.