Skip to content

drivers/ina2xx: Fixed missing i2c_acquire/release#13324

Merged
benpicco merged 1 commit intoRIOT-OS:masterfrom
maribu:ina2xx_fix
Feb 11, 2020
Merged

drivers/ina2xx: Fixed missing i2c_acquire/release#13324
benpicco merged 1 commit intoRIOT-OS:masterfrom
maribu:ina2xx_fix

Conversation

@maribu
Copy link
Member

@maribu maribu commented Feb 10, 2020

Contribution description

  • Adding missing calls to i2c_acquire() and i2c_release()
  • Added some debug output

Testing procedure

  • tests/driver_ina2xx should now work on all boards

Issues/PRs references

Found while testing #13037

@maribu
Copy link
Member Author

maribu commented Feb 10, 2020

Output of the test on the MSB-A2 now is:

2020-02-10 10:34:10,324 # main(): This is RIOT! (Version: 2020.04-devel-309-g7975d-ben)
2020-02-10 10:34:10,326 # INA2XX sensor driver test application
2020-02-10 10:34:10,326 # 
2020-02-10 10:34:10,328 # Initializing INA2XX sensor at I2C_0, address 0x00000040
2020-02-10 10:34:10,329 # [OK]
2020-02-10 10:34:10,331 # +------------+--------------+----------+--------+
2020-02-10 10:34:10,333 # | U_Bus [mV] | U_Shunt [µV] |  I [µA]  | P [µW] |
2020-02-10 10:34:10,336 # +------------+--------------+----------+--------+
2020-02-10 10:34:10,338 # |        860 |           50 |        0 |      0 |
2020-02-10 10:34:10,435 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:10,563 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:10,691 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:10,819 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:10,947 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:11,074 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:11,201 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:11,330 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:11,458 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:11,586 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:11,713 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:11,841 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:11,969 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:12,097 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:12,225 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:12,366 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:12,494 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:12,622 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:12,750 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:12,878 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:13,007 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:13,135 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:13,262 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:13,391 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:13,519 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:13,646 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:13,774 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:13,902 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:14,030 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:14,158 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:14,285 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:14,413 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:14,541 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:14,669 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:14,796 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:14,924 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:15,052 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:15,180 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:15,308 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:15,435 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:15,563 # |        852 |           10 |       20 |      0 |
2020-02-10 10:34:15,691 # |        852 |           10 |       20 |      0 |

(No load connected, the ADC pins are floating; so the measurements are garbage.)

@maribu maribu added Area: drivers Area: Device drivers Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) labels Feb 10, 2020
@maribu
Copy link
Member Author

maribu commented Feb 10, 2020

@fjmolinas: This should be backported to the release, right?

@maribu maribu requested a review from benpicco February 10, 2020 15:55
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Feb 10, 2020
Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

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

Code looks good and except for the init function, this does not generate multiple acquire()/release() pairs in a single function.

The added error handling is a nice touch too :)

@benpicco benpicco merged commit d513334 into RIOT-OS:master Feb 11, 2020
@leandrolanzieri leandrolanzieri added the Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer label Feb 20, 2020
@leandrolanzieri leandrolanzieri added this to the Release 2020.04 milestone Feb 20, 2020
@maribu maribu deleted the ina2xx_fix branch May 11, 2020 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: drivers Area: Device drivers 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 Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants