MobiFlight Community Support

Welcome to the forum for MobiFlight! Feel free to reach out to the community in case you have questions, issues or just want to share great ideas or details about your latest home cockpit project.

You like MobiFlight? Donate via PayPal and support the MobiFlight development. Thanks! 

05/03/2024 - This forum is read-only

The community support for MobiFlight has moved exclusively over to our Discord server. Register for free and enjoy more interactive functions like image and video upload, voice chat. More than 7,000 registered users around the world make it a great experience!

See you on our MobiFlight Community Discord server.

A HUGE Thank You to everyone who participated in the forum, especially obviously to Pizman and Stephan who did an outstanding job over so many years providing an incredible service to the MobiFlight community.

The forum is still providing a lot of good content, hence we keep this information accessible.

Go to page 1Go to page 012Go to page 2Go to page 2
Avatar
clarke250
Posts: 18
Hello Guys,

I have setup a DIY MCP with the following config:

Pins 2 to 26 are buttons
Pins 28 to 44 are leds
Pins 45-47 are 7 seg displays
Pins 48-53 are encoders

All is working great apart from 6 pins. Pins 19,20, 24,25, 50,51

I can see the LED blink on the Ardunio Mega when the button is pressed, but its not registered in the debug screen

If i delete all other pins in the settings page apart from pins 19, 20, 25, 50 & 51 work perfectly. As soon as i add the rest, they stop working.

Is there a reason for this? I am curious if i have too many switches or if there is a better way to setup?

Of course i have spare pins on another board and will just use them, But for the life of me, i can not figure out why the become inoperative.

I do appreciate all the work from the Mobiflight team, Thank you.

Kind Regards

Karl
[Last edited by clarke250, 2019-02-06 13:36]
2019-02-06 13:08
Avatar
thatchi
Posts: 181
There special pins with mega2560 and I usually avoid using them, there are 20,21,50,51,52,53. They designated as sda,scl,miso,sck,mosi,ss.
They may work with unexpected results. Pin 19 is ok, so your problem could be hardware wiring, with so many wires to connect, always make sure to solder well. Better use flat cable and number them clearly.
2019-02-06 15:11
Avatar
thatchi
Posts: 181
Also there limit how many devices mega can use. Please search forum for its limitation.
2019-02-06 15:14
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi

Normaly the only Pins that can be problematic are pin0 and pin1 .
I´m summary not 100% shure if this is realy a Problem but to avoid that ( hear lots of issue reports in the past) I NEVER use this 2 Pins.
All Other Pins should "normaly" work fine.

Solution:

1. Its recommend to NOT use Pin0 and Pin1 ( as you do)

2. I personaly limit Pins to 50 per Board ( Not sure if this is a official Limit.... But i heard about issues and so i do it. never test if 52 are working too cause with 50 i get never problems)

3. It´s also recommend to use short as possible Names for Devices.
The "Names" must be saved in the Memory of Mega that is verry small. We get some reports where Devices stop working if Device Names are to long. Important... Not the Device with the long name is the problematic one.... Mostly the device you set at least cause there the mem is fileld.

So...
Try out if problem is solved when you simply delete 2 Pins ( for example ONE of your Encoders) The 50 Pins a reached and all should work fine
Also try out if it help when you reduce Device Name lengts segnificant ( I personaly use not more like 6-8 Letters and only use 0.9 and A-Z ( No Spaces no symbols)
Good Luck !
2019-02-06 16:33
Avatar
clarke250
Posts: 18
Boom! 2 from 2! A big thank you again! The pins that were not working did have long file names! I will now keep them short. Awesome effort and really pleased. Easy solution! not sure how i missed this in all the years i have been using MF.

Just incase others read this, the example in my programming of MF in the upload config page was:

MCP SPEED INT 24 (MCP Speed INTV Button 24) - This switch would register on the ardunio and the onboard LED would flash, but MF wouldn't recognize it

Changed the line to read:

MCP24 - Pressed upload and it started to work straight away! The same with all the other pins that were not functioning.

Thank you to all the others that replied too.

Kind Regards

Karl
[Last edited by clarke250, 2019-02-07 03:43]
2019-02-07 00:54
Avatar
StephanHo
From: EDDG, Germany
Posts: 1867
Supporter
Hi,

1. reading the messege of Karl, I can not see that he uses Pin 0 or 1
iconKarl:

Pins 2 to 26 are buttons
Pins 28 to 44 are leds
Pins 45-47 are 7 seg displays
Pins 48-53 are encoders


If I count them right, this are 51 pins

2. there is a limit of 40 LED per board
3. there is a limit of 50 buttons per board
4. it is possible to mix LED and buttons but their number must not exceed 50 oins
5. while using more than 50 pins the last defined pins above 50 were ignored from Mobiflight.
6. Karl, you use 52 pins, so the limit exceeds

Solution: delete the two last defined devices in the mfmc file and reload it to this module or in the settings -> Mobiflight Modules [module with more than 50 pins]
It should be enough to remove the surplus pins from the device-list.
Grüße,
Stephan (Time: UTC+2)
2019-02-07 01:08
Avatar
clarke250
Posts: 18
Hi Stephan,

Thank-you, that explains a lot. I always tried to max out my 18 boards in the past trying to fit all 52 pins in. No wonder certain devices never worked! That shall be corrected shortly.

Awesome effort, knew it was an issue with me.

Kind Regards Karl
2019-02-07 03:48
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Nice we three guys could clear up that fact ( Thanks to Stephan and Karl )
EDIT: Sorry i forgot thatchi.... Sorry for that


But one last point should be figured out finaly....

If i read your first awnser (#11550 ) correct then a reducing of Devicenames have finaly already fix the problems.
Otherwise you say there "2 from 2" that sounds like my other suggestion with Maximum of 50 Pins was also correct ( Stephan said the same)

Maby you be able to clear up the situation!

Can you confirm :
Is it possible to run 51 Pins ( maby also test with 52) on a Board aslong the Devicenames are short enough ?
OR
Do you also need to delete the Devices to get a limit of 50 Pins in use. (To solve your specific problem)

I think THIS is a perfect situation to decleare if this "Urban Legend" about 50 Pins Limit is true or not.
(apollogy i never try out that myself in the past :blush: )
Looking forward to your reply.
[Last edited by pizman82, 2019-02-08 00:17]
Good Luck !
2019-02-07 09:23
Avatar
clarke250
Posts: 18
Hello guys and challenge accepted!

I have just added back the final two pins and have completed a full functional check. I am only using buttons and LEDs on the first board, but all 52 pins, from Pin2 to pin53 are populated with a device.

These include the special pins 20,21,50-53.

All the devices (buttons/leds) are configured in the config page as the number they correspond to the pin.

button 2 is just called 2
led 21 is just called 21

I can confirm every single LED and Button/switch works without fault in standard mode (not debug) without any lag at all.

Im going to call this one: Myth Busted! lol!

Thanks Guys,

Karl
2019-02-07 13:30
Avatar
StephanHo
From: EDDG, Germany
Posts: 1867
Supporter
Hi Karl,

You can certainly occupy the 52 pins. However, Mobiflight will not issue an error message for the occupied pins 51 and 52 (counted not number). It simply will not react during execution.
I have experienced this on my own FMC and have fully occupied the 52 pins with buttons, but then there are 2 buttons not. By the time I reached the limit of 50, I had disassembled the entire FMC and checked for errors. The mistake was (again) in front of the keyboard.

Try the last two devices - they should not work. With logging enabled Mobiflight should not spend any activity here either.
Grüße,
Stephan (Time: UTC+2)
2019-02-07 16:22
Avatar
DeltaBravo
From: Schneeberg, Germany
Posts: 90
Weil´s so gut hier her passt, häng ich meinen Mist mal noch mit dran - auf Deutsch, für die, die der englischen Sprache nicht so mächtig sind und nur die onlineflightphrases verstehen :thumbup:


Ich hatte für die Konfiguration...
(hier ist klar zu sagen - nicht die Konfiguration der Outputs und Inputs auf der 1. Seite, wo man die EventIDs oder FSUIPC-Datenbereiche einstellen kann, sondern die Konfiguration des Arduinos unter Extras -> Einstellungen)
...auch sehr lange Namen verwendet und wollte diese an die PMDG Bezeichnungen aus dem SDK anlehnen. GROBER FEHLER
Ich hatte nicht nur, wie oben beschrieben, einzelne PINs die nicht funktionierten, sondern nach Neustart ständig wechselnde PINs, die nicht so wollten wie ich.
Mal ging die eine Funktion nicht, dann eine andere - zeigte aber, dass die Config richtig war.
Ich hatte immer wieder die EventIDs und Parameter kontrolliert, aber keine Fehler entdeckt.
Dieser Thread hat mir das mit dem begrenzten Arduinospeicher für die PIN-Benennung erläutert und nun habe ich in einer Exceltabelle alle I/Os einer Zahl zugeordnet:
Arduino Nr. 1 und PIN 1 ergeben die Benennung 11 und fertig. Klar muss man Querkontrollieren, aber jetzt läuft alles problemlos!

:lol:

Grüße Stephan
PMDG based 747 Homecockpit, 3 Beamer
P3Dv4.3 QOTSII FSUIPC 5full 6xArduinoMega CDU cpFlight 747MCP
2019-02-07 19:11
Avatar
StephanHo
From: EDDG, Germany
Posts: 1867
Supporter
Hi all,

[deutsche Version]
der pizman hat da sein eigenes System entwickelt, das in sich schlüssig ist und jedem Device 8 Ziffern/Buchstaben zuordnet. Erklärt er es hier bestimmt gerne.

Wenn du sicher bist, nicht mehr als 10 Module einzusetzen, kannst du ja bei einer einstelligen Modulbezeichnung bleiben, andernfalls würde ich auf 01 umstellen und bei den Pins auch, weil es sich dann leichter sortieren läßt.

Zu den Devicenamen selbst. Diese werden im EEPROM abgelegt. Daraus folgt, daß ich mir den Speicherverbrauch dort anschauen muß.

Wird das EEPROM ausgelesen, kann festgestellt werden, daß der Modulname ab Byte 0x000 bis 0x02F, also 48 Zeichen lang sein darf.
Es folgt die Seriennummer ab Adresse 0x030 - 0x039, also 10 Zeichen.
Es folgen dann die Devices und deren zugewiesenen Pins zuzüglich interner Verwaltungsdaten, die bis 0xFFF gehen.
Umgerechnet als 4096 Bytes EEPROM abzüglich 48 Zeichen Modulname und max. 15 Zeichen Seriennummer gefolgt vom 0x00. Verbleiben 4032 Zeichen.
Die Verwaltungsdaten setzen sich zusammen aus Deviceart (1 Byte), gefolgt von 1x 0x2E oder "." als Trennung, benutzte Pins (je nach Device bis zu 4) [2E], Devicetype (1 Byte)[2E].
Pins größer als 9 belegen 2 Bytes, weil sie als ASCII-Charakter abgelegt sind. Dadurch müssen sie beim Auslesen nicht umgerechnet werden.

Augehend davon, daß die Hälfte der verbleibenden 4032 Bytes für die Verwaltungsdaten verbraucht werden (grob gerechnet), verbleiben 2016 Bytes für die Namen der Devices.
Da hier bis zu 50 Devices möglich sind, müssen 2016 Bytes / 50 Devices dividiert werden und es dürften rein rechnerisch 40 Zeichen für jeden Devicenamen übrig bleiben.

Die Praxis hat gezeigt, daß Probleme auftreten, sobald Sonderzeichen (^°ßäöüÖÄÜ=, aber auch !"§$%&/()=?²³{[]}\ benutzt werden.
Dies führte zu der Empfehlung, pro Devicenamen nicht mehr als 16 Zeichen zu verwenden, noch besser, nicht mehr als 8 Zeichen. Dabei sollte nur der Standard-ASCII-Zeichensatz verwendet werden. Diese Kombination hat in allen Fällen dazu geführt, daß es keine Probleme mehr mit den Devicenamen gegeben hat.
Kurz gesagt, eine Devicebezeichnung sollte so kurz wie möglich sein und 16 Zeichen nicht überschreiten.

Zu dem Problem 51 oder mehr Devices: diese werden im EEPROM zwar gespeichert, aber nicht mehr ausgelesen und laufen somit bei Betätigung ins Leere.

[english version]
The pizman has developed his own system, which is coherent and assigns 8 digits / letters to each device. He certainly likes to explain it here.

If you are sure that you do not use more than 10 modules, you can stick to a one-digit module designation, otherwise I would switch to 01 and the pins, because it makes it easier to sort.

To the device names themselves. These are stored in the EEPROM. It follows that I have to look at the memory consumption there.

If the EEPROM is read, it can be determined that the module name may be from byte 0x000 to 0x02F, ie 48 characters.
This is followed by the serial number from address 0x030 - 0x039, ie 10 characters.
Then follow the devices and their assigned pins plus internal administrative data, which go to 0xFFF.
Converted to 4096 bytes EEPROM less 48 characters Module name and max. 15 characters serial number followed by 0x00. Remain 4032 characters.
The administration data consists of device type (1 byte), followed by 1x 0x2E or "." as a separation, used pins (up to 4 depending on the device) [2E], device type (1 byte) [2E].
Pins larger than 9 occupy 2 bytes because they are stored as an ASCII character. As a result, they do not have to be converted when read out.

Assuming that half of the remaining 4032 bytes are consumed for the management data (roughly calculated), 2016 bytes remain for the names of the devices.
Since up to 50 devices are possible here, 2016 bytes / 50 devices must be divided and it should be purely mathematically 40 characters left for each device name.

Practice has shown that problems occur when special characters (^ ° ßäöüÖÄÜ =, but also! "§ $% & / () =? ²³ {[]} \ are used.
This led to the recommendation to use no more than 16 characters per device name, even better, not more than 8 characters. Only the standard ASCII character set should be used. This combination has in all cases meant that there were no more problems with the device name.
In short, a device designation should be as short as possible and not exceed 16 characters.

The problem 51 or more devices: these are stored in the EEPROM, but no longer read and thus run when pressed in the void.
Grüße,
Stephan (Time: UTC+2)
2019-02-07 20:15
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
iconStephanHo:


I have experienced this on my own FMC and have fully occupied the 52 pins with buttons, but then there are 2 buttons not.



Here you reach additional the Limit of 50 Devices Typ Button . Thats logical. This limit is known !
A Encoder is maby also no indication cause it can be shown as a button internal.

BUT
A Setup with for example 30 Buttons and 22 LED will ocure in 52 Devices ....
Pin 0 and Pin1 not in Use. ---- Pin 02-53 in Use
Limit of 40 LED not reached .... Limit of 50 Buttons not reached.

Basicly This "can" work if there is no "overall" Limit on 50 Pins ... OR it can failed if this 50 Pin limit exist.
Thats what we need to find out !

*****

@ DeltaBravo

Sorry für das English. Is halt international hier.

Mein System der Devicenames ist nicht in Stein gemeiselt sondern mehr eine Art Grundgedanke.
Arduino 1 :::: Pin 1 = 11 bei dir. Arduino 1 Pin 11 wäre also 111 .... Aber Arduino 11 Pin 1 ist ebenfalls 111
Weiterhin hast du dadurch nur eine Nummer aber keine Info WAS das ganze darstellt.

"Mein System" wenn man es so nennen will arbeitet mit Zahlen und Buchstaben im Wechsel....
So hat man keine verwechslung ob nun z.b 123 für 1-23 oder 12-3 steht.

Beispiel . Input - Bereich Overhead - Arduino 1 - Pin 12 Input Typ "Button"
Das wäre z.b. i10A12B
Erste Stelle ist i oder o was sagt ob Input oder Output
Sweite stelle ist Nummer des Bereichs .... 2 Stellig von 01-99 z.b. MCP = 01 EFIS Links = 02 Overhead Unten = 03
Dritte Stelle Arduino Nummer als Buchstabe A-Z für 26 Arduinos. Wenn du mehr brauchst nimmst halt AA - ZZ was über 500 wären
Vierte Stelle Pin Nummer Zweistellig von 02-53
Fünfte Stelle Devicetyp Ein Buchstabe ..... zb. B für Button E für Encoder S für Sieben Segment Display D für Drehstufenschalter

Wie gesagt Nur ein Beispiel.
Der Grundgedanke ist nur aus 1-2 stelligen Wertpaaren , abwechselnd Numemrn und Buchstaben einen Code zu machen der Einzigartig im System ist UND direkt sagt ...
WAS ist es ... WO ist es ... Und Welcher Arduino bzw welcher Pin ist es.
Zusätzlich kommt an das Kabel an BEIDEN Enden ein stück Isolierband mit diesen Code.... Und schon ist dein Cockpit übersichtlich.
Hast dann noch ne Excel Tabelle ist es Narrensicher !
Good Luck !
2019-02-08 00:41
Avatar
clarke250
Posts: 18
Hello Everyone,

Let me explain, I have the following setup to help bust this myth:

Pins 2 to 26 are buttons
Pins 27 to 53 are LEDS

If i add up correctly this is 52 pins. I can confirm that every switch and led operate correctly in both debug and standard mode when keeping the description as short as possible in the MF config upoad page. e.g:

Button 2 is 2
Button 3 is 3
ETC

LED 26 is 26
Led 27 is 27

In this config, MobiFlight does recognize all my LEDS and BUTTONS.

So I can say without doubt in this config, you can use all 52 pins!

(This might change however, if you add encoders or 7 segments as i have not tested this)

Let me know if you need anything else.

Kind Regards, and as always, thank you for your help.

Karl
2019-02-08 07:14
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Thank You Karl !!!


Thats It ! Interesting to know !
Good Luck !
2019-02-08 09:03
Go to page 1Go to page 012Go to page 2Go to page 2