Skip to content
This repository has been archived by the owner on Jan 5, 2019. It is now read-only.

AM2315 Unknown Function Code 255 #320

Open
sp4ghet opened this issue Jul 24, 2017 · 9 comments
Open

AM2315 Unknown Function Code 255 #320

sp4ghet opened this issue Jul 24, 2017 · 9 comments

Comments

@sp4ghet
Copy link
Collaborator

sp4ghet commented Jul 24, 2017

The AM2315 sometimes gets into a state where it just reads "function code 255" and doesn't recover.
I'll have to look into the sensor datasheet to see how it works but the Atlas sensors have a code 255 as well. It might also just be the sensor pulling HIGH for the entire duration of the message causing it to do this as well.

@sp4ghet
Copy link
Collaborator Author

sp4ghet commented Jul 27, 2017

I tried unplugging the GND pin on an AM2315 while the firmware is running and it looks like that reproduces this error.
I'll look into this a bit more and see what we can do to either prevent this from happening or recover gracefully.

Any pin will actually do this. It might just be that the connection isn't that stable and it's not recovering gracefully.

@sp4ghet
Copy link
Collaborator Author

sp4ghet commented Jul 27, 2017

I think I've been able to reproduce this error by unplugging the GND pin(probably any pin) on the AM2315 and then replugging it in. This causes the Arduino to hang and then only successful reboot when you fully unplug the AM2315 or Arduino.

@rbaynes
Copy link
Contributor

rbaynes commented Aug 3, 2017

I also get this happening on rob-bot. I need to put a new connector on the sensor and hopefully that will solve the issue.

@sp4ghet
Copy link
Collaborator Author

sp4ghet commented Aug 3, 2017

The thing I'm curious about is why it started happening when it didn't before. Either the other stuff was crashing before this would happen, or we changed the firmware to no longer be resilient to the change. Not sure.

@goruck
Copy link
Contributor

goruck commented Aug 3, 2017 via email

@rbaynes
Copy link
Contributor

rbaynes commented Aug 4, 2017

This happened again in less than 12 hours on rob-bot. I tried pushing the restart button on the arduino shield and it didn't help. I unplugged the AM2315 and tested it on a different arduino connected to my laptop. It worked fine. Wiggled the connector and wires, no issues. Plugged it back into rob-bot and all is fine.

Perhaps there is a bug where that sensor shuts off and doesn't turn back on unless it is power cycled?

@rbaynes
Copy link
Contributor

rbaynes commented Aug 7, 2017

Found rob-bot in the "arduino not sending any data" state that is the result of getting the 255 error for too long this morning. AM2315 tests fine on the bench. Tinned the leads and put a new connector on it, reinstalled and its fine again. But for how long?

@rbaynes
Copy link
Contributor

rbaynes commented Aug 8, 2017

I'm going to make a change to the arduino_handler that will detect if it is not reading any data. After a certain number of empty reads (perhaps 10, since 1 is normal with the buffer reset logic) I will reset the serial port, which seems to reboot the arduino and get everything working again.

I know this isn't the same problem as getting TRACE> arduino_handler serial read: >2,AM2315 #1,1,Sensor responded with the wrong function code:255<.

I will also detect and count those, since I was getting them on rob-bot before I made a new connector for the AM2315.

I think the root problem is in the arduino code, but safety checks and reset on the ROS side can't hurt.

rbaynes pushed a commit that referenced this issue Aug 8, 2017
@rbaynes
Copy link
Contributor

rbaynes commented Aug 8, 2017

Added these changes to outstanding PR: #329

Testing on rob-bot and demo-bot.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants