PacktPublishing / Internet-of-Things-with-ESP32

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

Chapter 3 : Impressive Outputs with Displays #6

Closed HyoChangKim closed 1 year ago

HyoChangKim commented 1 year ago

Organic Light-Emitting Diode Displays (OLEDs) VScode Error i2c: i2c_param_config(644): i2c clock choice is invalid, please check flag and frequency i2c: i2c_set_pin(825): scl and sda gpio numbers are the same

void ssd1306_platform_i2cInit(int8_t busId, uint8_t addr, ssd1306_platform_i2cConfig_t * cfg) { s_bus_id = busId; i2c_config_t conf; conf.mode = I2C_MODE_MASTER; conf.sda_io_num = cfg->sda >= 0 ? cfg->sda : 21; conf.sda_pullup_en = GPIO_PULLUP_ENABLE; conf.scl_io_num = cfg->scl >= 0 ? cfg->scl : 22; conf.scl_pullup_en = GPIO_PULLUP_ENABLE; conf.master.clk_speed = 400000; i2c_param_config(s_bus_id, &conf); // error i2c_driver_install(s_bus_id, conf.mode, 0, 0, 0); }

can't run. Help.

HyoChangKim commented 1 year ago

void ssd1306_platform_i2cInit(int8_t busId, uint8_t addr, ssd1306_platform_i2cConfig_t * cfg) { if (addr) s_i2c_addr = addr; ssd1306_intf.spi = 0; ssd1306_intf.start = &platform_i2c_start; ssd1306_intf.stop = &platform_i2c_stop; ssd1306_intf.send = &platform_i2c_send; ssd1306_intf.close = &platform_i2c_close; ssd1306_intf.send_buffer = &platform_i2c_send_buffer; // init your interface here if ( busId < 0) busId = I2C_NUM_1; s_bus_id = busId;

#if 1
i2c_config_t conf;
memset(&conf, 0, sizeof(conf));
conf.mode = I2C_MODE_MASTER;
conf.sda_io_num = cfg->sda >= 0 ? cfg->sda : 32;
conf.sda_pullup_en = GPIO_PULLUP_ENABLE;
conf.scl_io_num = cfg->scl >= 0 ? cfg->scl : 33;
conf.scl_pullup_en = GPIO_PULLUP_ENABLE;
conf.master.clk_speed = 400000; //I2C_EXAMPLE_MASTER_FREQ_HZ;

#else
i2c_config_t conf = {
    .mode = I2C_MODE_MASTER,
    .sda_io_num = cfg->sda >= 0 ? cfg->sda : 32,
    .sda_pullup_en = GPIO_PULLUP_ENABLE,
    .scl_io_num = cfg->scl >= 0 ? cfg->scl : 33,
    .scl_pullup_en = GPIO_PULLUP_ENABLE,
    .master.clk_speed = 400000,
};
#endif

i2c_param_config(s_bus_id, &conf);
i2c_driver_install(s_bus_id, conf.mode, 0, 0, 0);

// I2C_EXAMPLE_MASTER_RX_BUF_DISABLE, // I2C_EXAMPLE_MASTER_TX_BUF_DISABLE, 0); }

infinite reboot. Help.

HyoChangKim commented 1 year ago
    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

    main.cpp : init_subsystems(); → uisub_init(ui_cfg);
    uisub.cpp : ssd1306_128x64_i2c_initEx(config.oled_scl, config.oled_sda, 0);
    oled_ssd1306.c : ssd1306_i2cInitEx(scl, sda, sa);
    ssd1306_i2c.c : ssd1306_platform_i2cInit(-1, sa, &cfg);
    platform.c : i2c_param_config(s_bus_id, &conf);
HyoChangKim commented 1 year ago

ch5_multisensor error. 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

ozanoner commented 1 year ago

Hi, please make sure you're using the libraries that comes with the repo here: https://github.com/PacktPublishing/Internet-of-Things-with-ESP32/tree/main/common

HyoChangKim commented 1 year ago

Chapter 3 works, but Chapter 5 has an error. https://github.com/PacktPublishing/Internet-of-Things-with-ESP32/tree/main/common

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