K82: full gpio pin configuration

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

K82: full gpio pin configuration

497 次查看
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 项奖励
回复
1 回复

397 次查看
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 项奖励
回复