Hello, does anyone know how I can identify the type of microcontroller from the code running on it? I mean, besides from setting a constant (or any other method) when the code is built.
The MC9S08QExx does not seem to have an internal register that provide such information.
Thanks.
已解决! 转到解答。
Hello,
The reason the SDI register contains the same value for the different capacity devices is that it is possible that the same die is used within all devices (64k through 128k flash). For the smaller capacity devices the only difference is that the flash and RAM outside their specified capacity is not guaranteed to be functional, and may be untested. On this basis, determining the device type by probing the RAM operation may be quite unreliable.
Regards,
Mac
Dear pbouf,
According to the data sheets the SDID can be used to identify:
0x01C => MC9S08QE8, MC9S08QE4
0x01F => MC9S08QE32, MC9S08QE16
0x015 => MC9S08QE128, MC9S08QE96, MC9S08QE64
You can probe the RAM boundaries to determine which chip within the group, AFAIK there is no register to indicate the RAM or flash size as in some other chips.
Of course there is nothing to stop Freescale bringing out a new mask version with a new SDID value.
Why do you need this?
bye
pgo wrote:
0x01C => MC9S08QE8, MC9S08QE4
0x01F => MC9S08QE32, MC9S08QE16
0x015 => MC9S08QE128, MC9S08QE96, MC9S08QE64
Why do you need this?
I'm using either the MC9S08QE128 or the MC9S08QE64 depending on the hardware revision of a board. It would have been good to determine the flash and ram boundaries based of a MCU register value of some sort.
I can always figure it out by using build information included in the binary output file, but it is prone to errors (e.g. if someone forgets to set the MCU type). I will manage to find something that works out right.
Thanks.
Hello,
The reason the SDI register contains the same value for the different capacity devices is that it is possible that the same die is used within all devices (64k through 128k flash). For the smaller capacity devices the only difference is that the flash and RAM outside their specified capacity is not guaranteed to be functional, and may be untested. On this basis, determining the device type by probing the RAM operation may be quite unreliable.
Regards,
Mac