Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature implement mpu6050 #455

Merged
merged 23 commits into from
Jul 20, 2023

Conversation

horsemann07
Copy link
Contributor

mpu6050 driver library tested on the esp32 development board.

@UncleRus UncleRus added area:components enhancement New feature or request labels Sep 24, 2022
@UncleRus
Copy link
Owner

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

  • 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.
  • This library supports a uniform approach to the development of i2c device drivers, in particular, the functions of initialization and deinitialization of the device descriptor are required and so on.
  • I don't see the need to create a separate utils component. Please get rid of it.
  • An additional layer of interaction with i2c, described in i2c_dev_bridge, does not make any sense. Functions from i2cdev are quite enough. See how other drivers in the repository work with i2c.
  • The example should be located in the default subdirectory, as is done in other drivers.
  • Almost each driver function must return an error code (esp_err_t). You cannot hide errors from the programmer who will use the driver. See how it's done in other drivers.
  • This PR lacks the necessary edits to the metadata and documentation.

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.

@UncleRus UncleRus self-requested a review September 26, 2022 00:25
@UncleRus UncleRus marked this pull request as draft September 26, 2022 00:25
@horsemann07
Copy link
Contributor Author

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
Copy link
Contributor Author

  • 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 horsemann07 reopened this Apr 14, 2023
@horsemann07 horsemann07 deleted the feature-implement-mpu6050 branch April 14, 2023 17:21
@horsemann07 horsemann07 reopened this Apr 14, 2023
@horsemann07
Copy link
Contributor Author

Hi @UncleRus

I updated the mpu6050 driver as per the guide.

Please check and let me know if any update required.

@horsemann07 horsemann07 marked this pull request as ready for review April 24, 2023 07:36
@UncleRus UncleRus merged commit d6caf1d into UncleRus:master Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants