I need the MCU part number for example for Kinetis MCU MKL16Z128VFT4, the part number "MKL16Z128VFT4" has to be fetched from the hardware for the bootloader to identify the MCU. How can I do this and identify the MCU part number using program?
Hello arunkannan,
You can do this using the System Device Identification Register (SIM_SDID) of your device.
This Read-Only register contains every information you need to identify the Part-Number of your chip.
For exemple, for your device you can do something like this :
- Read the register
- Check if FAMID is equal to 1. (KL1x Family (basic))
- Check if SUBFAMID is equal to 0b0110 (KLx6 Subfamily)
- Check if SRAMSIZE is equal to 0b0101 (16 KB)
- Check if PINID is equal to 0b0100 (48-pin)
You can find the specifications of this register in the reference manual :
12.2.6 System Device Identification Register (SIM_SDID).
You can also do a sort of "if-tree" to identify your specific configuration.
Hope it will help you, feel free to ask if you need anything else.
Devyy
PS: I forgot it but you can also identify the flash size of your device using the Flash Configuration Register 1 (SIM_FCFG1).
So, for your device you must read 0b111 for 128 KB.
Human readable things like "MKL16Z128VFT4" never appear anyplace inside the chip.
Often, not always, can be deduced by reading various registers.
See the attached files, starting with sys_id.c, that I use to deduce things about the MKL27.
There is some Magick linker tricks not show here because flash_kinetis_cmd.c needs to run from RAM.
Many not required for just the ID code, I never tried it that way. It is required for flash erase and program commands that this file is also used for.