2018-12-25 10:16 PM
Hi,
I would like to control a GPS module reset pin thru STM32L152. The reference circuit of the GPS module reset pin as per attached picture. According to the GPS data sheet, the reset pin "Only drive with open collector, no external voltage to be applied".
How should I configure my GPIO connected to the reset pin? I tried this but it doesn't seem to work:
// GPIO initialisation
GPIO_InitTypeDef GPIO_InitStruct;
// Enable clock for GPIOC
__HAL_RCC_GPIOC_CLK_ENABLE();
// Initialise watchdog pin
GPIO_InitStruct.Pin = GPS_RESET_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
HAL_GPIO_WritePin(GPIOC, GPS_RESET_PIN, GPIO_PIN_SET);
HAL_Delay(100);
HAL_GPIO_WritePin(GPIOC, GPS_RESET_PIN, GPIO_PIN_RESET);
HAL_Delay(100);
Thank you very much!
Solved! Go to Solution.
2018-12-26 10:19 PM
Thank you everyone! I have sorted it out. I just need to keep it low for a longer period to reset the GPS module. Thanks once again.
2018-12-25 11:42 PM
I actually connect the GPIO pin of STM32 directly to the reset pin of GPS module.
2018-12-25 11:44 PM
If it doesn't have internal pull-up you may want to use GPIO_PULLUP instead of GPIO_NOPULL. Do it on your own risk though, also I don't think it can do any harm even if I'm wrong.
2018-12-26 12:21 AM
Thanks for the suggestion. I tried using GPIO_PULLUP but it doesn't seem to work also.
Should I use GPIO_MODE_OUTPUT_OD or GPIO_MODE_OUTPUT_PP?
Thanks!
2018-12-26 01:23 AM
> Only drive with open collector
You are right to set it to GPIO_MODE_OUTPUT_OD (OD == open drain == open collector).
2018-12-26 04:55 AM
Likely expects the pin to be pulsed low briefly. If you keep it low it will stay in reset. I'd look at the data sheet but you fail to provide a cite.
Check level on pin, confirm it has a pull-up.
2018-12-26 10:19 PM
Thank you everyone! I have sorted it out. I just need to keep it low for a longer period to reset the GPS module. Thanks once again.