• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

MSFS Issues retrieving CDU text from PMDG 737-NG3 using SimConnect

Messages
83
Country
brazil
Hey everyone!

A couple of years ago I've assembled an Arduino with a TFT display that shows the CDU text from PMDG's 737-NGX for P3D.
I recently bought the NG3 for MSFS and was porting my code to the MSFS SimConnect, but I'm having some issues retrieving the CDU display data. I can send the data just fine (such as FMC button clicks). Getting the display data that is the issue.

I'm not sure if the structures or IDs have changed, but I'm getting error 25 (SIMCONNECT_EXCEPTION_ILLEGAL_OPERATION) from SimConnect when trying to receive the data from the display with the code below (used to work fine in P3D and NGX). It's all in C#:

C#:
simConnect.RequestClientData(DATA_DEFINITIONS.PMDG_NGX_CDU_0_ID, DATA_REQUESTS.CDU_REQUEST, DATA_DEFINITIONS.PMDG_NGX_CDU_0_DEFINITION, SIMCONNECT_CLIENT_DATA_PERIOD.ONCE, SIMCONNECT_CLIENT_DATA_REQUEST_FLAG.CHANGED, 0, 0, 0);
simConnect.RequestClientData(DATA_DEFINITIONS.PMDG_NGX_DATA_ID, DATA_REQUESTS.DATA_REQUEST, DATA_DEFINITIONS.PMDG_NGX_DATA_DEFINITION, SIMCONNECT_CLIENT_DATA_PERIOD.ONCE, SIMCONNECT_CLIENT_DATA_REQUEST_FLAG.CHANGED, 0, 0, 0);

Here are the enums used in that function:

C#:
enum DATA_DEFINITIONS {
    PMDG_NGX_CDU_0_ID = 0x4E477835,
    PMDG_NGX_CDU_1_ID = 0x4E477836,
    PMDG_NGX_CDU_0_DEFINITION = 0x4E477838,
    PMDG_NGX_CDU_1_DEFINITION = 0x4E477839,
    PMDG_NGX_DATA_ID = 0x4E477831,
    PMDG_NGX_DATA_DEFINITION = 0x4E477832
}


enum DATA_REQUESTS : byte {
    CDU_REQUEST,
    DATA_REQUEST
}

And here is where I register the data to be received (the same code I used in P3D):

C#:
simConnect.MapClientDataNameToID("PMDG_NGX_CDU_0", DATA_DEFINITIONS.PMDG_NGX_CDU_0_ID);
simConnect.AddToClientDataDefinition(DATA_DEFINITIONS.PMDG_NGX_CDU_0_DEFINITION, 0, (uint)Marshal.SizeOf<PMDG.PMDG_NGX_CDU>(), 0, 0);
simConnect.RegisterStruct<SIMCONNECT_RECV_CLIENT_DATA, PMDG.CDUData>(DATA_DEFINITIONS.PMDG_NGX_CDU_0_DEFINITION);

simConnect.MapClientDataNameToID("PMDG_NGX_Data", DATA_DEFINITIONS.PMDG_NGX_DATA_ID);
simConnect.AddToClientDataDefinition(DATA_DEFINITIONS.PMDG_NGX_DATA_DEFINITION, 0, (uint)Marshal.SizeOf<PMDG.PMDG_NGX_Data>(), 0, 0);
simConnect.RegisterStruct<SIMCONNECT_RECV_CLIENT_DATA, PMDG.PMDG_NGX_Data>(DATA_DEFINITIONS.PMDG_NGX_DATA_DEFINITION);

Anyone has any idea on what might be the issue? I think the data definition values or perhaps the Data structures for the new PMDG might have changed, but I couldn't find any documentation about the new 737 SDK on PMDGs forum.

Thanks in advance,
 
Last edited:
First, this isn't a PMDG support forum... however... if your code is unchanged and functions in the other sims, but isn't functioning in MSFS2020... then you need to bring it to PMDG's attention as it's their product and they would be better suited to chasing down the issue(s).
 
First, this isn't a PMDG support forum... however... if your code is unchanged and functions in the other sims, but isn't functioning in MSFS2020... then you need to bring it to PMDG's attention as it's their product and they would be better suited to chasing down the issue(s).

I know, but this is a SimConnect forum, and the SimConnect lib also had some changes from P3D to MSFS, so the issue might not be exclusively related to PMDG.
 
I understand, but I still think PMDG is the place you should be discussing this. They could at least tell you if it functions correctly for them, or not.
 
Managed to sort it out.
I forgot to rename "PMDG_NGX_CDU_0" to "PMDG_NG3_CDU_0" and "PMDG_NGX_Data" to "PMDG_NG3_Data". The rest of the structures and code can be exactly the same as it was on P3D and NGX.
 
Managed to sort it out.
I forgot to rename "PMDG_NGX_CDU_0" to "PMDG_NG3_CDU_0" and "PMDG_NGX_Data" to "PMDG_NG3_Data". The rest of the structures and code can be exactly the same as it was on P3D and NGX.
Hi Fergo,
Thanks a lot for sharing your work. Hope you will see my message which comes a long time after these posts.
I'm struggling with the same topic for a few days now while programming SimConnect managed code (C#) for the MSFS PM738. I think I have implemented all the hints you have provided in this thread.
However, there is one thing I can't figure out from these lines:

simConnect.MapClientDataNameToID("PMDG_NG3_CDU_0", DATA_DEFINITIONS.PMDG_NG3_CDU_0_ID);
simConnect.AddToClientDataDefinition(DATA_DEFINITIONS.PMDG_NG3_CDU_0_DEFINITION, 0, (uint)Marshal.SizeOf<PMDG.PMDG_NG3_CDU>(), 0, 0);
simConnect.RegisterStruct<SIMCONNECT_RECV_CLIENT_DATA, PMDG.CDUData>(DATA_DEFINITIONS.PMDG_NG3_CDU_0_DEFINITION);

The 'PMDG.PMDG_NG3_CDU' and 'PMDG.CDUData' are not recognized in my code. Where is this 'PMDG.' namespace coming from? (same issue with 'PMDG_NG3_Data' structure).
I could not find the answer in this thread or even in my web searches. I understand the code was originally from P3D SimConnect SDK, but you said it's working the same with the MSFS PMDG 737 (NG3).
Thanks in advance for your answer!
 
Back
Top