SPI support to other libraries using TRANSMIT ONLY or RECEIVE ONLY #2448
-
Describe the bug 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:
Expected behavior Screenshots Desktop (please complete the following information):
Board (please complete the following information):
Additional context are there any plans to support DMA transfer? the current code is slow and eats a lot of cpu power. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @AndreoBotelho |
Beta Was this translation helpful? Give feedback.
-
About your issue with clock divider did you check the clock config? Arduino_Core_STM32/libraries/SPI/src/utility/spi_com.c Lines 222 to 226 in 3a3ff84 About DMA, it is not planned. Anyway, feel free to contribute 😉 I see no specific issue (except maybe the clock divider) so what did you expect? |
Beta Was this translation helpful? Give feedback.
About your issue with clock divider did you check the clock config?
About the need of miso, yes it is required to properly init the SPI:
Arduino_Core_STM32/libraries/SPI/src/utility/spi_com.c
Lines 222 to 226 in 3a3ff84
About DMA, it is not planned. Anyway, feel free to contribute 😉
I see no specific issue (except maybe the clock divider) so what did you expect?