Copyright © https://mongoose-os.com

Mongoose OS Forum

frame
ATTENTION! This forum has moved to:

https://community.mongoose-os.com

Do not post any new messages.

Running ESP32 I2C bus at 1MHz

pjapja Cambridge

Hi,

I'm having trouble running the ESP32 I2C bus at 1 MHz with Mongoose OS.

GOAL:

I wish to communicate with an mlx90640 I2C device (low res thermal camera) over the I2C bus at 1MHz. I am using an esp32 device and the Espressif docs appears to indicate that the ESP32 device should support I2C fast mode +.

WHAT I DID:

I wrote some C code to communicate with the mlx90640 device using mongoose OS (ESP32 hardware). I ran the bus at 400 kHz and it worked and then ran the bus at 1MHz and it failed (logs below).

RESULT:

Running the I2C bus at 400 kHz works OK.

[Jan 20 10:36:36.054] mgos_i2c_create I2C1 init ok (SDA: 22, SCL: 21, freq: 400000)

I Changed the I2C freq to 1MHz (i2c.freq in mos.yml) and got

[Jan 20 10:33:08.974] mgos_i2c_create I2C1 init ok (SDA: 22, SCL: 21, freq: 1000000)
[Jan 20 10:33:10.412] AP IP address = 192.168.4.1
[Jan 20 10:33:40.463] E (32346) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
[Jan 20 10:33:40.473] - mgos (CPU 0), backtrace: 0x400e96f0 0x400e9900 0x400e6462 0x400e65d1 0x400e620f 0x400e6307 0x400e31ca 0x4016df6e 0x4016f41e 0x4017165c 0x40182055 0x40169fb9 0x400830a2 0x40082fa6
[Jan 20 10:33:40.489]
[Jan 20 10:33:40.489] E (32346) task_wdt: Tasks currently running:
[Jan 20 10:33:40.494] E (32346) task_wdt: CPU 0: mgos
[Jan 20 10:33:40.498] E (32346) task_wdt: Aborting.
[Jan 20 10:33:40.501] abort() was called at PC 0x400d1360 on core 0
[Jan 20 10:33:40.505]
[Jan 20 10:33:40.506] Backtrace: 0x4008e59f 0x4008e721 0x400d1360 0x4008167a 0x400e96ed
[Jan 20 10:33:40.511]
[Jan 20 10:33:40.512] --- BEGIN CORE DUMP ---
[Jan 20 10:33:40.514] mos: catching core dump
[Jan 20 10:33:43.370] .............
[Jan 20 10:34:19.959] ---- END CORE DUMP ----
[Jan 20 10:34:19.962] mos: wrote to /tmp/core-esp32_thermal_image_2_lcd-esp32-20190120-103419.042813642 (454381 bytes)
[Jan 20 10:34:19.962] mos: analyzing core dump
Core dump by esp32_thermal_image_2_lcd/esp32 1.0 20190120-102140
[Jan 20 10:34:19.966] mos: --fw-elf-file is not set and could not be guessed
[Jan 20 10:34:19.967] Rebooting...
[Jan 20 10:34:19.967] ets Jun 8 2016 00:22:57
[Jan 20 10:34:19.967]
[Jan 20 10:34:19.967] rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[Jan 20 10:34:19.968] configsip: 0, SPIWP:0xee
[Jan 20 10:34:19.970] clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[Jan 20 10:34:19.976] mode:DIO, clock div:2
[Jan 20 10:34:19.978] load:0x3fff0018,len:4
[Jan 20 10:34:19.980] load:0x3fff001c,len:5840
[Jan 20 10:34:19.983] ho 0 tail 12 room 4
[Jan 20 10:34:19.985] load:0x40078000,len:8900
[Jan 20 10:34:19.987] load:0x40080400,len:6244
[Jan 20 10:34:19.989] entry 0x40080728
[Jan 20 10:34:19.992] I (30) boot: ESP-IDF v3.2-r1 2nd stage bootloader
[Jan 20 10:34:19.998] I (30) boot: compile time 09:37:59
[Jan 20 10:34:20.002] I (31) boot: Enabling RNG early entropy source...
[Jan 20 10:34:20.007] I (35) boot: SPI Speed : 40MHz
[Jan 20 10:34:20.011] I (40) boot: SPI Mode : DIO
[Jan 20 10:34:20.015] I (44) boot: SPI Flash Size : 4MB
[Jan 20 10:34:20.019] I (48) boot: Partition Table:
[Jan 20 10:34:20.023] I (51) boot: ## Label Usage Type ST Offset Length Flags
[Jan 20 10:34:20.031] I (59) boot: 0 nvs WiFi data 01 02 00009000 00004000 00000000
[Jan 20 10:34:20.039] I (67) boot: 1 otadata OTA data 01 00 0000d000 00002000 00000000
[Jan 20 10:34:20.048] I (76) boot: 2 app_0 OTA app 00 10 00010000 00180000 00000000
[Jan 20 10:34:20.056] I (84) boot: 3 fs_0 SPIFFS 01 82 00190000 00040000 00000000
[Jan 20 10:34:20.064] I (92) boot: 4 app_1 OTA app 00 11 001d0000 00180000 00000000
[Jan 20 10:34:20.072] I (100) boot: 5 fs_1 SPIFFS 01 82 00350000 00040000 00000000
[Jan 20 10:34:20.081] I (109) boot: End of partition table
[Jan 20 10:34:20.085] I (113) boot: OTA data 0: seq 0x00000001, st 0x10, CRC 0x157a2b85, valid? 1
[Jan 20 10:34:20.093] I (121) boot: OTA data 1: seq 0x00000000, st 0x00, CRC 0x00000000, valid? 0
[Jan 20 10:34:20.100] I (128) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x27c4c (162892) map
[Jan 20 10:34:20.154] I (194) esp_image: segment 1: paddr=0x00037c74 vaddr=0x3ff80000 size=0x00000 ( 0) load
[Jan 20 10:34:20.163] I (194) esp_image: segment 2: paddr=0x00037c7c vaddr=0x3ff80000 size=0x00000 ( 0) load
[Jan 20 10:34:20.172] I (201) esp_image: segment 3: paddr=0x00037c84 vaddr=0x3ffb0000 size=0x0250c ( 9484) load
[Jan 20 10:34:20.181] I (213) esp_image: segment 4: paddr=0x0003a198 vaddr=0x3ffb250c size=0x00000 ( 0) load
[Jan 20 10:34:20.190] I (218) esp_image: segment 5: paddr=0x0003a1a0 vaddr=0x40080000 size=0x00400 ( 1024) load
[Jan 20 10:34:20.199] I (228) esp_image: segment 6: paddr=0x0003a5a8 vaddr=0x40080400 size=0x05a68 ( 23144) load
[Jan 20 10:34:20.208] I (245) esp_image: segment 7: paddr=0x00040018 vaddr=0x400d0018 size=0xb2604 (730628) map
[Jan 20 10:34:20.459] I (499) esp_image: segment 8: paddr=0x000f2624 vaddr=0x40085e68 size=0x0b000 ( 45056) load
[Jan 20 10:34:20.477] I (517) esp_image: segment 9: paddr=0x000fd62c vaddr=0x400c0000 size=0x00000 ( 0) load
[Jan 20 10:34:20.486] I (517) esp_image: segment 10: paddr=0x000fd634 vaddr=0x50000000 size=0x00000 ( 0) load
[Jan 20 10:34:20.495] I (524) esp_image: segment 11: paddr=0x000fd63c vaddr=0x50000000 size=0x00000 ( 0) load
[Jan 20 10:34:20.504] I (542) boot: Loaded app from partition at offset 0x10000
[Jan 20 10:34:20.511] I (542) boot: Disabling RNG early entropy source...
[Jan 20 10:34:20.516] I (544) cpu_start: Pro cpu up.
[Jan 20 10:34:20.520] I (548) cpu_start: Single core mode
[Jan 20 10:34:20.524] I (552) heap_init: Initializing. RAM available for dynamic allocation:
[Jan 20 10:34:20.531] I (559) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
[Jan 20 10:34:20.537] I (565) heap_init: At 3FFBE9C8 len 00021638 (133 KiB): DRAM
[Jan 20 10:34:20.543] I (572) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM
[Jan 20 10:34:20.550] I (578) heap_init: At 40078000 len 00008000 (32 KiB): IRAM
[Jan 20 10:34:20.556] I (584) heap_init: At 40090E68 len 0000F198 (60 KiB): IRAM
[Jan 20 10:34:20.562] I (590) cpu_start: Pro cpu start user code
[Jan 20 10:34:20.569] I (273) cpu_start: Starting scheduler on PRO CPU.

EXPECTED RESULT:

I expected the I2C bus to run at 1MHz. I have checked that the mlx90640 device runs at 1MHz on a RPi.

Any pointers/tips on how to get the I2C bus to run at 1MHz (if possible) when using mongoose OS will be greatly appreciated.

Thanks

Paul

Sign In or Register to comment.