btashton opened a new pull request #3646:
URL: https://github.com/apache/incubator-nuttx/pull/3646
## Summary
This adds i2c support to the NUCLEO-F676ZI board and optionally includes
support for an mpu60x0 IMU to be attached to it.
Additionally it fixes a bad bug in the mpu60x0 driver where bitmasks were
not computed correctly causing incorrect settings to be set.
## Impact
* mpu60x0 driver not produces expected results
* board optionally includes this driver now.
## Testing
```
NuttShell (NSH) NuttX-10.1.0-RC1
nsh> uname -a
NuttX 10.1.0-RC1 93f4526a4a-dirty May 2 2021 22:21:09 arm nucleo-144
nsh> hexdump /dev/imu0 count=14
/dev/imu0 at 00000000:
0000: fe 7f ff 8d 0c 5a f0 c5 ff 75 ff b0 ff dc .....Z...u....
nsh> i2c dev -b 1 0x00 0x7f
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
nsh>
```
This hex dump can then be supplied to this python script to decode the IMU
output:
```python
rawdata = 'fe 7f ff 8d 0c 5a f0 c5 ff 75 ff b0 ff dc'
data = struct.unpack(">7h",bytearray.fromhex(rawdata))
temp = data[3]/340 + 36.5
acel = [elm / 4096.0 for elm in data[0:3]]
gyro = [elm / 32.8 for elm in data[4:7]]
print(f'{temp}C\nacel: {acel}\ngyro: {gyro}')
```
```
25.03235294117647C
acel: [-0.093994140625, -0.028076171875, 0.77197265625]
gyro: [-4.237804878048781, -2.439024390243903, -1.0975609756097562]
```
This was also tested without the sensor connected to make sure that we do
not hang (previously the mpu60x0 driver would hang forever if it was not found).
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]