How to identify the MC9S08QExx type from code?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to identify the MC9S08QExx type from code?

Jump to solution
1,638 Views
pbouf
Contributor I

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.

Labels (1)
0 Kudos
1 Solution
622 Views
bigmac
Specialist III

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

 

View solution in original post

0 Kudos
5 Replies
622 Views
tonyp
Senior Contributor II

5.8.6 System Device Identification Register (SDIDH, SDIDL)

0 Kudos
622 Views
pbouf
Contributor I

Not good. The register value is 0x015 for all device types.

0 Kudos
622 Views
pgo
Senior Contributor V

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

 

0 Kudos
622 Views
pbouf
Contributor I

 


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.

 

 

0 Kudos
623 Views
bigmac
Specialist III

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

 

0 Kudos