Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STM32F410RBTx not supported #418

Closed
5 tasks done
thebiguno opened this issue May 19, 2016 · 9 comments
Closed
5 tasks done

STM32F410RBTx not supported #418

thebiguno opened this issue May 19, 2016 · 9 comments

Comments

@thebiguno
Copy link

thebiguno commented May 19, 2016

Hello all,

I am trying to program an STM32F410RBTx chip with stlink, and it is failing with error:

wyatt@behemoth:~/stm32f410/led$ /opt/stlink/st-flash write led.bin 0x8000000
2016-05-18T21:59:59 INFO /src/common.c: Loading device parameters....
2016-05-18T21:59:59 WARN /src/common.c: unknown chip id! 0x10006458

Looking at include/stlink/chipid.h I can see that there is no entry for ID 458. Unfortunately I am not clear on the different parameters in src/chipid.c to add this chip myself, as I am quite new to ARM programming.

I am programming the chip on a custom board via the NUCLEO F411RE dev board in target mode. I know the programmer works, as I can program it correctly using st-link. I know the custom board + chip works as I can program it via the Nucleo in USB mass storage mode.

I would prefer to use this command line tool for programming, as it integrates with Makefiles better than the USB mass storage programming mode; plus it will open up my options for other programmers (not just using the Nucleo).

  • Programmer/board type: NUCLEO F411RE board in target mode (CN2 not bridged)
  • Operating system: Debian Jessie
  • Stlink tools version and/or git commit hash: 1.2.0-27-gad39787
  • Stlink commandline tool name: st-flash
  • Target chip (and optional board): STM32F410RBTx

Output:

wyatt@behemoth:~/stm32f410/led$ /opt/stlink/st-flash write led.bin 0x8000000
2016-05-18T21:59:59 INFO /src/common.c: Loading device parameters....
2016-05-18T21:59:59 WARN /src/common.c: unknown chip id! 0x10006458

Expected/description:
st-link does not appear to support the STM32F410RBTx chip.

@thebiguno thebiguno changed the title STM32F410 not supported STM32F410RBTx not supported May 19, 2016
@xor-gate
Copy link
Member

Could you test with 9c635e4 I have not tested it on real hardware.

@thebiguno
Copy link
Author

Sorry for the delay in testing, yesterday was crazy.

Anyway, it is getting closer, but not quite there yet. This is the output now:

wyatt@behemoth:~/Documents/Electronics/projects/samples/arm/stm32f410/led$ /opt/stlink/st-flash write led.bin 0x8000000
2016-05-20T09:24:48 INFO /home/wyatt/Downloads/stlink/src/common.c: Loading device parameters....
2016-05-20T09:24:48 INFO /home/wyatt/Downloads/stlink/src/common.c: Device connected is: F410 device, id 0x10006458
2016-05-20T09:24:48 INFO /home/wyatt/Downloads/stlink/src/common.c: SRAM size: 0x8000 bytes (32 KiB), Flash: 0x20000 bytes (128 KiB) in pages of 16384 bytes
2016-05-20T09:24:48 INFO /home/wyatt/Downloads/stlink/src/common.c: Attempting to write 8024 (0x1f58) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08000000 erased
2016-05-20T09:24:49 INFO /home/wyatt/Downloads/stlink/src/common.c: Finished erasing 1 pages of 16384 (0x4000) bytes
2016-05-20T09:24:49 INFO /home/wyatt/Downloads/stlink/src/common.c: Starting Flash write for F2/F4/L4
2016-05-20T09:24:49 ERROR /home/wyatt/Downloads/stlink/src/common.c: unknown coreid, not sure what flash loader to use, aborting!: 2ba01477
2016-05-20T09:24:49 WARN /home/wyatt/Downloads/stlink/src/common.c: Failed to write flash loader to sram!
2016-05-20T09:24:49 ERROR /home/wyatt/Downloads/stlink/src/common.c: init_flash_loader() == -1
stlink_fwrite_flash() == -1

Compiled version:

wyatt@behemoth:~/Downloads/stlink$ git describe --long --tags
1.2.0-30-g1507e34

Thanks!

@xor-gate
Copy link
Member

There is something wrong now with selection of the correct flash loader because the coreid is not recognized.

@thebiguno
Copy link
Author

Is this something that you need from me? I would be happy to help but am not clear on what you need.

@xor-gate
Copy link
Member

xor-gate commented May 20, 2016

I'm not sure yet either because the flash loader mechanism is build by other people. I'm trying to figure out why it doesn't recognized correctly. What it does: st-flash writes a program (flash loader) in to SRAM and then runs it. Then the interaction is done using the flash loader to program the internal memory.

@thebiguno
Copy link
Author

Gotcha. When you figure it out, let me know what I can do to help.

@xor-gate
Copy link
Member

xor-gate commented May 20, 2016

https://github.com/texane/stlink/blob/1507e34dd6455636724bb68b7c5c2253dd2fb77b/src/common.c#L1620-L1622

We need to add the F410 chipid to that flash-loader selector, hopefully fixed here:
8da1467

As seen now, the chipid doesn't select the flash-loader itself and is semi-hardcoded in common.c currently.

Let me know if it works (or not)

@thebiguno
Copy link
Author

Beautiful!

wyatt@behemoth:~/Documents/Electronics/projects/samples/arm/stm32f410/led$ /opt/stlink/st-flash write led.bin 0x8000000
2016-05-20T09:53:21 INFO /home/wyatt/Downloads/stlink/src/common.c: Loading device parameters....
2016-05-20T09:53:21 INFO /home/wyatt/Downloads/stlink/src/common.c: Device connected is: F410 device, id 0x10006458
2016-05-20T09:53:21 INFO /home/wyatt/Downloads/stlink/src/common.c: SRAM size: 0x8000 bytes (32 KiB), Flash: 0x20000 bytes (128 KiB) in pages of 16384 bytes
2016-05-20T09:53:21 INFO /home/wyatt/Downloads/stlink/src/common.c: Attempting to write 8024 (0x1f58) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08000000 erased
2016-05-20T09:53:21 INFO /home/wyatt/Downloads/stlink/src/common.c: Finished erasing 1 pages of 16384 (0x4000) bytes
2016-05-20T09:53:21 INFO /home/wyatt/Downloads/stlink/src/common.c: Starting Flash write for F2/F4/L4
2016-05-20T09:53:21 INFO /home/wyatt/Downloads/stlink/src/common.c: Successfully loaded flash loader in sram
enabling 32-bit flash writes
size: 8024
2016-05-20T09:53:21 INFO /home/wyatt/Downloads/stlink/src/common.c: Starting verification of write complete
2016-05-20T09:53:21 INFO /home/wyatt/Downloads/stlink/src/common.c: Flash written and verified! jolly good!

This looks to be working as far as I am concerned. Thank you very much for your quick fix!

Cheers

@xor-gate
Copy link
Member

xor-gate commented May 20, 2016

Very nice, have fun 👍. I have not 100% verified the chipid parameters are correctly set. But the chip should have 32KB SRAM and 128KB flash (16KB pages).

@stlink-org stlink-org locked as resolved and limited conversation to collaborators Apr 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants