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

boards/stm32f4discovery: Change sda pin #10445

Merged

Conversation

MrKevinWeiss
Copy link
Contributor

Contribution description

This commit changes the I2C0 SDA pin to 9 from 7.
This is because the CS43L22 is connected to scl6 and sda9.
This PR has been taken over from #8812 from @graznik.

It states:

The STM32F4DISCOVERY on-board I2C peripheral CS43L22 is connected
to PB6 (SCL) and PB9 (SDA). Both pins have external 4.7K pull-up
resistors and are ready for I2C communication by default. The
default RIOT configuration uses PB7 as SDA pin which makes first
I2C bus bring up unnecessarily complicated.

The CS43L22 has an address of 0x5A (since the A0 pin is pulled down to ground) or 90 in decimal.

I don't have hardware to test on (at least stuff that works).

Testing procedure

BOARD=stm32f4discovery make -C tests/periph_i2c/ flash term
...
i2c_acquire 0
i2c_read_reg 0 0x5A 1 0

If you get an acked response with a value between 0b11100000 and 0b11100011 (or 224 to 227 in decimal) which is the CHIP ID and REVISION.

Issues/PRs references

Taken over from #8812

@MrKevinWeiss MrKevinWeiss added Platform: ARM Platform: This PR/issue effects ARM-based platforms Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: boards Area: Board ports labels Nov 21, 2018
@MrKevinWeiss MrKevinWeiss self-assigned this Nov 21, 2018
Copy link
Member

@smlng smlng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK, looks good. Verified with datasheet.

@smlng smlng added Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines labels Nov 21, 2018
@aabadie
Copy link
Contributor

aabadie commented Nov 22, 2018

Just had a look at this one and tested it on a board.

From the datasheet, the changes are good. But the testing procedure doesn't work:

2018-11-22 16:13:02,773 - INFO # main(): This is RIOT! (Version: 2018.10-RC1-207-gc6a7c-pr/fix/i2cpinout/stmdisco)
2018-11-22 16:13:02,774 - INFO # Start: Test for the low-level I2C driver
> i2c_acquire 0
2018-11-22 16:13:03,969 - INFO #  i2c_acquire 0
2018-11-22 16:13:03,970 - INFO # Command: i2c_acquire(0)
2018-11-22 16:13:03,971 - INFO # Success: i2c_0 acquired
i2c_read_reg 0 0x5A 1 0
2018-11-22 16:13:09,560 - INFO #  i2c_read_reg 0 0x5A 1 0
2018-11-22 16:13:09,561 - INFO # Command: i2c_read_reg(0, 0x5a, 0x01, 0x00)
2018-11-22 16:13:09,563 - INFO # Error: EIO [5]

This is weird because it should work normally.

@MrKevinWeiss
Copy link
Contributor Author

Hmm I will try to look into it more, maybe I missed something.

@graznik
Copy link

graznik commented Nov 22, 2018

Hi,

Thank you for taking over the pull-request! I still have a board and will try to investigate the issues at the weekend.

Cheers

Michael

smlng
smlng previously requested changes Nov 30, 2018
Copy link
Member

@smlng smlng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blocking, until further testing

@miri64 miri64 added the Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation label Dec 4, 2018
@smlng
Copy link
Member

smlng commented Dec 19, 2018

any news here?

@MrKevinWeiss
Copy link
Contributor Author

Maybe things clear up when the #10610 gets merged, it should fix a bunch of these types of problems.

@aabadie aabadie added this to the Release 2019.01 milestone Jan 3, 2019
@smlng
Copy link
Member

smlng commented Jan 10, 2019

#10610 is merged, so?

@MrKevinWeiss
Copy link
Contributor Author

@aabadie I think just needs retest when you have time.

This commit changes the I2C0 SDA pin to 9 from 7.
This is because the CS43L22 is connected to scl6 and sda9.
@MrKevinWeiss
Copy link
Contributor Author

Well a few things I noticed. The correct address is 0b1001010x which is actually 0x4A or if the addr pin is high it would be 0x4B. I was looking at the actual pins on the scope and couldn't find why it doesn't want to ack the address.

I can confirm the pin change is there as I probed the actual CS43L22 but I can confirm communication (maybe some other initialization stuff needs to be done). Do we want to merge or not?

@MrKevinWeiss MrKevinWeiss added this to the Release 2019.10 milestone Jul 16, 2019
@benpicco benpicco requested a review from smlng September 10, 2019 22:17
@kb2ma kb2ma removed this from the Release 2019.10 milestone Oct 8, 2019
@smlng smlng dismissed their stale review November 27, 2019 14:36

looks good, waiting for test confirmation

@MrKevinWeiss MrKevinWeiss force-pushed the pr/fix/i2cpinout/stmdisco branch from c6a7ced to 46e8f71 Compare May 19, 2020 15:28
@miri64 miri64 requested a review from leandrolanzieri June 24, 2020 13:58
@leandrolanzieri leandrolanzieri added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jun 24, 2020
Copy link
Contributor

@leandrolanzieri leandrolanzieri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By setting PORT_D 4 to 1 I got the CS43L22 to respond:

2020-06-24 17:29:11,316 - INFO # Connect to serial port /dev/ttyUSB0
Welcome to pyterm!
Type '/exit' to exit.
i2c_acquire 0
2020-06-24 17:29:18,804 - INFO # i2c_acquire 0
2020-06-24 17:29:18,805 - INFO # Command: i2c_acquire(0)
2020-06-24 17:29:18,805 - INFO # Success: i2c_0 acquired
> i2read_reg 0 0x4a 1re 0
2020-06-24 17:29:22,162 - INFO #  i2c_read_reg 0 0x4a 1 0
2020-06-24 17:29:22,163 - INFO # Command: i2c_read_reg(0, 0x4a, 0x01, 0x00)
2020-06-24 17:29:22,168 - INFO # Success: i2c_0 read 1 byte(s) from reg 0x01 : [0xe3]

Change looks good. ACK!

@leandrolanzieri leandrolanzieri merged commit 8e60c8b into RIOT-OS:master Jun 24, 2020
@leandrolanzieri leandrolanzieri added this to the Release 2020.07 milestone Jun 24, 2020
@leandrolanzieri leandrolanzieri added the Reviewed: 3-testing The PR was tested according to the maintainer guidelines label Jun 24, 2020
@MrKevinWeiss MrKevinWeiss deleted the pr/fix/i2cpinout/stmdisco branch June 25, 2020 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Platform: ARM Platform: This PR/issue effects ARM-based platforms Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants