Turn on the GPIO using NXPs32k322

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Turn on the GPIO using NXPs32k322

Jump to solution
5,896 Views
pratik_a
Contributor III

Hi,  

I'm trying to toggle the output of pins on S32k322 PTC19 and PTC21. I have followed the example provided in the NXP Design studio.  

This is my main.c file,

#include "Mcal.h"
#include "Mcu.h"
#include "Port.h"
#include "Dio.h"

volatile int exit_code = 0;
/* User includes */
void TestDelay(uint32 delay);
void TestDelay(uint32 delay)
{
static volatile uint32 DelayTimer = 0;
while (DelayTimer<delay)
{
DelayTimer++;
}
DelayTimer=0;
}

int main(void)
{
//#if (MCU_PRECOMPILE_SUPPORT == STD_ON)
Mcu_Init(NULL_PTR);
//#elif (MCU_PRECOMPILE_SUPPORT == STD_OFF)
//Mcu_Init(&Mcu_Config);
//#endif
/* Initialize the clock tree and apply PLL as system clock */
Mcu_InitClock(McuClockSettingConfig_0);
 
/* Apply a mode configuration */
Mcu_SetMode(McuModeSettingConf_0);
 
/* Initialize all pins using the Port driver */
Port_Init(NULL_PTR);
 
    for(;;)
    {
    Dio_WriteChannel(84, STD_HIGH);
    Dio_WriteChannel(86, STD_HIGH);
    }
    //Exit_Example(TRUE);
    return 0;
}
 
It doesn't work. Any help is appreciated. Thanks
0 Kudos
Reply
1 Solution
5,847 Views
pratik_a
Contributor III

Hi @Julián_AragónM ,

I have finally worked out the way around to toggle the LED,

For anybody reading the post please follow the below link,

HOWTO: Create a Blinking LED application project for S32G using S32 RTD with AUTOSAR - NXP Community

1) Dio port ID is 5 for me and any Dio channel ID should work.

2) MSCIR 83 and 85 for PTC 19, and PTC 21 for S32k322.

Thank you for supporting.

Cheers

Pratik

View solution in original post

4 Replies
5,848 Views
pratik_a
Contributor III

Hi @Julián_AragónM ,

I have finally worked out the way around to toggle the LED,

For anybody reading the post please follow the below link,

HOWTO: Create a Blinking LED application project for S32G using S32 RTD with AUTOSAR - NXP Community

1) Dio port ID is 5 for me and any Dio channel ID should work.

2) MSCIR 83 and 85 for PTC 19, and PTC 21 for S32k322.

Thank you for supporting.

Cheers

Pratik

5,847 Views
pratik_a
Contributor III

Hi, 

Can someone please verify if I'm doing anything wrong?

Also, I'm unsure what "Dio channel ID" in Dio Configuration to use for PTC19 and PTC21 for the S32k322 microcontroller.

Regards,

Pratik

0 Kudos
Reply
5,866 Views
pratik_a
Contributor III

Hi @Julián_AragónM 

So, I closely followed the example shown in the tutorial. As per the example, I did the following things,

1. In the pin configuration section I made the PTC19, and 21 as output. Refer image 1.png

2. I included the Dio, Mcu, port components. Refer image 2.png

3. In the "PortConfigSet" section of the port component I added 2 port containers for Mscr 83 and 85 respectively. Refer image 3.png. I have not added anything in the "untouchedPortPin" section.

4. In the "Dio config" section of the Dio component I added 1 Dio port with port ID = 5 as Port CH=5 corresponds to PTC[31-16]. Also, I have kept Dio channel ID = 5. I'm not sure if that's correct as I was unable to find the channel ID section in the RM document. Kindly revert if it is correct. Refer image 4.png.

I'm unsure if the problem lies in the above config or in the way I'm flashing the code to the controller. I'm following the steps mentioned in the link below,

Re: How to program / flash a standalone nxp s32k322 board? - NXP Community

Any help is appreciated.

Regards,

Pratik

   

 

0 Kudos
Reply
5,880 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @pratik_a,

It seems the declarations for the number identifier (MSCR) are off by 1. Please take a look into the IOMUX.xls for the values of each pin (83 & 85):

Julin_AragnM_0-1709584550155.png

Please help me confirm if this change works, also make sure to have the pins declared in the Pins and Modules view of Config Tools (the same way as the example shows).

Best regards,
Julián

0 Kudos
Reply