cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G030K6T6 execute system memory bootloader, STM32CubeProgrammer connect ok, but can not program

wenbang zheng
Associate III

Hi everyone,

I use a JumpToBootloader( ) function in my code to execute system memory bootloader. and then STM32CubeProgrammer connect ok, but it can not program

MCU:STM32G030K6T6 STM32CubeProgrammer: v2.4.0

Boot Interface: UART1 (PA9 PA10)+MAX13487EESE(RS485 witch AutoDirection Control)

here is JumpToBootloader(void)

static void JumpToBootloader( void )

{

  uint32_t i = 0;

  void ( *SysMemBootJump )( void );  /*declare a function pointer 声明一个函数指针 */

  __IO uint32_t BootAddr = 0x1FFF0000; /* BootLoader address*/

  /*Turn off global interrupts 关闭全局中断 */

  __disable_irq();

  /* Turn off the tick timer, reset to default 关闭滴答定时器,�?�?到默认值 */

  SysTick->CTRL = 0;

  SysTick->LOAD = 0;

  SysTick->VAL = 0;

  /* Set all clocks to default state, use HSI clock 设置所有时钟到默认状�?,使用HSI时钟 */

  HAL_RCC_DeInit();

  /* Disable all interrupts, clear all interrupt pending flags 关闭所有中断,清除所有中断挂起标志 */

  for ( i = 0; i < 1; i++ )

  {

    NVIC->ICER[i] = 0xFFFFFFFF;

    NVIC->ICPR[i] = 0xFFFFFFFF;

  }

  /* Enable global interrupt 使能全局中断 */

  __enable_irq();

   

  /* Jump to the system BootLoader 跳转到系统BootLoader,首地�?�是MSP,地�?�+4是�?�?中断�?务程�?地�?� */

  SysMemBootJump = ( void ( * )( void ) ) ( *( ( uint32_t * ) ( BootAddr + 4 ) ) );

  /* set the main stack pointer 设置主堆栈指针 */

  __set_MSP( *( uint32_t * )BootAddr );

  /* Jump to the system BootLoader 跳转到系统BootLoader */

  SysMemBootJump();

  /* */

  while ( 1 )

  {

  }

}

there is STM32CubeProgrammer log:

0693W00000NsgxZQAR.png0693W00000NsgxeQAB.png0693W00000Nsgy3QAB.png17:12:49 : Disconnected from device.

17:12:50 : Serial Port COM35 is successfully opened.

17:12:50 : Port configuration: parity = even, baudrate = 9600, data-bit = 8, stop-bit = 1.0, flow-control = off

17:12:51 : Timeout error occured while waiting for acknowledgement.

17:12:51 : Activating device: OK

17:12:51 : Chip ID: 0x466 

17:12:51 : BootLoader protocol version: 3.1

17:12:52 : UPLOADING OPTION BYTES DATA ...

17:12:52 : Bank : 0x00

17:12:52 : Address : 0x1fff7800

17:12:52 : Size : 52 Bytes

17:12:52 : Bank : 0x01

17:12:52 : Address : 0x1fff7870

17:12:52 : Size : 4 Bytes

17:12:53 : UPLOADING ...

17:12:53 : Size : 1024 Bytes

17:12:53 : Address : 0x8000000

17:12:53 : Read progress:

17:12:55 : Data read successfully

17:12:55 : Time elapsed during the read operation is: 00:00:02.257

17:13:33 : Memory Programming ...

17:13:33 : Opening and parsing file: SmokeSensorUnit.bin

17:13:33 : File : SmokeSensorUnit.bin

17:13:33 : Size : 28391 Bytes

17:13:33 : Address : 0x08000000 

17:13:33 : Erasing memory corresponding to segment 0:

17:13:33 : Erasing internal memory sectors [0 13]

17:13:33 : Download in Progress:

17:13:35 : Error: Write Command not acknowledged at address 0x8000000

17:13:35 : Error: failed to download Segment[0]

17:13:35 : Error: failed to download the File

17:13:35 : RUNNING Program ... 

17:13:35 : Address: : 0x08000000

17:13:35 : Error: START command not acknowledged!

17:13:35 : Error: Start operation failed

17:13:37 : Timeout error occured while waiting for acknowledgement.

17:13:37 : Error: GETID command not acknowledged!

17:13:37 : Reemission of GetID command

17:13:38 : Error: GETID command not acknowledged!

17:13:38 : Reemission of GetID command

17:13:38 : Error: GETID command not acknowledged!

17:13:39 : Timeout error occured while waiting for acknowledgement.

17:13:39 : Error: GETID command not acknowledged!

17:13:39 : Reemission of GetID command

17:13:40 : Timeout error occured while waiting for acknowledgement.

17:13:40 : Error: GETID command not acknowledged!

17:13:40 : Reemission of GetID command

17:13:41 : Timeout error occured while waiting for acknowledgement.

17:13:41 : Error: GETID command not acknowledged!

17:13:41 : Warning: Connection to device 0x466 is lost

17:13:46 : Disconnected from device.

17:13:46 : ST-LINK error (DEV_USB_COMM_ERR)

2 REPLIES 2
MM..1
Chief III

STM32CubeProgrammer: v2.4.0 very old buggy , try latest.

Hi MM..1 

Thanks for reply, i try STM32CubeProgrammer: v2.10.0(latest version), connect ok , failed to program again.