cancel
Showing results for 
Search instead for 
Did you mean: 

Is there actually any working solution to flash external SDRam in USB Mode?

Exit0815
Senior

Hello,

after reading a lot i am still confused.

I am looking for a solution to flash the internal and the external memory of an STM32F4 (for testing i am using the F469 Discovery Board).

There is no problem using the ST-Link on-board, but what about a solution for a mass-production board where no ST-Link is assembled and maybe the end-user needs to do an update?

Well, i am using this code to enter the bootloader for USB:

void goToBootloader(void)
{
	HAL_RCC_DeInit();
	SysTick->CTRL = SysTick->LOAD = SysTick->VAL = 0;
	__HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH();
 
	const uint32_t p = (*((uint32_t *) 0x1FFF0000));
	__set_MSP( p );
 
	void (*SysMemBootJump)(void);
	SysMemBootJump = (void (*)(void)) (*((uint32_t *) 0x1FFF0004));
	SysMemBootJump();
 
	while( 1 ) {}
}

So far so good, i can connect to the device with the CubeProgrammer.

And it seems that i can flash the internal memory but then failed at 0x9000000

  11:57:01 : USB speed   : Full Speed (12MBit/s)
  11:57:01 : Manuf. ID   : STMicroelectronics
  11:57:01 : Product ID  : STM32  BOOTLOADER
  11:57:01 : SN          : 336E335E3538
  11:57:01 : DFU protocol: 1.1
  11:57:01 : Board       : --
  11:57:01 : Device ID   : 0x0434
  11:57:01 : UPLOADING OPTION BYTES DATA ...
  11:57:01 :   Bank          : 0x00
  11:57:01 :   Address       : 0x1fffc000
  11:57:01 :   Size          : 16 Bytes
  11:57:01 :   Bank          : 0x01
  11:57:01 :   Address       : 0x1ffec008
  11:57:01 :   Size          : 4 Bytes
  11:57:01 : UPLOADING ...
  11:57:01 :   Size          : 2097152 Bytes
  11:57:01 :   Address       : 0x8000000
  11:57:01 : Read progress:
  11:57:04 : Data read successfully
  11:57:04 : Time elapsed during the read operation is: 00:00:03.465
  11:57:16 : Memory Programming ...
  11:57:16 : Opening and parsing file: STM32F469I-DISCO.hex
  11:57:16 :   File          : STM32F469I-DISCO.hex
  11:57:16 :   Size          : 9.63 MB 
  11:57:16 :   Address       : 0x08000000 
  11:57:16 : Erasing memory corresponding to segment 0:
  11:57:16 : Erasing internal memory sectors [0 6]
  11:57:16 : erasing sector 0000 @: 0x08000000 done
  11:57:16 : erasing sector 0001 @: 0x08004000 done
  11:57:17 : erasing sector 0002 @: 0x08008000 done
  11:57:17 : erasing sector 0003 @: 0x0800c000 done
  11:57:18 : erasing sector 0004 @: 0x08010000 done
  11:57:20 : erasing sector 0005 @: 0x08020000 done
  11:57:22 : erasing sector 0006 @: 0x08040000 done
  11:57:22 : Erasing memory corresponding to segment 1:
  11:57:22 : Not flash Memory : No erase done
  11:57:22 : Download in Progress:
  11:57:29 : Error: failed to download Segment[1]
  11:57:29 : Error: failed to download the File
  11:57:29 : RUNNING Program ... 
  11:57:29 :   Address:      : 0x08000000
  11:57:29 : Start operation achieved successfully
  11:57:29 : Warning: Connection to device 0x434 is lost
  11:57:29 : Disconnected from device.

I checked the External Loader for the 469-Disco Board.

A bit more detailed Log:

  11:59:36:170 : downloading data
  11:59:36:204 : Segment[0] downloaded successfully
  11:59:36:204 :   Size          : 9784556 Bytes
  11:59:36:204 :   Address       : 0x90000000 
  11:59:36:205 : setting the address pointer to address: 0x90000000
  11:59:36:732 : received memory address is wrong or unsupported
  11:59:36:732 : Error: failed to download Segment[1]
  11:59:36:733 : Error: failed to download the File
  11:59:36:752 : RUNNING Program ... 
  11:59:36:752 :   Address:      : 0x08000000
  11:59:36:752 : sending a clear status request
  11:59:36:753 : setting the address pointer to address: 0x08000000
  11:59:36:753 : sending a dfu end of download request
  11:59:36:753 : Start operation achieved successfully
  11:59:36:784 : Warning: Connection to device 0x434 is lost
  11:59:37:032 : Disconnected from device.

I hope someone can help me.

Thanks.

4 REPLIES 4
MM..1
Chief III

Correct your subject flash external SDRam is mistake, Ram is simply erased on reboot.

And if you mean QSPI flash system DFU i mean dont suppoert flash externall. But you can write own bootloader for this or can use multi sequence load app 1 2 3 with code for QSPI and last 4 code app...

Exit0815
Senior

Thank you.

Unfortunately i can not edit my post / subject.

Important is that it would be possible. Somehow by using the USB-Connection (DFU).

Do I understand correctly that you can overflash the bootloader that starts DFU mode?

I don't quite understand the other way. multi sequence load app 1 2 3, that means that i program the internal Flash which contains a program part to activate (routing) data to the qspi sdram?

That means, a custom programmer, first is to upload an app 1 which will then start a function to get access to the qspi, right? Next step is to upload the new data to the qspi sdram?

MM..1
Chief III

System bootloader cant be overflash, but you can place own bootloader in normal FLASH read about ISP.

And 1 2 3 method is based on size for write to external , for example you need write 9M maybe use compression 5M and internal flash is 2M then app 1 load part 1 and write unpack to QSPI on end jump back to DFU usw

2 contiues 3 ... Here you use normal system DFU and dont need write own bootloader...

>>qspi sdram

You keep using this, the part is a QSPI NOR Flash

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..