Git Product home page Git Product logo

esp-idf-lib's People

Contributors

1kc avatar arlaz avatar axellin avatar bugerdread avatar daschr avatar dianlight avatar dizcza avatar douardda avatar eldritchjs avatar haberturdeur avatar hezy0426 avatar horsemann07 avatar jkallus avatar jmpmscorp avatar juliandoerner avatar klsbecker avatar mattcaron avatar mbuckaway avatar nated0g avatar oisalb avatar qb4-dev avatar rob4226 avatar saasaa avatar shuki25 avatar slimcdk avatar sthing avatar trombik avatar unclerus avatar vonguced avatar weslleymfd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp-idf-lib's Issues

Try to read temperature from single DS18b20

Hi,
I have below code to read temperature from single DS18b20, but it always error.
Please help.


#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#include "sdkconfig.h"
#include "esp_log.h"
#include "esp_event_loop.h"
#include "esp_system.h"
#include "ds18x20.h"

void read_temp(void *pvParameter)
{

ds18x20_addr_t addr = 0x280F090FE40F2233;
float  temp = 0;
esp_err_t err;
while (1)
{
	err = ds18x20_measure(19, addr, true);	
	err = ds18x20_read_temperature(19, addr, &temp);
	printf("Temperature is: %f\n", temp);
	
	vTaskDelay(1000 / portTICK_PERIOD_MS);
}

}

void app_main()
{
xTaskCreate(&read_temp, "read_temp", configMINIMAL_STACK_SIZE, NULL, 5, NULL);
}

Travis CI problem

Building ads1115/...
Python requirements from /home/travis/esp32/esp-idf/requirements.txt are satisfied.
DEFCONFIG
GENCONFIG
App "example-ads111x" version: 7af124f
/home/travis/.travis/functions: line 531:  6822 Terminated              travis_jigger "${!}" "${timeout}" "${cmd[@]}"
Building bh1750/...
Python requirements from /home/travis/esp32/esp-idf/requirements.txt are satisfied.
DEFCONFIG
GENCONFIG
App "example-bh1750" version: 7af124f
/home/travis/.travis/functions: line 531: 12021 Terminated              travis_jigger "${!}" "${timeout}" "${cmd[@]}"
Building bmp180/...
Python requirements from /home/travis/esp32/esp-idf/requirements.txt are satisfied.
DEFCONFIG
GENCONFIG
App "example-bmp180" version: 7af124f
/home/travis/.travis/functions: line 531: 22423 Terminated              travis_jigger "${!}" "${timeout}" "${cmd[@]}"
Building dht/...
Python requirements from /home/travis/esp32/esp-idf/requirements.txt are satisfied.
DEFCONFIG
GENCONFIG
App "example-dht" version: 7af124f
/home/travis/.travis/functions: line 531: 27623 Terminated              travis_jigger "${!}" "${timeout}" "${cmd[@]}"

E (2387) DHTxx: Initialization error, problem in phase 'C'

Device type

  • [] ESP32
  • ESP8226

Framework version

  • [] ESP-IDF latest master
  • [] ESP-IDF 3.2.2
  • [] ESP8266 RTOS SDK latest master
  • ESP8266 RTOS SDK 3.2

Hi,

I tried your DHT (i use DHT11) library and seems it stuck in this phase:

E (2387) DHTxx: Initialization error, problem in phase 'C'

I use GPIO 14 with 4.7k pull up resistor.

unit tests or not

related to #38

some rationales are, I would like to make sure

  • functions does graceful error handling when invalid arguments, input signals, or any inputs, are given
  • a function behave same after modifying code, or refactoring

I am not an expert of device driver development and afraid of mistakes I have always been making. I am thinking that my buildbot server may be used with ESP micro controllers attached, as an optional CI process, which does not get in the way even if failed.

DS1307 module - Time is not restored.

Hi. I use esp32 devkit v1. Idf version is 3.2.2.
I'm able to see the time and it counts every second, no problem about it. I'm writing the time on a screen (which is ILI9341) and trying if the time is lost when I cut the power. I unplug the power and when I plug it in, time is lost. It starts from the beginning. From the time that I wrote in code. It doesn't count while the power is not supplied.
How to solve that? Thanks in advance...

compile error examples/ds3231 and examples/ds1307

I tried to compile these.
esp-idf-lib/examples/ds3231 and esp-idf-lib/examples/ds1307
But compile error occure.

/home/nop/esp-idf-lib/components/hd44780/hd44780.c: In function 'write_nibble':
/home/nop/esp-idf-lib/components/hd44780/hd44780.c:47:29: error: implicit declaration of function 'ets_delay_us' [-Werror=implicit-function-declaration]
 #define toggle_delay() do { ets_delay_us(DELAY_TOGGLE); } while (0)
                             ^
/home/nop/esp-idf-lib/components/hd44780/hd44780.c:65:9: note: in expansion of macro 'toggle_delay'
         toggle_delay();
         ^
/home/nop/esp-idf-lib/components/hd44780/hd44780.c: At top level:
cc1: warning: unrecognized command line option '-Wno-frame-address'
cc1: some warnings being treated as errors
/home/nop/esp-idf/make/component_wrapper.mk:289: recipe for target 'hd44780.o' failed
make[1]: *** [hd44780.o] Error 1
/home/nop/esp-idf/make/project.mk:582: recipe for target 'component-hd44780-build' failed
make: *** [component-hd44780-build] Error 2

My Environment:

freeRTOS version:V8.2.0
NEWLIB version:2.2.0
lwIP version:2-0-3-255
ESP-IDF version:v4.0-dev-512-g6fd535c98

So i added this line.
It's resolve.

sp-idf-lib/components/hd44780/hd44780.c

/**
 * ESP-IDF driver for HD44780 compartible LCD text displays
 *
 * Ported from esp-open-rtos
 * Copyright (C) 2016, 2018 Ruslan V. Uss <[email protected]>
 * BSD Licensed as described in the file LICENSE
 */
#include "hd44780.h"
#include <string.h>
#include <esp_system.h>
#include <esp32/rom/ets_sys.h> // add by nopnop2002

esp-idf-lib/components/max7219/max7219.h

/**
 * @file max7219.h
 *
 * ESP-IDF driver for MAX7219/MAX7221
 * Serially Interfaced, 8-Digit LED Display Drivers
 *
 * Ported from esp-open-rtos
 * Copyright (C) 2017, 2018 Ruslan V. Uss <[email protected]>
 * BSD Licensed as described in the file LICENSE
 */
#ifndef __MAX7219_H__
#define __MAX7219_H__

#include <stdint.h>
#include <stdbool.h>
#include <driver/spi_master.h>
#include <driver/gpio.h> // add by nopnop2002

Wrong usage of tm structure

Device type

  • ESP32

Framework version

  • ESP-IDF latest master

Describe the bug
This library uses full year format (2020) in tm structure whereas according to C documentation it should be using year since 1900 (120 for year 2020), this causes mktime() to return wrong values.

CCS811B

Is anyone working on porting the CCS811B driver over from esp-open-rtos? If not I may attempt in the near future and submit a PR as I will need it in an upcoming project. Great library!

Add product URL, and URL where you can buy it, to an issue template

Describe the bug

when users ask support for new device, there should be a link to product page of the device and its datasheet in the issue. also, another link to aliexpress, ebay, or amazon is a plus, so that someone, one of developers or even the author of the issue, can buy it for development. amazon and aliexpress have wish list, and you can share one of wish lists with others. this way, one can donate the hardware to developers.

here is an example: https://my.aliexpress.com/wishlist/shared.htm?groupId=100000022224314

Problem with DT Sensor

Hi
I am testing a esp32 board with a DT22 sensor according to the example. However, a get many erros. There is also a correct reading, but most of the times a got a error.
Any idea?
Br
Gilberto

E (161083) DHTxx: Initialization error, problem in phase 'B'
Could not read data from sensor
E (161403) DHTxx: Initialization error, problem in phase 'B'
Could not read data from sensor
E (161723) DHTxx: Initialization error, problem in phase 'B'
Could not read data from sensor
Humidity: 59% Temp: 23C

Library imported correctly but esp32 is restarting.

Devcie type

  • ESP32
    Framework version
  • ESP-IDF latest master
    I have to interface dht22 sensor in ESP32 using esp-idf.I refered https://github.com/UncleRus/esp-idf-lib for dht22 and i was unable to include the dht lib.Can you please help me with the CmakeList.txt file and the Make file to include path.The issue after following the procedure in above link is that esp32 is restarting.I didnt know how CmakeList file works.
    Screenshot of the errors after flashing the code in it.
    1
    2
    3

Error 'Could not take device mutex' in BME680 example

Devcie type

  • ESP32

Framework version

  • ESP-IDF latest master

Describe the bug
Error in executing the BME680 example:
I2C_DEV: [0x77 at 0] Could not take device mutex
This error happens inside bme680_set_oversampling_rates() when it is called by bme680_init_sensor() because the i2c_dev is already locked by the calling method.

Appreciate you look into this issue and many thanks for the great efforts.

Trying to use ds1307 with ssd1306 oled

Devcie type

  • ESP32

Framework version

  • ESP-IDF latest master

Describe the bug
I am using https://github.com/TaraHoleInIt/tarablessd1306 to drive the oled. When i try to use both in the same code, ESP crashes.

Error Log from serial monitor
Code:

// #include <stdio.h>
// #include <freertos/FreeRTOS.h>
// #include <freertos/task.h>
// #include "ds1307.h"
// #include <string.h>
// #include "esp_log.h"

#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "ssd1306.h"
#include "ssd1306_draw.h"
#include "ssd1306_font.h"
#include "ssd1306_default_if.h"
#include "ds1307.h"

#define SDA_GPIO 5
#define SCL_GPIO 18

void ds1307_test(void *pvParameters)
{
    i2c_dev_t dev;
    memset(&dev, 0, sizeof(i2c_dev_t));

    ESP_ERROR_CHECK(ds1307_init_desc(&dev, 0, SDA_GPIO, SCL_GPIO));
    struct tm time ;
    // = {
    //     .tm_year = 2020,
    //     .tm_mon  = 4,  // 0-based
    //     .tm_mday = 15,
    //     .tm_hour = 01,
    //     .tm_min  = 01,
    //     .tm_sec  = 00
    // };
    // ds1307_set_time(&dev, &time);

    while (1)
    {
        ds1307_get_time(&dev, &time);

        printf("%04d-%02d-%02d %02d:%02d:%02d\n", time.tm_year, time.tm_mon + 1,
            time.tm_mday, time.tm_hour, time.tm_min, time.tm_sec);

        vTaskDelay(500 / portTICK_PERIOD_MS);
    }
}


#define USE_I2C_DISPLAY
#define USE_SPI_DISPLAY

#if defined USE_I2C_DISPLAY
    static const int I2CDisplayAddress = 0x3C;
    static const int I2CDisplayWidth = 128;
    static const int I2CDisplayHeight = 64;
    static const int I2CResetPin = -1;

    struct SSD1306_Device I2CDisplay;
#endif

#if defined USE_SPI_DISPLAY
    static const int SPIDisplayChipSelect = 15;
    static const int SPIDisplayWidth = 128;
    static const int SPIDisplayHeight = 64;
    static const int SPIResetPin = 5;

    struct SSD1306_Device SPIDisplay;
#endif

static struct SSD1306_Device* Displays[ ] = {
#if defined USE_I2C_DISPLAY
    &I2CDisplay,
#endif
#if defined USE_SPI_DISPLAY
    &SPIDisplay,
#endif
    NULL
};

const int DisplayCount = sizeof( Displays ) / sizeof( Displays[ 0 ] );

const struct SSD1306_FontDef* FontList[ ] = {
    &Font_droid_sans_fallback_11x13,
    &Font_droid_sans_fallback_15x17,
    &Font_droid_sans_fallback_24x28,
    &Font_droid_sans_mono_7x13,
    &Font_droid_sans_mono_13x24,
    &Font_droid_sans_mono_16x31,
    &Font_liberation_mono_9x15,
    &Font_liberation_mono_13x21,
    &Font_liberation_mono_17x30,
    NULL
};

const int FontCount = sizeof( FontList ) / sizeof( FontList[ 0 ] );

void SetupDemo( struct SSD1306_Device* DisplayHandle, const struct SSD1306_FontDef* Font );
void SayHello( struct SSD1306_Device* DisplayHandle, const char* HelloText );

bool DefaultBusInit( void ) {
    #if defined USE_I2C_DISPLAY
        assert( SSD1306_I2CMasterInitDefault( ) == true );
        assert( SSD1306_I2CMasterAttachDisplayDefault( &I2CDisplay, I2CDisplayWidth, I2CDisplayHeight, I2CDisplayAddress, I2CResetPin ) == true );
    #endif

    #if defined USE_SPI_DISPLAY
        assert( SSD1306_SPIMasterInitDefault( ) == true );
        assert( SSD1306_SPIMasterAttachDisplayDefault( &SPIDisplay, SPIDisplayWidth, SPIDisplayHeight, SPIDisplayChipSelect, SPIResetPin ) == true );
    #endif

    return true;
}

void FontDisplayTask( void* Param ) {
    struct SSD1306_Device* Display = ( struct SSD1306_Device* ) Param;
    int NextFontTime = 0;
    int i = 0;

    if ( Param != NULL ) {
        for ( i = 0; i < FontCount && FontList[ i ] != NULL; i++ ) {
            if ( FontList[ i ] != NULL ) {
                SSD1306_SetFont( Display, FontList[ i ] );
                NextFontTime = time( NULL ) + 2;

                while ( time( NULL ) < NextFontTime ) {
                    SSD1306_Clear( Display, SSD_COLOR_BLACK );
                    SSD1306_FontDrawAnchoredString( Display, TextAnchor_Center, "Hello!", SSD_COLOR_WHITE );
                    SSD1306_Update( Display );

                    vTaskDelay( pdMS_TO_TICKS( 100 ) );
                }

                printf( "On to next font\n" );
            }
        }
    }

    printf( "Finished!\n" );
    vTaskDelete( NULL );
}

void app_main( void ) {
    int i = 0;
    xTaskCreate(ds1307_test, "ds1307_test", 2048, NULL, 5, NULL);
    printf( "Ready...\n" );

    if ( DefaultBusInit( ) == true ) {
        printf( "BUS Init lookin good...\n" );
        printf( "Drawing.\n" );

        for ( i = 0; i < DisplayCount; i++ ) {
            if ( Displays[ i ] != NULL ) {
                xTaskCreate( FontDisplayTask, "FontDisplayTask", 4096, Displays[ i ], 1, NULL );
            }
        }
    }
}

DS18X20 abort() was called at PC 0x4008267b

Devcie type

  • ESP32

Framework version

  • ESP-IDF latest master

Describe the bug
When I try read temperature from ds18b20 sensor I get maximally one read (not correct) and next I get error like this
`abort() was called at PC 0x4008267b on core 1
0x4008267b: lock_acquire_generic at /home/dominik/esp32/esp-idf/components/newlib/locks.c:143

ELF file SHA256: 1f7ff62be29ee34dc166c893d75f93478221a9afea43bbb21f3208096a0dbef4

Backtrace: 0x40084a45:0x3ffb9460 0x40084dc9:0x3ffb9480 0x4008267b:0x3ffb94a0 0x400827a5:0x3ffb94d0 0x400dce1a:0x3ffb94f0 0x400dfe29:0x3ffb9800 0x40081db5:0x3ffb9830 0x400d4b21:0x3ffb9880 0x400d3e23:0x3ffb98e0 0x400d40e4:0x3ffb9920 0x400d3b98:0x3ffb9940 0x400d3dd1:0x3ffb9960 0x400d3ab8:0x3ffb9980 0x40086fe5:0x3ffb9a20
0x40084a45: invoke_abort at /home/dominik/esp32/esp-idf/components/esp32/panic.c:157

0x40084dc9: abort at /home/dominik/esp32/esp-idf/components/esp32/panic.c:174

0x4008267b: lock_acquire_generic at /home/dominik/esp32/esp-idf/components/newlib/locks.c:143

0x400827a5: _lock_acquire_recursive at /home/dominik/esp32/esp-idf/components/newlib/locks.c:171

0x400dce1a: _vfprintf_r at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/vfprintf.c:853 (discriminator 2)

0x400dfe29: vprintf at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/vprintf.c:34

0x40081db5: esp_log_write at /home/dominik/esp32/esp-idf/components/log/log.c:219

0x400d4b21: gpio_config at /home/dominik/esp32/esp-idf/components/driver/gpio.c:354 (discriminator 9)

0x400d3e23: setup_pin at /home/dominik/esp32/esp-idf-lib/components/onewire/onewire.c:69 (discriminator 4)

0x400d40e4: onewire_power at /home/dominik/esp32/esp-idf-lib/components/onewire/onewire.c:228

0x400d3b98: ds18x20_measure at /home/dominik/esp32/esp-idf-lib/components/ds18x20/ds18x20.c:65

0x400d3dd1: ds18x20_measure_and_read_multi at /home/dominik/esp32/esp-idf-lib/components/ds18x20/ds18x20.c:142

0x400d3ab8: ds18x20_test at /run/media/dominik/Data2/Programming/ESP32/ds18b20_and_dht_sensors/build/../main/main.c:54

0x40086fe5: vPortTaskWrapper at /home/dominik/esp32/esp-idf/components/freertos/port.c:143
`

.travisci.yml should support ESP-IDF Release v3.3.1

Devcie type

  • ESP32
  • ESP8226

Framework version

  • ESP-IDF latest master
  • ESP-IDF 3.2.2
  • ESP-IDF 3.3.1
  • ESP8266 RTOS SDK latest master
  • ESP8266 RTOS SDK 3.2

Describe the bug

the latest stable release is v3.3.1. but the test does not support it.

Not able to display text properly over MAX7219 LED

Hello,

We are planning to use MAX7219 Total 3 LEDs with ESP32 Dev Kit C V4 with cascaded method.

We have ported all files from this component and created one task with below example shown.

`/******************************************************************************

  • FunctionName : max7129_task

  • Description : This function will Configure SPI bus with MAX7129

  • Parameters : none

  • Returns : none
    *******************************************************************************/
    void max7129_task()
    {
    esp_err_t ret;

      // Configure SPI bus
      spi_bus_config_t cfg = {
                      .mosi_io_num = PIN_NUM_MOSI,
                      .miso_io_num = -1,
                      .sclk_io_num = CLK_PIN,
                      .quadwp_io_num = -1,
                      .quadhd_io_num = -1,
                      .max_transfer_sz = 0,
                      .flags = 0
      };
      ret = spi_bus_initialize(HOST, &cfg, 1);
      ESP_ERROR_CHECK(ret);
      // Configure device
      max7219_t dev = { .cascade_size = 3, .digits = 8, .mirrored = true };
    
      ret = max7219_init_desc(&dev, HOST, CS_PIN);
      ESP_ERROR_CHECK(ret);
    
      char buf[9];
    
      ret = max7219_init(&dev);
      ESP_ERROR_CHECK(ret);
    
      while (1) {
              DEBUG_LOGI(UART, TAG, "Display STRING\n");
    
              max7219_clear(&dev);
              max7219_draw_text_7seg(&dev, 0, "7219TEST");
              vTaskDelay(DELAY / portTICK_PERIOD_MS);
    

// max7219_clear(&dev);
// sprintf(buf, "%2.4f A", 34.6782);
// max7219_draw_text_7seg(&dev, 0, buf);
// vTaskDelay(DELAY / portTICK_PERIOD_MS);

            DEBUG_LOGI(UART, TAG, "Display DIGIT\n");
            max7219_clear(&dev);
            sprintf(buf, "%08x", 12345678);
            max7219_draw_text_7seg(&dev, 0, buf);
            vTaskDelay(DELAY / portTICK_PERIOD_MS);
    }

}`

We have compiled it with ESP32 IDF 3.2 and flashed into development kit but not getting proper scrolling string like we got using Arduino example over same board.

I have uploaded sample video with 3 LEDs for reference purpose in which you can see issue which we are facing.

Let me know if need anything else from my end to resolve issue.

Regards,
Ritesh Prajapati
VID_20200424_181201_ESP32_IDF.zip

i2c driver install error

Hello everyone.
I'm having trouble with the library for pcf8575.
After successfully compiling, the esp32 on serial gives me this output:

[1B][0;31mE (0) i2c: C:\Users\Winny.platformio\packages\framework-espidf\components\driver\i2c.c:335 (i2c_driver_delete):i2c driver install error[1B][0m
[1B][0;31mE (10) I2C_DEV: Could not write to device [0x20 at 0]: 263[1B][0m

The hardware is properly installed, I also did other tests with another software is the device pcf8575 is normally seen at 0x20.

Any suggestions?

Im CMakeLists noob

Hello, when I compile the project I get:

  • undefined reference to `ds1302_init'
  • undefined reference to `ds1302_set_write_protect'
  • undefined reference to `ds1302_get_time'

Do you have any ideas what I could have missed?

HELP i2cdev

Hi,

I thank you very much for the work you did for those code es-idf-lib

i dont understand well how it work ur library i2cdev with mutex...i think we use it to make sur that port interface esp32 (0,1) its used by one device at same time ....? what is the advantage of this driver ?

so if i want to connect Multiple Sensors using an I2C Multiplexer like TCA9548A with another device OLED SSD1306, ADC mcp3428 ... or run i2cscanner, i must use i2cdev ?

Best regards,

ds1307 example xQueueGenericReceive - assertion

No matter what I do, I can't get the example of the ds1307 to run. always gives me the following:

[...]
V (13) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (13) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xE
D (18) intr_alloc: Connected src 46 to int 2 (cpu 0)
V (23) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (29) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xC0E
D (37) intr_alloc: Connected src 57 to int 3 (cpu 0)
V (42) esp_dbg_stubs: esp_dbg_stubs_init stubs 3ffbfea4
V (48) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (53) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0x40E
D (61) intr_alloc: Connected src 24 to int 9 (cpu 0)
I (67) cpu_start: Starting scheduler on PRO CPU.
V (0) intr_alloc: esp_intr_alloc_intrstatus (cpu 1): checking args
V (0) intr_alloc: esp_intr_alloc_intrstatus (cpu 1): Args okay. Resulting flags 0x40E
D (10) intr_alloc: Connected src 25 to int 2 (cpu 1)
I (10) cpu_start: Starting scheduler on APP CPU.
D (116) heap_init: New heap initialised at 0x3ffe0440
D (116) heap_init: New heap initialised at 0x3ffe4350
V (126) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (126) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xE
D (126) intr_alloc: Connected src 16 to int 12 (cpu 0)
V (146) I2C_DEV: [0x68 at 0] creating mutex
V (146) I2C_DEV: [0x68 at 0] taking mutex
/home/marco/dev/iot/esp32/esp-idf/components/freertos/queue.c:1448 (xQueueGenericReceive)- assert failed!
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.

I am running the example unmodified.
ds1307

ds18 sensor not detected!!

i am using esp-idf version 4.1 and the ds18 example code is correctly complied but after flashing on esp32 and in monitor it is only showing "sensor not detected".I have connected ds18 on gpio17 with pullup resistor 4.7k in between vcc and data pin.
Screenshot from 2020-01-10 17-58-35

New feature: VS1053 support

Device type

  • ESP8226

Framework version

  • ESP8266 RTOS SDK latest master
  • ESP8266 RTOS SDK 3.2

Describe the bug
Is there any chance you could add support for VS1053 board?

HX711 ESP-IDF v4.0 incompatibility error

Devcie type
ESP32

Framework version
ESP-IDF latest master 4.0

Describe the bug
The HX711 driver does not work with IDF 4.0

In file included from C:/Users/mattb/esp-idf/components/esp_eth/src/esp_eth.c:15:0:
../../../../components/newlib/include/stdatomic.h: In function 'atomic_flag_test_and_set_explicit':
../../../../components/newlib/include/stdatomic.h:271:31: error: request for member '__val' in something not a structure or union
__atomic_exchange_n(&(object)->__val, desired, #order)

This is based off of the same error and proposed solution from this issue OLIMEX/ESP32-POE#8

mcp23017 library problem

Hello. Have some problem with mcp23017_port_write() function. When i call it i see in monitor
E (751) i2c: /home/kshyshki/esp/esp-idf/components/driver/i2c.c:335 (i2c_driver_delete):i2c driver install error E (771) i2c: /home/kshyshki/esp/esp-idf/components/driver/i2c.c:870 (i2c_set_pin):this i2c pin does not support internal pull-up
Try difference pins for i2c (21,22; 16,17 (as in your example)), problem the same...

mcp23017_port_write() return ESP_ERR_INVALID_ARG,

Thank you for advance for your reply.

Enhancement: PCF8574/Pull-up

Device type

  • ESP32
  • ESP8226

Framework version

  • ESP-IDF latest master
  • ESP8266 RTOS SDK latest master

Certain PCF8574 based IO expanders seem to work with ESP internal pull-ups disabled while others do not. I tested the hd44780_i2c example with various displays. With internal pull-ups disabled some displays simply did not show anything and the application failed with an error indicating that write to device at address 0x27 failed (line 57). Generally enabling the ESP internal pull-ups made all displays work.

So I applied the following change to pcf8574.c generally enabling the internal pull-ups.
pcf8574.txt

Another option would be giving explicit control over the pull-up settings by adding parameters to pcf8574_init_desc.

bmp280 - FORCED mode device busy state is tested unreliably

Hello,
I used BMP280 sensor in FORCED mode.
Code that performed measurement reading looked like this:

bmp280_force_measurement(&dev);
do { bmp280_is_measuring(&dev, &busy); } while(busy);

However, it seemed that bmp280_is_measuring() always returned busy=false immediately after call to bmp280_force_measurement(). As the result, I received data measured at previous cycle.

I suggest modification to implementation of bmp280_is_measusing() function. Additionally to checking bit 3 in status register, I propose to check current operation mode. When mode is set to FORCED, device should be considered busy even if bit 3 in status register is 0. As the BMP280 datasheet states, the device should return to SLEEP mode after measurement cycle.

Suggested modified version of bmp280_is_measuring():

esp_err_t bmp280_is_measuring(bmp280_t *dev, bool *busy)
{
CHECK_ARG(dev);
CHECK_ARG(busy);

I2C_DEV_TAKE_MUTEX(&dev->i2c_dev);

const uint8_t regs[2] = { BMP280_REG_STATUS, BMP280_REG_CTRL };
uint8_t status[2];
CHECK_LOGE(dev, i2c_dev_read(&dev->i2c_dev, regs, 2, status, 2), "Could not read status registers");

// FORCED mode means BM280 is busy - it switches to SLEEP mode when finished
// Additionally, 'measuring' bit in status register is checked
*busy = (status[1] & 0b11) == BMP280_MODE_FORCED || (status[0] & (1 << 3));

I2C_DEV_GIVE_MUTEX(&dev->i2c_dev);

return ESP_OK;

}

SHT31 IDF 4.1 error

Device type

  • ESP32 (esp32-devkitc-v4)

Framework version

  • ESP-IDF release/4.1 branch (ESP-IDF v4.1-beta1-182-g9778b163b)

Describe the bug
I have been testing sht3x component example. Program always fail and reset at sht3x_init(&dev), and the error shown is:

 E (315) I2C_DEV: Could not write to device [0x44 at 0]: -1
ESP_ERROR_CHECK failed: esp_err_t 0xffffffff (ESP_FAIL) at 0x400861f0
0x400861f0: _esp_error_check_failed at D:/esp-idf_4.1/components/esp32/panic.c:739

file: "../main/main.c" line 145
func: app_main
expression: sht3x_init(&dev)

ELF file SHA256: d99006b6ec61c296

Backtrace: 0x40085c45:0x3ffb4830 0x400861f3:0x3ffb4850 0x400d3dbd:0x3ffb4870 0x400d0d0a:0x3ffb48a0 0x400884d1:0x3ffb48c0
0x40085c45: invoke_abort at D:/esp-idf_4.1/components/esp32/panic.c:157

0x400861f3: _esp_error_check_failed at D:/esp-idf_4.1/components/esp32/panic.c:740

0x400d3dbd: app_main at E:\JM\Code\esp-idf\sht31_test\build/../main/main.c:145 (discriminator 1)

0x400d0d0a: main_task at D:/esp-idf_4.1/components/esp32/cpu_start.c:564

0x400884d1: vPortTaskWrapper at D:/esp-idf_4.1/components/freertos/port.c:143


Rebooting...

I have tried many pin combinations, downgrade I2C_FREQ_HZ at source component to 100kHz and 400kHz but error always appears.

I have tested sensor in another Arduino board (1284p MCU) with Arduino framework and sensor measurement works perfectly. Also, I have tried same sensor with same esp-devkitc board using Arduino framework instead of IDF framework and board and sensor work great too.

Some days ago, I noticed similar issue with bme280. Reading issues, I found that we should update lib to last version and, done it, bme280 worked again. However, sht31 seems, at least mine, not to work yet.

Could you give me any tip?

Thanks in advance.

(i2c_driver_delete):i2c driver install error

Hello,
While running the ds3231 i am getting the below error in log screen.

components/driver/i2c.c:355 (i2c_driver_delete):i2c driver install error

What shall i need to do to fix these error? .
My IDF version : v4.0-dev-459-gba1ff1692-dirty

Wrong path in `EXTRA_COMPONENTS_DIR`.

Probably I am missing any point, but i still can't use it. Could you please help me?

Wrong path in EXTRA_COMPONENTS_DIR.
Please use full path like this:
EXTRA_COMPONENTS_DIR = /home/<username>/esp/esp-idf-lib/components

Originally posted by @UncleRus in #93 (comment)

BME680 example gives zero values for temp, humidity and pressure with ESP32

Device type

  • ESP32 (DOIT dev board) --> with error
  • ESP8226 (ESP12f) --> working

Framework version

  • ESP-IDF 3a9228fa02e933a28b15a335480fcc5e6f9d567a
  • esp-idf-lib 438dbbb

Describe the bug
I am seeing different results running the BME680 example code on an ESP12f and ESP32. Siee los attached.

Both chips recognize the sensor via I2C, but the ESP32 keeps converting the RAW data to zero

D (1774) BME680: Started measurement
D (1924) BME680: Raw data: 505721 524288 20095 873 8
D (1924) BME680: Fixed point sensor values - 0/100 deg.C, 0/1000 %, 0 Pa, 24661 Ohm
BME680 Sensor: 0.00 °C, 0.00 %, 0.00 hPa, 24661.00 Ohm

The ESP12f on the other hand works fine:

D (2458) BME680: Started measurement
D (2599) BME680: Raw data: 502435 524288 20547 462 10
D (2601) BME680: Fixed point sensor values - 2704/100 deg.C, 50947/1000 %, 0 Pa, 8099 Ohm
BME680 Sensor: 27.04 °C, 50.95 %, 0.00 hPa, 8099.00 Ohm

The BME is powerd by 3.3V from the board.
I an not sure if there could be something in the sdkconfig that messes up the configuration of the sensor / i2c, but I can not imagine what that would be.

sdkconfig.defaults.esp12f.txt
sdkconfig.defaults.esp32.txt
esp12f.log
esp32.log

Can't add the components - fatal error: hd44780.h: No such file or directory

I'm trying to add the components as described in the readme.md:

CMAKELISTS:

set(COMPONENT_SRCS "hello_world_main.c")
set(COMPONENT_ADD_INCLUDEDIRS "")
set(EXTRA_COMPONENT_DIRS /~/esp/esp-idf-lib/components)
register_component()



MAKEFILE:

PROJECT_NAME := hello-world
EXTRA_COMPONENT_DIRS := /~/esp/esp-idf-lib/components
include $(IDF_PATH)/make/project.mk


Screenshot from 2020-07-05 23-06-43

and my components folder is in: ~/esp/esp-idf-lib/components:

Screenshot from 2020-07-05 23-08-28

but, when i do make flash all i receive is: fatal error: hd44780.h: No such file or directory

Examples cannot be built with esp-idf v3.2.2

Tried to compile the mcp23017 example program for a esp32 lyrat board but it doesn't appear to be compatible with esp-idf v3.2.2. I looked at dht.c and it's looking for a define for CONFIG_IDF_TARGET_ESP32 but I thought I read that this isn't for the esp8266 anyway. There's no mention of any special config steps needed in the README.md files. There are several other files that are also looking for this define. Did I miss something?

CC build/esp32/hwcrypto/aes.o
AS build/esp32/dport_panic_highint_hdl.o
AR build/esp32/libesp32.a
CC build/dht/dht.o
/home/jponko/esp/esp-idf-lib/components/dht/dht.c: In function 'dht_read_data':
/home/jponko/esp/esp-idf-lib/components/dht/dht.c:177:5: error: 'PORT_ENTER_CRITICAL' undeclared (first use in this function)
PORT_ENTER_CRITICAL;
^
/home/jponko/esp/esp-idf-lib/components/dht/dht.c:177:5: note: each undeclared identifier is reported only once for each function it appears in
/home/jponko/esp/esp-idf-lib/components/dht/dht.c:179:5: error: 'PORT_EXIT_CRITICAL' undeclared (first use in this function)
PORT_EXIT_CRITICAL;
^
/home/jponko/esp/esp-idf-v3.2.2/make/component_wrapper.mk:285: recipe for target 'dht.o' failed
make[1]: *** [dht.o] Error 1
/home/jponko/esp/esp-idf/make/project.mk:530: recipe for target 'component-dht-build' failed
make: *** [component-dht-build] Error 2

Got some errors on DS1307 - ESP32

Device type

  • ESP32

Framework version

  • ESP-IDF v3.3

Description of the bug
Hi. Firstly I have to say that I'm new on Esp32 world. I've tried to flash the example code of DS1307. And got those lines of messages as follows repeatedly. What is the reason could be? I'll be very much appreciated if somebody can help...

The messages I got after I make monitor;

Rebooting...
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:6344
load:0x40078000,len:11624
load:0x40080400,len:6648
entry 0x40080764
I (29) boot: ESP-IDF v3.3 2nd stage bootloader
I (29) boot: compile time 23:39:26
I (29) boot: Enabling RNG early entropy source...
I (33) boot: SPI Speed : 40MHz
I (38) boot: SPI Mode : DIO
I (42) boot: SPI Flash Size : 4MB
I (46) boot: Partition Table:
I (49) boot: ## Label Usage Type ST Offset Length
I (56) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (64) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (71) boot: 2 factory factory app 00 00 00010000 00100000
I (79) boot: End of partition table
I (83) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x0af40 ( 44
864) map
I (108) esp_image: segment 1: paddr=0x0001af68 vaddr=0x3ffb0000 size=0x01ed8 (
7896) load
I (111) esp_image: segment 2: paddr=0x0001ce48 vaddr=0x40080000 size=0x00400 (
1024) load
0x40080000: _WindowOverflow4 at C:/msys32/home/Musab/esp/esp-idf/components/free
rtos/xtensa_vectors.S:1779

I (115) esp_image: segment 3: paddr=0x0001d250 vaddr=0x40080400 size=0x02dc0 ( 1
1712) load
I (128) esp_image: segment 4: paddr=0x00020018 vaddr=0x400d0018 size=0x15054 ( 8
6100) map
0x400d0018: _flash_cache_start at ??:?

I (163) esp_image: segment 5: paddr=0x00035074 vaddr=0x400831c0 size=0x062bc ( 2
5276) load
0x400831c0: spi_flash_mmap at C:/msys32/home/Musab/esp/esp-idf/components/spi_fl
ash/flash_mmap.c:320

I (179) boot: Loaded app from partition at offset 0x10000
I (179) boot: Disabling RNG early entropy source...
I (180) cpu_start: Pro cpu up.
I (183) cpu_start: Application information:
I (188) cpu_start: Project name: example-ds1307
I (194) cpu_start: App version: 1
I (198) cpu_start: Compile time: Nov 15 2019 23:39:55
I (204) cpu_start: ELF file SHA256: 23b3a89ef017dc9a...
I (210) cpu_start: ESP-IDF: v3.3
I (215) cpu_start: Starting app cpu, entry point is 0x40080f54
0x40080f54: call_start_cpu1 at C:/msys32/home/Musab/esp/esp-idf/components/esp32
/cpu_start.c:270

I (207) cpu_start: App cpu up.
I (225) heap_init: Initializing. RAM available for dynamic allocation:
I (232) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (238) heap_init: At 3FFB2F38 len 0002D0C8 (180 KiB): DRAM
I (245) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (251) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (257) heap_init: At 4008947C len 00016B84 (90 KiB): IRAM
I (263) cpu_start: Pro cpu start user code
I (282) cpu_start: Chip Revision: 1
W (282) cpu_start: Chip revision is higher than the one configured in menuconfig
. Suggest to upgrade it.
I (285) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
E (0) i2c: C:/msys32/home/Musab/esp/esp-idf/components/driver/i2c.c:335 (i2c_dri
ver_delete):i2c driver install error
E (10) I2C_DEV: Could not write to device [0x68 at 0]: -1

ESP_ERROR_CHECK failed: esp_err_t 0xffffffff (ESP_FAIL) at 0x40085290
0x40085290: _esp_error_check_failed at C:/msys32/home/Musab/esp/esp-idf/componen
ts/esp32/panic.c:720

file: "C:/msys32/home/Musab/esp/workspace/rtcson/examples/ds1307/main/main.c" li
ne 31
func: ds1307_test
expression: ds1307_set_time(&dev, &time)

ELF file SHA256: 23b3a89ef017dc9aee44448e2acb362b2d5ea0517fdf868f1fe1d87ed90bf3f
1

Backtrace: 0x40084e2c:0x3ffb8080 0x40085293:0x3ffb80a0 0x400d24ae:0x3ffb80c0 0x4
00878c1:0x3ffb8140
0x40084e2c: invoke_abort at C:/msys32/home/Musab/esp/esp-idf/components/esp32/pa
nic.c:715

0x40085293: _esp_error_check_failed at C:/msys32/home/Musab/esp/esp-idf/componen
ts/esp32/panic.c:721

0x400d24ae: ds1307_test at C:/msys32/home/Musab/esp/workspace/rtcson/examples/ds
1307/main/main.c:31 (discriminator 1)

0x400878c1: vPortTaskWrapper at C:/msys32/home/Musab/esp/esp-idf/components/free
rtos/port.c:403

I2c problems

Is it possible to have some examples regarding the i2c device and if possible also of the device pcf8575?

I can't understand many things about it, and I would have some examples, maybe even an initial configuration :-(

Timeout Error On Multiple Sesnors

I am getting the following log (with variation in address) while using your library which looks awesome BTW. I have done a simple scan and all 3 addresses on the network report properly. The examples all fail on the _init commands, sht3x_init(&dev); and bmp280_init(&dev, &params);

I am on IDF version v4.0-beta2 and I have adjusted timeout from 1 to 5 seconds.

V (7759) I2C_DEV: [0x44 at 0] creating mutex
V (7759) I2C_DEV: [0x44 at 0] taking mutex
D (7769) I2C_DEV: Reconfiguring I2C driver on port 0
V (7769) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (7779) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xE
D (7789) intr_alloc: Connected src 49 to int 13 (cpu 0)
D (7789) I2C_DEV: I2C driver successfully reconfigured on port 0
E (12799) I2C_DEV: Could not write to device [0x44 at 0]: 263
V (12799) I2C_DEV: [0x44 at 0] giving mutex
ESP_ERROR_CHECK failed: esp_err_t 0x107 (ESP_ERR_TIMEOUT) at 0x4008d164

BME280 Error: Could not read from device [0x77 at 0]: 263

Devcie type

  • ESP32

Framework version

  • ESP-IDF latest master

Using Library

  • bmp280

Hello! I am using a library bmp280, sensor bme280. I compile the program from the examples folder. I use GPIOs 21,22 with 4.7k pull up resistor. After power up, I see in serial monitor the following:

E (4000) I2C_DEV: Could not read from device [0x77 at 0]: 263
E (4000) BMP280: Sensor not found
ESP_ERROR_CHECK failed: esp_err_t 0x107 (ESP_ERR_TIMEOUT) at 0x40086304

This sensor works great with other libraries in the Arduino environment. I compared the signals in both cases with the help of logic analyzer. On this image I see that the sensor responds to the read request BMP280_REG_ID register, but the program does not see this, and driver wait 1000ms timeout.
1

What could cause this problem? Frequency clock I decreased to 100kHz.
Please, help me!

DRIVER FOR mcp3428

I am requesting a driver for mcp3428.

Device description

The MCP3428 is a four channel low-noise, high accuracy delta-sigma A/D converter with differential inputs and up to 16 bits of resolution. The on-board precision 2.048V reference voltage enables an input range of ±2.048V differentially. The device uses a two-wire I2C™ compatible serial interface and operates from a single power supply ranging from 2.7V to 5.5V.

MCP3428 is a chip to do a great thing. It supports only 2C. It
.

Device information

http://ww1.microchip.com/downloads/en/DeviceDoc/22226a.pdf

The product information and the data sheet can be found at:

https://webge.github.io/MCP342x/

Purchasing the product

The device can be purchased at:

  • Aliexpress
  • Amazon
  • ebay
  • Digi-Key

my library mcp3428 without i2cdev :

/*************************************************************** file .c  ****************************************************/
#define ACK_VAL 0x0
#define NACK_VAL 0x1


static const char *TAG = "MCP3428";

int adc_mcp3428_read(Channel_Selection_t chx,Sample_Rate_Selection_t resolutionx,Gain_Selection_t Gainx) {
	
	uint8_t Config_Register =0b00010000;//RDY: Ready Bit = 0 and O/C: Conversion Mode Bit = 1
	Config_Register = (Config_Register | (chx<<5) | (resolutionx<<2) | (Gainx) );

	//printf("Config_Register : HEX %0x and DEC %d\n",Config_Register,Config_Register);

    vTaskDelay(100 / portTICK_PERIOD_MS);
    /********************************************************************************************/
    i2c_cmd_handle_t cmd = i2c_cmd_link_create ( ) ;
    i2c_master_start ( cmd ) ;
    i2c_master_write_byte ( cmd ,  ( 0x69 <<  1 )  | I2C_MASTER_WRITE ,  true ) ;
    i2c_master_write_byte ( cmd , Config_Register ,  true );//0x10 ch1 //0x30 ch2 //0x50 ch3 //0x 70 ch4
   // i2c_master_write_byte ( cmd ,  0x00 ,  true );
    //i2c_master_write ( cmd , data_array , data_size ,  true ) ;

    //i2c_master_stop ( cmd ) ;
    //i2c_master_cmd_begin(I2C_NUM_0, cmd, 1000 / portTICK_RATE_MS);
     /********************************************************************************************/
    uint8_t first_byte , second_byte ;
    //cmd = i2c_cmd_link_create ( ) ;
    i2c_master_start ( cmd ) ;
    i2c_master_write_byte ( cmd ,  ( 0x69  <<  1 )  | I2C_MASTER_READ ,  true ) ;
    i2c_master_read_byte ( cmd ,  & first_byte , ACK_VAL ) ;
    i2c_master_read_byte ( cmd ,  & second_byte ,NACK_VAL ) ;
    i2c_master_stop ( cmd ) ;
    esp_err_t res =i2c_master_cmd_begin ( I2C_NUM_0 , cmd ,  1000  / portTICK_RATE_MS ) ;
    if (res != ESP_OK)
             ESP_LOGE(TAG, "Could not read from device");
    i2c_cmd_link_delete ( cmd ) ;
    /********************************************************************************************/
	//printf("first byte :  %d\n",first_byte);
	//printf("second byte : %d\n",second_byte);
	// Convert the data to 12-bits
	int raw_adc = (( first_byte & 0x0F) * 256 +  second_byte);
    /********************************************************************************************/
    //printf("raw_adc:%d\n",raw_adc);
	return raw_adc;

}
/************************************************************ file.h*********************************************************/
#ifndef MCP3428_H_
#define MCP3428_H_



#define ACK_VAL 0x0
#define NACK_VAL 0x1



typedef enum {
	 CHANNEL1  =  0x00,      /*!<  (Default) */
	 CHANNEL2  =  0x01,      /*!< */
	 CHANNEL3  =  0x02,      /*!<  (MCP3428 only, treated as “00� by the MCP3426/MCP3427)*/
	 CHANNEL4,               /*!<  (MCP3428 only, treated as “00� by the MCP3426/MCP3427)*/
} Channel_Selection_t;

typedef enum {
    BITS_12 = 0x00,      /*!< 240 SPS (12 bits) (Default) */
	BITS_14 = 0x01,      /*!<  60 SPS (14 bits)*/
	BITS_16,			 /*!<   15 SPS (16 bits)*/

}  Sample_Rate_Selection_t;

typedef enum {
    GAIN_1 = 0x00,      /*!< x1 (Default) */
	GAIN_2 = 0x01,      /*!< x2*/
	GAIN_4 = 0x02,      /*!< x4*/
	GAIN_8,			    /*!< x8*/
} Gain_Selection_t;



typedef struct{
	Channel_Selection_t CH;                     /*!< */
	Sample_Rate_Selection_t resolution ;        /*!<  */
	Gain_Selection_t Gain;            			/*!< */
}mcp3428_config_t;




int adc_mcp3428_read(Channel_Selection_t chx,Sample_Rate_Selection_t resolutionx,Gain_Selection_t Gainx) ;









#endif /* MCP3428_H_ */
/** @}*/

ADS111x problems

Device type

  • ESP32
  • [] ESP8226

Framework version

  • ESP-IDF latest master
  • [] ESP-IDF 3.2.x
  • [] ESP-IDF 3.3.x
  • [] ESP8266 RTOS SDK latest master
  • [] ESP8266 RTOS SDK 3.2

Describe the bug
Im trying to connect the ADS1115 chip to my ESP32 board on ESP-IDF using your library.
First of all I tried your example code for the library which checks the ADS for readiness (ads111x_is_busy) which was always true. So the chip was busy.
I've figured out to call "ads111x_start_conversion" before "ads111x_is_busy" to achieve the chip to be ready. Should it be done like that?

Now I've got the problem, that the raw ADC value printed out by "ads111x_get_value" is always 1.
Im trying to measure pressure.

The code im setting up my device for the first pressure sensor is the following:
ESP_ERROR_CHECK(ads111x_init_desc(device, ADS111X_ADDR_GND, I2C_NUM_0, GPIO_NUM_21, GPIO_NUM_22)); ESP_ERROR_CHECK(ads111x_set_mode(device, ADS111X_MODE_SINGLE_SHOT)); ESP_ERROR_CHECK(ads111x_set_gain(device, ADS111X_GAIN_6V144)); ESP_ERROR_CHECK(ads111x_set_input_mux(pressure_up1, ADS111X_MUX_0_1));

multiple i2c bus error

Devcie type

  • ESP32
  • ESP8226

Framework version

  • ESP-IDF latest master
  • ESP-IDF 3.2.2
  • ESP8266 RTOS SDK latest master
  • ESP8266 RTOS SDK 3.2

I have "merged" examples for BH1750 and BMP280 sensors, defining different GPIO pins for SDAs and SCLs (so i have 2 buses).
Tested separately both buses works (not initing one or the other sensor and relative task), if I configure both sensors i get

E (586) i2c: i2c driver install error

E (591) BMP280: Sensor not found
and a panic:
0x40221e30: _esp_error_check_failed at /home/steeve/newesp/ESP8266_RTOS_SDK/components/freertos/port/esp8266/panic.c:173

file: "sensors.c" line 27
func: bmp280_task
expression: bmp280_init(&dev, &params)
abort() was called at PC 0x40221e33 on core 0

Can I2C driver work on 2 buses simultaneously?

-- edit --
trying to init bmb280 with port 1
bmp280_init_desc(&dev, BMP280_I2C_ADDRESS_0, 1, BMP_SDA_GPIO, BMP_SCL_GPIO)

i get

E (583) i2c: /home/steeve/newesp/ESP8266_RTOS_SDK/components/esp8266/driver/i2c.c:140 (i2c_driver_install):i2c number error
E (600) I2C_DEV: Could not give port mutex 1
E (608) BMP280: Sensor not found

HMC5883L values stuck at 0

When executed for the HMC5883L, the following is generated:

components/driver/i2c.c:353 (i2c_driver_delete):i2c driver install error

Magnetic data: X:0.00 mG, Y:0.00 mG, Z:0.00 mG
Magnetic data: X:0.00 mG, Y:0.00 mG, Z:0.00 mG
Magnetic data: X:0.00 mG, Y:0.00 mG, Z:0.00 mG

I checked the sensor with an Arduino UNO, it works fine. What can be the issue?

Generic application multi-sensor

hi,

i am working on application multi-sensor using esp-idf-lib so i connect all my sensor with mux TCA9548A and i want to now if i need to create instance i2c_dev_t dev for each sensor or i can use one for all same sensor ?

Weird behavior when using ds3231

I'm messing around with the ds3231 library and it works great... most of the time.

Heres some code:

#include <stdio.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <ds3231.h>
#include <stdbool.h>
#include <string.h>
#include "ssd1306.h"
#include "ssd1306_draw.h"
#include "ssd1306_font.h"
#include "ssd1306_default_if.h"

#define SDA_GPIO 21
#define SCL_GPIO 22

void ds3231_test(void *pvParameters)
{
    i2c_dev_t dev;

    while (i2cdev_init() != ESP_OK)
    {
        printf("Could not init I2Cdev library\n");
        //vTaskDelay(250 / portTICK_PERIOD_MS);
    }

    while (ds3231_init_desc(&dev, 0, SDA_GPIO, SCL_GPIO) != ESP_OK)
    {
        printf("Could not init device descriptor\n");
        //vTaskDelay(250 / portTICK_PERIOD_MS);
    }

    // setup datetime: 2016-10-09 13:50:10
    struct tm time = {
        .tm_year = 0,
        .tm_mon  = 0,  // 0-based
        .tm_mday = 0,
        .tm_hour = 0,
        .tm_min  = 0,
        .tm_sec  = 0
    };
    // while (ds3231_set_time(&dev, &time) != ESP_OK)
    // {
    //     printf("Could not set time\n");
    //     vTaskDelay(250 / portTICK_PERIOD_MS);
    // }

    while (1)
    {
        float temp;

        //vTaskDelay(250 / portTICK_PERIOD_MS);

        if (ds3231_get_temp_float(&dev, &temp) != ESP_OK)
        {
            printf("Could not get temperature\n");
            continue;
        }

        if (ds3231_get_time(&dev, &time) != ESP_OK)
        {
            printf("Could not get time\n");
            continue;
        }
        char hour[5];
        sprintf(hour,"%d",time.tm_hour);
        //itoa(time.tm_hour, hour, 10);

        char min[5];
        sprintf(min,"%d",time.tm_min);
        //itoa(time.tm_min, min, 10);

        char sec[5];
        sprintf(sec,"%d",time.tm_sec);
        //itoa(time.tm_sec, sec, 10);

        printf("%s\n", hour);
        printf("%s\n", min);
        printf("%s\n", sec);


        char timeStr[20];
        // strcat(timeStr, hour);
        // strcat(timeStr, ":");
        // strcat(timeStr, min);
        // strcat(timeStr, ":");
        // strcat(timeStr, sec);

        printf("%04d-%02d-%02d %02d:%02d:%02d, %.2f deg Cel\n", time.tm_year, time.tm_mon + 1,
            time.tm_mday, time.tm_hour, time.tm_min, time.tm_sec, temp);

          printf("%s\n", timeStr);
    }
}

void app_main()
{
    xTaskCreate(ds3231_test, "ds3231_test", 4096, NULL, 5, NULL);
    //ds3231_test(NULL);
}

It results in this error:

Could not get temperature
E (419672) i2c: /home/talha/esp/esp-idf/components/driver/i2c.c:335 (i2c_driver_delete):i2c driver install error
E (419682) i2c: /home/talha/esp/esp-idf/components/driver/i2c.c:870 (i2c_set_pin):this i2c pin does not support internal pull-up

However, as soon as I remove the line

        char timeStr[20];

It starts pulling data no problem. No changes to the pins.

I'm farley new to ESP-IDF so I might just be doing something dumb but seems weird to me that creating the char array messes with the ability to read from the RTC

Using multiple sensors

Is it possible to use multiple sensors with the same port? I tried to use a bmp280 and a tsl2561 at the same i2c port but always got errors during init. Using them standalone worked fine. Would be great if you could provide an example of using 2 sensors.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.