MC9S12E128 - LVDS (Low Voltage Detect Status) Usage

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

MC9S12E128 - LVDS (Low Voltage Detect Status) Usage

3,692 Views
VincentV
Contributor I
As part of a Power-On/Reset test, I would like to make sure that the voltage to the chip is within tolerance.

Looking through the manual, there seems to be a bit in the "VREGCTRL" word at address 0x0019.

The LVDS, or Low-Voltage Detect Status Bit (bit 2) seems to to what I want it to. The manual says that if LVDS is 0, this indicates that, "input voltage V(DDA) is above level V(LVID) or RPM or shutdown mode.

So this seems good. Exactly what I want! The only problem is that on my board, it keeps reporting a '1'. And I really don't think it's the board.

But, to be sure that it isn't my code, I was hoping a few other eyeballs would be great, just in case I did something stupid.

Looking in mc9s12e128.h, this area of memory seems to be defined for easy reference (as _VREGCTRL0). The bit itself seems to be defined individually as VREGCTRL0_LVDS.

So I've written the following code to read it:

//BEGIN CODE
voltage = (uint8)_VREGCTRL0.Bits.LVDS; //get LVDS bit

VREGCTRL0_LVDE = 1;

//NOTE: The above line was just to see if I had to set an "enable" bit, which isn't listed in the documentation but is listed in the header

if(VREGCTRL0_LVDS == 1)
x = printf(" \n\r LVDS is one" );
else
x = printf(" \n\r LVDS is zero" );

x = printf(" \n\r Voltage Status: %02X", voltage);
//END CODE

Both methods produce a '1' which seems not to be what I want.

But, like I said, it could certainly be some terrible coding on my part. I would appreciate it if someone could help me figure out what's what.

in the header, the relevant lines start at line 918.

Thanks!
Labels (1)
0 Kudos
2 Replies

447 Views
VincentV
Contributor I
...because I really would think this should be a simple matter.

Anyone? Am I in the ballpark?
0 Kudos

447 Views
VincentV
Contributor I
New approach:

v_ptr = (uint16 *)0x0018;
voltage = *v_ptr;
voltage = (voltage & 0x0004);

if(voltage == 0x0000)
x = printf("\n\r Voltage word is: %8X", voltage);
else
x = printf("\n\r Voltage FAILED: %8X", voltage);

The following produces a value of '4' in voltage, which would indicate that the LVDS is indeed '1' (assuming my pointers are right...I think they are)...

I really need someone to tell me, "yeah, the voltage in your board is bad," or, "yeah, you really don't understand what LVDS is..."

or something. Help would be most appreciated.
0 Kudos