Connecting two GPS on VOXL2
-
@Aks One problem is a lack of extra UART going to the DSP. However, with the appropriate expansion board you can get another UART for the applications processor. Then it should be possible but we have never tried this configuration.
-
This post is deleted! -
@Eric-Katzfey Thank you for the response. For GPS to communicate with DSP anyways we would need extra UART to DSP rather then application processor right? Or is there any way to reroute data from application processor to DSP?
Also say if I expand UART with some expansion board, What all changes I would have to do in voxl-px4 firmware in order to get second GPS support running? I can also see one I2C line vacant on J19 where I can loop in second GPS MAG and get it running but not sure about software configurations. -
@Aks Yes, PX4 on VOXL2 runs partially on the applications processor and partly on the DSP. Generally it's best for all device drivers to run directly on the DSP since that is where all of the real time flight control code runs but GPS has a fairly slow update rate so it will be okay running on the applications processor. If you also want to use the magnetometer then you need an i2c bus. Yes, there is an open one on DSP side (via J19) but that one has not been tested yet. Since the GPS and magnetometer are 2 separate drivers you can run one on applications processor and one on DSP.
-
@Eric-Katzfey Thank you for the update. Any quick guide for software configuration which you can suggest for this dual gps setup? My hardware connections would be as follows :
-
GPS1 on VOXL2 J19 pins 1 to 6 (UART and I2C for GPS and Mag)
-
GPS2 UART over J18 (Modalai ESC port) and I2C over J19 pins 7 and 8.
-
I have VOXL2IO also integrated over J19 10,11 and 12 number pins.
By this configuration I can ensure all UART and I2C connections are going to DSP directly.
Here are my queries :-
With above mentioned connections I would have to change QUP settings in firmware I guess. Can you mention those places?
-
Can I follow this link to enable dual GPS as per PX4 mainline or is some other settings would be essential for dual GPS enabling over ModalAI PX4 version?
-
-
@Aks Those connections look reasonable. Let me do a little digging to see what would be required to use pins 7 and 8 on J19 for the new magnetometer.
-
@Aks I looked through the code and I don't see any obvious roadblocks to using pins 7 and 8 on J19 for the second magnetometer. The current magnetometer driver uses
-b 1
to specify the i2c bus on pins 4 and 5 of J19. For pins 7 and 8 I think you would need to specify-b 4
. I'll try to wire something up and try it on those pins in the next couple of days. -
@Aks I hooked up a magnetometer to pins 7 and 8 and it didn't work. But I found the issue in PX4 and was able to get it working by changing a couple of files. Here is the required diff:
voxl-px4-1.12/px4-firmware$ git diff diff --git a/boards/modalai/rb5-flight/src/board_config.h b/boards/modalai/rb5-flight/src/board_config.h index d205d7b124..479fb95652 100644 --- a/boards/modalai/rb5-flight/src/board_config.h +++ b/boards/modalai/rb5-flight/src/board_config.h @@ -54,7 +54,7 @@ #define PX4_I2C_BUS_EXPANSION 3 // I2C3: J14 / Power #define PX4_I2C_BUS_EXPANSION2 9 // I2C9: J15 / Radio Receiver / Sensors -#define PX4_NUMBER_I2C_BUSES 3 +#define PX4_NUMBER_I2C_BUSES 4 #define PX4_I2C_OBDEV_BMP280 0x76 diff --git a/boards/modalai/rb5-flight/src/i2c.cpp b/boards/modalai/rb5-flight/src/i2c.cpp index ce4b99a20c..49e361a877 100644 --- a/boards/modalai/rb5-flight/src/i2c.cpp +++ b/boards/modalai/rb5-flight/src/i2c.cpp @@ -36,6 +36,7 @@ constexpr px4_i2c_bus_t px4_i2c_buses[I2C_BUS_MAX_BUS_ITEMS] = { initI2CBusExternal(1), initI2CBusExternal(2), + initI2CBusExternal(4), initI2CBusInternal(5) //initI2CBusExternal(3), //initI2CBusExternal(9),
-
@Eric-Katzfey Thank you for this information. I highly appreciate this. How about using J18 for GPS UART? What changes would be essential for this? Also any idea about EKF configuration for using dual GPS?
-
@Aks Should be no problem using J18 for GPS instead of ESC.
-
@Aks We've never done a dual GPS configuration so not sure what is required for PX4.
-
@Eric-Katzfey All the points noted. Thanks alot for all the detailed digging into this. I would try out this configuration. One point which I missed is, In order to connect GPS to J18 UART, we need to change some port number / QUP number right? If you can clarify this it would be great.
-
@Aks Unfortunately, there seems to be a bug in the handling of options in the gps driver. The standard uart ports are 2 for the ESC (J18), 6 for the GPS (J19), and 7 for RC (Also on J19). The default port in the gps code is 6. You should be able to pass a different port to the gps driver using the -d option. However, px4_getopt in gps.cpp isn't parsing it if I pass it a different port with the -d option. In fact, you can see that the Holybro gps start line includes -d 7 and -b 115200. The code seems to parse the baudrate fine but not the port which is a good thing because port 7 is for RC, not GPS! Anyways, long story short, in order to put the gps on port 2 you would need to figure out why the gps driver is not parsing the d option correctly first.
-
@Eric-Katzfey Cool thank you. This gives me some lead to think on. I will debug this further. One small query. Can I run two gps driver with different 'd' options from config file or their can be conflict of same name services running? Just checking for clarity.
-
@Aks You should be able to run two. But, again, we have never tested.