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

AP_GPS: added GPS_DRV_OPTIONS bit for forcing ublox GPS to 115200 #16007

Merged
merged 2 commits into from
Aug 10, 2021

Conversation

tridge
Copy link
Contributor

@tridge tridge commented Dec 7, 2020

this may help with some GPS modules

@tridge tridge added the GPS label Dec 7, 2020
@@ -79,6 +79,12 @@ class AP_GPS_Backend
return _last_itow;
}

enum DriverOptions : int16_t {
UBX_MBUseUart2 = (1 << 0U),
Copy link
Contributor

Choose a reason for hiding this comment

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

Uh....

Suggested change
UBX_MBUseUart2 = (1 << 0U),
UBX_MBUseUart2 = (1U << 0),

?

@@ -79,6 +79,12 @@ class AP_GPS_Backend
return _last_itow;
}

enum DriverOptions : int16_t {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an odd storage type.

Copy link
Contributor

Choose a reason for hiding this comment

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

This was just to reflect the fact that we are using this against a AP_Int16 everywhere, so just trying to minimize casts/extensions.

Copy link
Contributor

@WickedShell WickedShell left a comment

Choose a reason for hiding this comment

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

What are the specific problems we are trying to address here? This mostly just seems unfortunate to include the whole UBLOX_SET_BINARY_115200 blob, since it was previously out of the build... (And since it's known to break if you try and combine this with some other options).

It's more work but I suspect if we really want something like this we are better off adding an option that says "honor the SERIALx_BAUD parameter instead, and use that as the basis of setting the baud rate, rather then hardcoding just this one for now.

@@ -79,6 +79,12 @@ class AP_GPS_Backend
return _last_itow;
}

enum DriverOptions : int16_t {
Copy link
Contributor

Choose a reason for hiding this comment

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

This was just to reflect the fact that we are using this against a AP_Int16 everywhere, so just trying to minimize casts/extensions.

@tridge
Copy link
Contributor Author

tridge commented Jan 25, 2021

It's more work but I suspect if we really want something like this we are better off adding an option that says "honor the SERIALx_BAUD parameter instead, and use that as the basis of setting the baud rate, rather then hardcoding just this one for now.

the problem with that is our blob handling, we construct msgs with the crc attached in NMEA and UBX form. We'd need to use general NMEA and UBX creation fns to support the configured baudrate. Maybe it is worth it?

@WickedShell
Copy link
Contributor

the problem with that is our blob handling, we construct msgs with the crc attached in NMEA and UBX form. We'd need to use general NMEA and UBX creation fns to support the configured baudrate. Maybe it is worth it?

It probably is, as the baudrate problems will grow worse over time. The other advantage that springs to mind is that if you have specified the type to be just UBlox for example if we are generating the blob at runtime we can drop the unneeded blobs for other drivers, which results in a smaller blob we are sending to the GPS, and allows us to start getting meaningful configuration done quicker, and avoids sitting behind a long queue of pending blobs.

@tridge
Copy link
Contributor Author

tridge commented Apr 23, 2021

@WickedShell see this PR: #17261
it demonstrates that the f405 GPS isn't handling the 230kbaud without packet loss if DMA is disabled.
the underlying problem must be that we have some interrupt handler taking more than 5usec

@WickedShell
Copy link
Contributor

@tridge given your comment here #17261 (comment) is it fair to say we should wait a bit more till that's investigated? It sounds like it's not actually the baud rate anymore...

@andyp1per
Copy link
Collaborator

We definitely need something like this. Anecdotally I believe F405 without DMA is sucking up CPU from other things and we have many F405 boards where there is essentially only one DMA enabled UART and so if you have something like CRSF that absolutely requires DMA you are a bit screwed.

I'm not sure I like the option bit - seems like its hard to configure. Maybe you could change the meaning to "use serial baud rate if supported" and check whether the baud rate has actually been configured and if not just default to the current behaviour.

@Hwurzburg
Copy link
Collaborator

have a user that is having problems with M8030 based GPS with new high baud rate....works in stable, not master or beta....here is the issue (#18252) showing some affected modules...will build him a master version with this merged and have him test...

@Hwurzburg
Copy link
Collaborator

User tested this and GPS now works and can arm...

@peterbarker
Copy link
Contributor

Why isn't this a bit in SERIALn_OPTIONS?

@tridge
Copy link
Contributor Author

tridge commented Aug 9, 2021

Why isn't this a bit in SERIALn_OPTIONS?

because it isn't affecting the serial port. It is affecting the auto-detection logic in AP_GPS.

@tridge
Copy link
Contributor Author

tridge commented Aug 9, 2021

I'm not sure I like the option bit - seems like its hard to configure. Maybe you could change the meaning to "use serial baud rate if supported" and check whether the baud rate has actually been configured and if not just default to the current behaviour.

that would mean we'd need to construct the UBLOX_SET_BINARY_XXX packet for arbitrary baud rates. That is possible, but is a much more complex patch.

@WickedShell
Copy link
Contributor

that would mean we'd need to construct the UBLOX_SET_BINARY_XXX packet for arbitrary baud rates. That is possible, but is a much more complex patch.

We are rapidly trending towards that actually being the simpler patch, but I do agree we don't need it yet.

Maybe you could change the meaning to "use serial baud rate if supported" and check whether the baud rate has actually been configured and if not just default to the current behaviour.

There are some minimums that need to not be deviated from (IE we have some hard minimum floors, 9600 will never work for example).

@tridge
Copy link
Contributor Author

tridge commented Aug 9, 2021

We are rapidly trending towards that actually being the simpler patch, but I do agree we don't need it yet.

its the memory management with the allocated blob that will be a bit tricky. Perfectly doable, but as there are calls for this in 4.1.0 I'd like to keep it simple.
Are you ok with this going in as-is?

@WickedShell
Copy link
Contributor

its the memory management with the allocated blob that will be a bit tricky

Agreed. The good news is if we can change that more of the init code may be sharable for stuff like the SBF drivers, that have to construct their strings at runtime.

I'd agree with deferring the change to later, especially if trying to race it into 4.1

@tridge tridge added the WikiNeeded needs wiki update label Aug 9, 2021
@IamPete1
Copy link
Member

IamPete1 commented Aug 9, 2021

Needs the param description update to match.

@tridge tridge merged commit 4f4a0a0 into ArduPilot:master Aug 10, 2021
@Hwurzburg Hwurzburg removed the WikiNeeded needs wiki update label Sep 30, 2021
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants