[S12XHY128]write register 0x01 but came out 0x80?

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

[S12XHY128]write register 0x01 but came out 0x80?

856 Views
kimchan_eb
Contributor III

for example, i write code like this:

REFDV = 0x01;

pastedImage_1.png

so i expected that REFDIV0 = 1

but when i run this code(using Trace32)

pastedImage_2.png

(before)

pastedImage_3.png

(after)

the REFFRQ1 became 1, seems like reversed when writing.

And it have the same problem in reading. If i want to read bit3( REGISTER_BIT3), have to use the bit4( REGISTER_BIT4)....

(though the REFDV.Byte=1 in the watch)

 And i'm very confuse about this.

So if anyone have ideas?

If it is problem with bit order or something else?

Tags (2)
0 Kudos
Reply
4 Replies

652 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

Have you tried changing Endian?

I think the command is: SYStem.Option BigEndian

Regards,
Daniel

0 Kudos
Reply

652 Views
kimchan_eb
Contributor III

I thought about Endian. But changing Endian is changing byte order, right? My problem is the bit order, and i think that it may be some settings related to compiler or debugger(TRACE32)

0 Kudos
Reply

652 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

We don't use TRACE32 for S12(X) but only for ARM 32-bit MCUs, I only tried changing Endian there and it changes the bit order in which registers are read. But this is probably not the problem. You may refer directly the Lauterbach support.

Regards,

Daniel

0 Kudos
Reply

652 Views
kimchan_eb
Contributor III

Hi,

The problem has been solved.

I use "watch" to watch the every bit of register like the picture in my question. and i found that it's "incorrect". But I tried to use "peripherals" to watch the register. It shows the value of register as we think. And I have corrected my code using "peripherals".

Also thanks to Lauterbach support that they told me try using it.

Br,

Kim