Air Player ARM on Raspberry Pi cannot handle stepper motors?

Support for Air Player desktop on ARM devices, like the Raspberry Pi.

Moderators: russ, Ralph

Message
Author
User avatar
nnyerges
Posts: 87
Joined: Sat Jun 18, 2022 6:28 pm

Air Player ARM on Raspberry Pi cannot handle stepper motors?

#1 Post by nnyerges »

Hello.
Now that you have mastered all the procedures between update, PUSH, running and testing, hardware, instruments and panels between Air Manager and Air Player, I have a new problem:

1. Case Example:
1.1 I have a Panel with 6 engines instruments
1.2 That panel also controls 8 different "hardware" devices with multiple analog inputs, digital inputs, outputs, stepper motors, encoders, etc. controlled by an Arduino MEGA. (call them h1, h2, h3, h4, h5, h6, h7 and h8 for future reference in step 3)
1.3 Test all instruments, hardware and panel in CREATE/EDIT. everything working fine on the PC/ Air Manager.

2. Panel Test on PC /Air Manager (WORKS PERFECT)
2.1 In HOME, added the panel under Air Manager with all 8 hardware scripts (h1 to h8).
2.2 The Arduino still plugged into the PC USB, click "SHOW" and all instruments and hardware work perfectly.

3. Testing on Air Player / Raspberry Pi (HARDWARE PROBLEMS)
The panel runs on Air Player ARM64 installed on a Raspberry Pi 4B (4Gb) and is displayed on a 7.9" screen.
3.1 Connect the Aurdiono to the RPI USB port.
3.2 First made the corresponding PUSH of each instrument, hardware and panel in CREATE/EDIT.
3.3 Try them out in Air Player as well by running each instrument, hardware and panel individually and EVERYTHING WORKS PERFECT in Air Player at this point.
3.4 Add the panel and all 8 hardware and SHOW in Air Player and the following happens:

- All instruments work perfectly.
- h1, h2, h3, h4,.. h6, h7 and h8 work perfectly, but h5 doesn't work.
- After hours trying to figure out what's going on, I found that if I remove h1 from the panel, the rest works fine, including h5 which didn't work before.

First i was thinking it was a conflict between h1 and h5, but the script are ok. ALSO it works on Air Manarager by the way. Experimenting, remove all hardware and add only h1 and h5 and both work perfectly ??? Whats going on ???. But if I add say 3 more (h2,h3,h4) then again h5 stops working . I give up! . I'm trying to figure out if the problem is the number of I/O or analog inputs connected to the Arduino at once, maybe Air Player has some limitation, but any combination ends up with the same result.

Please take note that is not necessarily h1 the only one that makes h5 stop working, adding any other combinations of the rest of the 7 hardware scripts, have the same result. Is the quantity that makes the diferrence, for example if try h5 with h3 or any other combination, it works, but the moment I add the 8 hardware, boommm h5 doesnt work and that make pulling my hair out along with the the most desperate thing that is the following statment:

if it works on PC via Air Manager, why doesn't work on Air Player?

Please help!
Nicolas
Last edited by nnyerges on Thu May 04, 2023 12:43 pm, edited 1 time in total.
Chief Technology Officer (CTO) at 360ATC Aviation Training Center
Electronic Engineer. Control & Software Specialist

User avatar
jph
Posts: 2857
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Air Player on Raspberry have any hardware limitations?

#2 Post by jph »

Hi Nicolas,
I believe the air PLAYER license for R-PI is also a licence for Air Player PC.
So it would be useful to try airplayer PC along with airmanager PC and put the 'pi' out of the loop.
If the same happens, then it would point to 'arm' code issues.
Cheers
Joe
Joe. CISSP, MSc.

User avatar
nnyerges
Posts: 87
Joined: Sat Jun 18, 2022 6:28 pm

Re: Air Player on Raspberry have any hardware limitations?

#3 Post by nnyerges »

Good morning,

Thank you for your suggestion JPH, but before I run out of the 3 device licence changes limits and while I get an answer from Ralph and his combo about why my 8 hardware systems script works well on PC / Air Manager and bad on the RPI / Air Player, today I'm going to make a script that integrates all 8 into one for testing. In this regard I have two questions, but first I would like to explain the reason for the 8 hardware systems.

The example is for a King Air B200 and the 8 separate hardware systems (h1 to h8) correspond to the brakes (h1), flaps including gauge (h2), Manual landing gear pump control (h3), Pitch Trim Whell and motor (h4), Levers (h5), Trim Tabs (h6), Pressurization System including controller and cabin gauges (h7) and micellaneous controls on the center pedestal of the B200 like CWS, Go-Around, Alarms, etc (h8). Each script contains a real simulation of the device's functionality, electrical control, lights where applicable and failures.

1. The idea of separate scripts is to reuse them on other aircraft models in different combinations. Obviously an implementation like this requires more memory space, but Air Player at the 4Gb RPI supposedly has no problem managing them or may have some memory issues.

2. Many of those scripts use some of the same functions, such as potentiometer readers, electrical routines, etc. Can having too many scripts running at the same time on Air Player can cause some problems?

Today I will try to create a single script with all 8 systems together saving some memory space and programming lines. I bet it will run fine on Air Manager, my concern is on the ARM Air Player.
Chief Technology Officer (CTO) at 360ATC Aviation Training Center
Electronic Engineer. Control & Software Specialist

User avatar
nnyerges
Posts: 87
Joined: Sat Jun 18, 2022 6:28 pm

Re: Air Player on Raspberry have any hardware limitations?

#4 Post by nnyerges »

INTERESTING DISCOVERY THAT CAN BE US AS A GUIDE TO SOLVE THIS ISSUE:

I was starting to program the script that integrates the 8 systems. It takes time but it is worth doing it in the future to simplify the code, memory usage and above all the XPL subscriptions, since separately, many callbacks are repeated and do the same thing. Being unified only one subscription is used at once and not 8 times for the 8 scripts, as for example the buses voltage (sim/cockpit2/electrical/bus_volts","FLOAT[6]), but...

Now, in the meantime, I notice something interesting and curious. Air Player ARM doenst like stepper motors to much. Let me explain.

Clicking on Air Managers SHOW Air Player panel, the panel displays normally on the RPI, but although the instruments works, something is causing Air Player to crash the hardware.Air Manager lost connection with Air Player after 20 or 30 seconds. Also if during that time I try to turn off the panel "HIDE", the panel in the RPI turns black but does not turn off the window and the Air Manager closes itself (crash). When I try to run the command sudo pkill AirPlayer in the RPI, it gives me the error pkill: killing pid XXXX failed: Operation not permitted and the only way to close the panel is with sudo kill -9 <XXXX>.

Seeing this, it occurred to me to look for what hardware on any of the 8 systems could be causing this. Two of them, the one for the flaps (h2) and the one for the cabin pressurization system (h3), are the only ones that handle stepper motors with the hw_stepper_motor_add function to control the Flap position gauge, Cabin Climb and Cabin Press.Diff/Altitude indicators.

Just as information, this is a example of the X27 stepper motor use in the flap indicator:
FLAP_hw_id = hw_stepper_motor_add("4WIRE_4STEP", 1080, 20, false, "ARDUINO_MEGA2560_D_D28", "ARDUINO_MEGA2560_D_D29", "ARDUINO_MEGA2560_D_D30", "ARDUINO_MEGA2560_D_D31")


Carried Out Test:

a) I tried to run the panel only with the other systems (excluding h2 and h3) and it works perfectly.

b) As soon as I add h2 and/or h3, Air Player crashes the hardware.

c) Try only with h2 and or h3 and Air Player blocks the hardware.

d) Remove the h2 and h3 steppers in the script and BINGO, Air Player does work.

e) Add the full 8 systems (removing hw_stepper_motor_add in h2 and h3) and BINGO, Air Player works.

CONCLUSION:
Air Player does not like to drive hw_stepper_motor_add ?

What do you think?
Im thinking to change the TOPIC name from Air Player on Raspberry have any hardware limitations? to Air Players for ARM doenst like steppers motors?
Chief Technology Officer (CTO) at 360ATC Aviation Training Center
Electronic Engineer. Control & Software Specialist

User avatar
Ralph
Posts: 7930
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Air Player on Raspberry have any hardware limitations?

#5 Post by Ralph »

If you can make one instrument that lets it crash, then please export it as a .siff so we can test it here.

User avatar
nnyerges
Posts: 87
Joined: Sat Jun 18, 2022 6:28 pm

Re: Air Player on Raspberry have any hardware limitations?

#6 Post by nnyerges »

Ralph wrote: Tue Apr 25, 2023 2:47 pm If you can make one instrument that lets it crash, then please export it as a .siff so we can test it here.
Yes indeed Ralph,

Attached are the example of the Flap scripts:

MacSIM Beechcraft B200 - RPI4 INT-CPC Flaps.siff is the original (the stepper motor lines are at the end)

"MacSIM Beechcraft B200 - RPI4 INT-CPC Flaps CLONE.siff" and "MacSIM Beechcraft B200 - RPI4 INT-CPC Flaps CLONE CLONE.siff" is to prove my point that Air Player ARM doesnt like hw_stepper_motor_add

In MacSIM Beechcraft B200 - RPI4 INT-CPC Flaps CLONE.siff defines the stepper motor but I delete all the calibration timer and calbacks to see if only the hw_stepper_motor_add is causing the problem.

In MacSIM Beechcraft B200 - RPI4 INT-CPC Flaps CLONE CLONE.siff I skip the stepper hardware definition (Air Player ARM works)

MacSIM Beechcraft B200 - RPI4 INT-CPC Flaps.siff
(8.52 KiB) Downloaded 96 times
Chief Technology Officer (CTO) at 360ATC Aviation Training Center
Electronic Engineer. Control & Software Specialist

User avatar
Ralph
Posts: 7930
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Air Player on Raspberry have any hardware limitations?

#7 Post by Ralph »

Thank you. This week I'm not in the office due to various reasons. I will check on Monday.

User avatar
nnyerges
Posts: 87
Joined: Sat Jun 18, 2022 6:28 pm

Re: Air Player on Raspberry have any hardware limitations?

#8 Post by nnyerges »

Ralph just test this two simple scripts. This prove that something is going on with hw_stepper_motor_add on Air Player ARM:

The scrip consist only of one line:
FLAP_hw_id = hw_stepper_motor_add("4WIRE_4STEP", 1080, 20, false, "ARDUINO_MEGA2560_D_D28", "ARDUINO_MEGA2560_D_D29", "ARDUINO_MEGA2560_D_D30", "ARDUINO_MEGA2560_D_D31")
- The one runing only with this line, cause the panel to crash the hardware
- The one without that line, no problem.
Simple Stepper - Air Player ARM CRASH.siff
(1.6 KiB) Downloaded 77 times
Simple Stepper - Air Player ARM WORKS.siff
(1.63 KiB) Downloaded 91 times
To test it, add any panel to the Air Player RPI and add any of this to hardware scripts. Run (SHOW) the panel with the one with the stepper motor line and the try to close the panel (HIDE). You will see that there is a problem.
Chief Technology Officer (CTO) at 360ATC Aviation Training Center
Electronic Engineer. Control & Software Specialist

User avatar
nnyerges
Posts: 87
Joined: Sat Jun 18, 2022 6:28 pm

Re: Air Player on Raspberry have any hardware limitations?

#9 Post by nnyerges »

Ralph wrote: Tue Apr 25, 2023 3:20 pm Thank you. This week I'm not in the office due to various reasons. I will check on Monday.
Thanks. In the mean time i will "--comment" al references to the stepper motors and continue programing. Have a nice week
Nicolas
Chief Technology Officer (CTO) at 360ATC Aviation Training Center
Electronic Engineer. Control & Software Specialist

User avatar
nnyerges
Posts: 87
Joined: Sat Jun 18, 2022 6:28 pm

Re: Air Player on Raspberry have any hardware limitations?

#10 Post by nnyerges »

Ralph wrote: Tue Apr 25, 2023 3:20 pm Thank you. This week I'm not in the office due to various reasons. I will check on Monday.
Dear Ralph

Is there any indication that Sim Innovation team is going to try to solve this Air Player ARM stepper motors issue on Raspberry PI?

If not, we are going to change all the scripts of the 11 instruments that we already have installed the stepper motors, to simulate the gauges on an Arduino Mega using Message port to comunicate with the Air Player ARM instead.

Remember that we depend on 4 Raspberry's to control the entire cockpit isntrumentations, so we cannot give up with Air Player ARM.

Nicolas
Chief Technology Officer (CTO) at 360ATC Aviation Training Center
Electronic Engineer. Control & Software Specialist

Post Reply