Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

ADC check fails if battery is connected #45

Closed
Razican opened this issue Aug 30, 2015 · 4 comments
Closed

ADC check fails if battery is connected #45

Razican opened this issue Aug 30, 2015 · 4 comments
Assignees
Milestone

Comments

@Razican
Copy link
Member

Razican commented Aug 30, 2015

It seems that when the battery is connected the response from the ADC is not correctly read by the software. Here is what the log looks like:
screenshot from 2015-08-31 00-13-32
Note that the \r is the \r character, not literal string __ and r. \n and \r are outputted like that for better log reading.

While here is what the screen /dev/ttyUSB0 outputs on the same command. It clearly seems a Serial issue. We need to track down the issue and fix it before the launch, or we could have battery issues D:
screenshot from 2015-08-31 00-14-05

@Razican
Copy link
Member Author

Razican commented Aug 30, 2015

It could have something to do with the read_line implementation in the serial library. I'll check out tomorrow. The thing is that debugging this kind of issues is really tough since the characters that have been read are not ASCII.

In any other case I would think that this could be some kind of baud issue, but it's clear that everything works as expected except from this.

It shouldn't be related to the timeout. We have tested it with timeouts from 1s to 30s ad occurs always. What it could be is that the \r is read but then there is some timeout to the final \r\n (it looks that it receives \r\r\n). This could lead to the unsetting of some variables checking for line ending. Nevertheless, this could make the second line be returned in the same string as the first one, but it does not explain the non-ASCII characters.

@Razican
Copy link
Member Author

Razican commented Sep 4, 2015

Maybe we could try to use fgets()/read() instead to read the line, but this could block the thread or maybe read incomplete lines.

@Razican Razican self-assigned this Sep 8, 2015
@Razican
Copy link
Member Author

Razican commented Sep 15, 2015

Incredibly this seems to be magically working and I do not understand why. I'll test better tomorrow.

@Razican
Copy link
Member Author

Razican commented Sep 19, 2015

It works randomly, we have seen some serial tests, both in GSM and GPS. We have added some protection for the flight, but it should be checked and fixed. Could be WiringPi issue.

@Razican Razican closed this as completed Sep 19, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant