OpenXSensor SPORT Interface

Development & General Chat for the superb openxvario project.

Moderator: rainer

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

Re: OpenXSensor SPORT Interface

Post by Kilrah »

Thanks. What are you using to compile it? Looks like it doesn't work in arduino 1.05 (current stable release). I get errors about PD4 not being defined in aserial.cpp.

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 »

Oh, I forgot, I replaced the (rather dated) compiler with the latest one, so while I used the arduino 1.05 IDE I also used the 4.8.0? compiler.

I copied the required compiler files into:
C:\ ... \arduino-1.0.5\hardware\tools\avr

Probably just change the two lines:
#define TX_PIN PD4 //!< Transmit data pin
#define RX_PIN PD4 //!< Receive data pin
to:
#define TX_PIN 4 //!< Transmit data pin
#define RX_PIN 4 //!< Receive data pin

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 »

Kilrah,

Has the new version been released? I don't see it when I browse the code or use svn to check out the code.

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

Re: OpenXSensor SPORT Interface

Post by Kilrah »

Oops, just wanted to test before committing, did it at 11pm and it didn't seem to work, then I went to bed and forgot about it. I'll try to check again today.
NeilRogers
Posts: 87
Joined: Sat Jun 22, 2013 2:12 pm
Country: United Kingdom
Location: Wiltshire

Re: OpenXSensor SPORT Interface

Post by NeilRogers »

I've just tested the sport oxs live on a slope unfortunately the wind direction made landing difficult so I could n't reset the vario during the 50min flight.
The sensor installed inside the fuselage all looked ok for the first 3 minutes of operation, then the vario stuck at the same alt & vspd, I try changing the sensitivity filter but did not kick it back into life. I had to land and switch tx & rx to restore operation.

I've include the telemetry data for interest it did seem to stop at a high/low vspd or Alt

Ive not seen any oyher reports of the oxs locking although frsky had a problem initially.
Attachments
oxslock.xlsx
telemetry from live operation of sport oxs
(37.88 KiB) Downloaded 251 times

davx
Posts: 210
Joined: Sun Sep 15, 2013 7:01 am
Country: -

Re: OpenXSensor SPORT Interface

Post by davx »

Hi,

What receiver did you use, if it's a D8R it may need an update.

Tchao
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 had/still having the FrSky high precision sensor locking, and this is in HUB mode to a D8R-II. I thought I had updated it to the latest firmware!

There could easily be some sort of problem with the integration of the code that causes this lockup. Out of interest, have you run it for several minutes on the bench? I don't think I have, I'll try it when time permits.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
davx
Posts: 210
Joined: Sun Sep 15, 2013 7:01 am
Country: -

Re: OpenXSensor SPORT Interface

Post by davx »

I was using the classic vario with the FrSky hub to a D8R-II and the altitude read on the FLD-02 was freezing after about 5 minutes. The last D8R update solved this problem.
NeilRogers
Posts: 87
Joined: Sat Jun 22, 2013 2:12 pm
Country: United Kingdom
Location: Wiltshire

Re: OpenXSensor SPORT Interface

Post by NeilRogers »

I'm running r2834 taranis software and x8r rx, I've run frsky hi pres vario for hours now before their software upgrade to the sensor I locked up all the time.
After the upgrade it has never locked.

I hand patched the code last night and shopped this morning flying in the afternoon I thought I would just give it go, I do some static testing tomorrow

Thanks all your work, the 3 minutes looked good.
Bruneaux
Posts: 119
Joined: Mon Oct 14, 2013 7:13 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by Bruneaux »

Kilrah,

Thanks.

Don't forget the other 2 lines that Mike needed to add.

MikeB wrote:Oh, I forgot, I replaced the (rather dated) compiler with the latest one, so while I used the arduino 1.05 IDE I also used the 4.8.0? compiler.

I copied the required compiler files into:
C:\ ... \arduino-1.0.5\hardware\tools\avr

Probably just change the two lines:
#define TX_PIN PD4 //!< Transmit data pin
#define RX_PIN PD4 //!< Receive data pin
to:
#define TX_PIN 4 //!< Transmit data pin
#define RX_PIN 4 //!< Receive data pin

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

Re: OpenXSensor SPORT Interface

Post by NeilRogers »

quick update on the locking before more shopping.

I've run a couple of static tests on the bench my oxs locks after 2 - 3 mins.

Its not the tx or rx unplug and replug the oxs restarts the operation.

I'll do some more testing later
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 running a test now. OxS with SPort to X8R, Taranis running ersky9x!
The OxS stopped sending after a few minutes (I'm 'scoping the SPort signal), and after a short while it just started up again! At least I could see it was not sending anything to the X8R. It could have been sending a "no new data" frame.

Mike.

I've seen it stop several more times, but it then seems to restart a while later.
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 »

When it stops sending, it is not seeing the leading edge of the start bit from the X8R, there is nothing on the debug pin. This is detected by a pin change interrupt. Either the interrupt is not enabled (after the last transmission), interrupts are completely disabled, or the SPort voltage is too low. It is only 3.3V, feeding to a 5V powered chip, although it should be seen as a '1' if it is above 3.0V.

I'll add some more debug later.

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 »

Sounds like its not my soldering then. the hands aren't too steady these days!!

I've not seen it restart yet and my one didn't restart during the 50 minute flight yesterday

I should have some time tonight to do investigation

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

Re: OpenXSensor SPORT Interface

Post by NeilRogers »

Bit more information

Interesting it looks like timing, when I compiled with the debug option to see what going on in the code, the lockout changed to around 20 minutes instead of 2 or 3.
After the lockout the M5611 appears to be updating the vario variables regularly, so it appears to be the output function is not working but is not stopping the main loop operation
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 picked up another problem as well. Sometimes it appears a timer1 compare interrupt is being missed. During transmission, I start a start bit, then over 4mS passes before the next bit goes out. This is the timer wrapping round the full 16 bit count. I'm still looking to see why this might happen.
When it locks up, it definitely is not seeing the incoming start bit transisition, so it seems the pin change interrupt is not being enabled. These two things may be related.

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 »

I think this 4mS problem is the timer0 interrupt delaying the serial output interrupt. I can see a long gap between bits going out, long enough to 'skip' a bit time.

This is 'fighting' the Arduino code it automatically puts in.

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 »

I have the same serial SPort code running on a mini lite doing an analog port. That is OK sending the data without stopping and without any 4mS pauses, so it is some sort of interaction with the rest of the code.

Mike.

Edit: I'm concluding the I2C interrupt is taking too long to execute, and the way it is written makes it difficult to re-enable interrupts while it is executing. I may have to block all interrupts while receiving and transmitting, and poll the timer 1 compare interrupt to make this work, messy!
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 for the update.

As the sport interface is running fast 56k may be make the rx data send priority and only look at the m5611 and other functions pmm when not in this data transfer mode

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'll investigate further, but the time the I2C interrupt takes to run can also mess up the detection of the first start bit of the incoming SPort data. I'll see how long it takes to run the whole I2C transaction. Maybe we can synchronise it so it only runs when the SPort is idle. The SPort guarantees at least 4mS of idle time every 12 mS. Either late tomight or tomorrow for this, busy today.

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,
I should up on the cold slopes later today.
If the wind direction good on Thursday that my next window to test live
Cheers 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've done a quick change to read the sensors immediatly after sending the SPort data. It all looks much better now. The sensor readings only take around 2.5mS, so there is plenty of time to read them. The voltage reading actually takes the longest as it is doing a lot of floating point calculations (1.3mS). The altitude sensor is arount 900uS, and the current sensor is around 250uS.
I've got a bit more tweaking to do but it looks promising.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: OpenXSensor SPORT Interface

Post by Kilrah »

When I built the old version of the smart port code I found that there was a ridiculous amount of filtering done to the different values, notably causing them to update like only once every couple of seconds even if read 10 times a second from the sensor. No doubt it causes quite a bit of processing overhead. There were constants for how much to filter and I brought that down by a whole lot.
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 »

Just left it running on the bench for over half an hour, still working OK. Since I've been added to the committers list, I'll just clean out some extra debug I put in and commit the code as it is.

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 »

Sounds good Mike.

Thanks 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 »

Commit done.

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 and Neil,

Thanks for all of your work and dedication, guys!

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

Re: OpenXSensor SPORT Interface

Post by NeilRogers »

Credit should go to Mike he's done all the programming.

I'll do some soak testing on the new version when I'm back from work tonight

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

Re: OpenXSensor SPORT Interface

Post by NeilRogers »

I used the SVN Update and found I had to comment out the following lines in OXS_OUT_FRSKY.h


//<<<<<<< .mine
//#include "SoftwareSerial.h"
//=======
//>>>>>>> .r194


It looks really good still running ok after 1.5 hours.

Thanks Mike I'll give it a live test Thursday if the weather ok
Bruneaux
Posts: 119
Joined: Mon Oct 14, 2013 7:13 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by Bruneaux »

Neil,

Hmm.. I'll have to look at my version. I had not problems.

oh, and. . .

I now have a functioning air speed sensor! YAY!!!

We had freezing rain and slick roads so I don't know if it is properly calibrated. Very close.

With the telemetry recorded I can then set up flight modes and alarms at the proper times/speeds.

Next step is the work on the GPS module. Should be fairly simple.

Bruneaux

Post Reply

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