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: Unknown chip id 0042000 on the 2nd st-flash write #669

Closed
6 tasks done
Tyrn opened this issue Feb 18, 2018 · 6 comments
Closed
6 tasks done

STM32F103C8T6: Unknown chip id 0042000 on the 2nd st-flash write #669

Tyrn opened this issue Feb 18, 2018 · 6 comments

Comments

@Tyrn
Copy link

Tyrn commented Feb 18, 2018

  • Programmer/board type: Stlink/v2
  • Programmer firmware version:
  • Operating system: Linux
  • Stlink tools version and/or git commit hash: stlink 1.4.0
  • Stlink commandline tool name: e.g st-flash
  • Target chip (and optional board): STM32F103C8T6

Sorry, being a newbie I've no idea how to check the programmer hardware version.

The following is pretty self-explanatory: first, the blinkyx uploads and blinks; on an attempt at reuploading it bricks. It looks very much like improper usage of st-flash, yet I failed to google a solution. Or the right manual.

Output:

$ st-flash write blinkyx.bin 0x8000000
st-flash 1.4.0
2018-02-18T15:12:37 INFO src/common.c: Loading device parameters....
2018-02-18T15:12:37 INFO src/common.c: Device connected is: F1 Medium-density device, id 0x20036410
2018-02-18T15:12:37 INFO src/common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0x20000 bytes (128 KiB) in pages of 1024 bytes
2018-02-18T15:12:37 INFO src/common.c: Attempting to write 8336 (0x2090) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08002000 erased
2018-02-18T15:12:38 INFO src/common.c: Finished erasing 9 pages of 1024 (0x400) bytes
2018-02-18T15:12:38 INFO src/common.c: Starting Flash write for VL/F0/F3/F1_XL core id
2018-02-18T15:12:38 INFO src/flash_loader.c: Successfully loaded flash loader in sram
  9/9 pages written
2018-02-18T15:12:38 INFO src/common.c: Starting verification of write complete
2018-02-18T15:12:38 INFO src/common.c: Flash written and verified! jolly good!

$ st-flash write blinkyx.bin 0x8000000
st-flash 1.4.0
2018-02-18T15:19:56 INFO src/common.c: Loading device parameters....
2018-02-18T15:19:56 WARN src/common.c: unknown chip id! 0xe0042000

$ st-flash erase
st-flash 1.4.0
2018-02-18T15:20:25 INFO src/common.c: Loading device parameters....
2018-02-18T15:20:25 WARN src/common.c: unknown chip id! 0xe0042000

Thank you,
The stlink project maintainers

@lhoyosm
Copy link

lhoyosm commented Sep 13, 2018

I've got a very similar issue with almost the same conditions, I got instead:

$st-flash --format ihex write out.hex
st-flash 1.5.0
2018-09-12T20:47:17 INFO common.c: Loading device parameters....
2018-09-12T20:47:17 WARN common.c: Invalid flash type, please check device declaration
Unknown memory region

I could fix that by moving the boot0 and boot1 to make it boot from from anywhere else but flash, reset it, and then it will accept the st-flash commands again.
This problem is caused by the SWDIO and SWCLK being configured for other purpose (GPIO, etc) other than Serial Wire configuration or Jtag

On the STM32CubeMx set the SYS->Debug option to "Serial Wire" or Jtag and it should work every time.

Hope this helps!
Luis

@Nightwalker-87 Nightwalker-87 added this to the General milestone Feb 19, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: General, v1.6.1 Feb 21, 2020
@Nightwalker-87 Nightwalker-87 self-assigned this Feb 21, 2020
@Nightwalker-87 Nightwalker-87 changed the title Unknown chip id 0042000 on the 2nd st-flash write flashing: Unknown chip id 0042000 on the 2nd st-flash write Mar 17, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: v1.6.1, Feedback required Mar 19, 2020
@Nightwalker-87 Nightwalker-87 removed their assignment Mar 19, 2020
@Nightwalker-87
Copy link
Member

@Tyrn @lhoyosm: What is the current status of this issue? Is it hardware- or software-related?
Please test with Release v1.4.0 and v1.5.0 first.

@lhoyosm
Copy link

lhoyosm commented Mar 19, 2020

For me the issue was due to a wrong configuration of the STM32 Chip that caused the communication to fail. After programming, It looked like it was "bricked" as the SWDIO and SWCLK pins were reconfigured as GPIO and the error message was displayed when trying a reprogram.

I think "unknown chip id! 0x_______" is a synonym of a connection problem, if nothing is connected that is displayed. Maybe a message can be added regarding that to check: physical connections or SWDIO and SWCLK pin configuration.

The st-flash was not the issue. Just tested 1.4.0, 1.5.0 and 1.6.0 all working fine!

@Nightwalker-87
Copy link
Member

Nightwalker-87 commented Mar 19, 2020

Thank you very much for the feedback which appears to be helpful.
The idea of improving the displayed message does make sense to me.
I'll check this and forward it as a feature request to Release v1.6.2.

@Nightwalker-87 Nightwalker-87 modified the milestones: Feedback required, v1.6.1 Mar 19, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: v1.6.1, Device issues Mar 31, 2020
@Nightwalker-87 Nightwalker-87 changed the title flashing: Unknown chip id 0042000 on the 2nd st-flash write STM32F103C8T6: Unknown chip id 0042000 on the 2nd st-flash write Mar 31, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: Device issues, Feedback required, Old issues, Unknown chip id 0042000 Apr 6, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: d) Unknown chip id 0042000, v1.6.2 Jun 3, 2020
@Nightwalker-87 Nightwalker-87 self-assigned this Jun 3, 2020
@Nightwalker-87
Copy link
Member

The meaning of the output unknown chip id! 0xe0042000 should be documented, as well as some other error codes.

@Nightwalker-87
Copy link
Member

Duplicate of #568.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.