2015-05-26 06:29 PM
Hi,
I'm writing a bootloader, and need to determine the device density and flash size. I can read the flash size OK, from memory address 0x1FFFF7E0 However I can't seem to read the ''MCU device ID code'' , which is described on page 1076 of RM0008 DBGMCU_IDCODE Address: 0xE004 2000 Only 32-bits access supported. Read-only ''This code is accessible using the JTAG debug port (4 to 5 pins) or the SW debug port (two pins) or by the user software. It is even accessible while the MCU is under system reset.'' However I just get zero when I read this address. I can't see anything in the docs that say that there is a config register that needs to be enabled to read this register, and I don't have SWD or JPEG enabled by default in the bootloader code, as it doesn't need to communicate via SWD I noticed that this memory address is ''MCU DEVICE ID code located in the external PPB memory map'' but I'm not sure if this makes any difference to the code that needs to read it uint32 *devID = (uint32 *) (0xE0042000); Thanks Roger2015-05-26 11:07 PM
OK.
Just to answer my own question See http://www.st.com/st-web-ui/static/active/en/resource/technical/document/errata_sheet/CD00190234.pdf ''TheDBGMCU_IDCODE
and DBGMCU_CR debug registers are accessible only in debug mode (not accessible by the user software).When these registers are read in user mode,the returned value is 0x00.'' So basically RM0008 is incorrect and has been superseded by the Errata So.. It looks like I cant accurately detemine device density from the code :0-( I can get total flash size, but not the page size. I'm not sure if there is a link between these two, e.g. is up to 128kb flash in 1k pages, and devices with more then 128k flash in 2k pages ??2015-05-27 04:57 AM
There are other sources for system information. Look at the Cortex SCB->CPUID register to get the device family (Cortex), variant (M series). and member (M0, M3, M3+, M4, M7) That tells you if it's a 'F10x series (1K pages) or 'F2xx or later (2K pages).
You can also get some ST specific information, device and revision, from DBGMCU. Jack Peacock