6 years, 3 months ago.

SPI1 as Slave in DISCO_L475VG_IOT0A1

Hi My Code is like below

SPI Slave Code not working


#include "mbed.h"

Serial pc(USBTX, USBRX); // tx, rx
//SPI dwm(PA_7, PA_6, PA_5); // mosi, miso, sclk,cs
//DigitalOut cs(PA_2);

SPISlave device(PA_7, PA_6, PA_5, PA_2);       // mosi, miso, sclk, ssel

int main()
{
     pc.baud(115200);
     pc.printf("in main\n");
}

If I use SPI1 (CN1 connector on the STM32l475 board) as master I see print on console.

If I use as Slave by declaring SPISlave(..) and commenting SPI Master code.

I do not see any print.

Does that mean SPISlave is not supported ? or am I missing something ?.

NOTE:I have not connected the peripheral.

Can some one help me please .

1 Answer

6 years, 3 months ago.

Can you use PA_4 instead of PA_2?

Accepted Answer

Thanks for the reply, I am able to see the print, does that mean PA_4 is the Slave select pin not PA_2. I saw on Board Cover PA2(D10) as CS, is PA_2 not SSel . please help.

posted by raghavan p 07 Aug 2018

Yeah, according to this page, PA_4 or PA_15 is used as SPI1_SSEL. You can double-check this in this source code, too.

posted by Osamu Koizumi 07 Aug 2018

Thanks for the help

posted by raghavan p 07 Aug 2018