Could anyone shed some light on why when I enable the SD Card on the board I’m using, the touchscreen is disabled? (It just doesn’t work anymore.) I don’t know what it is, it doesn’t give an error, it doesn’t crash and the other things keep working.
I’m using the LVGL code generated by Squareline Studio and everything works fine, only when I enable SDCard it stops.
If any of the information below helps:
and code:
void setupDisplay(){
lcd.begin();
lcd.setRotation(0);
lcd.fillScreen(TFT_BLACK);
lcd.setTouch(calData);
delay(100);
//background light pin
pinMode(27, OUTPUT);
digitalWrite(27, HIGH);
lv_init();
lv_disp_draw_buf_init( &draw_buf, buf1, NULL, screenWidth * screenHeight / 13 );
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
//Display driver port of LVGL
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
//f_progressoDisplay("Iniciando Sistema...", 500);
}
and code the enable SD Card:
void v_Datalogger(void *parameters){
Serial.println("Ponto A");
TickType_t now;now = xTaskGetTickCount();
while(1){
Serial.println("Ponto B");
//DataLogger_.NomeArq = f_CriaArq();
DataLogger_.NomeArq = "/mapa.csv";
Serial.println("Ponto C");
//time_t tt = time(NULL);//Obtem o tempo atual em segundos. Utilize isso sempre que precisar obter o tempo atual
//data = *gmtime(&tt);//Converte o tempo atual e atribui na estrutura
//strftime(data_formatadaX, 64, "%d/%m/%Y %H:%M:%S", &data);//Cria uma String formatada da estrutura "data"
//------------------------------------------------------------------------------------------------------------------------
if (xSemaphoreTake(xMutexArq, 200)) {
Serial.println("Ponto D");
File oFile = SD.open(DataLogger_.NomeArq, FILE_APPEND);if (!oFile){Serial.println("Failed to open config file for writing");}
char buffer[128];
snprintf(buffer, sizeof(buffer), "%s;%.2f", datahora_formatadaX, tempC);
oFile.println(buffer);
oFile.close();
xSemaphoreGive(xMutexArq);
}
//-----------------------------------------------------------------------------------------------------------------------
vTaskDelayUntil(&now,pdMS_TO_TICKS(DataLogger_.Intervalo));
}
}
char *f_CriaArq() {
Serial.println("Ponto B.2");
char *dataFormatada = data_formatadaX;
static char NomeArq[64];
snprintf(NomeArq, sizeof(NomeArq), "/%s.csv", dataFormatada);
free(dataFormatada);
char *nomeArquivo = (char *)malloc(strlen(NomeArq) + 1);
strcpy(nomeArquivo, NomeArq);
Serial.println("Ponto B.3");
return nomeArquivo;
}
Any suggestion ? Where should I start looking for this problem?
Does it share the same SDI bus? of the Display?