打印
[N32G43x]

请教问题 GPIO输入为0

[复制链接]
532|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
liuxy67|  楼主 | 2024-4-24 14:36 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
ni, pi, gp, IO, GPIO
经朋友推荐,使用N32G35CCL7芯片,配置PA5,PA6,PB4,PB5,PB6做为普通IO输入,(输入电平均为1),读取结果除PA5为1外其它均为0,请教各位指导?
void EXT_Key_Config(void)
{
    GPIO_InitType GPIO_InitStructure;
//    EXTI_InitType EXTI_InitStructure;

    /* Enable GPIO clock */
    RCC_EnableAPB2PeriphClk(KEY_INT_GPIO_CLK, ENABLE);
   

    /*--------------------------KEY1\2  PA5\PA6 Configuration-----------------------------*/
    /* Initialize GPIO_InitStructure */
    GPIO_InitStruct(&GPIO_InitStructure);
    /* Configure KEY1 as input floating */
    GPIO_InitStructure.Pin       = KEY_INT_GPIO_PIN;    //PA5|PA6
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Input;   
        GPIO_InitStructure.GPIO_Pull = GPIO_No_Pull;
    GPIO_InitPeripheral(KEY_INT_GPIO_PORT, &GPIO_InitStructure);    //PA

    /*--------------------------PAUSE Configuration PB4,PB5,PB6-----------------------------*/
    /* Initialize GPIO_InitStructure */
    RCC_EnableAPB2PeriphClk(PAUSE_INT_GPIO_CLK, ENABLE);        //PB
   // RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_AFIO, ENABLE);

        GPIO_InitStruct(&GPIO_InitStructure);
    /* Configure PAUSEN as input floating */
    GPIO_InitStructure.Pin       = PAUSE_INT_GPIO_PIN;        //PB4|PB5|PB6
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Input;
        GPIO_InitStructure.GPIO_Pull = GPIO_No_Pull;        
    GPIO_InitPeripheral(PAUSE_INT_GPIO_PORT, &GPIO_InitStructure);    //PB

}



使用特权

评论回复
沙发
LEDyyds| | 2024-4-25 13:48 | 只看该作者
好像1.3V以上才视为高电平吧

使用特权

评论回复
板凳
liuxy67|  楼主 | 2024-4-25 16:09 | 只看该作者
硬件的电平问题不用质疑,低电平0.1V,高电平3.3V,用JLINK仿真,PID存贮器的那一位0、1反应没问题。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

2

主题

3

帖子

0

粉丝