UncleRus / esp-idf-lib

Component library for ESP32-xx and ESP8266
https://esp-idf-lib.readthedocs.io/en/latest/
1.38k stars 429 forks source link

Feature implement mpu6050 #455

Closed horsemann07 closed 1 year ago

horsemann07 commented 1 year ago

mpu6050 driver library tested on the esp32 development board.

UncleRus commented 1 year ago

Sorry, but your PR does not meet the following library requirements:

Summing up, I can only say that this is a rough draft that requires a lot of work to bring it in line with the standards of the repository.

horsemann07 commented 1 year ago

Hello @UncleRus

Thanks for explaining all these points. I will try to change the driver as per repository standards. If it is possible can you collaborate on this? It will be much helpful for me as learning wise.

Thank you so much @UncleRus

horsemann07 commented 1 year ago
  • Most importantly, your driver can only work with a single device. It is not possible to connect several sensors at the same time. All other drivers in this repository can work simultaneously with any number of devices of the same type connected to the esp. Please use the same approach.

Hello @UncleRus,

Here, I tried to make a driver which works on several sensors of the same type with one esp32. But the system is crashing while reading the two i2c. It happening while taking the semaphore in i2c_dev.

I m using different two different ports with different pin no. to read two mpu6050 sensors on 1 esp32. I saw some examples using tca9548 components to work with multi i2c. But I think esp32 supports 3 ports so we can connect 3 sensors using other i2c multichannel components. So, why the system is crashing taking semaphores of the different ports?

Can you help me with this?

Here is the log and example link


W (305) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (319) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (329) mpu6050_test: mpu6050 config 1: addr 0x68, sda 32, scl 33, clk, 100000 port 2
I (0) mpu60
assert failed: xQueueSemaphoreTake queue.c:1545 (( pxQueue ))

Backtrace:0x4008192e:0x3ffb9a200x400863f1:0x3ffb9a40 0x4008b701:0x3ffb9a60 0x4008724e:0x3ffb9b80 0x400d576f:0x3ffb9bc0 0x400d5476:0x3ffb9be0 0x400d4f7e:0x3ffb9c10 0x40088f49:0x3ffb9c50 
0x4008192e: panic_abort at /home/raghav/Desktop/Personal/esp_idf_v4.4.1/components/esp_system/panic.c:402

0x400863f1: esp_system_abort at /home/raghav/Desktop/Personal/esp_idf_v4.4.1/components/esp_system/esp_system.c:128

0x4008b701: __assert_func at /home/raghav/Desktop/Personal/esp_idf_v4.4.1/components/newlib/assert.c:85

0x4008724e: xQueueSemaphoreTake at /home/raghav/Desktop/Personal/esp_idf_v4.4.1/components/freertos/queue.c:1545 (discriminator 1)

0x400d576f: i2c_dev_probe at /home/raghav/Desktop/Personal/esp_idf_v4.4.1/examples/personal/esp-idf-lib/components/i2cdev/i2cdev.c:244

0x400d5476: mpu6050_init_desc at /home/raghav/Desktop/Personal/esp_idf_v4.4.1/examples/personal/esp-idf-lib/components/mpu6050/mpu6050.c:2628 (discriminator 2)

0x400d4f7e: mpu6050_test1 at /home/raghav/Desktop/Personal/esp_idf_v4.4.1/examples/personal/esp-idf-lib/examples/mpu6050/multi_switch_i2c/build/../main/main.c:82

0x40088f49: vPortTaskWrapper at /home/raghav/Desktop/Personal/esp_idf_v4.4.1/components/freertos/port/xtensa/port.c:131
horsemann07 commented 1 year ago

Hi @UncleRus

I updated the mpu6050 driver as per the guide.

Please check and let me know if any update required.