Author Topic: STM32F103 ports going bad?  (Read 1239 times)

0 Members and 2 Guests are viewing this topic.

Offline strawberryTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 1199
  • Country: lv
STM32F103 ports going bad?
« on: January 08, 2023, 03:12:16 am »
B3,B4,C13,.. and some other are permanently high or low
first board couple years ago worked fine but this one didn't last one week
highly doubt about ESD
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10154
  • Country: nz
Re: STM32F103 ports going bad?
« Reply #1 on: January 08, 2023, 03:34:37 am »
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?
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1738
  • Country: au
Re: STM32F103 ports going bad?
« Reply #2 on: January 08, 2023, 04:44:21 am »
B3,B4,C13,.. and some other are permanently high or low
first board couple years ago worked fine but this one didn't last one week
What connects to those pins ?
If you check the strength of high or low, what drive resistance do you get ?
 

Offline ozcar

  • Frequent Contributor
  • **
  • Posts: 331
  • Country: au
Re: STM32F103 ports going bad?
« Reply #3 on: January 08, 2023, 05:10:55 am »
B3,B4,C13,.. and some other are permanently high or low
first board couple years ago worked fine but this one didn't last one week
What connects to those pins ?
If you check the strength of high or low, what drive resistance do you get ?

PB3 and PB4 are 5V tolerant, PC13 is not, and PC13 also has lower drive strength.
 

Offline strawberryTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 1199
  • Country: lv
Re: STM32F103 ports going bad?
« Reply #4 on: January 08, 2023, 11:21:35 am »
3.3V
LCD connected to B3,B4
default button to C13 (100n + pullup 4.7k)
MODE=0 CNF=1 ODR=0 IDR=0 (can pulll up with 47R IDR = 1)
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10154
  • Country: nz
Re: STM32F103 ports going bad?
« Reply #5 on: January 08, 2023, 11:45:32 am »
LCD connected to B3,B4

Does the LCD have its own boost circuit that produces a higher voltage to run a backlight or led array?
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline wek

  • Frequent Contributor
  • **
  • Posts: 522
  • Country: sk
Re: STM32F103 ports going bad?
« Reply #6 on: January 08, 2023, 12:14:28 pm »
default button to C13 (100n + pullup 4.7k)
C13 means PC13? It's always better to use the same terminology as the manufacturer so that we don't need to guess.
MODE=0 CNF=1 ODR=0 IDR=0 (can pulll up with 47R IDR = 1)
Then it's most likely damaged input.

Is this a genuine STM32F103 bought from a reputable source?

JW
 

Offline strawberryTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 1199
  • Country: lv
Re: STM32F103 ports going bad?
« Reply #7 on: January 08, 2023, 12:49:18 pm »
5V to 3.3V LDO, no switching PSU, both LCD and MCU on 3.3V
if LCD caused damage to stm32, but LCD works as I can tell
PB3 ,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 code
PC13 is reading input state correctly
from Mouser from eu stock
 

Offline wek

  • Frequent Contributor
  • **
  • Posts: 522
  • Country: sk
Re: STM32F103 ports going bad?
« Reply #8 on: January 08, 2023, 03:40:03 pm »
> PC13 is reading input state correctly

OK 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
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6145
  • Country: es
Re: STM32F103 ports going bad?
« Reply #9 on: January 08, 2023, 05:56:24 pm »
Unlikely, better show your code.
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline strawberryTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 1199
  • Country: lv
Re: STM32F103 ports going bad?
« Reply #10 on: January 08, 2023, 07:28:09 pm »
47R can pull PC13 high to trigger interrupt. too low impedance for input port
Code: [Select]
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_Pin
                           D11_Pin D12_Pin D13_Pin D14_Pin
                           D15_Pin D5_Pin D6_Pin D7_Pin
                           D8_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();
}
)
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6145
  • Country: es
Re: STM32F103 ports going bad?
« Reply #11 on: January 08, 2023, 07:52:58 pm »
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.
« Last Edit: January 08, 2023, 08:16:24 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf