I am building a board based around an STM32L051C6 microcontroller, which will measure a hall effect sensor (AH3362Q) and count the time in between the edges the sensor sees. The sensor is powered from 12V, and the MCU is powered by a 3.3V switching regulator (ROF-78E3.3-0.5SMD-R) which is powered from the same 12V. The sensor's output, being open-drain, is connected directly to the GPIO of the MCU, which is configured with internal pull-up.
I powered up the board without the sensor plugged in, and everything (minus the sensor functionality of course) worked fine. Then I powered the board off, connected the sensor, powered it back on, and observed that the chip began to heat up drastically. The chip is now dead, even when the sensor is unplugged.
My question is: what could be causing the MCU to die when the sensor is plugged in, given that its output is open-drain and shouldn't be driving the MCU pin at high voltage? Originally, in STCubeMX, I noticed that the GPIO mode of the timer pin the sensor is connected to was configured to "Alternate function push-pull" rather than the only other option of "Alternate function open drain". However, since the timer is being used in input mode, shouldn't these options should be irrelevant?
edit: Code used to configure GPIO, generated by STM32CubeMX:
GPIO_InitStruct.Pin = MOTOR_SENSE_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; // This was GPIO_MODE_AF_PP in push-pull mode GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Alternate = GPIO_AF2_TIM2; HAL_GPIO_Init(MOTOR_SENSE_GPIO_Port, &GPIO_InitStruct);