3 years ago.

SPI_CS has a wrong pin number on the picture

Hi, the definition of the SPI Pin CS is as follow

const PinMap PinMap_SPI_SSEL[] = {
    {NC,    NC,    0}

this means the PB_6 is wrong if you choose that and the SPI will not work. Please fix that in the picture

The same mistake is there in the code .. the definition of the pins as bellow

    // Standardized button names
    SERIAL_TX   = PA_2,
    SERIAL_RX   = PA_3,
    USBTX       = PA_2,
    USBRX       = PA_3,
    I2C_SCL     = PB_8,
    I2C_SDA     = PB_9,
    SPI_MOSI    = PA_7,
    SPI_MISO    = PA_6,
    SPI_SCK     = PA_5,
    SPI_CS      = PB_6,
    PWM_OUT     = PC_7,


Question relating to:

Affordable and flexible platform to ease prototyping using a STM32F030R8T6 microcontroller.

1 Answer

3 years ago.

Dear Mariwan

Thank you for your interest. Could you provide me with the link of the picture you would like to be fixed ? I cannot see SPI in PB_6 of NUCLEO_F030R8.

You can use PB_6 as a SPI chip select. This is a software chip select, that you declare as a DigitalOut. You have every details here : https://docs.mbed.com/docs/mbed-os-api-reference/en/latest/APIs/interfaces/digital/SPI/

In your case, you can use

#include "mbed.h"
SPI spi(D11, D12, D13); // mosi, miso, sclk
DigitalOut cs(D10);


#include "mbed.h"
SPI spi(SPI_MOSI, SPI_MISO, SPI_SCK); // mosi, miso, sclk
DigitalOut cs(SPI_CS);

I hope this helps

Kind regards


Accepted Answer

You used D10. If you use SPISlave .. you will get an error for the CS. D10 is the same as PB_6 and it is as I am showing in the firs pieces of code, not defined as CS for the SPI. look at this picture, it is printed on the module (i.e the CS near to pin PB_6). https://media.digikey.com/Photos/STMicro%20Photos/MFG_NUCLEO.jpg

The error I get is as follow:

pinmap not found for peripheral

posted by Mariwan J. 12 Jun 2017

Hi, I see what is going on.


works for any SPI master example that uses Arduino naming convention. This is commonly used and will therefore not be removed.

You want to initialize a SPI slave. You should use a hardware SPIx_NSS pin to make it work. You can trust SPIx_NSS from the pinout pictures available on the platform web page : https://developer.mbed.org/platforms/ST-Nucleo-F030R8/

In particular: SPI1 NSS is available on PA_4 / A2 pin of the nucleo platform.


Kind regards

posted by Armelle DubocST 12 Jun 2017