AnsweredAssumed Answered

Error when trying to read/change MCG_C1 value.

Question asked by Donovan Lee on Apr 10, 2014
Latest reply on Apr 11, 2014 by Donovan Lee

Hello, my first post! I am trying to read the value of MCG_C1 but having bad luck.  I am using a KL25Z Freescale Mbed board and trying to do some baremetal stuff.

 

I have the following in my header file:

#define MCG_C1                (*(volatile unsigned long *)(0x40064000)) // MCG Register

And I am simply trying to read it at this point in my main.cpp file:

unsigned int FU_TIM=0;

FU_TIM=MCG_C1;

pc.printf("MCG_C1 = %x \n",FU_TIM);

 

I am expecting an 8-bit Hex number per the datasheet (p. 372) but I get "C84241A" which translates to: 1100100001000010010000011010 ... clearly more than 8 bits.

 

Questions:

1) Why am I getting more than 8-bits on read?

2) How do I write to this register?  I want to select the slow IRC eventually.

3) Moreover, if I try to read MCG_C2 at 0x40064001, my board just hangs... what gives?

 

Thank you,

Donovan

Outcomes