-
Couldn't load subscription status.
- Fork 7.7k
added support for enabling I2C HAL locks even when system wide HAL locks are disabled #11941
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
base: master
Are you sure you want to change the base?
Conversation
|
|
👋 Hello AlmirKadric, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
Test Results 76 files 76 suites 16m 43s ⏱️ Results for commit efdf2bf. |
Memory usage test (comparing PR against master branch)The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.
Click to expand the detailed deltas report [usage change in BYTES]
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Why are changes in kconfig and CmakeList.txt? This changes how the Arduino libs are compiled! |
@Jason2866 because its needed to make the option configurable. Also it will not break anything as it is completely optional just like the existing system wide HAL lock disable flag. |
| set(srcs ${CORE_SRCS} ${ARDUINO_LIBRARIES_SRCS}) | ||
| set(priv_includes cores/esp32/libb64) | ||
| set(requires spi_flash esp_partition mbedtls wpa_supplicant esp_adc esp_eth http_parser esp_ringbuf esp_driver_gptimer esp_driver_usb_serial_jtag driver esp_http_client esp_https_ota) | ||
| set(requires spi_flash esp_partition wear_levelling mbedtls wpa_supplicant esp_adc esp_eth http_parser esp_ringbuf esp_driver_gptimer esp_driver_usb_serial_jtag driver esp_http_client esp_https_ota) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is irrelevant change that warrants its own PR with explanation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry i recently push up some other fixes to this branch by accident, will rebase it
and put those in a separate PR
| conf.pull_down_en = GPIO_PULLDOWN_ENABLE; | ||
| } | ||
| } | ||
| if (gpio_reset_pin(pin) != ESP_OK) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is irrelevant change that warrants its own PR with explanation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry i recently push up some other fixes to this branch by accident, will rebase it
and put those in a separate PR
| and code implemented only in setup/loop and Arduino callbacks | ||
|
|
||
| config FORCE_I2C_HAL_LOCKS | ||
| bool "Enable mutex locks for I2C HAL even if HAL locks are disbled" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to depend on hal locks being off
|
|
||
| #include "esp32-hal-i2c.h" | ||
|
|
||
| #define I2C_HAL_LOCKS_ENABLED (!CONFIG_DISABLE_HAL_LOCKS || CONFIG_FORCE_I2C_HAL_LOCKS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be defined in esp32-hal-i2c.h and propagate here and all relevant files (esp32-hal-i2c.c, Wire.h and Wire.cpp)
|
@AlmirKadric you need to sign the CLA for this to go further |
By completing this PR sufficiently, you help us to review this Pull Request quicker and also help improve the quality of Release Notes
Checklist
This entire section above can be deleted if all items are checked.
Description of Change
I had a use case where I want to disable HAL locks for UART and SPI busses (self-managed for performance reasons), but needed them for I2C. So implemented a way to override the behaviour for I2C (we should create something similar for other HAL lock categories as well, I'll open other PRs for this when I have the time).
Test Scenarios
Tested on ESP32S3 with arduino-esp32 v3.3.2 with multiple sensors connected over I2C and
CONFIG_DISABLE_HAL_LOCKS=y, withoutCONFIG_FORCE_I2C_HAL_LOCKS=yI get bad data over from I2C sensors. However withCONFIG_FORCE_I2C_HAL_LOCKS=ythis issue is resolved.Related links
Please provide links to related issue, PRs etc.