Adding MAVLINK support

erskyTx runs on many radios and upgrade boards
ersky9x was a port of er9x for use on the sky9x board.
User avatar
RCHH
Posts: 467
Joined: Sun Jun 24, 2012 2:48 pm
Country: -
Location: Plymouth

Re: Adding MAVLINK support

Post by RCHH »

Downloaded firmware and flashed to my Sky9X box. Initital looksee shows all is in order visually. I like the 'integrated' new screen with all the info in the one place. Will find those Arduinos and get it working soon as.

Can also try out on a 9X-R Pro and AR9X 9X as well.
The simpleton asked "Hows about ErSky9X for Horus???". And the Genius from Dorset replied "Why not indeed? I shall get right onto it!" And then there was light on Horus! And it was good!

User avatar
RCHH
Posts: 467
Joined: Sun Jun 24, 2012 2:48 pm
Country: -
Location: Plymouth

Re: Adding MAVLINK support

Post by RCHH »

Mike,
Found the bag of Arduinos. Confirmed they are working as have uploaded other sketches to one.

I am getting compile errors with the sketch you posted. Using Arduino 1.0.5-r2, and errors as follows:

In file included from C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink\GCS_MAVLink.cpp:16:
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink/GCS_MAVLink.h:24: error: expected initializer before '*' token
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink/GCS_MAVLink.h:27: error: expected initializer before '*' token
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink/GCS_MAVLink.h: In function 'void comm_send_ch(mavlink_channel_t, uint8_t)':
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink/GCS_MAVLink.h:41: error: 'mavlink_comm_0_port' was not declared in this scope
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink/GCS_MAVLink.h:44: error: 'mavlink_comm_1_port' was not declared in this scope
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink/GCS_MAVLink.h: In function 'uint8_t comm_receive_ch(mavlink_channel_t)':
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink/GCS_MAVLink.h:62: error: 'mavlink_comm_0_port' was not declared in this scope
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink/GCS_MAVLink.h:65: error: 'mavlink_comm_1_port' was not declared in this scope
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink/GCS_MAVLink.h: In function 'uint16_t comm_get_available(mavlink_channel_t)':
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink/GCS_MAVLink.h:82: error: 'mavlink_comm_0_port' was not declared in this scope
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink/GCS_MAVLink.h:85: error: 'mavlink_comm_1_port' was not declared in this scope
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink/GCS_MAVLink.h: In function 'uint16_t comm_get_txspace(mavlink_channel_t)':
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink/GCS_MAVLink.h:103: error: 'mavlink_comm_0_port' was not declared in this scope
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink/GCS_MAVLink.h:106: error: 'mavlink_comm_1_port' was not declared in this scope
In file included from C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink\GCS_MAVLink.cpp:16:
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink/GCS_MAVLink.h: At global scope:
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink/GCS_MAVLink.h:123: error: use of enum 'ap_var_type' without previous declaration
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink\GCS_MAVLink.cpp:23: error: expected constructor, destructor, or type conversion before '*' token
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink\GCS_MAVLink.cpp:24: error: expected constructor, destructor, or type conversion before '*' token
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink\GCS_MAVLink.cpp:38: error: use of enum 'ap_var_type' without previous declaration
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink\GCS_MAVLink.cpp: In function 'uint8_t mav_var_type(int)':
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink\GCS_MAVLink.cpp:40: error: 'AP_PARAM_INT8' was not declared in this scope
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink\GCS_MAVLink.cpp:43: error: 'AP_PARAM_INT16' was not declared in this scope
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink\GCS_MAVLink.cpp:46: error: 'AP_PARAM_INT32' was not declared in this scope

Will google it of course, but any ideas appreciated ...
The simpleton asked "Hows about ErSky9X for Horus???". And the Genius from Dorset replied "Why not indeed? I shall get right onto it!" And then there was light on Horus! And it was good!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: RE: Re: Adding MAVLINK support

Post by jhsa »

RCHH wrote:
Will test only if we have British spelling .... StabiliSe and not StabiliZe! heh heh!!!! :twisted: :mrgreen: lol!!!
You could translate the firmware from English US to English UK :mrgreen: But I think it is not needed :mrgreen:

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Adding MAVLINK support

Post by jhsa »

Mike, what if you compile the code, post the hex file, and people could flash it to the arduino using a little wonderful tool called "Xloader", still using the FTDI adapter?
That is how we program the multiprotocol module.
Like that everybody would have the smallest code possible. Well, at least the same you have.. ;)

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
tomismrkolj1
Posts: 58
Joined: Sun Jan 24, 2016 10:32 am
Country: -

Re: Adding MAVLINK support

Post by tomismrkolj1 »

NO DATA blinking on mavlink screen of ersky9xr:

tested with
9xr pro
xjt and x8r modules
arduino nano
apm 2.6

compiled with arduino ide 1.6.7, uploaded without errors
ground connected to d2 pin on nano (to activate s.port)
signal of s.port connected to d5
apm powered by usb 220v to 5v adapter (should it be power module?)




RSSI works, so it is not problem of xjt x8r communication
green light is on all the time on nano and another green blinks every second

tomi

User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

RCHH wrote:I am getting compile errors with the sketch you posted. Using Arduino 1.0.5-r2, and errors as follows:

In file included from C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink\GCS_MAVLink.cpp:16:
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink/GCS_MAVLink.h:24: error: expected initializer before '*' token
I'm not using an libraries, I think you might have some libraries still available from something you have done previously, and they are being used rather than the code I posted.
Please try renaming the "C:\Users\Nikki\Documents\Arduino\libraries" directory to, say, "C:\Users\Nikki\Documents\Arduino\librariesx" and try compiling again.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
tomismrkolj1
Posts: 58
Joined: Sun Jan 24, 2016 10:32 am
Country: -

Re: Adding MAVLINK support

Post by tomismrkolj1 »

Double checked the connections and connectors. They are fine.
Regarding nano led lights:
when I power it up, green led power is lit, and after apm 2.6 intializes green tx light starts blinking every second, but red rx light does not blink at all. I guess this is a problem. For test I have connected rx and tx pin on nano together and both led (green tx and red tx blink).

tomi
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

I think the APM may not drive the Rx signal fully. On the nano, there is a 1K resistor to the FTDI serial chip. The APM needs to be able to overcome this. If the APM has a resistor in the output it may not be able to do so.
As long as the Arduino doesn't see data from the APM it sends a "rate request" to the APM every 2 seconds.

The code should fit in a 16K Pro Mini (around 11K using 1.5.8 IDE).

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
tomismrkolj1
Posts: 58
Joined: Sun Jan 24, 2016 10:32 am
Country: -

Re: Adding MAVLINK support

Post by tomismrkolj1 »

Ok,

so you think it should work with mini pro? Does it have the same resistor as nano?

Have you made any config settings in mission planner on the apm before it worked?

Should I use 1.5.8 IDE instead of 1.6.7?

In two hours, I will run some more tests, when my brother is coming with his equipment. Another 9xr pro, another xjt and x8r and another apm powered by BEC. This way we will try to pinpoint the problem. We will use another cables too.
We will also be able to upload sketch to my mini pro, as I don't have FTDI cable in my house, and nano did not want to program mini pro...

Will report back in few hours.

tomi
User avatar
RCHH
Posts: 467
Joined: Sun Jun 24, 2012 2:48 pm
Country: -
Location: Plymouth

Re: Adding MAVLINK support

Post by RCHH »

MikeB wrote:
RCHH wrote:I am getting compile errors with the sketch you posted. Using Arduino 1.0.5-r2, and errors as follows:

In file included from C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink\GCS_MAVLink.cpp:16:
C:\Users\Nikki\Documents\Arduino\libraries\GCS_MAVLink/GCS_MAVLink.h:24: error: expected initializer before '*' token
I'm not using an libraries, I think you might have some libraries still available from something you have done previously, and they are being used rather than the code I posted.
Please try renaming the "C:\Users\Nikki\Documents\Arduino\libraries" directory to, say, "C:\Users\Nikki\Documents\Arduino\librariesx" and try compiling again.

Mike.
Ah! Apologies Mike - already solved it earlier this morning. It was as you said however ... :D
The simpleton asked "Hows about ErSky9X for Horus???". And the Genius from Dorset replied "Why not indeed? I shall get right onto it!" And then there was light on Horus! And it was good!
User avatar
RCHH
Posts: 467
Joined: Sun Jun 24, 2012 2:48 pm
Country: -
Location: Plymouth

Re: Adding MAVLINK support

Post by RCHH »

Pin out from Arduino Pro Mini to 'D' series RX would be A0?
The simpleton asked "Hows about ErSky9X for Horus???". And the Genius from Dorset replied "Why not indeed? I shall get right onto it!" And then there was light on Horus! And it was good!
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

It's still IO5 for both SPort and Hub.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

tomismrkolj1 wrote:so you think it should work with mini pro? Does it have the same resistor as nano?
Yes it should work, no it doesn't have the resistor.
tomismrkolj1 wrote:Have you made any config settings in mission planner on the apm before it worked?
Set the Telemetry baudrate to 57600 is the only critical setting.
tomismrkolj1 wrote:Should I use 1.5.8 IDE instead of 1.6.7?
I would expect 1.6.7 to be OK, just check the size of the code (Do a Verify rather than an Upload to see the size).

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
RCHH
Posts: 467
Joined: Sun Jun 24, 2012 2:48 pm
Country: -
Location: Plymouth

Re: Adding MAVLINK support

Post by RCHH »

MikeB wrote:It's still IO5 for both SPort and Hub.

Mike.
Thanks Mike. Only confused as to what pin to use as on the write up on the github info about the original er9x MAVLink setup, it shows the connection by the A0 pin, but lists it as D5 which is correctly termed - not 'IO5' strictly speaking)

Image
The simpleton asked "Hows about ErSky9X for Horus???". And the Genius from Dorset replied "Why not indeed? I shall get right onto it!" And then there was light on Horus! And it was good!
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

I was using the schematic of the Mini (not Pro) I'm using. The pin you want is the one labelled '5' on the board D5 on your picture.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
RCHH
Posts: 467
Joined: Sun Jun 24, 2012 2:48 pm
Country: -
Location: Plymouth

Re: Adding MAVLINK support

Post by RCHH »

Yep. Have it programmed and wired up to my APM2.8 but work is a calling .... not back now til midnight gone! Grrrr!!!
The simpleton asked "Hows about ErSky9X for Horus???". And the Genius from Dorset replied "Why not indeed? I shall get right onto it!" And then there was light on Horus! And it was good!
tomismrkolj1
Posts: 58
Joined: Sun Jan 24, 2016 10:32 am
Country: -

Re: Adding MAVLINK support

Post by tomismrkolj1 »

Ok after tests with two different sets of 9xr pro, xjt, x8r, apm 2.6 and wires
we have consistent conclusions (the same behaviour on both sets):

arduino nano does not work.

arduino mini pro 168 5V 16MHz seems to connect.

After apm starts sending telemetry data, diasrmed is shown on telemetry screen, but NO GPS is still lit. 0% is blinking above disarmed. Other variables (including GPS position) do not blink, but show zeroes. Disarmed does not change when apm gets armed! Modes do not change on telemetry screen when changed in apm.

What do you think?

tomi
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

On the SPort version I'm not (yet) sending all possible data. I needed to get it basically working. Currently I'm sending:
Temp1 = APMmode
Altitude (barometric)
Course
Voltage
BaseMode
Temp2 = number of satellites
Current
RPM
Vcc
CpuLoad
HomeDir
WP-Bearing

Please also set up a custom telemetry screen to show TmOK.
When running, does TmOK then show 0, 1 or 2?

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
tomismrkolj1
Posts: 58
Joined: Sun Jan 24, 2016 10:32 am
Country: -

Re: Adding MAVLINK support

Post by tomismrkolj1 »

TmOK shows 2.
If i disconnect power to apm and x8r TmOK shows 1.

I am still not sure that apm is sending out the telemetry. We tried to confrim that with two osd devices (minimOSD and ramzebi), but somehow it didn't work even without arduino connected. It was working before, but not today. Strange.


tomi
Brodziek
Posts: 15
Joined: Thu Mar 20, 2014 5:55 pm
Country: Poland

Re: Adding MAVLINK support

Post by Brodziek »

It's great that you can see some progress. Unfortunately, he can not participate in testing (using normal 9XR) :( .
I look forward to a positive conclusion.
Maybe then Mike will take time and will add the same for er9x?
Mike, can you show your extra Mavlink screen?
Using Tapatalk
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

I've just copied the display on your post above: viewtopic.php?f=7&t=8396#p110011, at present.
I should be able to add this to the '128 and '256 versions of er9x.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Brodziek
Posts: 15
Joined: Thu Mar 20, 2014 5:55 pm
Country: Poland

Re: RE: Re: Adding MAVLINK support

Post by Brodziek »

MikeB wrote:...
I should be able to add this to the '128 and '256 versions of er9x.
Mike.
That's great news!
Already thank you very much. :)
Using Tapatalk
tomismrkolj1
Posts: 58
Joined: Sun Jan 24, 2016 10:32 am
Country: -

Re: Adding MAVLINK support

Post by tomismrkolj1 »

Mike,

do you think we have problem because using 16k version of mini pro? During compile it warns, that only 112 bytes is left for variables.
How can I test if mini is getting mavlink messages from apm?
What is the meaning of TmOK 0, 1 and 2? DO the work if there is no mavlink from APM?

tomi
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

You may have a problem. I forgot the 16K version only has 1K RAM while the 32K version has 2K.
TmOK, indicates the state of received telemetry:
0 - nothing
1 - receiver information
2 - receiver and sensor information

The values you report show the receiver to transmitter is operating correctly, and there is sensor data being sent. The sensor data will all be zero if no data is arriving from APM.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

I've got the code in er9x ('128/'2561). It is partly working.
Having fixed a small bug, it seems to be working as well as the ersky9x version. I'll post some test versions for '128 and '2561 a short while, just building them now.
Currently tested using a XJT Tx module and a D8R-II receiver.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

I have posted test versions of er9x on the er9x test versions thread.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Brodziek
Posts: 15
Joined: Thu Mar 20, 2014 5:55 pm
Country: Poland

Re: RE: Re: Adding MAVLINK support

Post by Brodziek »

MikeB wrote:I have posted test versions of er9x on the er9x test versions thread.

Mike.
There is a small mistake in the menu Telemetry. On the second screen is empty click the key, when you switch down. The last item on the menu "Custom display" is not available.
Using Tapatalk
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

Corrected and new versions posted.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
tomismrkolj1
Posts: 58
Joined: Sun Jan 24, 2016 10:32 am
Country: -

Re: Adding MAVLINK support

Post by tomismrkolj1 »

I guess I will wait for my mini pro 328 to get from China. It will take two more weeks.
I will test with it, as 16k version might not work due to its limitations.

tomi
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

I'm trying to find what is using all the RAM. Unfortunately the Arduino IDE doesn't create a 'proper' MAP file for the compiled code to show this easily.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

Post Reply

Return to “erskyTx (was ersky9x)”