How to identify the MC9S08QExx type from code?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to identify the MC9S08QExx type from code?

跳至解决方案
1,964 次查看
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.

标签 (1)
0 项奖励
回复
1 解答
948 次查看
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 项奖励
回复
5 回复数
948 次查看
tonyp
Senior Contributor II

5.8.6 System Device Identification Register (SDIDH, SDIDL)

0 项奖励
回复
948 次查看
pbouf
Contributor I

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

0 项奖励
回复
948 次查看
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 项奖励
回复
948 次查看
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 项奖励
回复
949 次查看
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 项奖励
回复