32 #include "ubx_protocol.h"
36 #if PRINT_DEBUG_GPS_UBX_UCENTER
37 #define DEBUG_PRINT(...) printf(__VA_ARGS__)
39 #define DEBUG_PRINT(...) {}
51 #define GPS_UBX_UCENTER_STATUS_STOPPED 0
52 #define GPS_UBX_UCENTER_STATUS_AUTOBAUD 1
53 #define GPS_UBX_UCENTER_STATUS_CONFIG 2
54 #define GPS_UBX_UCENTER_STATUS_WAITING 3
56 #define GPS_UBX_UCENTER_REPLY_NONE 0
57 #define GPS_UBX_UCENTER_REPLY_ACK 1
58 #define GPS_UBX_UCENTER_REPLY_NACK 2
59 #define GPS_UBX_UCENTER_REPLY_VERSION 3
60 #define GPS_UBX_UCENTER_REPLY_CFG_PRT 4
63 #define UBX_GPS_BAUD (UBX_GPS_LINK).baudrate
116 #if PRINT_DEBUG_GPS_UBX_UCENTER
120 DEBUG_PRINT(
"WARNING: Unable to determine the ublox baudrate. Autoconfiguration is unlikely to work.\n");
328 #define NAV_DYN_STATIONARY 1
329 #define NAV_DYN_PEDESTRIAN 2
330 #define NAV_DYN_AUTOMOTIVE 3
331 #define NAV_DYN_SEA 4
332 #define NAV_DYN_AIRBORNE_1G 5
333 #define NAV_DYN_AIRBORNE_2G 6 // paparazzi default
334 #define NAV_DYN_AIRBORNE_4G 7
336 #define NAV5_DYN_PORTABLE 0 // ublox default
337 #define NAV5_DYN_FIXED 1
338 #define NAV5_DYN_STATIONARY 2
339 #define NAV5_DYN_PEDESTRIAN 3
340 #define NAV5_DYN_AUTOMOTIVE 4
341 #define NAV5_DYN_SEA 5
342 #define NAV5_DYN_AIRBORNE_1G 6
343 #define NAV5_DYN_AIRBORNE_2G 7 // paparazzi default
344 #define NAV5_DYN_AIRBORNE_4G 8
346 #ifndef GPS_UBX_NAV5_DYNAMICS
347 #define GPS_UBX_NAV5_DYNAMICS NAV5_DYN_AIRBORNE_2G
350 #define NAV5_MASK 0x05 // Apply dynamic model and position fix mode settings
352 #define NAV5_2D_ONLY 1
353 #define NAV5_3D_ONLY 2 // paparazzi default
354 #define NAV5_AUTO 3 // ublox default
356 #define NAV5_DEFAULT_MIN_ELEV 5 // deg
357 #define NAV5_DEFAULT_PDOP_MASK 25 // no units
358 #define NAV5_DEFAULT_TDOP_MASK 25 // no units
359 #define NAV5_DEFAULT_P_ACC 100 // m
360 #define NAV5_DEFAULT_T_ACC 300 // m
361 #define NAV5_DEFAULT_STATIC_HOLD_THRES 0 // cm/s
374 0x3C, 0x14, 0x03E8 , 0x0000, 0x0, 0x17, 0x00FA, 0x00FA,
375 0x0064, 0x012C, 0x000F, 0x00, 0x00);
390 #warning "GPS_PORT_ID is no longer needed by the ublox ucenter for automatically configuration. Please remove this defined variable and double check that autoconfig is working as expected."
394 #define UBX_UART_MODE_MASK 0x000008D0
396 #define UBX_PROTO_MASK 0x0001
397 #define NMEA_PROTO_MASK 0x0002
398 #define RTCM_PROTO_MASK 0x0004
400 #define GPS_PORT_DDC 0x00
401 #define GPS_PORT_UART1 0x01
402 #define GPS_PORT_UART2 0x02
403 #define GPS_PORT_USB 0x03
404 #define GPS_PORT_SPI 0x04
405 #define GPS_PORT_RESERVED 0x05
407 #ifndef GPS_UBX_UCENTER_RATE
408 #define GPS_UBX_UCENTER_RATE 0x00FA // In milliseconds. 0x00FA = 250ms = 4Hz
419 DEBUG_PRINT(
"WARNING: Please include the gps_i2c module.\n");
437 DEBUG_PRINT(
"WARNING: ublox SPI port is currently not supported.\n");
445 #define GPS_SBAS_ENABLED 0x01
447 #define GPS_SBAS_RANGING 0x01
448 #define GPS_SBAS_CORRECTIONS 0x02
449 #define GPS_SBAS_INTEGRITY 0x04
451 #define GPS_SBAS_MAX_SBAS 1 // Default ublox setting uses 3 SBAS channels(?)
453 #define GPS_SBAS_AUTOSCAN 0x00
468 DEBUG_PRINT(
"gps_ubx_ucenter_configure nr: %u\n", nr);
482 #if PRINT_DEBUG_GPS_UBX_UCENTER
484 DEBUG_PRINT(
"ublox did not acknowledge port configuration.\n");
510 #if DEBUG_GPS_UBX_UCENTER
534 #if GPS_UBX_UCENTER_SLOW_NAV_SOL
554 #if USE_GPS_UBX_RXM_RAW
560 #if USE_GPS_UBX_RXM_SFRB
569 #if DEBUG_GPS_UBX_UCENTER
#define NAV5_DEFAULT_MIN_ELEV
#define NAV5_DEFAULT_P_ACC
void uart_periph_set_baudrate(struct uart_periph *p, uint32_t baud)
Set baudrate.
static bool gps_ubx_ucenter_configure(uint8_t nr)
#define GPS_UBX_UCENTER_CONFIG_STEPS
U-Center Variables.
#define NAV5_DEFAULT_PDOP_MASK
#define GPS_UBX_UCENTER_STATUS_STOPPED
#define GPS_UBX_UCENTER_REPLY_NONE
#define GPS_SBAS_AUTOSCAN
#define GPS_SBAS_CORRECTIONS
#define NAV5_DEFAULT_STATIC_HOLD_THRES
UBX protocol specific code.
#define GPS_UBX_UCENTER_RATE
char replies[GPS_UBX_UCENTER_CONFIG_STEPS]
uint8_t msg_buf[GPS_UBX_MAX_PAYLOAD]
static void gps_ubx_ucenter_config_sbas(void)
#define GPS_UBX_UCENTER_REPLY_NACK
static void gps_ubx_ucenter_config_port(void)
struct gps_ubx_ucenter_struct gps_ubx_ucenter
#define GPS_UBX_UCENTER_STATUS_WAITING
void gps_ubx_ucenter_periodic(void)
#define NAV5_DEFAULT_T_ACC
#define GPS_UBX_NAV5_DYNAMICS
#define GPS_UBX_UCENTER_STATUS_AUTOBAUD
#define NAV5_DEFAULT_TDOP_MASK
#define GPS_UBX_UCENTER_REPLY_ACK
#define GPS_UBX_UCENTER_STATUS_CONFIG
#define GPS_SBAS_INTEGRITY
#define NAV_DYN_AIRBORNE_2G
#define GPS_UBX_UCENTER_REPLY_VERSION
#define GPS_UBX_UCENTER_REPLY_CFG_PRT
static void gps_ubx_ucenter_config_port_poll(void)
Polls the u-blox port configuration When the payload is omitted (zero length), the configuration for ...
#define DefaultChannel
SITL.
void gps_ubx_ucenter_init(void)
void gps_ubx_ucenter_event(void)
#define GPS_SBAS_MAX_SBAS
uint8_t port_id
Port identifier number.
bool gps_i2c_tx_is_ready(void)
is driver ready to send a message
Common code for AP and FBW telemetry.
static bool gps_ubx_ucenter_autobaud(uint8_t nr)
Automatically determine the baudrate of the u-blox module.
void gps_i2c_begin(void)
config is done, begin reading messages
#define UBX_UART_MODE_MASK
static void gps_ubx_ucenter_config_nav(void)
static void gps_ubx_ucenter_enable_msg(uint8_t class, uint8_t id, uint8_t rate)
Enable u-blox message at desired period.