Hi @pagdav
Thank you for sharing your .mex file. Now I understand better the context of your error.
When you create a new functional group in the peripherals tool, in your case "BOARD_InitPeripherals_2", it is also necessary to create a new functional in the pins tool, which has to be named PortContainerName_PeripheralFunctionalGroupName. If you do not change the Port Container name (PortContainer_0) in the new Functional group, then the new functional group created in the pins tool has to be named "PortContainer_0_BOARD_InitPeripherals_2".