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

LPS22HB: Fix invalid driver reset (I2C bus) #11231

Merged
merged 1 commit into from
Jan 23, 2019

Conversation

dvornikov-aa
Copy link
Contributor

@dvornikov-aa dvornikov-aa commented Jan 17, 2019

Driver sets I2C_DIS (I2C disable) flag during the reset. Reset operation will fail (on write_reg()) if the sensor is on the I2C bus. Driver works after a failed reset but doesn't create a BARO_BASE_DEVICE_PATH device file (/dev/baro*). It affects checks that use device files to determine a working barometer.

To fix the problem we should remove I2C_DIS flag from the driver's reset operation. Is there any reason why I2C_DIS flag has been added in the first place?

@dagar
Copy link
Member

dagar commented Jan 17, 2019

The driver was written for a board that has an lps22hb on spi. I was never able to actually test it on I2C.

@dvornikov-aa
Copy link
Contributor Author

The driver was written for a board that has an lps22hb on spi. I was never able to actually test it on I2C.

We have tested the driver on a copter with a custom board and a LPS22HB barometer on the I2C bus (primary barometer). The driver doesn't work correctly with I2C_DIS flag ("no baro sensor 0" error) and it's not possible to arm the vehicle. The vehicle arms and flies well with this commit.

@dagar
Copy link
Member

dagar commented Jan 17, 2019

Ok, I'll verify the change on a board with an lps22hb on spi.

Copy link
Member

@dagar dagar left a comment

Choose a reason for hiding this comment

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

Verified it's still working on SPI.

lps22hb_comms_errors: 0 events
lps22hb_read: 511 events, 9682us elapsed, 18.95us avg, min 17us max 78us 2.932us rms

nsh> listener sensor_baro

TOPIC: sensor_baro instance 0 #1
 sensor_baro_s
	timestamp: 33653416  (0.021898 seconds ago)
	error_count: 0
	device_id: 5767202 (Type: 0x58, SPI:4 (0x00)) 
	pressure: 1023.3169
	temperature: 47.4271

@dagar dagar merged commit ce0dd41 into PX4:master Jan 23, 2019
@dvornikov-aa dvornikov-aa deleted the lps22hb_fix branch January 10, 2020 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants