AnsweredAssumed Answered

STM32F072CBT6 Reset

Question asked by fischer.patrick on Apr 17, 2015
Hi there

I designed a print with a STM32F072CBT6 and connect with a Discovery Board.
First I designed the software on the Discovery Board. After that, i want to test the connection to the CBT6. My Code works fine on the first try but after disconnect, the mcu starts itself after 5ms, repeating itself and i cant connect with to stop an reprogram it. Is there a way to force the chip to reset/flash the rom?

My IDE is the free version of Keil
My Startup Code:

/* Includes ------------------------------------------------------------------*/
#include "stm32f0xx_hal.h"

/* USER CODE BEGIN Includes */
/* USER CODE END Includes */

/* Private variables ---------------------------------------------------------*/
UART_HandleTypeDef huart1;
DMA_HandleTypeDef hdma_usart1_rx;
DMA_HandleTypeDef hdma_usart1_tx;

/* USER CODE BEGIN PV */
/* USER CODE END PV */

/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_DMA_Init(void);
static void MX_USART1_UART_Init(void);

/* USER CODE BEGIN PFP */
/* USER CODE END PFP */

/* USER CODE BEGIN 0 */
/* USER CODE END 0 */

int main(void)
{
  /* USER CODE BEGIN 1 */
    uint8_t aTransmitBuffer[3];
    aTransmitBuffer[0]=0x55;
    aTransmitBuffer[1]=0xFF;
    aTransmitBuffer[2]=0x32;
  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_DMA_Init();
  MX_USART1_UART_Init();

  /* USER CODE BEGIN 2 */
  HAL_GPIO_WritePin(GPIOB, GPIO_PIN_6, GPIO_PIN_SET);
  HAL_UART_Transmit_DMA(&huart1, &aTransmitBuffer[0], 3);
  /* USER CODE END 2 */

  /* USER CODE BEGIN 3 */
  /* Infinite loop */
  while (1)
  {

  }
  /* USER CODE END 3 */
}

Outcomes