Skip to content

added check to correct i2C reading #2

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

Merged
merged 1 commit into from
Jan 31, 2020

Conversation

Rocketct
Copy link
Contributor

@Rocketct Rocketct commented Jan 27, 2020

Added wait for ONE_SHOT bit to be cleared by the hardware for correct read of measurement

cc/: @sandeepmistry this avoid an incorrect first measure read, would you counter check if can

to reproduce the issue:

  1. Execute on nano 33 BLE the following sketch Example-<Arduino_LPS22HB->ReadPressure

  2. Aftrer the upload the first readings returned is incorrect (Pressure = 75.93 kPa in my test when should be 99.02 kPa)

  3. adding this check all the measures are the same and the correct one

Copy link
Contributor

@sandeepmistry sandeepmistry left a comment

Choose a reason for hiding this comment

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

Tested and seems to correct the issue. However, the datasheet doesn't seem to indicate that the bit should be cleared before reading the value. (unless I missed the section).

https://www.st.com/resource/en/datasheet/lps22hb.pdf

Added wait for ONE_SHOT bit to be cleared by the hardware for correct read of measurement
@Rocketct
Copy link
Contributor Author

Rocketct commented Jan 27, 2020

removed the status wait because the datasheet reports, in section 9.5 p. 37:

Once the acquisition is completed and the output registers updated, the device automatically enters in power-down mode. ONE_SHOT bit self-clears itself.

Rocketct added a commit to Rocketct/Arduino_MKRENV that referenced this pull request Jan 27, 2020
Rocketct added a commit to Rocketct/Arduino_MKRENV that referenced this pull request Jan 27, 2020
@Rocketct Rocketct merged commit d3d6bac into arduino-libraries:master Jan 31, 2020
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.

2 participants