Thomas Haertling

9S08SG16 problem with trim value

Discussion created by Thomas Haertling on Nov 27, 2009
Latest reply on Nov 27, 2009 by pgo

Hello,

I use the 9S08SG16 and want to do serial communication with 19200 Baud and use the internal clock reference. I use the ICS module with locked FLL and reading the factory set trim value and so I should get a accuracy of about 1%.

As far as I understand the appnotes, the value of NVOPT is automatically read at startup from flash and stored in the ICSTRM working register.

In my hardware, I see a difference in the baud rate (having about 21000 Baud instead of 19200). I have already checked the register values for initializing the SCI - interface.

But now, I found in the memory view at the location 0xffaf (NVTRIM), that the trim value is equal to zero. But the value ICSTRM register is 0x80 (default value).

 

I have checked in parallel with my demo board for 9S08SG32 (On the demo board I have a trim value of 0xB4).

I have the following differences between the demo board and my hardware (I have two simple projects with the same uart - module, because of two different controllers on demo board and my hardware):

 

On startup (when loading the flash with the hiwave - window), the process runs without any break on the demo board.

But on my hardware, I get a message "Initializing - error measureing trim values, device is secured. Erasing...", then comes up a Power Cycle Dialog, and then the flash is loaded to the device.

I see the value at 0xFFBF (NVOPT) = 0x7e, which means that device is unsecured (until next reset?) and a trim value of 0x00 at adress 0xFFAF (NVTRIM).  In the register ICSTRM (working register of ICS) there is the value 0x80.

 

On the demo board, I have a value of 0x7E for the NVOPT (0xFFBF) and a trim value of 0xB4 (at 0xffaf). In the ICSTRM register is the value 0xb3. I think, this is ok.

 

So I don't understand 3 things:

Why is the trim value == 0 (in flash) on my hardware with the S08SG16?

And why is this value not transferred to the working register ICSTRM?

Why is the trim value on the demo board (with 9S08SG32) in flash different to the value in the working register? (0xb4 and 0xb3).

 

May be silly qustions, sorry.

But I didn't find (or didn't understand?) answers in the appnotes or the other documentation. 

 

Thomas

Outcomes