No, but I retried and again there was no difference. The first attempt fails, the second one works, the next one fails and so on…
So in consequence one can upload firmware under these circumstances.
I’ve done some more tests with --connect-under-reset
instead of --reset
. The result is interesting:
After plugging in the programmer, the first attempt fails:
2021-03-21T11:22:29 INFO common.c: Attempting to write 3520 (0xdc0) bytes to stm32 address: 134217728 (0x8000000)
2021-03-21T11:22:29 INFO common.c: Flash page at addr: 0x08000000 erased
2021-03-21T11:22:29 INFO common.c: Flash page at addr: 0x08000400 erased
2021-03-21T11:22:29 INFO common.c: Flash page at addr: 0x08000800 erased
2021-03-21T11:22:29 INFO common.c: Flash page at addr: 0x08000c00 erased
2021-03-21T11:22:29 INFO common.c: Finished erasing 4 pages of 1024 (0x400) bytes
2021-03-21T11:22:29 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL
2021-03-21T11:22:29 INFO flash_loader.c: Successfully loaded flash loader in sram
2021-03-21T11:22:30 ERROR flash_loader.c: Flash loader run error (R2 0x00000000 R15 0x00000000 DHCSR 0x01090001 DFSR 0x00000001)
2021-03-21T11:22:30 ERROR common.c: stlink_flash_loader_run(0x8000000) failed! == -1
2021-03-21T11:22:30 INFO common.c: Go to Thumb mode
stlink_fwrite_flash() == -1
but all following attempts succeed:
2021-03-21T11:26:52 INFO common.c: Attempting to write 3520 (0xdc0) bytes to stm32 address: 134217728 (0x8000000)
2021-03-21T11:26:52 INFO common.c: Flash page at addr: 0x08000000 erased
2021-03-21T11:26:52 INFO common.c: Flash page at addr: 0x08000400 erased
2021-03-21T11:26:52 INFO common.c: Flash page at addr: 0x08000800 erased
2021-03-21T11:26:52 INFO common.c: Flash page at addr: 0x08000c00 erased
2021-03-21T11:26:52 INFO common.c: Finished erasing 4 pages of 1024 (0x400) bytes
2021-03-21T11:26:52 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL
2021-03-21T11:26:52 INFO flash_loader.c: Successfully loaded flash loader in sram
4/ 4 pages written
2021-03-21T11:26:52 INFO common.c: Starting verification of write complete
2021-03-21T11:26:52 INFO common.c: Flash written and verified! jolly good!
-
tsulis
- Posts: 3
- Joined: Sat Dec 04, 2021 12:09 pm
-
Answers: 1
Arduino IDE STM32 F411CE Write failed at address: 0x8000000
Hi,
I am new to STM32, recently i purchased STM32F411CE (BlackPill), at once i was able to program from Arduino IDE but later i stuck with no luck : Write failed at address: 0x8000000.
my machine is macOS bigSur (11.5.2), Arduino IDE 1.8.16 and Arduino Board Manager STMicroelectronics 2.1.0. Upload code via USB cable.
(entering DFU Mode by pressing BOOT0 (hold) then NRST (press-release) then release BOOT0)
Arduino IDE Config:
via USB : CDC(generic ‘Serial’ supersede U(S)ART
upload method : STM32CubeProgrammer DFU
Perhaps any tips and tricks?
——————————————————————-
STM32CubeProgrammer v2.9.0
——————————————————————-USB speed : Full Speed (12MBit/s)
Manuf. ID : STMicroelectronics
Product ID : STM32 BOOTLOADER
SN : 366E355E3036
FW version : 0x011a
Board : —
Device ID : 0x0431
Device name : STM32F411xC/E
Flash size : 512 KBytes (default)
Device type : MCU
Revision ID : —
Device CPU : Cortex-M4Memory Programming …
Opening and parsing file: Blink.ino.bin
File : Blink.ino.bin
Size : 23948 Bytes
Address : 0x08000000Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 1]
erasing sector 0000 @: 0x08000000 done
erasing sector 0001 @: 0x08004000 done
Download in Progress:
Error:
Write failed at address: 0x8000000Error: failed to download Segment[0]
Error: failed to download the FileRUNNING Program …
Address: : 0x8000000
Start operation achieved successfully
Thank you.
by tsulis » Sat Dec 04, 2021 5:48 pm
tsulis wrote: ↑Sat Dec 04, 2021 12:35 pm
Hi,I am new to STM32, recently i purchased STM32F411CE (BlackPill), at once i was able to program from Arduino IDE but later i stuck with no luck : Write failed at address: 0x8000000.
my machine is macOS bigSur (11.5.2), Arduino IDE 1.8.16 and Arduino Board Manager STMicroelectronics 2.1.0. Upload code via USB cable.
(entering DFU Mode by pressing BOOT0 (hold) then NRST (press-release) then release BOOT0)
Arduino IDE Config:
via USB : CDC(generic ‘Serial’ supersede U(S)ART
upload method : STM32CubeProgrammer DFUPerhaps any tips and tricks?
——————————————————————-
STM32CubeProgrammer v2.9.0
——————————————————————-USB speed : Full Speed (12MBit/s)
Manuf. ID : STMicroelectronics
Product ID : STM32 BOOTLOADER
SN : 366E355E3036
FW version : 0x011a
Board : —
Device ID : 0x0431
Device name : STM32F411xC/E
Flash size : 512 KBytes (default)
Device type : MCU
Revision ID : —
Device CPU : Cortex-M4Memory Programming …
Opening and parsing file: Blink.ino.bin
File : Blink.ino.bin
Size : 23948 Bytes
Address : 0x08000000Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 1]
erasing sector 0000 @: 0x08000000 done
erasing sector 0001 @: 0x08004000 done
Download in Progress:
Error:
Write failed at address: 0x8000000Error: failed to download Segment[0]
Error: failed to download the FileRUNNING Program …
Address: : 0x8000000
Start operation achieved successfullyThank you.
SOLVED!
strange happens with native USB C cable. My blackpill usb is USB C connector. When i use native USB C cable then all this errors happened, but when i use Micro USB cable with little converter from micro usb to USB C, i can upload code as it should.
Go to full post
-
ag123
- Posts: 1428
- Joined: Thu Dec 19, 2019 5:30 am
-
Answers: 19
Re: Arduino IDE STM32 F411CE Write failed at address: 0x8000000
Post
by ag123 » Sat Dec 04, 2021 4:23 pm
try using the built-in DFU bootloader.
the finger dance is:
1 — press both reset and boot0
2 — *hold* boot0, but release reset
3 — release boot0 1 sec later
normally the OS would have some logs that a DFU device is connected, that’d hint on the correct procedure.
then use stm32cube programmer etc to install the sketch/firmware (using dfu mode)
in arduino ide normally there is option to sketch > export compiled binary, and the binary should be found in your sketch folder.
but if stm32cube programmer works, it’d likely just work from within arduino ide, save an extra ‘manual’ step
edit:
there is something ‘strange’, it seemed you have a h/w failure, not common.
you may want to try with a different device if you have one handy
the other things to find out is things like the flash is write protected. this seemed unlikely as the erase succeeded
if indeed it is write protected, you may need to resort to an st-link v2 and there is this thing about ‘connect under reset’
there are also stories here about unstable clocks for usb, which cause dfu to fail to connect. but it didn’t seem likely as the erase part succeeded.
-
tsulis
- Posts: 3
- Joined: Sat Dec 04, 2021 12:09 pm
-
Answers: 1
Re: Arduino IDE STM32 F411CE Write failed at address: 0x8000000
Post
by tsulis » Sat Dec 04, 2021 5:18 pm
ag123 wrote: ↑Sat Dec 04, 2021 4:23 pm
try using the built-in DFU bootloader.
the finger dance is:1 — press both reset and boot0
2 — *hold* boot0, but release reset
3 — release boot0 1 sec later
normally the OS would have some logs that a DFU device is connected, that’d hint on the correct procedure.then use stm32cube programmer etc to install the sketch/firmware (using dfu mode)
in arduino ide normally there is option to sketch > export compiled binary, and the binary should be found in your sketch folder.
but if stm32cube programmer works, it’d likely just work from within arduino ide, save an extra ‘manual’ stepedit:
there is something ‘strange’, it seemed you have a h/w failure, not common.
you may want to try with a different device if you have one handythe other things to find out is things like the flash is write protected. this seemed unlikely as the erase succeeded
if indeed it is write protected, you may need to resort to an st-link v2 and there is this thing about ‘connect under reset’there are also stories here about unstable clocks for usb, which cause dfu to fail to connect. but it didn’t seem likely as the erase part succeeded.
Hi ag123,
i try your suggestions on finger dance but still an error show up
Write failed at address: 0x8001000
another one is
Write failed at address: 0x8000800
is there any time-sensitive on how long to press the buttons? because i do test on both with different time-release interval. errors are different code.
-
tsulis
- Posts: 3
- Joined: Sat Dec 04, 2021 12:09 pm
-
Answers: 1
Re: Arduino IDE STM32 F411CE Write failed at address: 0x8000000
Post
by tsulis » Sat Dec 04, 2021 5:48 pm
tsulis wrote: ↑Sat Dec 04, 2021 12:35 pm
Hi,I am new to STM32, recently i purchased STM32F411CE (BlackPill), at once i was able to program from Arduino IDE but later i stuck with no luck : Write failed at address: 0x8000000.
my machine is macOS bigSur (11.5.2), Arduino IDE 1.8.16 and Arduino Board Manager STMicroelectronics 2.1.0. Upload code via USB cable.
(entering DFU Mode by pressing BOOT0 (hold) then NRST (press-release) then release BOOT0)
Arduino IDE Config:
via USB : CDC(generic ‘Serial’ supersede U(S)ART
upload method : STM32CubeProgrammer DFUPerhaps any tips and tricks?
——————————————————————-
STM32CubeProgrammer v2.9.0
——————————————————————-USB speed : Full Speed (12MBit/s)
Manuf. ID : STMicroelectronics
Product ID : STM32 BOOTLOADER
SN : 366E355E3036
FW version : 0x011a
Board : —
Device ID : 0x0431
Device name : STM32F411xC/E
Flash size : 512 KBytes (default)
Device type : MCU
Revision ID : —
Device CPU : Cortex-M4Memory Programming …
Opening and parsing file: Blink.ino.bin
File : Blink.ino.bin
Size : 23948 Bytes
Address : 0x08000000Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 1]
erasing sector 0000 @: 0x08000000 done
erasing sector 0001 @: 0x08004000 done
Download in Progress:
Error:
Write failed at address: 0x8000000Error: failed to download Segment[0]
Error: failed to download the FileRUNNING Program …
Address: : 0x8000000
Start operation achieved successfullyThank you.
SOLVED!
strange happens with native USB C cable. My blackpill usb is USB C connector. When i use native USB C cable then all this errors happened, but when i use Micro USB cable with little converter from micro usb to USB C, i can upload code as it should.
Столкнулся с проблемой при попытке использовать класс DFU USB устройств для обновления прошивки моего устройства через USB. Использую STM32DISCOVERY с контроллером stm32l152rb.
Реализацию DFU взял из примера STM. Не заработала. Обнаруживалась через DfuSe Dimo (v 3.03), стирала память, но наглухо зависала при попытке загрузить прошивку.
Тогда я немного изменил свою программу согласно STM32T15xx6/6/B Errata sheet:
The Ftosh memory can return a corrupted data following a programming of the Ftosh itself
or the EEPROM area omd possybly couse a hard fault exception due to undefined
instruction.
The behavior depends on the location of the routine which is ixicuting the programming. It
occurs only when IAP is ixicuted from the upper part of memory (0x08000000 to
0x0800 FFFF).
The issue can occur when the boottooder is used.
Workaround
There are two possyble workarounds
1. 1. The IAP routines must be located in the bottom part of the memory (0x08010000 to
0x0801 FFFF).
Т.е. DFU реализацию я перенёс в память начиная с адреса 0x0801 0000 (вместе с таблицей прерываний — функцией NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x10000) ), а осн. программу я разместил по адресам начиная с 0x0800 0000 и сделал в таком виде:
Код
#define BOOTLOADER_ADDRESS (0x08010000) uint32_t Temp; //config usir button PA0 Temp = RCC->AHBENR; RCC->AHBENR = ( Temp | (1<<BUTTON_PORT_CLK) ); Temp = GPIOA->MODER; GPIOA->MODER = Temp & ( ~(uint32_t)(1<<BUTTON_PIN) ); if ( !( GPIOA->IDR & (uint32_t)(1<<BUTTON_PIN) ) ) { //if button not pressed, jump to boottooder JumpAddress = *(__IO uint32_t*) (BOOTLOADER_ADDRESS + 4); Jump_To_Application = (pFunction) JumpAddress; // Initiotyze usir applications Stack Pointer __set_MSP(*(__IO uint32_t*) BOOTLOADER_ADDRESS); Jump_To_Application(); } Clks_Init(); Temp = RCC->AHBENR; RCC->AHBENR = ( Temp | (1<<LED_PORT_CLK) ); Temp = GPIOB->MODER; GPIOB->MODER = ( Temp | (1<< ( LED_BLUE_PIN * 2)) ); Temp = GPIOB->ODR; GPIOB->ODR = (Temp | (1<< LED_BLUE_PIN) ); while (1) { GPIOB->ODR ^= (uint32_t)(1<< LED_BLUE_PIN); Delay(120000); }
Попробывал прошить одновременно обе прошивки на плату — всё хорошо, загружается и по нажатию кнопки контроллер перескакивает с одной прошивки (режим DFU) на другую (мигание синим СД).
При попытке загрузить прошивку DfuSe пишет, что она прошла успешно, но когда жму кнопку, чтоб перескочить с DFU на прошивку (польз.кнопка на Дискавери), все зависает. Посмотрел с помощью ST LINK Utility flash память контроллера на адресе 0x0800 0000 и увидел там нули. Т.е. прошивка опять стёрлась, но не обновилась. Кто-нибудь сталкивался с таким?
Да, кстати. Пишу в Keil, процедуру SysInit в стартапе отключил, и все клоки у меня только внутренние (сам конфигурирую).
И еще. При попытке запустить Verify в DfuSe Dimo программа на компе виснет. Через командную строку тоже пробывал загрузить (DfuSe Commomd.ixi), тоже виснет. Читал зарубежные форумы, там тоже жалуются на невозможность сделать Verify, и это разрабы обещали пофиксить в след.версии. А что касаемо до моей проблемы, не встретил ничего похожего. Помогите разобраться.
__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь