2024-06-24 05:34 AM - last edited on 2024-11-13 03:23 AM by Andrew Neil
i have interfaced stm32 and Sd card performed different operations separately and i have interfaced stm32 and tft wave share(ili9486) display and able to display some graphics separately ,now i am trying to fetch a image from sd card and display it on the LCD but i am able to communicate with only one slave and if Sd card works display does not work and vice -versa and i am using Arduino ide for coding. Please help me to solve this
#include <spi.h>
#include <SD.h>
#include <Adafruit_GFX.h>
#include <Waveshare_ILI9486.h>
#define SD_MOSI_PIN PC12 // MOSI Pin
#define SD_MISO_PIN PC11 // MISO Pin
#define SD_SCLK_PIN PC10 // Clock Pin
#define SD_SS_PIN PB0 // Chip Select or Slave Select Pin
#define TFT_CS_PIN PB6
#define TFT_DC_PIN PA8
#define TFT_RST_PIN PA9
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
#define BUFFER_SIZE 50
char textBuffer[BUFFER_SIZE];
// Assuming the constructor in your library takes no arguments
Waveshare_ILI9486 tft;
uint16_t color565(uint8_t r, uint8_t g, uint8_t b) {
return ((r & 0xF8) << | ((g & 0xFC) << 3) | (b >> 3);
}
static int bufferIndex = 0;
File myFile;
void setup() {
Serial.begin(115200);
Serial.println("Initializing SD card...");
SPI.setMISO(SD_MISO_PIN);
SPI.setMOSI(SD_MOSI_PIN);
SPI.setSCLK(SD_SCLK_PIN);
if (!SD.begin(SD_SS_PIN)) {
Serial.println("SD card initialization failed!");
while (1);
}
Serial.println("SD card initialization done.");
myFile = SD.open("test6.txt");
if (myFile) {
while (myFile.available() && bufferIndex < BUFFER_SIZE - 1) {
char nextChar = myFile.read();
textBuffer[bufferIndex++] = nextChar;
}
textBuffer[bufferIndex] = '\0'; // Null-terminate the string
myFile.close();
} else {
Serial.println("Error opening test6.txt");
}
tft.begin();
}
void loop() {
tft.fillScreen(GREEN);
tft.setTextSize(2);
// Print the content of the buffer on the display
tft.print(textBuffer);
delay(1200);
}
2024-11-13 04:07 AM
Where do you run qt? If it's on pc, you can send message via uart to start the day to display stored sinewave.
2024-11-13 04:50 AM - edited 2024-11-13 04:53 AM
Qt runs on the ARM Cortex-A7 core, which operates under the Linux OS on the STM32MP157D-DK1.i have set up cross compilation in order to deploy Qt projects directly from a host Linux machine to the embedded target(stm32mp157d-dk1) using qtcreator.
so using qt can i connect it to stm32cubeide which has arm cortex m and which in turn has dac