Thanks so much for the reply. Being new to ESP32 programming in Arduino, I have tried very hard to enable verbose logging, referencing this link (
https://esp32.com/viewtopic.php?t=5730) but I have had no luck (INO below). Am I missing something?
I tried adding the following to my SPI setup:
Code: Select all
mySPI->begin(36, 37, 35, SS);
SPISettings s;
mySPI->beginTransaction(s);
I am puzzled by the fact that none of these functions (SPI-begin, SPI-transfer, SPI->set*) returns any kind of error code. SPI->transfer returns 0 no matter what pins I map in the setup, so I don't think the communication is actually happening.
The following code prints nothing:
Code: Select all
#if (!PLATFORMIO)
// Enable Arduino-ESP32 logging in Arduino IDE
#ifdef CORE_DEBUG_LEVEL
#undef CORE_DEBUG_LEVEL
#endif
#ifdef LOG_LOCAL_LEVEL
#undef LOG_LOCAL_LEVEL
#endif
#define CORE_DEBUG_LEVEL 5
#define LOG_LOCAL_LEVEL CORE_DEBUG_LEVEL
#endif
#include <esp32-hal-log.h>
#include <SPI.h>
#include <spieeprom.h>
#include "esp_log.h"
#define CHIP_SELECT 20
byte buffer[64];
uint16_t address = 0;
SPIClass Sonic_EEPROM_SPI = SPIClass(HSPI);
#define DEBUG
static const char* TAG = "main-main";
SPIEEPROM myEEPROM(EEPROM_TYPE_16BIT, CHIP_SELECT, &Sonic_EEPROM_SPI); // parameter is type
// type=0: 16-bits address
// type=1: 24-bits address
// type>1: defaults to type 0
void setup() {
// delay(2000);
Serial.begin(921600);
myEEPROM.setup(); // setup myEEPROM
while(Serial.available()>0)
Serial.read();
esp_log_level_set("*", ESP_LOG_VERBOSE);
Serial.printf("LOG_LOCAL_LEVEL %d\n", LOG_LOCAL_LEVEL);
// esp32-hal-log.h esp_log.h
// level 0 = ARDUHAL_LOG_LEVEL_NONE = ESP_LOG_NONE
ESP_LOGE(TAG, "ESP_LOGE, level 1 = ARDUHAL_LOG_LEVEL_ERROR = ESP_LOG_ERROR");
ESP_LOGW(TAG, "ESP_LOGW, level 2 = ARDUHAL_LOG_LEVEL_WARN = ESP_LOG_WARN");
ESP_LOGI(TAG, "ESP_LOGI, level 3 = ARDUHAL_LOG_LEVEL_INFO = ESP_LOG_INFO");
ESP_LOGD(TAG, "ESP_LOGD, level 4 = ARDUHAL_LOG_LEVEL_DEBUG = ESP_LOG_DEBUG");
ESP_LOGV(TAG, "ESP_LOGV, level 5 = ARDUHAL_LOG_LEVEL_VERBOSE = ESP_LOG_VERBOSE");
}
[/code]