OpenXSensor SPORT Interface

Development & General Chat for the superb openxvario project.

Moderator: rainer

NeilRogers
Posts: 87
Joined: Sat Jun 22, 2013 2:12 pm
Country: United Kingdom
Location: Wiltshire

Re: OpenXSensor SPORT Interface

Post by NeilRogers »

Peg@se

I've only a frsky vario to check here, I couldn't see a startup sequence your frame looks good I saw

7E 83 10 10 1 FF 3 0 0 DB
7E 83 10 0 1 9 56 0 0 8F

These frame types alt & vario



Startup looks to just poll different IDs


Windy and wet here so no gliding so I'm playing with trigger polling and talking back in the required format still back to experimenting

NeilRogers
Posts: 87
Joined: Sat Jun 22, 2013 2:12 pm
Country: United Kingdom
Location: Wiltshire

Re: OpenXSensor SPORT Interface

Post by NeilRogers »

A quick update on my experimenting, I've managed to write a program to handshake with the SPort on x8r and display static data onto the Vsp field of the taranis monitor screen.

MikeB wrote the following:

"The first problem I found is the baud rate timing for 57600 baud. It was too long between receive bits. I've had to change the Rx timing in softwareSerial.cpp from 37 to 34, then the data from the Rx is recognised.
The next problem is the lack of "turning round" of the pin, it was relying on the internal pullup to drive a logic 1."

I agree without changing stop bit length setting in the Arduino library I was unable to get the x8r to Rx data, softwareSerial.cpp from 37 to 34.

I think it is easiler to setup the softwareSerial interface to use 2 pins one rx and one tx as designed, just connect the signal to both pins I used 4 & 5 and switch the TX to input during liatening for the rx poll.
I found the internal pulllup was good enough for the x8r to detect the data stream
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: OpenXSensor SPORT Interface

Post by MikeB »

I'm working on a version of the code that uses timer1 to provide accurate timing. I already have code working that 'turns the pin round' properly.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
NeilRogers
Posts: 87
Joined: Sat Jun 22, 2013 2:12 pm
Country: United Kingdom
Location: Wiltshire

Re: OpenXSensor SPORT Interface

Post by NeilRogers »

thanks mike,

Sounds like mods you are further along and yours will be better than my simple vario.

Its nice little project for me to learn the Arduino devices and get back into a bit of programming, while the slope soaring weather is useless
I don't know how you have time to do all this testing and mods when you are doing the analogue sensor as well
Bruneaux
Posts: 119
Joined: Mon Oct 14, 2013 7:13 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by Bruneaux »

Neil,

Now you can buy a voltage based sensor for a SPORT interface.

http://www.alofthobbies.com/x8r2analog.html

It's not sold by FrSky, but I'm thinking of trying it.

Bruneaux

User avatar
bob195558
Posts: 2377
Joined: Sun Dec 16, 2012 7:24 pm
Country: United States
Location: New England, Vermont
Contact:

Re: OpenXSensor SPORT Interface

Post by bob195558 »

:)
Will this work with 9x Radio (er9x-FrSky firmware) using the FrSky XJT - JR/Graupner Type 16ch Duplex Transmitter Telemetry Module
and the X8R - 16 channel, Sbus, Smart Port Receiver and with a 3S Lipo battery ?
Er9x on 9x radio, with Smartieparts Programmer and TelemetrEZ Board.
ErSky9x on Taranis, Sky9x, 9Xtreme radios.
3D-Printing: (https://openrcforums.com/forum/viewforum.php?f=129).
Bruneaux
Posts: 119
Joined: Mon Oct 14, 2013 7:13 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by Bruneaux »

Take a look at the specs. I can't make any statements beyond the link that I posted. I'm going to get a couple of them and play with them. I'd prefer to see the openXsensor work with the SPORT because it opens up the digital possibilities vs. a single analog voltage.

FrSky has released a SPORT based Amp sensor so people can read (up to 40 amp) current draw.
http://www.alofthobbies.com/sp-40a.html

Oh, and don't bother to try to buy one of the analog voltage sensors. They are already sold out already!!!!. Amazing.
NeilRogers
Posts: 87
Joined: Sat Jun 22, 2013 2:12 pm
Country: United Kingdom
Location: Wiltshire

Re: OpenXSensor SPORT Interface

Post by NeilRogers »

This is a sensor x8r2analog designed by MikeB
it is designed for the sport interface with the function to add an A2 external voltage sensor for the x8r rx which only has sport and sbus interfaces along with its internal A1 battery voltage sensor. Adam who is building them has parts to build a further 100 so if you want one it is likely to be restocked quicker than from china!! so keep watching or send WAYNE a mail.

looks like you are creating another waiting list MikeB
Bruneaux
Posts: 119
Joined: Mon Oct 14, 2013 7:13 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by Bruneaux »

So is the openXsensor code (for SPORT) complete now? Or is it now dead?

I know that you guys were working on the SPORT *not* working issue. I was working on RPM, GPS and airspeed sensors. I gave up on the EagleTree and bought a simple I2C sensor ( arrived today).


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

Re: OpenXSensor SPORT Interface

Post by MikeB »

I'm still working on it. I've just got my new SPort interface code working. It is using timer 1 as a hardware timebase, and a pin change interrupt to detect the start of a receive start bit. It also turns the pin round for transmit. It is looking good, I'm testing it on a 'mini lite' with my code to add an A2 analog port to the X8R. I have a debug pin showing me what is happening with the actual sample timing and it looks good.
Timer 1 provides timing for both Rx and Tx on the SPort. I now need to integrate this code into the openXsensor code.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Bruneaux
Posts: 119
Joined: Mon Oct 14, 2013 7:13 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by Bruneaux »

Awesome. I was afraid that openXsensor was going to die for lack of interest.

The demand for sensors (in the void of FrSky not getting theirs out in a timely manner) seems to have been answered, in part. Good work.

Bruneaux
User avatar
bob195558
Posts: 2377
Joined: Sun Dec 16, 2012 7:24 pm
Country: United States
Location: New England, Vermont
Contact:

Re: OpenXSensor SPORT Interface

Post by bob195558 »

Thank you for your reply NeilRogers ! :)

Is Wayne at alofthobbies.com?

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
:)
Will there be more X8R2Analog board for sale in the upcoming week?

If and when I have the X8R2Analog board, could and/or is it possible to use the FrSky Sensor Hub - FSH-01 in the same way that I use the Sensor Hub (FSH-01) with
the A2 Port on the FrSky D8R-XP- 8 Channel Receiver w/ telemetry, RSSI, & CPPM receivers and the FrSky D8R-II Plus - 8 Channel Receiver w/ telemetry receivers? :?:
Er9x on 9x radio, with Smartieparts Programmer and TelemetrEZ Board.
ErSky9x on Taranis, Sky9x, 9Xtreme radios.
3D-Printing: (https://openrcforums.com/forum/viewforum.php?f=129).
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: OpenXSensor SPORT Interface

Post by MikeB »

Bob: You may be confusing what the X8R2Analog board is. It provides just an analog port, NOT the serial telemetry port.

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: OpenXSensor SPORT Interface

Post by MikeB »

Getting close, I'm left with one integration problem. The Arduino IDE seems to insist on including the SoftwareSerial code, even though I'm not using it and have conditionally compiled out all references to it. This results in a conflict as I need to use one of the interrupts that is using.
I'm guessing the Arduino IDE is scanning the source files, and if it sees an include for SoftwareSerial.h, then it pulls in the code.

Seems like this is the case as I've just commented out all the references to including that header file and now it doesn't have the conflict!

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Bruneaux
Posts: 119
Joined: Mon Oct 14, 2013 7:13 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by Bruneaux »

Mike,

I've seem the same behavior. If I needed something out of one (like a few #define's) I make a new .h file (fubar.h comes to mind) and include that without the <xxxxx.h> but the local "xxxxx.h".

Bruneaux
Bruneaux
Posts: 119
Joined: Mon Oct 14, 2013 7:13 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by Bruneaux »

Mike,
I now have a working airspeed sensor. I have to calibrate it (which means some runs up and down the interstate with it duck taped to the top of the car). I used an MS4525DO-DS5AI001DP (DigiKey part #223-1110-ND) and the standard pitot tube from EagleTree (available all over the place) if anyone is following this thread and wondered which sensor I used.

I could not get the EagleTree airspeed sensor to work. There was some work on Paparazzi (open source) that had code but it was not using the Wire library, so I gave up on that one.

I'll be sending the data through the telemetry at GPS_SPEED to make it easy. There have been no GPS sensors available for the FrSky hub for months, so it shouldn't conflict with that. The sensor that I bought gives a vary accurate temperature sensor imbedded, so I'll probably go ahead and feed it through the second temp telemetry.

When I get my GPS sensor hooked up I'll be using only the lat/lon (and maybe altitude) data. Just to find lost planes, etc.

Bruneaux
NeilRogers
Posts: 87
Joined: Sat Jun 22, 2013 2:12 pm
Country: United Kingdom
Location: Wiltshire

Re: OpenXSensor SPORT Interface

Post by NeilRogers »

Bruneaux

Sounds very interesting, are you using the SPort or standard serial Hub interface ?

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

Re: OpenXSensor SPORT Interface

Post by MikeB »

I'm going to enhance the serial SPort code I've written to handle the 9600 baud serial for use in hub mode. This will stop using the Arduino "softwareSerial" code, and provide a serial transmit using interrupts.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: OpenXSensor SPORT Interface

Post by jhsa »

With all this sport stuff being added to the openXsensor will we still be able to use it in D mode as before?

Sent from my GT-I9195 using Tapatalk
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
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: OpenXSensor SPORT Interface

Post by MikeB »

That's what I thought I said I was doing! The Arduino IDE is just getting in the way. It doesn't recognise conditional compilation and just pulls the software serial code in if the include for its header file appears. This causes a failure to link with the SPort code. I'm simply dropping the Arduino software serial code and providing the same function from the code I'm adding.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: OpenXSensor SPORT Interface

Post by jhsa »

Thanks Mike.

João

Sent from my GT-I9195 using Tapatalk
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
Bruneaux
Posts: 119
Joined: Mon Oct 14, 2013 7:13 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by Bruneaux »

Neil,
I'd use the SPORT interface and X8R's. I've already replaced most of a my D8's with X8R's. The one that I have not replaced yet is in my gas (petrol) Spitfire. I have mounted antennas on the top (like the mast on the older Spitfires) and one one under the belly (not scale, but it's horizontal so it doesn't show too bad) using the 250mm SMA mounts. The D8's have replaceable antenna's. I'm waiting for a new batch of X8R's that should have replaceable antenna's.

Scale Spitfire's (and many scale war-birds) have the nasty habit to tip stall. So I wanted an airspeed warning because, when landing, you don't get a good view of 'speed' (coming almost directly at you). I've see a LOT of beautiful planes lost on the turn to final and on final because of it.

I also wanted an airspeed indicator in my Lovesong (4 meter sailplane) so I can keep it at max lift/speed to stay up longer. I bought that sailplane back (1990) when most were balsa/monocote and vacuum bagging wings was the 'new tech'. It is still a beautiful thing to see in the air.

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

Re: OpenXSensor SPORT Interface

Post by MikeB »

I'm getting close to a combined SPort/Hub serial set of code. There is, however a possible problem with the SPort. It runs at 57600 baud, so around 17uS per bit. The problem is that the inbuilt Arduino Timer0 interrupt takes over 5.5 uS to execute. If this occurs at just the wrong moment, it could upset the receive (or transmit) timing by this amount, and half a bit time is 8.5uS, so it is quite close. There are also certain routines (like millis() and micros()) that disable interrupts for a microsecond or so. This could upset the serial timing.

Mike.

Edit: Possibly, if I bias the sample point, say, 2uS early, then it will be better if it does get delayed.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Bruneaux
Posts: 119
Joined: Mon Oct 14, 2013 7:13 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by Bruneaux »

Mike,

millis() and micros() disables interrupts? Guess it has to. And I guess there is not concept of poke() or peek().

I'm using delayMicroseconds() in my setup() (constructor) which, according the Arduino, does NOT disable interrupts. I'm not certain how they possibly avoid using millis() or micros() in the code of delayMicroseconds().

Do you think that will become a problem for me? Hmmm, I wonder if anyone uses delay(). That will muck it all up.

Bruneaux
Bruneaux
Posts: 119
Joined: Mon Oct 14, 2013 7:13 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by Bruneaux »

Mike,

Would it be acceptable to fork the code in to two? One for SPORT and one for the older D8's?

It's great to have one that does everything. But at what cost?

And when someone has a D8 the is being retired they could load up the SPORT code. Worse case someone gets confused and tries to use the wrong version and it doesn't respond.


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

Re: OpenXSensor SPORT Interface

Post by MikeB »

I've done it the same way is is currently done, there is a single #define in Oxs_config.h:
#define FRSKY_SPORT 1

If this is present, you get the SPort version compiled, if it is absent, you get the Hub version compiled.

I have it all working it seems. I've compiled both versions and tested them.

The next problem is I don't have commit rights, so I can't update the googlecode repository.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Bruneaux
Posts: 119
Joined: Mon Oct 14, 2013 7:13 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by Bruneaux »

Mike,

Ah, I thought you were having problems with the Arduino pulling in code that you don't need/want.

Thanks for all of your work. I'll look forward to the code being committed on the repository.

Bruneaux
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: OpenXSensor SPORT Interface

Post by Kilrah »

MikeB wrote: The next problem is I don't have commit rights, so I can't update the googlecode repository.
I do, if you can post a patch I'll commit it.
Bruneaux
Posts: 119
Joined: Mon Oct 14, 2013 7:13 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by Bruneaux »

Mike,
I was going to use a programmable interrupt to signal when the GPS data is ready. (about a second for the GPS to be ready).

Seems like timing is critical and that you might have used the two available (Uno and Nano) programmable interrupts already.

True?

I can pole for it, but I hate the concept! But to catch the interrupt and switch the state might cause timing issues for the SPORT.

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

Re: OpenXSensor SPORT Interface

Post by MikeB »

I'm using a pin change interrupt.
If you are coding directly, you can specify the interrupt as non-blocking, or enable interrupts as the first thing in the interrupt routine. er9x does this for most interrupts as the PPM out interrupt is very sensitive to interrupt latency.
I'm also using timer 1 COMPA interrupt. This is a higher priority than all the others currently in use.

Here is the patch (diff) file for the code as I have it. Hopefully it is still valid from the last commit.
oxspatch.patch
(23.74 KiB) Downloaded 308 times
Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

Post Reply

Return to “OpenXVario - an open source vario supported by the open source firmwares!!”