linguini1 opened a new pull request, #17012:
URL: https://github.com/apache/nuttx/pull/17012
## Summary
Initial I2C implementation such that I2C sending and receiving now works
well enough to use the BMP280 driver for a BMP280 device connected to any of
I2C0-I2C6 on the default pins. I2CTOOL also works for these interfaces.
Functionality for "no stop" and "no start" options is not present.
Implementing that is not clear from the peripheral datasheet and will be a
challenge.
## Impact
Allows users to make use of every I2C interface on the Raspberry Pi 4B for
at least basic sensors and `i2ctool` usage (that is all I am able to test).
Closes #16937.
## Testing
These changes were tested on a Pi 4B with 4GB RAM.
The test setup consisted of a BMP280 Adafruit breakout connected to the Pi
4B using 3V3 power.
In order to test, I connected the SDA and SCL pins of the breakout to each
of teh I2C interfaces and did the following:
* Ran the I2C tool scanner to verify that 0x77 showed as populated
* Ran the I2C tool `get` command to check the ID register of the device read
0x58
* Registered the BMP280 driver to each of the interfaces and ran the BMP280
example program to verify correct temperature and pressure output
To my surprise, it's possible to use all of the I2C interfaces without
having to configure any magic registers. I did not test all of the possible pin
pairs for each I2C interface, but tested using the default pins pairs for all
of them. I also tested using all of the interfaces simultaneously, which
surprisingly worked.
Here is example output from the BMP280 program and I2C tool programs:
```console
nsh> bmp280
Absolute pressure [hPa] = 983.099976
Temperature [C] = 24.129999
```
```console
nsh> i2c dev -b 3 00 77
NOTE: Some devices may not appear with this scan.
You may also try a scan with the -z flag to discover more devices using a
zer.
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- 77
nsh>
```
More information/logs can be found in the comments of #16937.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]