OpenXsensor "freezes" after some minutes

Development & General Chat for the superb openxvario project.

Moderator: rainer

Post Reply
Akerman
Posts: 9
Joined: Thu Jun 25, 2015 1:17 pm
Country: Japan
Location: Tokyo

OpenXsensor "freezes" after some minutes

Post by Akerman »

Hello all,

first of all, THANK YOU SO MUCH to all contributors of this project! I just made 3 openXsensors (vario only) with basically zero knowledge of the matter, turn them on and... they work! :D Now THAT was easy...

after the first day out with my 2 DLGs and the new varios, I have to report a problem though. Always after some minutes the altitude display freezes on my Taranis. It can be brought back to life by pressing the reset button on the Arduino. All 3 varios behave the same. I did a lot of experimenting, googling and searching through the forum for a week, but could not find the reason. So I figured I'd better ask for help here.

My setup:
  • Arduino Mini pro 3.3 V 8 MHz (noname knockoff)
  • GY-63
  • X4R or X6R RX, tested with old and updated non-EU FW
  • 1S battery in the DLGs, 4.8 V battery on the testbench
  • Tested openXsensor 2.5 and 4.0
So whatever I did, it always freezes after some minutes. No change on the arduino and GY-63 LEDs. I also tried to "force" using the SPORT interface by uncommenting the line #define FRSKY_TYPE_SPORT in oXs_config.h.
I tried to get around debugging and managed to get some lines of text in the serial monitor, but not any information that seemed interesting for me (sorry, am quite a noOb with this stuff..).

So if you have any ideas or guidance on what to try next, it would be much appreciated. Thank you for your patience with a total noOb!

Philipp

mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXsensor "freezes" after some minutes

Post by mstrens »

As first point, in order to help you, I suggest that you put in attachment your oXs_config.h file. I can check if it is rigth.
Can you also say which version of Arduino IDE you are using. Usually I use version 1.5.

One point to check too: are you sure that you select the right arduino type (pro mini 3.3 volt 8 Mhz) when you compile the sketch.
Can you say how many byte are generated (normally it is reported on the last line by the IDE when you compile the sketch)

Perhaps the issue is related to the type of arduino you are using.
Most users work with a pro mini 5 volt at 16 Mhz.
I never tested with a 3.3 volt 8 Mhz. Still I think that some users build an oXs with this type of Arduino. So normally it should work.

Another attention point too: which Arduino pin is connected to the GY63 Vcc?
With an Arduino 5 volt I would recommend to connect the GY63 Vcc to the Arduino Vcc (so the regulated 5 volt) but for an Arduino 3.3 volt I think it is better to connect the GY63 VCC to the Arduino Raw (so the input voltage regulator on GY63 will get more than 3.3 volt and wil regulate the output voltage as expected).

If this is not enough to fix the issue, I could explain some more debug options to activate in order to get an idea of the origin of the issue. If needed, I can even make a special version with extra debug options.

Sory but I do not have an Arduino pro mini 3.3 volt 8 mHz, so I can not reproduce your hardware configuration.
Akerman
Posts: 9
Joined: Thu Jun 25, 2015 1:17 pm
Country: Japan
Location: Tokyo

Re: OpenXsensor "freezes" after some minutes

Post by Akerman »

Hello mstrens,

many thanks for your input! See attached the file.

Yes, I also thought that it might have something to do with the 3.3 v 8 MHz version of the Mini Pro. I double and triple checked the selection of the arduino type, its OK.
I also tried powering the GY-63 by RAW on Arduino, but same result.

The file size when compiling is 616 bytes for global variables, 12,614 bytes for the sketch.

Philipp

P.S. I am using Arduino 1.6.4
Attachments
oXs_config.h
(7.47 KiB) Downloaded 333 times
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXsensor "freezes" after some minutes

Post by mstrens »

Your config file seems ok.
I imported it in my arduino IDE selecting a 3Volt 8mhz (processor = ATMEGA328!!) and I get a total different size when I compile.
I get 17038 bytes instead of 12614.

Please note that I am using the IDE version 1.0.6 and not the latest 1.6.4.
Probably that the new version activates different options of the compiler.
This could perhaps explain your issues.

Would it be possible that you try to compile/flash using the same IDE version as me? I think it is still available for download.
Akerman
Posts: 9
Joined: Thu Jun 25, 2015 1:17 pm
Country: Japan
Location: Tokyo

Re: OpenXsensor "freezes" after some minutes

Post by Akerman »

Ok, will try the 1.0.6 tomorrow...takes over 1 hour to download...? guess the cable to our island is very thin once again...

Yes, I did check that the board has an 328 processor, and also checked that I selected it in the IDE...

Thanks, Philipp

Akerman
Posts: 9
Joined: Thu Jun 25, 2015 1:17 pm
Country: Japan
Location: Tokyo

Re: OpenXsensor "freezes" after some minutes

Post by Akerman »

Awesome, I guess that was the problem! Uploaded using 1.0.6 and all 3 varios work! Completely depleted the Taranis battery with long time tests.

My sketch now has the same filesize as you posted, 17038 bytes.

Thank you mstrens! I would never have figured that a newer compiler version could create such problem.

I hope to be flight testing tomorrow!

Philipp
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: OpenXsensor "freezes" after some minutes

Post by jhsa »

So, what is the problem then? I'm asking because people won't stay stuck on this version of the IDE. Is it the code that needs to be adapted to the new IDE or is the problem with the IDE itself?

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
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXsensor "freezes" after some minutes

Post by mstrens »

I will try to reproduce the issue using the new IDE with an Arduino pro mini 5 volt 16 Mhz.
If I can reproduce it, I will search for a solution.
I suspect that some variable used in interrupt and outside of interrupt is not declared as volatile. This could generate this kind of issue.
Akerman
Posts: 9
Joined: Thu Jun 25, 2015 1:17 pm
Country: Japan
Location: Tokyo

Re: OpenXsensor "freezes" after some minutes

Post by Akerman »

to be 100% sure, I just uploaded again with 1.6.4, and the "freeze" reappeared.

Let me know if I can help anything for finding the problem with the 1.6.4.

Philipp
Akerman
Posts: 9
Joined: Thu Jun 25, 2015 1:17 pm
Country: Japan
Location: Tokyo

Re: OpenXsensor "freezes" after some minutes

Post by Akerman »

Back from flight testing, the sensors work flawlessly now. I need to work on my launch height :)

Thanks again to everyone contributing to this project!

Philipp
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXsensor "freezes" after some minutes

Post by mstrens »

Thanks for your feed back. :D
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXsensor "freezes" after some minutes

Post by mstrens »

I made a test using oXs with an arduino pro mini using latest IDE version (1.6.5) and oXs version 4 and your config.h file.
As expected, after compilation, I got exactly the same number of bytes as you (flash and global data).
I uploaded it and I let it run for about 1 hour and it never blocked.
So I can't reproduce the issue you have.

Please note that I used an arduino 5 volt / 16 Mhz (and not a 3.3 volt / 8 Mhz).

Looking on internet, I found this post:
http://www.instructables.com/id/Arduino ... ster-code/
It explains that new compiler used in IDE 1.6.X produces a shorter coder but this code runs slowlier.
I have doubs, but it could be that the new code is running to slowly on an arduino 8 mhz.
If you look at the link here above (clicking several times on Next button), you will see that it possible in IDE 1.6.x to change a compiler option in order to get the code running faster.
I tried the option O2 (instead of Os) and I tested it again on my arduino (at 16 Mhz) and it runs ok too.
Perhaps this could be a solution for the arduino pro mini 8 Mhz.

Could you check this?
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXsensor "freezes" after some minutes

Post by mstrens »

I am not sure if this will help but I just made a new version of oXs in order to declare more variables as "volatile".
The new version is not (yet?) in the master branch on github but I created another branch named "openXsensor_Arduino_1_6".

Perhaps can you try if this version (used with IDE 1.6.5) solves the issue.
Note : I expect that IDE 1.6.5 gives the same results as IDE 1.6.4.
It is normal that the code generated for this version of oXs is a little bigger than with previous release.

If you try it, please let me know if it solves the issue or not.
Thanks.
Akerman
Posts: 9
Joined: Thu Jun 25, 2015 1:17 pm
Country: Japan
Location: Tokyo

Re: OpenXsensor "freezes" after some minutes

Post by Akerman »

Hi mstrens,

thank you for your investigations! I compiled my original sketch using O2 compiler option, and it freezed after about 10 minutes. Now trying with O3, and its still going strong after 20 min. I will let it run overnight.

I also flashed your new sketch with Os compiler setting, but my sensor doesn't seem to work...?

Thanks, Philipp
Akerman
Posts: 9
Joined: Thu Jun 25, 2015 1:17 pm
Country: Japan
Location: Tokyo

Re: OpenXsensor "freezes" after some minutes

Post by Akerman »

Ok, the O3 option ran the whole night! Most brilliant!

Thanks, Philipp
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXsensor "freezes" after some minutes

Post by mstrens »

I just put a new version in the same branch as yesterday (openXsensor_arduino_1_6).
I modified the code to simplify the part that prepare the data to be sent.

I tested with compiler option -Os on an Arduino 16 Mhz and it seems Ok to me.

Perhaps can you test this new version too?

If it block with option -Os perhaps can you make a test with option -O0 (which means no optimisation at all)?
Akerman
Posts: 9
Joined: Thu Jun 25, 2015 1:17 pm
Country: Japan
Location: Tokyo

Re: OpenXsensor "freezes" after some minutes

Post by Akerman »

Hi mstrens,

I tested the new version with 1.6.4 and -Os, it works perfectly! No freezes! Something around 16000 bytes for the sketch if I remember correctly.

Tested as always with Arduino Mini Pro 8 Mhz running on 4.8 V battery.

Philipp

Post Reply

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