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

bus_scan.c example - fix pin number in comment #146

Merged
merged 2 commits into from
Oct 21, 2021

Conversation

a-h
Copy link
Contributor

@a-h a-h commented Jul 24, 2021

The comment in the code is incorrect. I tested this out, and it doesn't detect the device via those pins.

I was searching and found this comment thread: https://www.raspberrypi.org/forums/viewtopic.php?p=1822258&sid=1ff96911779abcedda7b3ae535d1d0af#p1822258

Sure enough, when I switched to pins 6 and 7, the code worked fine and could detect the device I had plugged into the i2c bus.

I2C Bus Scan
   0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
00 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
10 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
20 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
30 .  .  .  .  .  .  .  .  .  .  .  .  @  .  .  .
40 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
50 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
60 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
70 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
Done.

Example wiring.

pico

The comment in the code is incorrect. I tested this out, and it doesn't detect the device via those pins.

I was searching and found this comment thread: https://www.raspberrypi.org/forums/viewtopic.php?p=1822258&sid=1ff96911779abcedda7b3ae535d1d0af#p1822258

Sure enough, when I switched to pins 6 and 7, the code worked fine and could detect the device I had plugged into the i2c bus.
@lurch
Copy link
Contributor

lurch commented Jul 24, 2021

The comment is correct, it's referring to the GPIO numbers, and the "default I2C pins" are defined in https://github.com/raspberrypi/pico-sdk/blob/master/src/boards/include/boards/pico.h

You seem to be confusing "GPIO numbers" with "physical pins" - see the diagram at https://www.raspberrypi.org/documentation/rp2040/getting-started/#board-specifications
So if you wanted to submit an alternative PR where you change "(4, 5 on a Pico)" to "(GP4, GP5 on a Pico)" I think we might be willing to accept that. ping @aallan ?

@a-h
Copy link
Contributor Author

a-h commented Jul 24, 2021

Great. I wasn't the first person to be confused by that, and wouldn't be the last.

Prefixing GPIO numbers with GP would remove any ambiguity about what the number means and match the pinout diagram (https://datasheets.raspberrypi.org/pico/Pico-R3-A4-Pinout.pdf).

@a-h
Copy link
Contributor Author

a-h commented Jul 24, 2021

I've updated based on your suggestion.

lurch
lurch previously approved these changes Jul 24, 2021
@JamesH65
Copy link
Collaborator

JamesH65 commented Sep 2, 2021

@lurch Can you approve this so that Github actually thinks its approved? Or don't you have write access? @kilograham?

aallan
aallan previously approved these changes Sep 2, 2021
@aallan
Copy link

aallan commented Sep 2, 2021

Done @JamesH65

@JamesH65
Copy link
Collaborator

JamesH65 commented Sep 2, 2021

Feel free to merge

@lurch
Copy link
Contributor

lurch commented Sep 2, 2021

@lurch Can you approve this so that Github actually thinks its approved? Or don't you have write access?

IIRC the only Pico-related repo I have write access to is pico-feedback.

@kilograham kilograham changed the base branch from master to develop October 21, 2021 22:17
@kilograham kilograham dismissed stale reviews from aallan and lurch October 21, 2021 22:17

The base branch was changed.

@kilograham kilograham merged commit 1b1948a into raspberrypi:develop Oct 21, 2021
@kilograham kilograham added this to the SDK 1.3.0 release milestone Oct 21, 2021
@a-h a-h deleted the patch-1 branch October 22, 2021 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants