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

STM32F103C8T6 doesn't flash #172

Closed
MartianZ opened this issue Aug 10, 2013 · 15 comments
Closed

STM32F103C8T6 doesn't flash #172

MartianZ opened this issue Aug 10, 2013 · 15 comments

Comments

@MartianZ
Copy link

Hello!

I tried ST-LINK v2 to flash STM32F103C8T6, but I cannot flash my code to the chip and it gives me a weird error:

2013-08-10T16:52:48 INFO src/stlink-common.c: Loading device parameters....
2013-08-10T16:52:48 INFO src/stlink-common.c: Device connected is: F1 Medium-density device, id 0x20036410
2013-08-10T16:52:48 INFO src/stlink-common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0 bytes (0 KiB) in pages of 1024 bytes
stlink_sram_flash() == -1

The STM32F103C8T6 has 64KiB ROM but the st-flash and st-util display: Flash: 0 bytes (0 KiB) in pages of 1024 bytes

I tried to flash the STM32F103C8T6 on Windows with J-Link and it worked fine so I'm sure there is nothing wrong with my board.

@MightyPork
Copy link

Did you ever find a solution to this? I'm having the same issue now and can't find anything useful on Google

@xor-gate
Copy link
Member

xor-gate commented May 11, 2016

Reopening this issue,
Please provide some more info on your setup/issue as described here (copy-paste and fill please):
https://raw.githubusercontent.com/texane/stlink/master/.github/ISSUE_TEMPLATE.md

@MightyPork
Copy link

I managed to fix it by trying random things in openocd, can't really say how. I tried 'stm32f1 unlock' or something like that, also erase.
At any rate, st-flash now works as expected. Odd that it just printed 0 KB earlier as if that made any sense...

linux, stm32f103k8, stlink 1.2.0, stlink v2

@xor-gate
Copy link
Member

Hmm, doing random things will not make life easier for other people to search to reproduce it. I have seen similar issues when st-info is prints info with 0KB SRAM etc.

@MightyPork
Copy link

I have two of those Chinese F103 modules, so I'll pay closer attention if I encounter the issue with the second one ;-)

@xor-gate
Copy link
Member

xor-gate commented May 14, 2016

I will close this issue because you got it working "sort of". Feel free to open a new issue when there are still troubles. Of course with the appropriate level of details so people can point in the right direction and try reproduce for themselves.

Thank you for your feedback.

@jeanthom
Copy link

I got the same issue as MightyPork and solved it using OpenOCD :

$ openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg

In OpenOCD's telnet session :

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> halt
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x01000003 pc: 0xfffffffe msp: 0xffffffdc
> stm32f1x unlock 0
Device Security Bit Set
target halted due to breakpoint, current mode: Handler HardFault
xPSR: 0x61000003 pc: 0x2000003a msp: 0xffffffdc
stm32x unlocked.
INFO: a reset or power cycle is required for the new settings to take effect.

I then unplugged the target, and plugged it back in. Flash size was correctly recognized in st-flash ! :)

@lucky62
Copy link

lucky62 commented Feb 13, 2018

Hello, I have the same issue:

2018-02-13T17:45:54 INFO src/stlink-usb.c: -- exit_dfu_mode
2018-02-13T17:45:54 INFO src/stlink-common.c: Loading device parameters....
2018-02-13T17:45:54 INFO src/stlink-common.c: Device connected is: F1 Medium-density device, id 0x20036410
2018-02-13T17:45:54 INFO src/stlink-common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0 bytes (0 KiB) in pages of 1024 bytes

Which tools I can run and what output will help to solve this issue?

Thanks

@jeanthom
Copy link

Please read my message above. It explains all you need to do :-)

@lucky62
Copy link

lucky62 commented Feb 13, 2018

I tried this, but result is not as expected.

$ telnet 127.0.0.1 4444
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Open On-Chip Debugger
> halt
> stm32f1x unlock 0
device id = 0x20036410
STM32 flash size failed, probe inaccurate - assuming 128k flash
flash size = 128kbytes
Device Security Bit Set
target state: halted
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x2000003a msp: 0x20000688
stm32x unlocked.
INFO: a reset or power cycle is required for the new settings to take effect.

But Flash size is wrong. Should be 64K, not 128K.

$ ./st-info --probe
Found 1 stlink programmers
 serial: 573f7106493f56535432083f
openocd: "\x57\x3f\x71\x06\x49\x3f\x56\x53\x54\x32\x08\x3f"
  flash: 131072 (pagesize: 1024)
   sram: 20480
 chipid: 0x0410
  descr: F1 Medium-density device

@jeanthom
Copy link

jeanthom commented Feb 13, 2018

You are using an STM32F103CBT6, right ?

@lucky62
Copy link

lucky62 commented Feb 13, 2018

No, it is STM32F103C8.

@jeanthom
Copy link

jeanthom commented Feb 13, 2018

They're the same internally ;) That's why you get reports of 128K of flash on an STM32F103C8.

More infos : http://www.stm32duino.com/viewtopic.php?t=110

tldr: it is totally normal that you get reports that your MCU is 128k

@lucky62
Copy link

lucky62 commented Feb 13, 2018

Hmm, I think my MCU has only 64K.

This line from openocd output (see above) can be a problem:
STM32 flash size failed, probe inaccurate - assuming 128k flash

Blinky example flashed to board is not working.

It is possible to set the Flash size via openocd explicitly?

@Nightwalker-87
Copy link
Member

Nightwalker-87 commented Feb 25, 2020

Issue has been reviewed and is now permanently closed.
Please also keep in mind that this is not an openocd support forum.
Remaining problems need to be verified with Release v1.6.0 first to receive support.
Any further questions or feedback on this must then go into a new ticket.

@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

6 participants