PacktPublishing / Internet-of-Things-with-ESP32

Developing IoT Projects with ESP32, published by Packt
MIT License
184 stars 50 forks source link

Chapter 5: Practice – Multisensor for Your Room #7

Closed HyoChangKim closed 1 year ago

HyoChangKim commented 1 year ago

[env:az-delivery-devkit-v4] platform = espressif32 board = az-delivery-devkit-v4 framework = espidf

monitor_speed = 115200 lib_extra_dirs = ../../common/esp-idf-lib/components ../../common/components

E (322) i2c: i2c_param_config(644): i2c clock choice is invalid, please check flag and frequency E (1344) i2c: i2c_set_pin(825): scl and sda gpio numbers are the same

platform.c : i2c_param_config(s_bus_id, &conf); ← error

HyoChangKim commented 1 year ago

how can i get it to work?

https://www.youtube.com/watch?v=watfWATt8S8&list=PLeLcvrwLe187iw968S35Xf2P2NxsqEqBo&index=4

HyoChangKim commented 1 year ago

Currently, only the BMP280 (SCL 22, SDA 21) and SSD1306 (SCL 33, SDA 32) are connected. "BMP280" and "SSD1306" seem to conflict. E (322) i2c: i2c_param_config(644): i2c clock choice is invalid, please check flag and frequency E (1344) i2c: i2c_set_pin(825): scl and sda gpio numbers are the same

HyoChangKim commented 1 year ago

YY␖␂␂␂␂␂�␂��j!�m[0m ␛[0;32mI (41) boot.esp32: SPI Mode : DIO␛[0m ␛[0;32mI (46) boot.esp32: SPI Flash Size : 4MB␛[0m ␛[0;32mI (50) boot: Enabling RNG early entropy source...␛[0m ␛[0;32mI (56) boot: Partition Table:␛[0m ␛[0;32mI (59) boot: ## Label Usage Type ST Offset Length␛[0m ␛[0;32mI (67) boot: 0 nvs WiFi data 01 02 00009000 00006000␛[0m ␛[0;32mI (74) boot: 1 phy_init RF data 01 01 0000f000 00001000␛[0m ␛[0;32mI (82) boot: 2 factory factory app 00 00 00010000 00100000␛[0m ␛[0;32mI (89) boot: End of partition table␛[0m ␛[0;32mI (93) boot_comm: chip revision: 1, min. application chip revision: 0␛[0m ␛[0;32mI (100) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=0a8dch ( 43228) map␛[0m ␛[0;32mI (125) esp_image: segment 1: paddr=0001a904 vaddr=3ffb0000 size=02384h ( 9092) load␛[0m ␛[0;32mI (128) esp_image: segment 2: paddr=0001cc90 vaddr=40080000 size=03388h ( 13192) load␛[0m ␛[0;32mI (136) esp_image: segment 3: paddr=00020020 vaddr=400d0020 size=18cf8h (101624) map␛[0m ␛[0;32mI (176) esp_image: segment 4: paddr=00038d20 vaddr=40083388 size=09c40h ( 40000) load␛[0m ␛[0;32mI (192) esp_image: segment 5: paddr=00042968 vaddr=50000000 size=00010h ( 16) load␛[0m ␛[0;32mI (199) boot: Loaded app from partition at offset 0x10000␛[0m ␛[0;32mI (199) boot: Disabling RNG early entropy source...␛[0m ␛[0;32mI (212) cpu_start: Pro cpu up.␛[0m ␛[0;32mI (213) cpu_start: Starting app cpu, entry point is 0x40081e40␛[0m ␛[0;32mI (0) cpu_start: App cpu up.␛[0m ␛[0;32mI (227) cpu_start: Pro cpu start user code␛[0m ␛[0;32mI (227) cpu_start: cpu freq: 160000000␛[0m ␛[0;32mI (227) cpu_start: Application information:␛[0m ␛[0;32mI (231) cpu_start: Project name: oled_example␛[0m ␛[0;32mI (237) cpu_start: App version: 3ada8b9␛[0m ␛[0;32mI (242) cpu_start: Compile time: Feb 4 2023 10:48:15␛[0m ␛[0;32mI (248) cpu_start: ELF file SHA256: 1f4b0daed253b4b3...␛[0m ␛[0;32mI (254) cpu_start: ESP-IDF: 4.4.2␛[0m ␛[0;32mI (259) heap_init: Initializing. RAM available for dynamic allocation:␛[0m ␛[0;32mI (266) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM␛[0m ␛[0;32mI (272) heap_init: At 3FFB3168 len 0002CE98 (179 KiB): DRAM␛[0m ␛[0;32mI (278) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM␛[0m ␛[0;32mI (284) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM␛[0m ␛[0;32mI (291) heap_init: At 4008CFC8 len 00013038 (76 KiB): IRAM␛[0m ␛[0;32mI (298) spi_flash: detected chip: generic␛[0m ␛[0;32mI (302) spi_flash: flash io: dio␛[0m ␛[0;32mI (307) cpu_start: Starting scheduler on PRO CPU.␛[0m ␛[0;32mI (0) cpu_start: Starting scheduler on APP CPU.␛[0m ␛[0;31mE (317) i2c: i2c_param_config(684): i2c clock choice is invalid, please check flag and frequency␛[0m ␛[0;31mE (1327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (2327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (3327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (4327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (5327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (6327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (7327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (8327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (9327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (10327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (11327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (12327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (13327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (14327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (15327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (16327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (17327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (18327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (19327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (20327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (21327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (22327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (23327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (24327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (25327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (26327) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (27337) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (28337) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (29337) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (30337) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (31337) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (32337) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (33337) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (34337) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (35337) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (36837) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (37847) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (38847) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (39847) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (40847) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (41847) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (42847) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (43847) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (44847) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (45847) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m 101561.91 Pa, 20.63 C, 32.15 % ␛[0;31mE (47347) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (48357) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (49357) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (50357) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (51357) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (52357) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (53357) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (54357) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (55357) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m ␛[0;31mE (56357) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m 101563.91 Pa, 20.62 C, 32.16 % ␛[0;31mE (57857) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same␛[0m

HyoChangKim commented 1 year ago

It seems that the two functions cannot coexist.

static void init_ssd1306(void) { ssd1306_128x64_i2c_initEx(OLED_CLK, OLED_SDA, 0); }

static void init_bmp280(void) { i2cdev_init();

memset(&temp_sensor, 0, sizeof(bmp280_t));
temp_sensor.i2c_dev.timeout_ticks = 0xffff / portTICK_PERIOD_MS;

bmp280_params_t params;
bmp280_init_default_params(&params);

bmp280_init_desc(&temp_sensor, BMP280_I2C_ADDRESS_0, 0, SDA_GPIO, SCL_GPIO);
bmp280_init(&temp_sensor, &params);

}

HyoChangKim commented 1 year ago

Is it not working because I am wrong? Do others work?

HyoChangKim commented 1 year ago

It's an error if together. i2cdev_init(); ssd1306_128x64_i2c_initEx(OLED_CLK, OLED_SDA, 0);

HyoChangKim commented 1 year ago

I wonder if the module connections listed in the book are correct.

For example bme280 and tsl2561.

While connecting together, it seems that one of them is damaged, resulting in a communication failure.

HyoChangKim commented 1 year ago

The author is asked to provide a detailed explanation of the i2c circuit in Chapter 5.

HyoChangKim commented 1 year ago

I'm assuming the source code is ok and asking for a detailed description of the hardware.