-
|
Hello, I am using a drone FC (Flywoo F722 PRO V2), that uses a STM32F722RET6. On the board, there is a Winbond W25Q128FV flash chip wired to the SPI3 bus on the MCU (MISO PC11, MOSI PB5, SCK PC10) with CS on PC13. #include <SPI.h>
#define CS_PIN PC13
#define SPI_MISO PC11
#define SPI_MOSI PB5
#define SPI_SCK PC10
SPIClass SPI_3(SPI_MOSI, SPI_MISO, SPI_SCK);
void setup() {
Serial.begin(115200);
while(!Serial);
pinMode(CS_PIN, OUTPUT);
digitalWrite(CS_PIN, HIGH);
SPI_3.begin();
delay(100);
digitalWrite(CS_PIN, LOW);
delay(10);
SPI_3.transfer(0x9F); // read JEDEC ID
uint8_t manufacturer = SPI_3.transfer(0x00);
uint8_t memType = SPI_3.transfer(0x00);
uint8_t capacity = SPI_3.transfer(0x00);
digitalWrite(CS_PIN, HIGH);
Serial.println(manufacturer, HEX);
Serial.println(memType, HEX);
Serial.println(capacity, HEX);
}
void loop() {}
Is there something that I'm missing? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Hi @EnzoPB So simply change to: #define SPI_MOSI PB5_ALT1
Like this the SPI3 is used for PB5 and aligned with PC10/PC11 |
Beta Was this translation helpful? Give feedback.
Hi @EnzoPB
In fact PB5 can be used for 2 SPI instance:
Arduino_Core_STM32/variants/STM32F7xx/F722R(C-E)T_F730R8T_F732RET/PeripheralPins.c
Lines 236 to 237 in e531ea8
So simply change to:
#define SPI_MOSI PB5_ALT1Like this the SPI3 is used for PB5 and aligned with PC10/PC11