Skip to content

SPI for STM32F407G-DISC1 #575

@nopnop2002

Description

@nopnop2002

I'm testing hardware SPI support.
With necleo, SPI work fine.
With BluePill & BlackPill, SPI work fine.

Devive STM32
MOSI -- PA7
MISO -- PA6
SCK -- PA5

With DIY_MORE_F407VGT, SPI work fine.

Device STM32
MOSI -- PB5
MISO -- PB4
SCK -- PB3

But with STM32F407G-DISC1, SPI don't work.

I'm using this sketch for test.

Do you have any help.

	#include <SPI.h>
	#include <Wire.h>
	#include <Adafruit_GFX.h>
	#include <Adafruit_SSD1306.h>


	#if 1 // STM32
	// Uncomment this block to use hardware SPI
	//#define OLED_MOSI  11(FIX)
	//#define OLED_CLK   13(FIX)
	#define OLED_DC     PA10
	#define OLED_CS     PA8
	#define OLED_RESET  PA9 // vccでもOK
	Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS);
	#endif

	#define NUMFLAKES 10
	#define XPOS 0
	#define YPOS 1
	#define DELTAY 2

	#define LOGO16_GLCD_HEIGHT 16 
	#define LOGO16_GLCD_WIDTH  16 
	static const unsigned char PROGMEM logo16_glcd_bmp[] =
	{ B00000000, B11000000,
	  B00000001, B11000000,
	  B00000001, B11000000,
	  B00000011, B11100000,
	  B11110011, B11100000,
	  B11111110, B11111000,
	  B01111110, B11111111,
	  B00110011, B10011111,
	  B00011111, B11111100,
	  B00001101, B01110000,
	  B00011011, B10100000,
	  B00111111, B11100000,
	  B00111111, B11110000,
	  B01111100, B11110000,
	  B01110000, B01110000,
	  B00000000, B00110000 };

	#if (SSD1306_LCDHEIGHT != 64)
	#error("Height incorrect, please fix Adafruit_SSD1306.h!");
	#endif

	void setup()   {                
	  Serial.begin(9600);

	  // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
	  display.begin(SSD1306_SWITCHCAPVCC);
	  // init done
	  
	  // Show image buffer on the display hardware.
	  // Since the buffer is intialized with an Adafruit splashscreen
	  // internally, this will display the splashscreen.
	  display.display();
	  delay(2000);

	  // Clear the buffer.
	  display.clearDisplay();

	  // miniature bitmap display
	  display.drawBitmap(30, 16,  logo16_glcd_bmp, 16, 16, 1);
	  display.display();
	}


	void loop() {
	  
	}


Metadata

Metadata

Assignees

No one assigned

    Labels

    question ❓Usually converted as a discussion

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions