-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Describe the bug
stm hang when trying to send data to SPI bus
To Reproduce
#include <SPI.h>
#define TFT_MOSI PE14
#define TFT_SCLK PE12
#define TFT_CS PE4 // Chip select control pin
#define TFT_DC PE13 // Data Command control pin
#define TFT_RST PE11 // Reset pin (could connect to RST pin)
#define TFT_BL PC7 // bl pin (could connect to bl pin)
void setup() {
Serial.begin(115200);
pinMode(TFT_CS, OUTPUT);
pinMode(TFT_DC, OUTPUT);
pinMode(TFT_BL, OUTPUT);
digitalWrite(TFT_BL, LOW);
digitalWrite(TFT_CS, LOW);
digitalWrite(TFT_DC, LOW);
SPI.setMOSI(TFT_MOSI);
//SPI.setMISO(PE5);
SPI.setSCLK(TFT_SCLK);
SPI.setClockDivider(2);
SPI.begin();
Serial.println("Inited");
}
// the loop function runs over and over again forever
void loop() {
Serial.println("Loop");
digitalWrite(TFT_BL, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(TFT_CS, LOW);
SPI.transfer(0x21, true);
digitalWrite(TFT_CS, HIGH);
delay(1000); // wait for a second
digitalWrite(TFT_CS, LOW);
digitalWrite(TFT_BL, LOW); // turn the LED off by making the voltage LOW
SPI.transfer(0x28, true);
digitalWrite(TFT_CS, HIGH);
delay(1000); // wait for a second
}Steps to reproduce the behavior:
- power on
Expected behavior
send bytes to display
Screenshots
N/A
Desktop (please complete the following information):
- OS: Windows
- Arduino IDE version: 2.3.2
- STM32 core version: latest
- Tools menu settings if not the default: default
- Upload method: DFU
Board (please complete the following information):
- Name: STM32H743 custom board
- Hardware Revision: none
- Extra hardware used if any: SPI ST7789 display
Additional context
SPI.setClockDivider(int); is not working, I can get only 256 divider, manually coding 2 divider works fine
uncommenting //SPI.setMISO(PE5); make it works but I don't have this MISO pin connected and loses a GPIO on PE5
are there any plans to support DMA transfer? the current code is slow and eats a lot of cpu power.
Metadata
Metadata
Assignees
Labels
No labels