#Creating a custom device in 9.7.1.7

1 messages ยท Page 1 of 1 (latest)

acoustic sapphire
#

Hi,
I'm trying to play with the new custom devices option in the new Beta. My long term goal is a custom firmware for the Pico with Kav-LCD support and the 4 missing pins in the standard Pico firmware. I must admit that I am not very skilled in VS Code/platformio/github and chances are that there is a mistake on my end...
So, I'm following elrals wiki (https://github.com/elral/MobiFlight-Connector/wiki/How-to-set-up-a-custom-device). I installed VS Code and the platformio extension and it seems to work. I created a fork of the MobiFlight-FirmwareSource repository and managed to clone it to my local computer using the Clone Git Projectfunction in platformio.
Next step according to the wiki is to type pio run in the terminal, which I did. The process seems to start and I got the following error message which is probably related to my local file structure but doesn't seem to be a showstopper:
git: '2023\Custom' is not a git command. See 'git --help'. *** Error 1
The process continues however for a while and occasionally announces
=== [SUCCESS] Took 2.81 seconds ===
Then, after a while, during
Processing mobiflight_raspberrypico (platform: https://github.com/maxgerhardt/platform-raspberrypi.git; board: pico; framework: arduino)
I get an error message:
VCSBaseException: VCS: Could not process command ['git', 'clone', '--recursive', 'https://github.com/earlephilhower/arduino-pico.git', 'C:\\Users\\kmpou\\.platformio\\.cache\\tmp\\pkg-installing-c9atnx7k']

My expectation was that after this process, there are new folders in /CustomDevices. The folder is empty however. I assume that is due to the error?

GitHub

Contribute to elral/MobiFlight-Connector development by creating an account on GitHub.

next oriole
#

This could be an issue with long file names on windows. Seems that the Pico framework does not get installed.

#

There is a ready custom device for the kav displays.
You need just to create a new board.json file for the missing pins.

#

I am not at home, later I can provide Infos how to activate long file names for git and windows.

vernal coral
#

do you have git installed?

acoustic sapphire
acoustic sapphire
vernal coral
#

Ok, it's the long file path problem then.

vernal coral
acoustic sapphire
#

I believe I do... or maybe I'm misunderstanding the concept. Here is what I am trying to do:
I have a PCB with an embedded RP2040 that controls the FCU I/Os and a separate display board that is either the Kav LCD or a LED/7-Segment version of it.

vernal coral
#

ah, yeah, because you have the kav lcd

#

anyway, it's almost certainly the long path problem. do the above thingy from the linka nd you should be good to go

acoustic sapphire
#

Thanks, I'm already on it!

next oriole
#

And again, there is already a custom device for the kav's displays available.

acoustic sapphire
#

For the Pico? Really?

vernal coral
#

yes

#

when you get your build working it'll be there, it's one of the things that's trying to get cloned in and failing

acoustic sapphire
#

Oh... then maybe that's an option. Hmm...

vernal coral
#

well you still need custom firmware to set the mobiflight type

#

so your board will identify as your board to mobiflight and not a generic pico

#

and you can even, if you want, hack in a hardcoded config so when the board connects it already has all its pins defined

acoustic sapphire
#

Just to clarify: custom firmware and custom device isn't the same thing, is it?

vernal coral
#

correct

#

they aren't the same thing

acoustic sapphire
vernal coral
#

Exactly

#

you want to follow that wiki, but the firmware you ship should be one that includes the kav-lcd custom device too

#

in platformio.ini there's a line that says this:

    ./CustomDevices/KAV_Simulation/EFIS_FCU/EFIS_FCU_platformio.ini
#

That produces builds of the firmware that include the kav custom device. You'd just ship the pico version of that build to your users

#

after doing the steps in the above wiki

acoustic sapphire
#

Not sure if I get what you mean then ๐Ÿ˜„

#

Oh btw it still fails after changing the regedit

#

Same error

#

I'll do a reboot, maybe...

vernal coral
#

you have to reboot

#

I just updated the custom boards wiki with better details on what version number you should pick for your firmware

acoustic sapphire
#

Should have read until the end ๐Ÿ˜„

#

Running again, let's see

vernal coral
#

that tinyusb error you pasted is definitely the long paths problem

acoustic sapphire
#

Oh good, that gives me hope. Sorry, As I said, I'm not very familiar with all this. I'm a hardware guy ๐Ÿ˜„

vernal coral
#

Once you get it up and running I can help you figure out how to hardcode the conneced device config. That way if someone flashes the firmware and plugs the device in it will automatically tell mobiflight all the buttons etc. I did that for my MCU and it's sweet.

#

no need to ship a separate file and say "load this to set up the board with all the buttons"

acoustic sapphire
#

That's possible? Awesome!

#

Oh, failed again although the regedit change is still there. I'll try the second method with the Local Group Policy Editor.

#

Aaaand... reboot ๐Ÿ˜„

vernal coral
#

I can't remember which way I had to do it (I don't think GPE exists in windows 11? At least it didn't for me?) Anyway, that is your core problem

acoustic sapphire
#

Maybe it's time for me to set up a fresh Windows installation anyway...

vernal coral
#

won't make a difference, you still have to do this little change

acoustic sapphire
#

Hmm you're right ๐Ÿ˜„

#

Let's see.. it's running again

#

Yay! It passed the tinyusb part without error. Still running

#

Nope...

#

It's German, but I think it's quite obvious

vernal coral
#

looking at your screenshot, your clone location is just too deep

#

make a c:\git folder (or on another drive)

#

and clone in there

acoustic sapphire
#

Roger!

vernal coral
#

so the path should wind up being c:\git\mobiflight-firmwaresource

#

you'll run the clone command from c:\git (or d:\git or whatever drive you put it on, I have all mine on d:)

#

that still may not work though, it really seems like your long path stuff isn't working

acoustic sapphire
#

is that an issue?

vernal coral
#

no I don't think so. I think it's just something wonky with how the current process is set up but it's harmless

#

you should look at the link I pasted above, it outlines steps someone did in October that semeed to make long paths work.

acoustic sapphire
#

I'm reading it right now, thanks!

next oriole
#

Setting up a description how to use existing custom devices is on my ToDo list. Wanted to do it yesterday, but an additional bug come up which had to be fixed โ˜น๏ธ

acoustic sapphire
#

No pressure!

#

It was just very likely that the explanation is there already, but i fail to understand it ๐Ÿ™‚

next oriole
#

@vernal coral Just a reminder, the Mobiflight type was moved from the board.h file to the platformio.ini file. Each custom device has its own file.

#

I am now out as our neighbors are coming

acoustic sapphire
#

Ahh... I give up... followed the steps from Travis - no success.

#

At the top of this screenshot it even says "filename too long"

next oriole
#

As far as I remember there is a command to tell git also to use long file names. This is a second step!

acoustic sapphire
#

Thank you, I'll Google that

next oriole
#

Copy the device.jsons to your /device folder and the board.json file to the /Board folder.

#

If you restart MF this firmware can be flashed to the Pico. Next you can add a custom device and define the pins.

#

There are also example files for the FBW A320

vernal coral
#
git config --system core.longpaths true
acoustic sapphire
#

That answers my question! Perfect! I owe you one

acoustic sapphire
vernal coral
#

yeah you have to be an admni to run it

next oriole
acoustic sapphire
#

As far as I know I am. Maybe VS Code doesn't run as Admin. We'll know in a minute. If it fails again, I finally give up and do it without the extra pins

vernal coral
#

vscode doesn't run as admin

#

nothing does unless you explicitly run as administrator

acoustic sapphire
#

You know what... That's it. I don't have enough patience for this stuff. It's a different message this time and it appears sooner in the process.

vernal coral
#

go to c:\users\kmpou\.platformio\packages and delete the framework-arduinopico folder

#

then try opening the project again in vscode and doing the build

acoustic sapphire
#

Finally solved it. Thank you both for your patience. Now let's see what's next

acoustic sapphire
#

I was expecting to find the examples in /CustomDevices now. It's still empty.

#

I think it's best for me to just leave it. It's pretty obvious that I'm trying to do something I don't understand. I'll use the Pico firmware with the Kav display. Thank you both for your effort! I appreciate your help, but I don't want you to guide me through the entire process and do all the work for me. YOur time is more valuable than that.

vernal coral
#

the folder you see is a bug in the build that confuses me too

#

one sec, you're like 90% of the way there. don't give up!

#

ok so something didn't fully run since your customdevices folder is empty. it should be populated automatically by the build

#

I would try running the platformio build again

acoustic sapphire
#

Just to confirm, you mean pio run?

vernal coral
#

no, in visual studio code

#

type CTRL+SHIFT+P

#

then type PlatformIO and it should autocomplete down to a list of things, find PlatformIO: Build and pick that

acoustic sapphire
#

Worked, but still empty

vernal coral
#

yeah it's definitely not cloning

#

check your build logs for something like this:

git --work-tree=D:\git\MobiFlight-FirmwareSource/CustomDevices --git-dir=D:\git\MobiFlight-FirmwareSource/CustomDevices/.git pull origin main --depth 100
From https://github.com/MobiFlight/MobiFlight-CustomDevices
 * branch            main       -> FETCH_HEAD
#

we just need to figure out why it isn't cloning then you should be up and running with the hard part (getting the first build) done

#

from there adding a custom mobiflight type is pretty easy

acoustic sapphire
#

That's the part where I get an error message

#

git --work-tree=C:\git\fcu_firmware\MobiFlight-FirmwareSource/CustomDevices --git-dir=C:\git\fcu_firmware\MobiFlight-FirmwareSource/CustomDevices/.git pull origin main --depth 100 fatal: not a git repository: 'C:\git\fcu_firmware\MobiFlight-FirmwareSource/CustomDevices/.git' *** Error 128 CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/megaatmega2560.html

#

Although it continues differently

vernal coral
#

interesting

#

you're on windows yes?

acoustic sapphire
#

Yep, Win 10

vernal coral
#

delete the empty CustomDevices folder and try building again

#

I looked at how this works and because that folder is there and empty it assumes it just needs refreshing, but since it's empty it can't. you need it to do the clone of the repo first, and the presence of the empty CustomDevices folder prevents that

acoustic sapphire
#

Crazy... that did the trick!

vernal coral
#

beautiful! your build will take much longer now since it's building all the platforms

acoustic sapphire
#

I can live with that ๐Ÿ˜„

#

Okay, from here I'll try to continue with elrals wiki. Probably coming back with the next problem in a few minutes ๐Ÿ˜…

vernal coral
#

the wiki is slightly out of date

#

Open this file: CustomDevices\KAV_Simulation\EFIS_FCU\EFIS_FCU_platformio.ini

#

search for Kav FCU/EFIS RaspiPico

#

Change that to whatever you want your custom board to show up as in Mobiflight, e.g. komp FCU

#

that's the right place to make the change described in step 1 of the wiki now, instead of in the board.h file

#

the rest of the wiki should be accurate... I think

#

then when the build is done your firmware will be in .pio\build\kav_efis_fcu_raspberrypico, the file will end in .uf2

next oriole
vernal coral
#

oh I just realized he said "elrals wiki" oops lol

#

but at this point your wiki really isn't required, if the only goal is to get a pico build with the kav custom device in it. The default build you provide already does that, it's just a matter of changing the mobiflight type and making the board.json match

next oriole
#

Yes, and that's what I mean that a Wiki is missing how to use existing custom devices

acoustic sapphire
#

I'm using both, trying to understand how everything connects

next oriole
#

It's still on my ToDo list, but where is all the time going? ๐Ÿ˜ฌ

acoustic sapphire
#

Hopefully not into helping me! As I said, your time is more valuable than that!

vernal coral
#

the whole reason we are in this discord is to help ๐Ÿ˜‰

acoustic sapphire
#

Adding the custom device doesn't work...

acoustic sapphire
#

And updating the firmware leads to an error. It seems like it's trying to upload a different file (which isn't in the folder):

next oriole
#

Local builds set the FW version to 0.0.1, that's prevent adding custom devices.
Open in PlatformIO the file getversion.py and change 0.0.1 to 2.4.4

#

Then flash your Pico again

acoustic sapphire
#

Okay. This isn't my local build though. I followed your instructions to upload the kav-pico firmware you provided

next oriole
#

Uuups, then the version in the board.json file does not match the uf2 file.

acoustic sapphire
#

Ah yes. Should be a simple fix, right? 2.4.4 and save?

next oriole
#

Yeah, it looks for version 2.4.1, but the file has 2.4.?

acoustic sapphire
#

I assume it's 2.4.4 because that's the filename

#

Upload finished! Wonderful!

next oriole
#

This is an open point how to update the board.json files when a new FW version is set up

acoustic sapphire
#

This was overdue btw. I know the money doesn't go to you directly, but it goes to the project and hopefully helps keeping it alive

next oriole
drowsy tendon
#

heh we stumbled on this same issue today, independently!

#

but this is so cool stuff. Definitely will want to do a radio panel for this.

#

and we need the text string support in WASM so we can read stuff like (A:COM ACTIVE FREQ TYPE:1)

#

to do this:

lucid wharf
vernal coral
#

after this release Sebastian!!!

#

step away from the coding!!!

lucid wharf
#

it is done by somebody else

#

secretly

#

a friend

#

not me

acoustic sapphire
#

So I think I followed the wiki successfully. It seems to work. One thing that I couldn't figure out is how to tell the build process to name my file with a current firmware version suffix. It always puts 0_0_1 . I changed it in the board.json and I believe in another file that I can't find anymore

vernal coral
#

you have to edit it in the get_version.py script

acoustic sapphire
#

Duh... ok, found it. I was searching for it in the /CustomDevices folder ๐Ÿ˜„

vernal coral
#

did I forget to put tha tin the wiki? I bet I did

acoustic sapphire
#

No, now that you mention it I recall reading something like that

#

Does that also change the displayed firmware or is this somewhere else?

vernal coral
#

it all comes from tha tone file

acoustic sapphire
#

This is so crazy. I know it's not a big deal, but it definitely is for me ๐Ÿ˜„

#

Thank you once again!

vernal coral
#

woooooo nice!!!!!!!!!!

acoustic sapphire
#

As of now, it is only a copy of Kav's firmware that I renamed. But I think from here I know how to continue. If only I could test it... The Kav LCDs don't seem to work with 3V3 and I don't have any suitable parts lying around for a makeshift level shifter. I just ordered some premade boards from amazon

acoustic sapphire
#

Ahhh what is happening now?

#

I changed the board.json to add the missing pins, nothing else...

#

Even if I manually upload my kompFCU_pico_2_4_4.uf2 Mobiflight detects it as Kav LCD

acoustic sapphire
#

Found it...

#

And all pins available!
Looks like I am almost there ๐Ÿ˜

next oriole
# vernal coral you have to edit it in the get_version.py script

This drove me always crazy to change the file and to revert the change before commiting.
Today I worked on this, and now I have solution which is fine for me.
I defined an user environment variable "VERSION" and set it to 2.4.4 (last FW version).
Now I don't have to change the getversion.py file anymore ๐Ÿ˜„
Once a new version is out I just have to change the environment variable

vernal coral
#

Yes that works fine

lucid wharf
vernal coral
next oriole
#

Hmhm, I don't know what you mean ๐Ÿ˜ฌ
What should I do?

acoustic sapphire
#

Has the Kav Display been tested in this context? I installed the firmware for it on an old Mega2560 and can't get it to show anything. The log also shows an Error message:

next oriole
#

Oh, you mean the output config. Not sure if something has changed in the meantime.

#

Have to check it with my display

acoustic sapphire
#

It looks like the .mcc that is included doesn't match my setup

#

I tried creating my own config

#

No errors in the log. No output on the LCD though

#

Is it intentional that the field in column "type" is empty? Contrary to a simple LED/output?

#

This is the config for it

vernal coral
drowsy tendon
#

oh, so forking the repo also forks the build infrastructure stuff?

next oriole
#

@acoustic sapphire there must be an issue with the FCU display. Last weeks I did the tests with the EFIS display on a pico.
I will have a look on it tomorrow.

acoustic sapphire
#

Ahh okay. I can try the EFIS display quickly, as a cross-check. One sec

next oriole
#

EFIS will not run either

acoustic sapphire
#

Can confirm ๐Ÿ˜„

#

No hurry... I have plenty of time and other stuff I can do in the meantime!

#

If it helps you, this is the log when I change the values in sim

next oriole
#

The config gets not loaded properly for EFIS and FCU on the mega. On the Pico only the FCU gets not loaded but the EFIS does work.
Strange, strange...

next oriole
#

@acoustic sapphire please build again the FW for the KAV displays. Fixes are in the custom device and will be downloaded on the next run. Both displays should work, but I tested up to now only the FCU display.

acoustic sapphire
#

Understood, will try in the afternoon. Just came home from a night shift.
I assume I have to update my fork on GitHub first, right? Because that's what my local version depends on.

next oriole
#

Only if you have forked the custom device repo

next oriole
#

@acoustic sapphire I had to do some renaming of the board.json and device.json files for the KAV displays. Also the custom types within these files have changed and the include path for the displays in Platformio.ini.
So unfortunately you have to change your own board.json file too.
For the changed include path I have already setup a pull request. Until this is merged and part of the next beta you can download the hex or uf2 files from my PR.
Exchange also the board.json and device.json files for the Kav displays in your Mobiflight folder.

acoustic sapphire
#

I think this is getting too complex for me.

#

I did as you said, but cannot upload the new firmware 0_0_277. Mobiflight is still looking for the 2_4_4 version.
Step by step what I did:

  1. downloaded the zip of CustomDevices and placed KAV_Simulation/connector_files/kav_mega.board.json and kav_pico.board.json in the Boards folder of MF. Same with kav_efis.device.json and kav_fcu.device.json in Devices.
  2. downloaded the firmware from https://github.com/MobiFlight/MobiFlight-FirmwareSource/pull/277 and placed kav_raspberrypico_0_0_277.uf2 and kav_mega_0_0_277.hex in the Firmware folder.

As long as the old firmware files (suffix 2_4_4) are still there the upload succeeds, so far so expected. But that's not the firmware I want to install. If I remove these files, I get an error during upload because MF is still looking for these files, not for the 0_0_277

#

And by now my entire file structure is such a mess that it's easier to delete everything, including the MF folder, and start over.

vernal coral
#

just rename the .uf2 file to 2_4_4

acoustic sapphire
#

Works for the upload, yeah... but I cannot configure custom devices since the firmware version is below 2.4.4

vernal coral
#

oh ya, you just can't with the firmware attached to the pr

#

you need to update your fork and build again

#

if you go to github.com and go to the forked repo in your account there is a sync button

#

then locally you can do a git pull

#

here's what it looks like in my fork

acoustic sapphire
#

I'm not sure I understand ๐Ÿ˜„
With the current configuration I am not using any files of my local version of Mobiflight-FirmwareSource anymore. Anyway... I synced my fork. Tried git pulland this is the result. Clearly a fault on my end, I'm sure

vernal coral
#

you need to be inside the mobiflight-firmwaresource folder

#

then run git pull

acoustic sapphire
#

Oh ๐Ÿ˜…

next oriole
#

I send @acoustic sapphire the files per PM. It's running now, EFIS and FCU on Mega and Pico

#

Hopefully I have changed now the names in all required files in the 3 repos. That was a nightmare...

#

At least the PR for the FW and the connector are out, the files on the custom device repo are merged

acoustic sapphire
#

There we go!
Again, thank you so much, both of you! This is a milestone for me and allows me to proceed with my FCU project.
It's so heartwarming to have a community full of people helping each other and I am happy to give something in return by making my FCU open source. But that's another story and will still take a while

vernal coral
#

amazing!!!

#

AMAZING!!!