8 years, 7 months ago.

Nucleo STM32-F401RE as SPISlave

Hi.

I'm using Nucleo STM32-F401RE board with mbed SDK. I tried to connect this board with LPC1768 based board via SPI protocol without success. When I try to configure Nucleo board as SPI slave (with SPISlave mbed class), i constantly get error "Pinmap not found for peripheral" on serial output.

All of the following codes compiles successfully but after start i get already mentioned "Pinmap not found for peripheral" error.

First tryout

#include "mbed.h"
 
SPISlave device(SPI_MOSI, SPI_MISO, SPI_SCK, SPI_CS);
 
int main() {
    while(1) {
        wait_us(50);
    }
}
 

Second tryout

#include "mbed.h"
 
SPISlave device(PB_5, PB_4, PB_3, PB_6);
 
int main() {
    while(1) {
        wait_us(50);
    }
}
 

Third tryout

#include "mbed.h"
 
SPISlave device(PA_7, PA_6, PA_5, PB_6);
 
int main() {
    while(1) {
        wait_us(50);
    }
}
 

I will appreciate any kind of help, hint...

Thanks in advance.

1 Answer

8 years, 7 months ago.

Check the platform page for the F401 here. The SPI slave requires an SPI port that has an NSS pin. So the only options are SPI1 or SPI2. In case of SPI1 you must select NSS1 (PA_15).

#include "mbed.h"
 
SPISlave device(PA_7, PA_6, PA_5, PA_15);
 
int main() {
    while(1) {
        wait_us(50);
    }
}

Accepted Answer

Thank you very much!

So there are dedicated pins for SPI select signal on the Nucleo board. I missed that detail. I didn't find PA_15 pin on picture, but configuration with PA_4 as ssel parameter works for me... There is no more "Pinmap not found..." error.

posted by Milos Petrovic 02 Sep 2015

The SPI Slave lib needs dedicated select signals. You can use any pin as CS for a slave when you are using the SPI master code.

posted by Wim Huiskamp 03 Sep 2015