Closed nopnop2002 closed 5 years ago
I've tested SPI and it woks on F407 Disco. Moreover as it works for the DYIMROE which is also based on F407 there is no reason to not work on DISCO. Maybe an issue with wiring or the library you used which use a wrong pin hide in its code....
Hello. Is MOSI = PB5?
MOSI is PA7
Ok I think I understand your issue. On DiscoF407 the PB3/4/5 could not be used for SPI as they are commented in the PeripheralPins.c https://github.com/stm32duino/Arduino_Core_STM32/blob/85fd492c15a87048086e7e82318c555fb6410a41/variants/DISCO_F407VG/PeripheralPins.c#L259
Default SPI instance use the PA5/6/7 pins with SPI1.
I confirmed that SPI is PA5, PA6, PA7.
I understood the cause of my sketch not working.
PA9 does not work stably as GPIO. PA13,PA14,PA15 can not be used as GPIO Please check with the sketch below.
static int led[] = {PA13, PA14, PA15};
// the setup function runs once when you press reset or power the board
void setup() {
Serial.begin(115200);
while(!Serial);
Serial.println("Blink start");
for(int i=0;i<3;i++) pinMode(led[i], OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
static int pin = 0;
Serial.println(" LED=" + String(led[pin]));
digitalWrite(led[pin], HIGH);
delay(100);
digitalWrite(led[pin], LOW);
delay(100);
pin++;
if (pin == 3) pin = 0;
}
@nopnop2002 please read the UM and check also schematics of the board. PA9 is USB VBUS PA13/14 are the SWD signals.
I close this issue as original issue is answered: SPI worked.
I'm testing hardware SPI support. With necleo, SPI work fine. With BluePill & BlackPill, SPI work fine.
With DIY_MORE_F407VGT, SPI work fine.
But with STM32F407G-DISC1, SPI don't work.
I'm using this sketch for test.
Do you have any help.