Can I safely use 2 sets of pinouts for singe SPI bus? error:"addApbChangeCallback(): duplicate func"
Posted: Sat Mar 06, 2021 6:00 pm
Can I map 2nd sets of pintouts for VSPI bus sefely? Generally everythink work fine as long as I use TFT and SD in single task loop, or tasks at the same priority and core, in any other configuration wtd trigger and/or SD return crc errors etc. I'm just not sure can I ignore "addApbChangeCallback(): duplicate func" warning and keep going.
My board: TTGO T-Display
Framework: Arduino
IDE: platformio
here is sample how I initialize SD:
some SPI.cpp library modyfication:
monitor result:
My board: TTGO T-Display
Framework: Arduino
IDE: platformio
here is sample how I initialize SD:
Code: Select all
static SPIClass SD_SPI(VSPI);
void SDINIT(){
pinMode(SD_CS_PIN,OUTPUT); digitalWrite(SD_CS_PIN,1);
SD_SPI.begin(SD_SCK_PIN,SD_MISO_PIN,SD_MOSI_PIN,-1); // ESP32
if(!SD.begin(SD_CS_PIN,SD_SPI)){
LOG("Card Mount Failed\n");
SD_MOUNT = 0;
return;
}
// other initialize stuff here
}
Code: Select all
#include <esp32-hal-log.h>
void SPIClass::begin(int8_t sck, int8_t miso, int8_t mosi, int8_t ss)
{
log_i("SPI.begin( %i,%i,%i,%i )",sck,miso,mosi,ss); // <-- I just added here some logs
if(_spi) {
return;
}
...
Code: Select all
[I][SPI.cpp:33] begin(): SPI.begin( 18,19,19,-1 ) <--- tft VSPI (tft_eSPI library)
[I][SPI.cpp:33] begin(): SPI.begin( 25,26,27,-1 ) <--- other SPI device HSPI (its time critical so I need to use separate SPI bus)
[I][SPI.cpp:33] begin(): SPI.begin( 33,32,15,-1 ) <--- SD VSPI
[E][esp32-hal-cpu.c:93] addApbChangeCallback(): duplicate func=400D7964 arg=3FFBDCAC
[I][SPI.cpp:33] begin(): SPI.begin( -1,-1,-1,-1 ) <--- its because SD.begin(SD_CS_PIN,SD_SPI)->spi.begin()