I have a board with presumably an STM32 mcu. I want to make custom firmware for that board as the stock one is very buggy. Unfortunately the board manufacturers were kind enough to grind off all the markings. Is there any way to get the device/family id via jtag and cross reference it to a model number? Everything I could find was about getting the unique id of the chip, which is NOT what I need.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can get down to a family of STM32 through the JTAG IDCODE of the device, but getting to the exact part number will require more guessing, like actual flash and ram size, or optional features.
I would do the following:
- get IDCODE from boundary scan JTAG TAP, confirm it is ST and STM;
- look for it in manuals from ST, get to the family;
- see whether the family implements the flash identification feature (some families expose flash size and page size at fixed offsets in memory space);
- if not, probe for actual flash size through memory accesses (dichotomy in plausible address space will give good results);
- do the same for ram.
At last, you know for sure the package you have on the board. With this, you should be able to narrow down to the matching part number.
回答2:
In pystlink (SWD programmer) is implementation, which almost successfully identify any STM32 MCU.
The principle is:
- read
PART_NO
from registerCPUID
at address0xe000ed00
and with this is possible to identify if MCU is CortexM0, M3, M4, .. in this filestm32devices.py
- read
IDCODE_REG
(M0 and M0+ has this register on different address than M3, M4 and M7) first 12bits isDEV_ID
, which identify family and again look intostm32devices.py
file - read flash size from register
FLASH_SIZE_REG
(each family has this register on different address) and identify concrete device again bystm32devices.py
file
Or simply connect SWD and keep pystlink to detect right MCU.
回答3:
If you have access to a boot loader UART you can use stm32flash
to identify and program the device, unless it is locked down.