diff --git a/cores/esp32/esp32-hal-i2c.c b/cores/esp32/esp32-hal-i2c.c index 4d008c0fde7..ba9afd26f9c 100644 --- a/cores/esp32/esp32-hal-i2c.c +++ b/cores/esp32/esp32-hal-i2c.c @@ -379,8 +379,8 @@ void i2cInitFix(i2c_t * i2c){ while ((!i2c->dev->command[2].done) && (--count > 0)); I2C_MUTEX_UNLOCK(); } -/* - unused 03/15/2018 +*/ +/* unused 03/15/2018 void i2cReset(i2c_t* i2c){ if(i2c == NULL){ return; @@ -622,7 +622,7 @@ while(aqueueCount){ a++; } #else -log_n("Enable Core Debug Level \"Error\""); +//log_n("Enable Core Debug Level \"Error\""); //blup #endif } @@ -971,7 +971,7 @@ for(uint32_t a=1;a<=INTBUFFMAX;a++){ if(intBuff[b][0][num]!=0) log_e("[%02d] 0x%04x 0x%04x 0x%04x 0x%04x 0x%08x",b,((intBuff[b][0][num]>>16)&0xFFFF),(intBuff[b][0][num]&0xFFFF),((intBuff[b][1][num]>>16)&0xFFFF),(intBuff[b][1][num]&0xFFFF),intBuff[b][2][num]); } #else -log_n("enable Core Debug Level \"Error\""); +//log_n("enable Core Debug Level \"Error\""); //blup #endif } @@ -1026,8 +1026,7 @@ if(!i2c->i2c_event){ i2c->i2c_event = xEventGroupCreate(); } if(i2c->i2c_event) { - uint32_t ret=xEventGroupClearBits(i2c->i2c_event, 0xFF); - if(ret != ESP_OK) log_e("Unable to Clear Event Bits=%d",ret); + xEventGroupClearBits(i2c->i2c_event, 0xFF); } else {// failed to create EventGroup log_e("eventCreate failed=%p",i2c->i2c_event); @@ -1105,7 +1104,7 @@ i2c->dev->int_ena.val = if(!i2c->intr_handle){ // create ISR for either peripheral // log_i("create ISR %d",i2c->num); - uint32_t ret=0xFFFFFFFF; // clear uninitialized var warning + uint32_t ret = ESP_FAIL; switch(i2c->num){ case 0: ret = esp_intr_alloc(ETS_I2C_EXT0_INTR_SOURCE, 0, &i2c_isr_handler_default, i2c, &i2c->intr_handle); @@ -1155,7 +1154,7 @@ if(!(eBits==EVENT_DONE)&&(eBits&~(EVENT_ERROR_NAK|EVENT_ERROR_DATA_NAK|EVENT_ERR i2cDumpI2c(i2c); i2cDumpInts(i2c->num); #else - log_n("I2C exitCode=0x%x",eBits); + //log_n("I2C exitCode=0x%x",eBits); //blup #endif } diff --git a/cores/esp32/esp32-hal-i2c.h b/cores/esp32/esp32-hal-i2c.h index 453473e5844..17c2dff923e 100644 --- a/cores/esp32/esp32-hal-i2c.h +++ b/cores/esp32/esp32-hal-i2c.h @@ -168,6 +168,7 @@ i2c_err_t i2cProcQueue(i2c_t *i2c, uint32_t *readCount, uint16_t timeOutMillis); i2c_err_t i2cAddQueueWrite(i2c_t *i2c, uint16_t i2cDeviceAddr, uint8_t *dataPtr, uint16_t dataLen, bool SendStop, EventGroupHandle_t event); i2c_err_t i2cAddQueueRead(i2c_t *i2c, uint16_t i2cDeviceAddr, uint8_t *dataPtr, uint16_t dataLen, bool SendStop, EventGroupHandle_t event); i2c_err_t i2cFreeQueue(i2c_t *i2c); +void i2cReleaseISR(i2c_t * i2c); void i2cReleaseAll(i2c_t *i2c); // free ISR, Free DQ, Power off peripheral clock. Must call i2cInit(),i2cSetFrequency() to recover //stickbreaker debug support void i2cDumpInts(uint8_t num); diff --git a/libraries/SD_MMC/src/SD_MMC.cpp b/libraries/SD_MMC/src/SD_MMC.cpp index 104769693ad..9c27544a8ac 100644 --- a/libraries/SD_MMC/src/SD_MMC.cpp +++ b/libraries/SD_MMC/src/SD_MMC.cpp @@ -42,8 +42,19 @@ bool SDMMCFS::begin(const char * mountpoint, bool mode1bit) } //mount sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT(); - sdmmc_host_t host = SDMMC_HOST_DEFAULT(); + // sdmmc_host_t host = SDMMC_HOST_DEFAULT(); + // host.max_freq_khz = SDMMC_FREQ_HIGHSPEED; + sdmmc_host_t host; + host.flags = SDMMC_HOST_FLAG_4BIT; + host.slot = SDMMC_HOST_SLOT_1; host.max_freq_khz = SDMMC_FREQ_HIGHSPEED; + host.io_voltage = 3.3f; + host.init = &sdmmc_host_init; + host.set_bus_width = &sdmmc_host_set_bus_width; + host.set_card_clk = &sdmmc_host_set_card_clk; + host.do_transaction = &sdmmc_host_do_transaction; + host.deinit = &sdmmc_host_deinit; + host.command_timeout_ms = 0; #ifdef BOARD_HAS_1BIT_SDMMC mode1bit = true; #endif