SDK_2.3.0_MKE06Z128xxx4中,GPIO_PinInit()是否有问题?SDK只对base->PDDR进行了初始化,是否还应对base->PIDR初始化?

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

SDK_2.3.0_MKE06Z128xxx4中,GPIO_PinInit()是否有问题?SDK只对base->PDDR进行了初始化,是否还应对base->PIDR初始化?

721 Views
yudongjin
Contributor II

原SDK如下,无法进行GPIO输入操作:

   if (config->pinDirection == kGPIO_DigitalInput)
    {
        base->PDDR &= ~(1U << ((uint32_t)pin + (shift * PIN_NUMBERS_EACH_PORT)));
    }
    else
    {
        GPIO_PinWrite(port, pin, config->outputLogic);
        base->PDDR |= (1U << ((uint32_t)pin + (shift * PIN_NUMBERS_EACH_PORT)));
    }

改成下列后,可以进行GPIO输入操作了

    if (config->pinDirection == kGPIO_DigitalInput)
    {
        base->PDDR &= ~(1U << ((uint32_t)pin + (shift * PIN_NUMBERS_EACH_PORT)));
        base->PIDR &= ~(1U << ((uint32_t)pin + (shift * PIN_NUMBERS_EACH_PORT)));
    }
    else
    {
        GPIO_PinWrite(port, pin, config->outputLogic);
        base->PDDR |= (1U << ((uint32_t)pin + (shift * PIN_NUMBERS_EACH_PORT)));
        base->PIDR |= (1U << ((uint32_t)pin + (shift * PIN_NUMBERS_EACH_PORT)));
    }

是否原SDK有问题?还是我的方法有问题?

0 Kudos
Reply
1 Reply

589 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Yudong:

Thank you for your feedback. PIDR register should be configured. Let me discuss with the soft team and get it back to you later.

Regards

Daniel

0 Kudos
Reply