Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
52fc56a6
Commit
52fc56a6
authored
6 years ago
by
Beat Küng
Committed by
Daniel Agar
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
gps: explicitly set SPI bus speed to 1MHz
Required on RPi, the default seems to be too high.
parent
bec43b0b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/drivers/gps/gps.cpp
+24
-0
24 additions, 0 deletions
src/drivers/gps/gps.cpp
with
24 additions
and
0 deletions
src/drivers/gps/gps.cpp
+
24
−
0
View file @
52fc56a6
...
...
@@ -87,6 +87,9 @@
#include
"devices/src/mtk.h"
#include
"devices/src/ashtech.h"
#ifdef __PX4_LINUX
#include
<linux/spi/spidev.h>
#endif
/* __PX4_LINUX */
#define TIMEOUT_5HZ 500
#define RATE_MEASUREMENT_PERIOD 5000000
...
...
@@ -608,6 +611,27 @@ GPS::run()
PX4_ERR
(
"GPS: failed to open serial port: %s err: %d"
,
_port
,
errno
);
return
;
}
#ifdef __PX4_LINUX
if
(
_interface
==
GPSHelper
::
Interface
::
SPI
)
{
int
spi_speed
=
1000000
;
// make sure the bus speed is not too high (required on RPi)
int
status_value
=
ioctl
(
_serial_fd
,
SPI_IOC_WR_MAX_SPEED_HZ
,
&
spi_speed
);
if
(
status_value
<
0
)
{
PX4_ERR
(
"SPI_IOC_WR_MAX_SPEED_HZ failed for %s (%d)"
,
_port
,
errno
);
return
;
}
status_value
=
ioctl
(
_serial_fd
,
SPI_IOC_RD_MAX_SPEED_HZ
,
&
spi_speed
);
if
(
status_value
<
0
)
{
PX4_ERR
(
"SPI_IOC_RD_MAX_SPEED_HZ failed for %s (%d)"
,
_port
,
errno
);
return
;
}
}
#endif
/* __PX4_LINUX */
}
param_t
handle
=
param_find
(
"GPS_YAW_OFFSET"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment