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?
Solved! Go to Solution.
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!
-----------------------------------------------------------------------------------------------------------------------
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!
-----------------------------------------------------------------------------------------------------------------------
Great, thank you Igor.