Skip to main content
pietro2
Associate III
September 28, 2012
Question

USART2 / BOOT problem

  • September 28, 2012
  • 4 replies
  • 728 views
Posted on September 28, 2012 at 14:13

Hi! I'm working with a STM32F0-Discovery board + IAR IDE

After loading this code

...

 void USART_Configuration(void)

  

  /* Abilita clock GPIOA e DMA  */

  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA , ENABLE);

  

  /* Abilita clock USART2 APB  */

  RCC_APB2PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);

  

  /* configurazione pin USART2   **************************************************/

 // GPIO_DeInit(GPIOA);

  

  /* Connette i pin PA14 e PA15 alla periferica USATR */

  GPIO_PinAFConfig(GPIOA, GPIO_PinSource14, GPIO_AF_1);    

  GPIO_PinAFConfig(GPIOA, GPIO_PinSource15, GPIO_AF_1); 

  

  /* Configura i pin come AF pushpull */

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14 | GPIO_Pin_15 ;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_Level_2;

  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;

  GPIO_Init(GPIOA, &GPIO_InitStructure); 

  

  /* Configurazione USART2:

  - BaudRate = 115200 baud  

  - Word Length = 8 Bits

  - Stop Bit = 1 Stop Bit

  - Parity = No Parity

  - Hardware flow control disabled (RTS and CTS signals)

  - Receive and transmit enabled

  */

  

  USART_DeInit(USART2);

  USART_InitStructure.USART_BaudRate = 115200;

  USART_InitStructure.USART_WordLength = USART_WordLength_8b;

  USART_InitStructure.USART_StopBits = USART_StopBits_1;

  USART_InitStructure.USART_Parity = USART_Parity_No;

  USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;

  USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

  USART_Init(USART2, &USART_InitStructure);

  USART_Cmd(USART2, ENABLE); 

}

...

the board works wrong, because i can't program anymore the board.

when i try a programming/bebugging session, i receive the seguent message

''Fatal error: ST LINK, No MCU device found.''

It' possible to restore the board?

#usart2-/-boot-problem
This topic has been closed for replies.

4 replies

Tesla DeLorean
Guru
September 28, 2012
Posted on September 28, 2012 at 20:09

Because  PA14 is SWCLK, part of the debug interface

Pull the BOOT0 pin high, and restart the device, it will go into the system loader instead of your code, then erase your code.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
pietro2
pietro2Author
Associate III
October 1, 2012
Posted on October 01, 2012 at 09:39

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6lr&d=%2Fa%2F0X0000000buz%2Feoxhu2AUDOaAo6XO3BNFejLSprz1t7iOMJRANo3ZQQs&asPdf=false
Tesla DeLorean
Guru
October 1, 2012
Posted on October 01, 2012 at 13:33

RCC_APB2PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE); //??

APB1 surely
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
pietro2
pietro2Author
Associate III
October 1, 2012
Posted on October 01, 2012 at 13:57

Great! Works, thank you clive1