STM32F103 ports going bad? - Page 1
Forum section: electronics / general

author: strawberry
author_rank: Super Contributor
timestamp: January 08, 2023, 03:12:16 am
content: B3,B4,C13,.. and some other are permanently high or lowfirst board couple years ago worked fine but this one didn't last one weekhighly doubt about ESD

author: Psi
author_rank: Super Contributor
timestamp: January 08, 2023, 03:34:37 am
content: I would suspect latchup damaging the pins.Does your circuit receive any voltages from external sources on I/O pins and are those protected so they cant exceed the MCU vcc rail?

author: PCB.Wiz
author_rank: Super Contributor
timestamp: January 08, 2023, 04:44:21 am
content: Quote from: strawberry on January 08, 2023, 03:12:16 amWhat connects to those pins ?If you check the strength of high or low, what drive resistance do you get ?

author: ozcar
author_rank: Frequent Contributor
timestamp: January 08, 2023, 05:10:55 am
content: Quote from: PCB.Wiz on January 08, 2023, 04:44:21 amPB3 and PB4 are 5V tolerant, PC13 is not, and PC13 also has lower drive strength.

author: strawberry
author_rank: Super Contributor
timestamp: January 08, 2023, 11:21:35 am
content: 3.3VLCD connected to B3,B4default button to C13 (100n + pullup 4.7k)MODE=0 CNF=1 ODR=0 IDR=0 (can pulll up with 47R IDR = 1)

author: Psi
author_rank: Super Contributor
timestamp: January 08, 2023, 11:45:32 am
content: Quote from: strawberry on January 08, 2023, 11:21:35 amDoes the LCD have its own boost circuit that produces a higher voltage to run a backlight or led array?

author: wek
author_rank: Frequent Contributor
timestamp: January 08, 2023, 12:14:28 pm
content: Quote from: strawberry on January 08, 2023, 11:21:35 amC13 means PC13? It's always better to use the same terminology as the manufacturer so that we don't need to guess.Quote from: strawberry on January 08, 2023, 11:21:35 amThen it's most likely damaged input.Is this a genuine STM32F103 bought from a reputable source?JW

author: strawberry
author_rank: Super Contributor
timestamp: January 08, 2023, 12:49:18 pm
content: 5V to 3.3V LDO, no switching PSU, both LCD and MCU on 3.3Vif LCD caused damage to stm32, but LCD works as I can tellPB3 ,PB4 could be damaged during shipping??another weird bug is when clearing display but instead it do LCD software reset( but can draw black pixels without any problem??)Maybe CubeIDE is optimizing/generating wrong codePC13 is reading input state correctlyfrom Mouser from eu stock

author: wek
author_rank: Frequent Contributor
timestamp: January 08, 2023, 03:40:03 pm
content: > PC13 is reading input state correctlyOK so the problem is only with PB3 and PB4?If you disconnect then from the LCD, still problem?How are the GPIOB registers set?JW

author: DavidAlfa
author_rank: Super Contributor
timestamp: January 08, 2023, 05:56:24 pm
content: Unlikely, better show your code.

author: strawberry
author_rank: Super Contributor
timestamp: January 08, 2023, 07:28:09 pm
content: 47R can pull PC13 high to trigger interrupt. too low impedance for input portCode:static void MX_GPIO_Init(void){GPIO_InitTypeDef GPIO_InitStruct = {0};/* GPIO Ports Clock Enable */__HAL_RCC_GPIOC_CLK_ENABLE();__HAL_RCC_GPIOD_CLK_ENABLE();__HAL_RCC_GPIOA_CLK_ENABLE();__HAL_RCC_GPIOB_CLK_ENABLE();/*Configure GPIO pin Output Level */HAL_GPIO_WritePin(GPIOC, RST_Pin|CS_Pin|GPIO_PIN_11|GPIO_PIN_12, GPIO_PIN_RESET);/*Configure GPIO pin Output Level */HAL_GPIO_WritePin(GPIOA, RD_Pin|WR_Pin|DC_Pin|LD2_Pin, GPIO_PIN_RESET);/*Configure GPIO pin Output Level */HAL_GPIO_WritePin(GPIOB, D0_Pin|D1_Pin|D2_Pin|D10_Pin|D11_Pin|D12_Pin|D13_Pin|D14_Pin|D15_Pin|D5_Pin|D6_Pin|D7_Pin|D8_Pin|D9_Pin, GPIO_PIN_RESET);/*Configure GPIO pin : BTN_Pin */GPIO_InitStruct.Pin = BTN_Pin;GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;GPIO_InitStruct.Pull = GPIO_NOPULL;HAL_GPIO_Init(BTN_GPIO_Port, &GPIO_InitStruct);/*Configure GPIO pins : RST_Pin CS_Pin PC11 PC12 */GPIO_InitStruct.Pin = RST_Pin|CS_Pin|GPIO_PIN_11|GPIO_PIN_12;GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;GPIO_InitStruct.Pull = GPIO_NOPULL;GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);/*Configure GPIO pins : RD_Pin WR_Pin DC_Pin LD2_Pin */GPIO_InitStruct.Pin = RD_Pin|WR_Pin|DC_Pin|LD2_Pin;GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;GPIO_InitStruct.Pull = GPIO_NOPULL;GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);/*Configure GPIO pins : D0_Pin D1_Pin D2_Pin D10_PinD11_Pin D12_Pin D13_Pin D14_PinD15_Pin D5_Pin D6_Pin D7_PinD8_Pin D9_Pin */GPIO_InitStruct.Pin = D0_Pin|D1_Pin|D2_Pin|D10_Pin|D11_Pin|D12_Pin|D13_Pin|D14_Pin|D15_Pin|D5_Pin|D6_Pin|D7_Pin|D8_Pin|D9_Pin;GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;GPIO_InitStruct.Pull = GPIO_NOPULL;GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);/* EXTI interrupt init*/HAL_NVIC_SetPriority(EXTI15_10_IRQn, 5, 0);HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);}/* USER CODE BEGIN 4 */void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {if (GPIO_Pin == GPIO_PIN_13) {menu++;if (menu == 12) {menu = 0;}} else {__NOP();})

author: DavidAlfa
author_rank: Super Contributor
timestamp: January 08, 2023, 07:52:58 pm
content: Is it a blue pill? If so, board button is PA1, PC13 is the led.If it's working with other boards, try resoldering the stm32 (Maybe there's some junk between the pins?), but seems like the STM32 is bad.