DIO port configuration not updating in Simulink blocks

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

DIO port configuration not updating in Simulink blocks

跳至解决方案
1,370 次查看
MaMM
Contributor III

Hello.

I'm configuring new DIO ports starting from an example, and although it seems to be configured, the new variables don't appear in the channel drop_down list. If I change to DIO_Read_channel, they appear in the drop-down list. If I change again to DIO_Write_channel, they disappear. I've checked and the new variables are configured as input-output. Any idea how to solve it? Below is the text which appears into the "configuration parameters":

 

CommonPublishedInformation - CommonPublishedInformation

CommonPublishedInformation/ArReleaseMajorVersion - 4

CommonPublishedInformation/ArReleaseMinorVersion - 7

CommonPublishedInformation/ArReleaseRevisionVersion - 0

CommonPublishedInformation/ModuleId - 120

CommonPublishedInformation/SwMajorVersion - 4

CommonPublishedInformation/SwMinorVersion - 0

CommonPublishedInformation/SwPatchVersion - 0

CommonPublishedInformation/VendorId - 43

DioConfig - DioConfig

DioConfig/DioPort - PTA_H PTB_H PTC_H PTD_L PTE_L PTG_L PTH_L

DioConfig/PTA_H/DioPortId - 1

DioConfig/PTB_H/DioPortId - 3

DioConfig/PTC_H/DioPortId - 5

DioConfig/PTD_L/D33_NEW/DioChannelId - 9

DioConfig/PTD_L/D33_NEW/PDACSlot - VIRTUAL_WRAPPER_PDAC0

DioConfig/PTD_L/D34_NEW/DioChannelId - 10

DioConfig/PTD_L/D34_NEW/PDACSlot - VIRTUAL_WRAPPER_PDAC0

DioConfig/PTD_L/DioChannel - D33_NEW D34_NEW

DioConfig/PTD_L/DioPortId - 6

DioConfig/PTE_L/DioPortId - 8

DioConfig/PTG_L/DioChannel - USER_SW7 USER_SW8 USER_SW9

DioConfig/PTG_L/DioPortId - 12

DioConfig/PTG_L/USER_SW7/DioChannelId - 2

DioConfig/PTG_L/USER_SW7/PDACSlot - VIRTUAL_WRAPPER_PDAC0

DioConfig/PTG_L/USER_SW8/DioChannelId - 1

DioConfig/PTG_L/USER_SW8/PDACSlot - VIRTUAL_WRAPPER_PDAC0

DioConfig/PTG_L/USER_SW9/DioChannelId - 0

DioConfig/PTG_L/USER_SW9/PDACSlot - VIRTUAL_WRAPPER_PDAC0

DioConfig/PTH_L/D35_BLUE/DioChannelId - 7

DioConfig/PTH_L/D35_BLUE/PDACSlot - VIRTUAL_WRAPPER_PDAC0

DioConfig/PTH_L/DioChannel - D35_BLUE

DioConfig/PTH_L/DioPortId - 14

DioGeneral - DioGeneral

DioGeneral/DioDevErrorDetect - 1

DioGeneral/DioEnableUserModeSupport - 0

DioGeneral/DioFlipChannelApi - 1

DioGeneral/DioMaskedWritePortApi - 1

DioGeneral/DioMulticoreSupport - 0

DioGeneral/DioReadZeroForUndefinedPortPins - 0

DioGeneral/DioReversePortBits - 0

DioGeneral/DioVersionInfoApi - 1

DioGeneral/DioVirtWrapperSupport - 0

DioGeneral/SIUL2DioIPDevErrorDetect - 1

 

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,322 次查看
MaMM
Contributor III

Hello Irina.

Apparently, everything is set up as you mentioned. What I’ve done is base it on the example with 3 LEDs for digital outputs and 3 switches. When modifying the example for the S32K39, two out of the three LEDs are not correctly configured on the corresponding output. After modifying the output port, they no longer appear in the configuration. Anyway, I’m attaching two images of how they are configured, as well as the MATLAB program so you can review it in detail.

Config 1 DIO.png

Config 2 DIO.png

Thanks in advance!

Miguel.

在原帖中查看解决方案

标记 (2)
0 项奖励
回复
4 回复数
1,332 次查看
Irina_Costachescu
NXP Employee
NXP Employee

Hello @MaMM 

Under the described scenario, besides the Dio component configuration, the Port component configuration should be also taken into account, since there is a connection that must be made between these two components. To be more specific, the display of the Dio channels inside the Dio block is based on the following mechanism:

If the direction of the pin, corresponding to the Dio channel, is configured inside the Port component as OUT or INOUT, the Dio Channel will be displayed inside the dropdown of the block when the Dio_WriteChannel function is selected.

If the direction of the pin, corresponding to the Dio channel, is configured inside the Port component as IN or INOUT, the Dio Channel will be displayed inside the dropdown of the block when the Dio_ReadChannel function is selected.

To be more explicit, let's take for example one of the USER_SWs (USER_SW0) enabled inside the default configuration project delivered by MBDT for the S32K344.

USER_SW0 has the DioChannel Id = 10 and is configured inside the PTB_H port, having the Dio Port Id = 3. The channel to microcontroller pin mapping can be done using the following formula

Microcontroller pin = DioChannel Id + Dio Port Id * 16

in this case, Microcontroller pin = 58

Now, if we go inside the Port component, under the Dio_Pins container, you will be able to find the same USER_SW0 pin, with MSCR = 58 (just like we previously computed), being set with the PortPin Direction = PORT_PIN_IN.

Irina_Costachescu_0-1737358339859.png

Because the direction of the pin with MSCR 58, corresponding to the Dio Channel USER_SW0, is configured inside the Port component as IN, the USER_SW0 Dio Channel will be displayed inside the dropdown of the block when the Dio_ReadChannel function is selected, and will disappear when the Dio_WriteChannel function is selected.

Have you configured your additional Dio Channel inside the Port component as well, with the PortPin Direction setting enabled on PORT_PIN_INOUT?

If this is a step that you have performed, based on the details presented above, and you are still encountering this issue, could you please share with us the configuration project?

Thank you,

Irina

 

 

0 项奖励
回复
1,323 次查看
MaMM
Contributor III

Hello Irina.

Apparently, everything is set up as you mentioned. What I’ve done is base it on the example with 3 LEDs for digital outputs and 3 switches. When modifying the example for the S32K39, two out of the three LEDs are not correctly configured on the corresponding output. After modifying the output port, they no longer appear in the configuration. Anyway, I’m attaching two images of how they are configured, as well as the MATLAB program so you can review it in detail.

Config 1 DIO.png

Config 2 DIO.png

Thanks in advance!

Miguel.

标记 (2)
0 项奖励
回复
1,316 次查看
Irina_Costachescu
NXP Employee
NXP Employee

Hi @MaMM 

Tested the configuration you attached and the behavior seems to be aligned with the toolbox implementation.

D33_NEW is configured having the PortPin Direction set to PORT_PIN_OUT, hence, the Dio Channel is displayed in the dropdown when the selected function is Dio_WriteChannel.

Irina_Costachescu_0-1737371669989.png

If the function is changed to Dio_ReadChannel, the D33_NEW disappears from the available options.

Irina_Costachescu_1-1737371757645.png

If you would like to access D33_NEW in both Read and Write use cases, its direction should be set to PORT_PIN_INOUT.

Irina_Costachescu_3-1737372312732.png

After performing this change in the project, please press the Refresh button of the Simulink block for the new settings to be visible inside the model.

Irina_Costachescu_2-1737372156806.png

Hope this helps,

Irina

 

 

0 项奖励
回复
1,306 次查看
MaMM
Contributor III

Hi Irina.

Now the new ports appear on the drop-down list, really strange behaviour. Probably because I've changed the pin according to the equation yo wrote with the pin number...

Thanks a lot.

0 项奖励
回复