One thought I had is that maybe the chip needs MCLK to function, but I don't think that's the case: the datasheet doesn't mention it and my own code for the NAU88C10 initializes I2C before it initializes I2S and that works well.
Well, in my tests with the STM32, the ESP32 is executing a _NOP-Waiting-Loop without doing anything (except the things, that happen before app_main()). Hence, there is no I2S-Interface and especially no MCLK active.
Do you have a 2nd PCB you can test this on?
Yes, I have 5 PCBs and I tested 3 of them.
Maybe something freakish is going on...
For sure! <ironic mode on> I suspect the ESP32 senses that its fiercest rival in the microcontroller world is sitting 5cm next to it on the same PCB. It is therefore offended and makes this known with nasty errors.</ironic mode off>
3v3 of the codec not being connected so it draws parasitic power from the other IO or something?
I double checked with my multimeter and the finest test tips, whether all 3.3V pins get the proper voltage. Well they do..
A Guru Meditation Error happens...
Code: Select all
I (304) gpio: GPIO[4]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
I (314) gpio: GPIO[5]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x42019008 PS : 0x00060330 A0 : 0x8200c8ad A1 : 0x3fc984f0
0x42019008: i2c_ll_get_scl_clk_timing at C:/Users/mail/esp/v5.3/esp-idf/components/hal/esp32s3/include/hal/i2c_ll.h:980
(inlined by) i2c_hal_get_timing_config at C:/Users/mail/esp/v5.3/esp-idf/components/hal/i2c_hal.c:71
A2 : 0x3fc99948 A3 : 0x3fc98520 A4 : 0x00000000 A5 : 0x00060523
A6 : 0x00000001 A7 : 0x3fc99cf4 A8 : 0x00000000 A9 : 0x3fc984f0
A10 : 0x00060523 A11 : 0x00000000 A12 : 0x00060520 A13 : 0x3fc99dd0
A14 : 0x3fc99d4c A15 : 0x00000000 SAR : 0x00000018 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000038 LBEG : 0x400570e8 LEND : 0x400570f3 LCOUNT : 0x00000000
0x400570e8: memset in ROM
0x400570f3: memset in ROM
Backtrace: 0x42019005:0x3fc984f0 0x4200c8aa:0x3fc98520 0x4200d0ac:0x3fc98580 0x42008ccf:0x3fc985b0 0x4201a1db:0x3fc98600 0x4037a929:0x3fc98630
0x42019005: i2c_ll_get_scl_clk_timing at C:/Users/mail/esp/v5.3/esp-idf/components/hal/esp32s3/include/hal/i2c_ll.h:980
(inlined by) i2c_hal_get_timing_config at C:/Users/mail/esp/v5.3/esp-idf/components/hal/i2c_hal.c:71
0x4200c8aa: s_i2c_hw_fsm_reset at C:/Users/mail/esp/v5.3/esp-idf/components/esp_driver_i2c/i2c_master.c:96
0x4200d0ac: i2c_master_bus_reset at C:/Users/mail/esp/v5.3/esp-idf/components/esp_driver_i2c/i2c_master.c:1054
0x42008ccf: app_main at C:/repos/playground/espidf-i2c_scanner/main/hello_world_main.c:28
0x4201a1db: main_task at C:/Users/mail/esp/v5.3/esp-idf/components/freertos/app_startup.c:208
0x4037a929: vPortTaskWrapper at C:/Users/mail/esp/v5.3/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134
With the call commeted out, everything* works (*except, the missing 0x1A NAU88C22)
Code: Select all
I (305) main_task: Calling app_main()
I (305) gpio: GPIO[4]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
I (315) gpio: GPIO[5]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
I (335) MAIN: Found I2C-Device @ 0x38
I (335) MAIN: Found I2C-Device @ 0x6A
I (345) main_task: Returned from app_main()
For your reference, scanner code is
Code: Select all
#include <driver/i2c_master.h>
#define TAG "MAIN"
#include "esp_log.h"
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
void app_main(void)
{
i2c_master_bus_handle_t bus_handle;
i2c_master_bus_config_t i2c_mst_config = {
.i2c_port = 0,
.sda_io_num = 4,
.scl_io_num = 5,
.clk_source = I2C_CLK_SRC_DEFAULT,
.glitch_ignore_cnt = 0,
.intr_priority = 3,
.trans_queue_depth = 0,
.flags = {
.enable_internal_pullup = 1,
}};
i2c_new_master_bus(&i2c_mst_config, &bus_handle);
//i2c_master_bus_reset(&bus_handle);
for (uint8_t i = 1; i < 128; i++)
{
if (i2c_master_probe(bus_handle, i, 100) != ESP_ERR_NOT_FOUND)
{
ESP_LOGI(TAG, "Found I2C-Device @ 0x%02X", i);
}
}
}