2024-06-24 11:46 AM - edited 2024-06-24 11:58 AM
Hello all,
I'm working on a custom PCB using the L072RZT6. I want to convert pins PB6 & PB7 from an I2C assignment to GPIO_EXTI during run time. Is that possible with HAL_I2C_DeInit?
Currently, the board goes through the pre-generated startup process (such as HAL_Init, ClockConfig, etc, etc) then, if the board detects it needs to make the change, I call a function where HAL_I2C_DeInit is used, as well as HAL_GPIO_DeInit using GPIOB and the macros for pins 6 & 7. Then, I re-initialize the pins as GPIO and set the struct to use the EXTI. Unfortunately this is not working and I am also having issues with the debugger. I'm hoping to see if I can get my question answered while I work out what's going on with the debugger.
Specifically, inputs 6 & 7 are not triggering the HAL_GPIO_EXTI_Callback function, unlike the un-changed pins. I've confirmed the remaining GPIOB pins do trigger the interrupt and enter the call back using print statements.
Up to this point I had successful testing with default GPIO_EXTI configurations and the I2C individually, but due to some redesign I want to make the pins dynamically assigned like I described above. Thanks for any feedback.
2024-06-25 12:54 AM
After configuring the GPIO as input, check if gpio read works for both high and low inputs. Later you can enable the interrupt. But be careful not to configure as output and connect to vcc or ground directly, use some resistance to current .