iMX6SX: GPIO_Init() resets IMR of all pins (gpio_imx driver @FreeRTOS)

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

iMX6SX: GPIO_Init() resets IMR of all pins (gpio_imx driver @FreeRTOS)

跳至解决方案
1,228 次查看
kubiznak_petr
Contributor V

I hit on an issue with the gpio_imx driver shipped with the FreeRTOS BSP v1.0.1 (FreeRTOS_BSP_1.0.1_iMX6SX\platform\drivers\src\gpio_imx.c). In the beggining of the GPIO_Init() function, GPIO_IMR and GPIO_EDGE_SEL registers are cleared:

    /* Register reset to default value */
    GPIO_IMR_REG(base) = 0;
    GPIO_EDGE_SEL_REG(base) = 0;

Anyway, the function serves for initialization of a single GPIO pin. When called to reinitialize a pin configuration at runtime, the settings of IMR and EDGE_SEL registers are lost for all pins on that port. I believe this is a bug and the aforementioned code should be masked to only affect a single bit, as follows:

    /* Register reset to default value */
    GPIO_IMR_REG(base) &= ~(1U << pin);
    GPIO_EDGE_SEL_REG(base) &= ~(1U << pin);

Can someone please confirm this is a correct fix? Or would that cause any side effects?

标签 (2)
标记 (3)
0 项奖励
1 解答
1,068 次查看
igorpadykov
NXP Employee
NXP Employee

Hi Petr

fix seems as quite sensible, I do not think it would cause any side effects.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
2 回复数
1,069 次查看
igorpadykov
NXP Employee
NXP Employee

Hi Petr

fix seems as quite sensible, I do not think it would cause any side effects.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
1,068 次查看
kubiznak_petr
Contributor V

Great, thank you Igor.

0 项奖励