-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
mimxrt/machine_i2c.c: Make I2C bus ID arg optional with default. #16956
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
Closed
malcolm-sparkfun
wants to merge
1
commit into
micropython:master
from
sparkfun:feature/default_i2c_teensy
Closed
mimxrt/machine_i2c.c: Make I2C bus ID arg optional with default. #16956
malcolm-sparkfun
wants to merge
1
commit into
micropython:master
from
sparkfun:feature/default_i2c_teensy
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Malcolm McKellips <malcolm.mckellips@sparkfun.com>
Code size report:
|
Thanks for the contribution. This change is already covered in a different PR #16876, last commit, which addresses I2C, SPI and UART. |
Oh perfect, thank you. I will close this then. |
It looks like both this and #16876 have the same changes, which is good, you both implicitly agreed that I2C instance 0 is a good default. |
ricksorensen
added a commit
to ricksorensen/micropython
that referenced
this pull request
Apr 13, 2025
This addresses issue micropython#17103. The new default I2C init does not require setting SCL or SDA but the default pins for C3 (and S3?) conflict with the espressif GPIO usage. For the C3, pins 18/19 are for USB/JTAG. If used for I2C() they will cause the REPL to hang on initialization of the I2C. For the S3 pin 19 is allocated for USB/JTAG also but the defaults do not seem to affect the REPL. See PR micropython#16956 See Issue micropython#17103 Signed-off-by: Rick Sorensen <rick.sorensen@gmail.com>
ricksorensen
added a commit
to ricksorensen/micropython
that referenced
this pull request
Apr 16, 2025
his addresses issue micropython#17103. The new default I2C init does not require setting SCL or SDA but the default pins for C3 (and S3?) conflict with the espressif GPIO usage. For the C3, pins 18/19 are for USB/JTAG. If used for I2C() they will cause the REPL to hang on initialization of the I2C. For the S3 pin 19 is allocated for USB/JTAG also but the defaults do not seem to affect the REPL. This pull request updates pin settings for the non base ESP32 models (C3,C6,S2,S3,...). See PR micropython#16956 See Issue micropython#17103 Signed-off-by: Rick Sorensen <rick.sorensen@gmail.com>
ricksorensen
added a commit
to ricksorensen/micropython
that referenced
this pull request
May 14, 2025
This addresses issue micropython#17103. The default I2C init does not require setting SCL or SDA but the default pins for C3 (and S3?) conflict with the espressif GPIO usage. For the C3, pins 18/19 are for USB/JTAG. If used for I2C() they will cause the REPL to hang on initialization of the I2C. For the S3 pin 19 is allocated for USB/JTAG also but the defaults do not seem to affect the REPL. Also the default pins for I2C(2) were 25/26 which are invalid for S3. This pull request updates pin settings for C3 and S3 I2C defaults if not specified during the build. See PR micropython#16956 See Issue micropython#17103 Signed-off-by: Rick Sorensen <rick.sorensen@gmail.com>
ricksorensen
added a commit
to ricksorensen/micropython
that referenced
this pull request
May 14, 2025
This addresses issue micropython#17103. The default I2C init does not require setting SCL or SDA but the default pins for C3, S3, and S2 conflict with the espressif GPIO usage. For the C3, pins 18/19 are for USB/JTAG. If used for I2C() they will cause the REPL to hang on initialization of the I2C. For the S3 pin 19 is allocated for USB/JTAG also but the defaults do not seem to affect the REPL. Also the default pins for I2C(2) were 25/26 which are invalid for S3 and S2. This pull request updates pin settings for C3, S3 and S2 I2C defaults if not specified during the build. See PR micropython#16956 See Issue micropython#17103 Signed-off-by: Rick Sorensen <rick.sorensen@gmail.com>
projectgus
pushed a commit
to ricksorensen/micropython
that referenced
this pull request
May 16, 2025
This addresses issue micropython#17103. The default I2C init does not require setting SCL or SDA but the default I2C0 pins for C3, S3 conflict with the espressif GPIO usage. For the C3, pins 18/19 are for USB/JTAG. If used for I2C() they will cause the REPL to hang on initialization of the I2C. For the S3 pin 19 is allocated for USB/JTAG also but the defaults do not seem to affect the REPL. See PR micropython#16956 See Issue micropython#17103 Signed-off-by: Rick Sorensen <rick.sorensen@gmail.com> Signed-off-by: Angus Gratton <angus@redyak.com.au>
dpgeorge
pushed a commit
to ricksorensen/micropython
that referenced
this pull request
May 16, 2025
The default I2C init does not require setting SCL or SDA but the default I2C0 pins for C3, S3 conflict with the espressif GPIO usage. For the C3, pins 18/19 are for USB/JTAG. If used for I2C() they will cause the REPL to hang on initialization of the I2C. For the S3 pin 19 is allocated for USB/JTAG also but the defaults do not seem to affect the REPL. See related micropython#16956. Fixes issue micropython#17103. Signed-off-by: Rick Sorensen <rick.sorensen@gmail.com> Signed-off-by: Angus Gratton <angus@redyak.com.au>
lawrencedudley
pushed a commit
to lawrencedudley/micropython-esp32-pcnt
that referenced
this pull request
May 29, 2025
The default I2C init does not require setting SCL or SDA but the default I2C0 pins for C3, S3 conflict with the espressif GPIO usage. For the C3, pins 18/19 are for USB/JTAG. If used for I2C() they will cause the REPL to hang on initialization of the I2C. For the S3 pin 19 is allocated for USB/JTAG also but the defaults do not seem to affect the REPL. See related micropython#16956. Fixes issue micropython#17103. Signed-off-by: Rick Sorensen <rick.sorensen@gmail.com> Signed-off-by: Angus Gratton <angus@redyak.com.au>
eliclement
pushed a commit
to eliclement/micropython
that referenced
this pull request
Jun 2, 2025
The default I2C init does not require setting SCL or SDA but the default I2C0 pins for C3, S3 conflict with the espressif GPIO usage. For the C3, pins 18/19 are for USB/JTAG. If used for I2C() they will cause the REPL to hang on initialization of the I2C. For the S3 pin 19 is allocated for USB/JTAG also but the defaults do not seem to affect the REPL. See related micropython#16956. Fixes issue micropython#17103. Signed-off-by: Rick Sorensen <rick.sorensen@gmail.com> Signed-off-by: Angus Gratton <angus@redyak.com.au>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds for the mimxrt port the same functionality as the already approved #16671. It gives the option to not pass an I2C Bus ID when creating a machine I2C object on the mimxrt port. This would allow users on mimxrt platforms to simply declare an I2C object with machine.I2C() without passing any arguments, thus creating an object with a default I2C ID of 0 (freq and drive were already optional for this port).
Testing
Tested on TEENSY4.0 and TEENSY4.1 Boards:
Trade-offs and Alternatives
I simply chose the default I2C ID to be 0, which may not be the desired default for some boards? As far as I could tell, this seemed like a fairly reasonable choice.