K82: full gpio pin configuration

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

K82: full gpio pin configuration

583 Views
EugeneHiihtaja
Senior Contributor I

Hello !

I would like to configure gpio pin as normal gigital output with default state 0.

Config tool generate :

gpio_pin_config_t SWITCH_EN_config = {
.pinDirection = kGPIO_DigitalOutput,
.outputLogic = 0U
};
/* Initialize GPIO functionality on pin .../
GPIO_PinInit(BOARD_SWITCH_EN_GPIO, BOARD_SWITCH_EN_PIN, &SWITCH_EN_config);

PORT_SetPinMux(BOARD_SWITCH_EN_PORT, BOARD_SWITCH_EN_PIN, kPORT_MuxAsGpio);


But default exact pin config is missing and in theory it should looks like this :


const port_pin_config_t pin_config = {
/* No pull setup for this pin */
.pullSelect = kPORT_PullDisable,
/* Fast slew rate is configured */
.slewRate = kPORT_FastSlewRate,
/* Passive filter is disabled */
.passiveFilterEnable = kPORT_PassiveFilterDisable,
/* Open drain is enabled */
.openDrainEnable = kPORT_OpenDrainDisable,
/* Low drive strength is configured */
.driveStrength = kPORT_LowDriveStrength,
/* Pin is configured as GPIO */
.mux = kPORT_MuxAsGpio,
/* Pin Control Register fields [15:0] are not locked */
.lockRegister = kPORT_UnlockRegister};
PORT_SetPinConfig(PORTC, BOARD_SWITCH_EN_PIN, &pin_config);

All of those constants have value 0.

Can I assume that PORT_SetPinConfig() call is no need if values have default state e.g 0 ?

Regards,

Eugene

0 Kudos
Reply
1 Reply

483 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hello Eugene, I hope you're doing well,

 

You can see the reset values for some of the PCR values in the K82 Reference Manual:

 pastedImage_2.png

However, as the notes say, some of the reset values for the Pin Control Register vary, depending on which port the pin you're configuring belongs to.

 

 

You can check further information about this at Table 12-2 (pages 214 and 215 of the K82 Sub-Family Reference Manual). Depending on each pin, you may need to manually configure them using PORT_SetPinConfig().

 

Please, let me know if you have any other questions.

 

Best regards,

Sebastian

0 Kudos
Reply