Sign in

username:

password:



Not a member?

Search 68hc12



Search tips

Subscribe to 68hc12



68hc12 by Keywords

68HC1 | 812A4 | 9S12DP256 | Bootloader | CodeWarrior | D60A | Debugger | DP256 | ECT | EEPROM | EVB | Flash | HC1 | HCS12 | I2C | IAR | ICC1 | Interrupts | LCD | M68KIT912DP256 | MC9S12DP256 | MC9S12DP256B | Metrowerks | Motor | MSCAN | Multilink | PLL | Quadrature | SDI | SPI | Transceiver | XFC

Ads

Discussion Groups

Discussion Groups | 68HC12 | 68HC12 i/o glitch

Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).

68HC12 i/o glitch - Jeff Smith - Sep 20 17:30:21 2007

I've been seeing a strange problem in a test fixture within the
MC68HC912B32. I recently modified the software so it uses PS2 and
simulates open-collector output. The pin is just gpio because the
device has no SCI1. I have a 470 ohm resistor pulling to +5V. I write
0x00 -> PORTS to ensure that the output will be low when enabled as
output.

I control an LED with anode to the PS2 pin and kathode to Ground:
OFF: set DDRS.2
ON: clear DDRS.2

The problem is that after an unknow period of time since powerup (up
to one millisecond or so), bit 2 in PORTS has become '0' after I had
set it to '1'. I find that it only happens once: While debugging, I
set PORTS.2 and the LED begins flashing as expected indefinitely. What
could cause that, do others see it? It seems to me a hardware failure,
but haven't got other hardware to test on.



(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )


Re: 68HC12 i/o glitch - Jeff Smith - Sep 21 1:43:52 2007

--- In 6...@yahoogroups.com, "Jeff Smith" wrote:
>
> I've been seeing a strange problem in a test fixture within the
> MC68HC912B32. I recently modified the software so it uses PS2 and
> simulates open-collector output. The pin is just gpio because the
> device has no SCI1. I have a 470 ohm resistor pulling to +5V. I write
> 0x00 -> PORTS to ensure that the output will be low when enabled as
> output.

In reply to self; It helps to stop working on a problem after you've
been trying for days. That lets your subconcious start working...

I think I've solved the problem. [The manifestation of the problem was
that the LED blinks Bright/Dim instead of Off/On]

I had been assuming that the output PS2 was setting itself to '1' (in
PORTS) after I cleared it. I think now that I see what really was the
problem. First I was working around the problem by writing '0' to bit
2 in PORTS every 100mS.

The real problem was that the PORTS bit could not be written until
after setting that bit in DDRS (set as output). Maybe I forgot that or
didn't know because it's not documented, and in S12 it just works (and
is documented to work). I was trying to initialize it to '0' first,
and later make it an output when I wanted it to turn off (start
blinking). Often it was powering up with '1'. Value of PORTS bits are
not defined on powerup, maybe because on powerup the pins are inputs.
In startup code I finally tried
DDRS = 0x40;
PORTS = 0;
LED_ON();
and it has worked ever since.



(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )