HC908GR16A -- Timer problem w/ Cyclone

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

HC908GR16A -- Timer problem w/ Cyclone

2,665 Views
rbeaudry
Contributor I
Hello all,
 
I have a weird problem, and I hope someone has seen this before, and can help me
 
Some background information:
 
I'm using a 68HC908GR16A, with CodeWarrior "C", and a Cyclone Pro programmer/debugger.  We have the Cyclone hooked up via the standard MON08 16-pin header.
 
I have a 50ms timer interrupt (TIM2 Overflow), that currently just blinks a light, and checks for a debounced button press.  The light does not blink every 50ms, but I use a counter in the interrupt to blink every 500ms.
 
I also have a serial receive interrupt, and my device responds to serial polls from an external device.
 
Now, the problem:
 
When the Cyclone is hooked up, the serial receive interrupt fires, and the TIM2 Overflow interrupt fires.  When the Cyclone is NOT hooked up, the serial receive interrupt fires, but the TIM2 Overflow interrupt DOES NOT FIRE.  This is the same flash code, but for some reason, TIM2 Overflow does not fire unless the Cyclone is hooked up....
 
Any ideas??  I'm a bit stuck
 
Rich B.
 


Message Edited by rbeaudry on 2007-05-24 03:42 PM

Message Edited by rbeaudry on 2007-05-24 04:10 PM
Labels (1)
0 Kudos
5 Replies

537 Views
jarin
Contributor I
How do you know that TIM2 OVF interrupt is not generated? LED just doesn't blink? There may be problems with your interrupt routines.
We may start helping you when you could show source code for your interrupt routines.
0 Kudos

537 Views
rbeaudry
Contributor I
Jarin,
 
I know it doesn't fire because the LED doesn't blink, and the debounced button presses are no longer detected (I added code to report a fault condition out the serial line when a button is pressed).
 
I'm not sure it is the interrupt routine itself because it works 100% as long as the Cyclone is connected.  Once the Cyclone is reset or disconnected, it no longer works....
 
I'm not trying to blame the Cyclone.  It could easily be a hardware issue, or maybe a firmware setting, or something like that ... It just seems really weird.....
 
Rich B.
 
0 Kudos

537 Views
bigmac
Specialist III
Hello Rich,
 
It is possible that, depending on the MON08 connection you have used, the Cyclone will inject a clock frequency of 9.8304 MHz for use during monitor mode, and this would over-ride the crystal you may have connected.  In this case the PLL would not be utilised.
 
In normal user mode, if you are using a low frequency crystal in conjunction with the PLL, if the CGM is incorrectly set up it also may be possible that your bus frequency is very low, and this might give the appearance that the TIM interrupt is not working.
 
I think you need to confirm that you have the expected bus frequency.  A possible approach is to set up one of the TIM channels for PWM output (unbuffered with arbitary duty cycle) and monitor the output waveform.
 
Regards,
Mac
 
0 Kudos

537 Views
rbeaudry
Contributor I
Hello all,
 
Thanks for the replies ....
 
Jarin was indeed correct .. partly :-)  My ISR code was fine, but the main loop does a WAIT, and the COP fired off a reset.  The serial transmissions were processed before the WAIT, but since no other interupts happened in time, the COP fired off...
 
I should note that my LED/Button interrupt was every 50ms, but the COP, because of the 8MHz crystal, was 32ms.  The Cyclone, when connected, holds the IRQ and RST pins, which tells the micro to disable the COP for debugging ..... *sigh*...
 
*goes off to eat some crow*
 
Rich B.


Message Edited by rbeaudry on 2007-05-25 02:39 PM
0 Kudos

537 Views
jarin
Contributor I

rbeaudry wrote:
...it could easily be a hardware issue, or maybe a firmware setting, or something like that ...



Yes, that's right. And that's why I want to see your code first - to decide if it's firmware problem or not. Then we may look closer to your hardware.
0 Kudos