Oscillator noise on squarewave output pin
ken261
Posts: 4
I am trying to develop a fixed data output source for a test set. As part of that source, I need a 10 kHz (approx) square wave CLK signal coming out. This was simple enough to create with interrupts, but I am getting oscillator noise on the square wave output.
I am using a 4 MHz Murata on the SX Tech dev board. There is no other circuitry added to the board, and I am reading the output on RA0. I get a steady 4 MHz signal (about 600mV) riding on the 5V output.
I have tried all the DEVICE OSC settings and it happens with the SX-Key as well. I also tried adding the 1Mohm resistor across the resonator, but that didn't change anything. I thought perhaps the chip was bad, but two other chips show the same thing. Unfortunately, I don't have another Tech board. For grins I changed everything to a 50 MHz resonator I had and ended up with a 50 MHz signal on the square wave. That at least tells me it's not coming from the SX28 internal clock.
I may try to breadboard the whole thing from scratch to see how that works. I've included the code just in case it's a simple setting error.
Thanks for any help.
Ken
'
' Device Settings
'
DEVICE SX28, OSCXT2, OPTIONX, STACKX, TURBO, BOR42
FREQ 4_000_000
'
' IO Pins
'
CLK PIN RA.0 OUTPUT ' square wave output
'
INTERRUPT NOPRESERVE 20_000
'
ISR_Start:
CLK = ~CLK ' toggle CLK around 10 kHz
RETURNINT
' =========================================================================
PROGRAM Start
' =========================================================================
Start:
LOW CLK ' assure startup state
Main:
pause 50
GOTO Main
I am using a 4 MHz Murata on the SX Tech dev board. There is no other circuitry added to the board, and I am reading the output on RA0. I get a steady 4 MHz signal (about 600mV) riding on the 5V output.
I have tried all the DEVICE OSC settings and it happens with the SX-Key as well. I also tried adding the 1Mohm resistor across the resonator, but that didn't change anything. I thought perhaps the chip was bad, but two other chips show the same thing. Unfortunately, I don't have another Tech board. For grins I changed everything to a 50 MHz resonator I had and ended up with a 50 MHz signal on the square wave. That at least tells me it's not coming from the SX28 internal clock.
I may try to breadboard the whole thing from scratch to see how that works. I've included the code just in case it's a simple setting error.
Thanks for any help.
Ken
'
' Device Settings
'
DEVICE SX28, OSCXT2, OPTIONX, STACKX, TURBO, BOR42
FREQ 4_000_000
'
' IO Pins
'
CLK PIN RA.0 OUTPUT ' square wave output
'
INTERRUPT NOPRESERVE 20_000
'
ISR_Start:
CLK = ~CLK ' toggle CLK around 10 kHz
RETURNINT
' =========================================================================
PROGRAM Start
' =========================================================================
Start:
LOW CLK ' assure startup state
Main:
pause 50
GOTO Main
Comments
Are you using the ground clip and thereby "coupling" noise in or are you using good 'scope method - a stub from the probe ground ring to the ground plane of your board?
When you get picky, you have to be picky. I don't know your background, that's why I'm asking questions.
If you don't have a spare capacitor, try running the SX directly (not going thru the voltage regulator) using 3 AA (or AAA) cells in series at 4.5 volts.
-Katie
I've thought about the LP filter, but I'm still curious why I'm seeing this in the first place. I had built a PWM circuit a year ago with this same Tech board and I don't think I saw the problem then.
Thanks for your suggestions.