Trying to see clock signal on an oscilliscope

Go To Last Post
57 posts / 0 new

Pages

Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am a beginner. Go easy on me please  :-)

 

 

I have a Uno  R3 that works perfect  (ATMega328P-PU).  I have a cheep chinese digital oscilliscope I bought a while ago just to learn on.

 

I am trying to look at my clock signal on the chip / board. So I probe (with and with and without the hook) pin 14 (CLKO) and the ground of the probe to the boards ground.  I tried this in 1x and 10x and I tried it with and with out a 50 ohm pass through attenuator.

 

All I get is a very jumpy sine wave that is all over the place and the oscilliscope says 28MHz even though the board runs as 16MHz.

 

 

I just want to look at the clock signal just to learn.  This is not for any kind of school / class / job / business.  Its just for me to learn.

 

If anyone can point me in the right direction i would appreciate it very much!

 

 

Thank you!

 

Sam

I am a new AVR programmer. I am learning alone out of books, the Internet, etc. Please excuse me if I ask simple questions. Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To use the CKO pin, you must have the CKOUT fuse programmed.

 

With the fuse programmed, you should then have a full amplitude (0V low, Vcc high) square wave at 16MHz. Depending on the bandwidth of your scope, it may have "soft" rise and fall, or it may look quite square. It  will look fairly soft with a scope having a bandwidth of 50MHz,  maybe more (your inexpensive  scope is probably lower than 50MHz, but maybe not). 

 

You also need to be careful about the probe. First, you ALWAYS need a ground connection in addition to the signal connection. IF you do not have a ground connection, you will get the jumpy display you describe. If it is not "just" a wire with a grabber on the end, but a real 10X probe,  then it HAS to be compensated  properly. Here is a web page that describes how to do it.

 

https://www.electronics-notes.co...

 

Google scope probe compensation for other instructions if this one does not help you.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

Last Edited: Mon. Feb 12, 2018 - 01:49 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jim:

 

Thank you.  I do have a good probe, the one that came with the 100MHz scope.

 

I am using the Arduino IDE:  If you have any Arduino or C.  It sounds like that was all i needed.

 

Thank you again.

 

Sam

I am a new AVR programmer. I am learning alone out of books, the Internet, etc. Please excuse me if I ask simple questions. Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I meant to say any Arduino or C code:  sorry, my kid is tugging at me LOL

I am a new AVR programmer. I am learning alone out of books, the Internet, etc. Please excuse me if I ask simple questions. Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can put the probe on the XTAL pins. Preferably on X2 and play with the scope settings to get a clean waveform.

Another Jim

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

With your 10X probe, you can look directly at the oscillator X2 pin. It will shift the frequency very slightly (a small fraction of a percent, maybe). The signal you see WILL NOT be full logic amplitude and it will be a less perfect square wave than the CKO pin. In fact, it may look more like a "sine with corners". But you will not have to change any fuses.

 

The waveform you see SHOULD be steady in both DC level and amplitude. At that frequency, probe compensation may not show the classic under-peak/over-peak but may, instead, just change the apparent amplitude. Normally, you compensate the probe with a much lower frequency square wave, such as 1KHz. 

 

By the way, with a 100MHz scope, a 16MHz actual square wave, such as out of CKO, will look pretty square. The rise and fall times are 3.3ns out of 31.25ns high and 31.25ns low. So the rises and the falls only take about 10% of each half cycle. Actually, it will be a bit slower than that, because the logic out of an AVR has rise and fall times of its own around 6ns. So, I guess that, actually, the rises and the falls will take closer to 1/3 of each half cycle. That is a bit less square than I started out suggesting and that is because of the chip's internal rise and fall times, not the scope.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

Last Edited: Mon. Feb 12, 2018 - 04:27 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

oscilliscope says 28MHz

Are you figuring the freq by looking at the actual waveform?  If the wave is noisy or poorly shaped, lower end scopes with built-in measurement readouts may often be rather unreliable, unless carefully set up (they can respond to glitches, poor triggering, etc).

If you are using a crystal, some cheapo scope probes can add enough capacitance to cause problems.  

 

You might also make something called a “gimmick capacitor” to make a capacitor with only 1pF or so of capacitance. This is done by twisting two short insulated wires together. Connect one wire end to the scope probe, and use the end of the other wire to connect to the crystal. Try both ends of the crystal. You can think of one side of the crystal as the “input” and the other as the “output”. You want the “input” side, that is driven by the internal active device that is the clock oscillator. It will be a stronger signal, less subject to disturbing the frequency.

Thanks to CATVTech dot com for the image. You could make it a lot shorter than this, maybe about 1/4 or 1/3 as long.

https://www.quora.com/How-can-the-oscilloscope-measure-the-XTAL

When in the dark remember-the future looks brighter than ever.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you everyone!  I seem to get a decent sine wave off pin 10 and espcially 9.  15.976 MHz... good enough for me :)  But this is the XTAL not the internal clock signal. 

 

So I am making progress.  My oscilliscope is a very cheep one but good enough for a beginner like me for now. 2 channel , 100MHz like I said, and should let me compare the clock signal to the 9600 baud serial I see off the digital pin one in the Arduino world ( physical pin 3 of the chip).

 

I can see the digital square wave just fine... I am just trying to see the square clock signal now on ch 2 so i can compare them. 

 

Thank you again!

I am a new AVR programmer. I am learning alone out of books, the Internet, etc. Please excuse me if I ask simple questions. Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you!  I will keep ity mind for sure once I have a stable wave form to see.

I am a new AVR programmer. I am learning alone out of books, the Internet, etc. Please excuse me if I ask simple questions. Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AVR_Beginner wrote:

I meant to say any Arduino or C code:  sorry, my kid is tugging at me LOL

 

Are you asking for code to program the CKOUT fuse?

 

To program the fuses on the ATmega328P used by the Arduino Uno R3,

you need to use an ISP programmer attached to the 6-pin header on the R3.

 

You can use another Arduino board (doesn't have to be an Uno R3) to act as

an ISP programmer.  Here is a tutorial from Instructables:

 

How to Change Fuse Bits of AVR Atmega328p - 8bit Microcontroller Using Arduino (LINK).

(The avrdude software used comes with the Arduino IDE.)

(Note: I haven't performed the procedure in the above tutorial, so I can't vouch for it.)

 

You need to be careful when changing the fuses.  Engbedded Atmel AVR Fuse Calculator (LINK)

is a very handy tool to determine the correct values of the fuse bytes.

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AVR_Beginner wrote:
But this is the XTAL not the internal clock signal. 

It certainly is the internal clock signal.  Where do you think the internal clock comes from?

 

Jim

 

EDIT:

What I mean to say is that the internal clock is derived from the crystal, and as long as the DIV8 fuse is not programmed your internal clock will be the same as the crystal.  I read the fuse settings of one of the UNOs I have sitting here and the DIV8 fuse is not programmed, so the internal clock would be 16Mhz

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

Last Edited: Tue. Feb 13, 2018 - 02:48 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:
It certainly is the internal clock signal.  Where do you think the internal clock comes from?   Jim   EDIT: What I mean to say is that the internal clock is derived from the crystal, and as long as the DIV8 fuse is not programmed your internal clock will be the same as the crystal.  I read the fuse settings of one of the UNOs I have sitting here and the DIV8 fuse is not programmed, so the internal clock would be 16Mhz

 

 

Jim:  Thank you.  I obviously see it as a clean sine wave  (off the XTAL pins) . I was hoping to see is the square wave the chip uses. Is is correct to say then that the clock speed of the Uno is infact 16MHz and it is not slower (prescaled)?  In other words what ever digital clock signal I hope to see will be 16MHz.

 

So now I just have to get to see the square wave.

I am a new AVR programmer. I am learning alone out of books, the Internet, etc. Please excuse me if I ask simple questions. Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Chuck99 wrote:
You can use another Arduino board (doesn't have to be an Uno R3) to act as an ISP programmer.  Here is a tutorial from Instructables:   How to Change Fuse Bits of AVR Atmega328p - 8bit Microcontroller Using Arduino (LINK). (The avrdude software used comes with the Arduino IDE.) (Note: I haven't performed the procedure in the above tutorial, so I can't vouch for it.)

 

Thank you!  I will check it out after work tonight.

I am a new AVR programmer. I am learning alone out of books, the Internet, etc. Please excuse me if I ask simple questions. Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you want to look at the serial output (posr 8) you sould send

"U" -ie, chr (0x55) in binary 010101-  ... "continuously" (in a loop)

 

Last Edited: Tue. Feb 13, 2018 - 12:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

AVR_Beginner wrote:

Is is correct to say then that the clock speed of the Uno is infact 16MHz and it is not slower (prescaled)?  In other words what ever digital clock signal I hope to see will be 16MHz.

 

No. See the datasheet for the description of the CLKDIV8 setting.

 

In fact, see the datasheet for a perfectly good diagram which shows the 'Clock Distribution' inside the chip.

"This forum helps those that help themselves."

"How have you proved that your chip is running at xxMHz?" - Me

"If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AVR_Beginner wrote:
I was hoping to see is the square wave the chip uses.
That's probably just your grounding, not using 10X probes or the quality of your scope (is 16MHz some small fraction of it's "top sample rate" - like is it just specified as 50MHz or something?)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

On the crystal pins you will not see a square wave, instead you will see a "dirty" done wave.

If the OP has an Atmel programmer or an avrdude he/she can simply turn on the clock out fuse and see the magical square wave desired.

Jim

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a simple ISP boot programmer made out of two Unos.  It lets me load the Arduino boot loader to any 328P-PU chips I buy that do not have the Arduino boot ,loader already installed. Is there some way i could use this to "turn on" the fuse I need to see the square clock signal (at a pin)?

I am a new AVR programmer. I am learning alone out of books, the Internet, etc. Please excuse me if I ask simple questions. Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, you can use avrdude to do that, but be careful with the fuses, you can brick your MCU if you mess with the wrong settings.

But why do you need 2 Unos? One is enough to use as programmer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

IIRC, those UNO's mimic an AVRISPMKII or STK500.  You might be able to use Studio and then you can simply go into device programming and a simple checkbox will solve all.

 

Jim

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Any particular reason you want to see the "square wave"?

 

If it is academic, or just to play with the clock output "Fuse", then so be it.

 

But know that once you have measured the sin wave at 16.whatever MHz, the square wave will also be 16.whatever MHz.

Inside the micro, the sin wave is converted to a square wave, they have exactly the same frequency.

 

Also know that when you put an O'scope probe on one of the Xtal pins it will, hopefully slightly, change the frequency.

That would be a reasonable reason to want to see the actual clock out, output square wave.  That signal is buffered from the micro's oscillator, and probing that signal won't change the oscillator's frequency.

 

Once you have a programmer that lets you read (or read and write) the "Fuses", then it is easy to see if the Divide by 8 Fuse is set or not.

 

One could also write a simple program to flash an LED at once / second.

Define the micro's clock as 16 MHz in the program's header.

If the LED flashes at 1 Hz then all is good, the micro is running at 16 MHz.

 

If the LED flashes slowly, at 1/8th its expected flash rate, then you know that the Divide By 8 Fuse is enabled.

 

The quickie LED clock check is very easy, and reasonable when one is using a new board.

 

I think it is rather rare to take the time, effort, and trouble to actually exactly measure the clock frequency when one is using an external Xtal as the selected clock source.

 

JC

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One could also write a simple program to flash an LED at once / second.

To avoid questions & all the uncertainty about whether a "bad" rate is actually due to any timers settings  (top?,  bottom?,  CTC?,  std?, OCRA?, TCCRA1?)... I prefer the no-doubt way:

 

loopy:		sbi PORTB, PB1	;2 cycles...(1 on xmega & avr8L)
		nop		;1 cycle
		nop		;1 cycle
		nop		;1 cycle

		cbi PORTB, PB1	;2 cycles...(1 on xmega & avr8L)
		nop		;1 cycle
		rjmp loopy	;2 cycles  ...10 total cycles

This little snip requires no register setup (other than setting port directions, DDRB ) and gets straight to the result.  
Using a 20MHz Xtal, you'd measure a 2MHz pin frequency.   This also verifies the any system clock prescaler software setting is proper & taking hold. Thereafter, you're certain any timer issues are due to their setup.

 

 

 

When in the dark remember-the future looks brighter than ever.

Last Edited: Wed. Feb 14, 2018 - 05:36 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
This little snip requires no register setup (other than setting port directions, DDRB ) and gets straight to the result.   Using a 20MHz Xtal, you'd measure a 2MHz pin frequency.   This also verifies the any system clock prescaler software setting is proper & taking hold. Thereafter, you're certain any timer issues are due to their setup.

 

 

I think avrcandies might be on to something here.  If I use this ASM code he presented then can i assume my "clock signal" will be darn close to the real internal clock?  I am just looking to see how the rising and falling edges I see in the 9600 baud serial output match up to the rising / falling edges of the clock signal... in short I am tryingt o do an eye pattern of sorts. It is just to lean: I am not actually diagnosing any problem.

I am a new AVR programmer. I am learning alone out of books, the Internet, etc. Please excuse me if I ask simple questions. Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC wrote:
Any particular reason you want to see the "square wave"?   If it is academic, or just to play with the clock output "Fuse", then so be it.

 

 

Just to learn. 

I am a new AVR programmer. I am learning alone out of books, the Internet, etc. Please excuse me if I ask simple questions. Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AVR_Beginner wrote:

...can i assume my "clock signal" will be darn close to the real internal clock? 

 

It will be EXACTLY one tenth of the CPU's internal clock in frequency.

"This forum helps those that help themselves."

"How have you proved that your chip is running at xxMHz?" - Me

"If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:
see the datasheet for a perfectly good diagram which shows the 'Clock Distribution' inside the chip.

Right here:

http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_Datasheet.pdf

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I guess flipping a pin on and off to make a square wave will work but then won't my 9600 baud "hello world" on pin 3 get messed up... I wanted to see both work at the same time to visually compare.

I am a new AVR programmer. I am learning alone out of books, the Internet, etc. Please excuse me if I ask simple questions. Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you want a micro to do "two things at once" put at least one of the processes on an interrupt.

 

Having said that most AVR timers can happily toggle pins on/off completely independent of any CPU activity once started so I would just set a timer going and have it toggle a pin. Doesn't have to be up in the MHz if you don't want. In fact if you bring it down into Hz range you could stick an LED on it and count flashes!

 

A 328 has OCOA on pin 12 for example - consider setting up timer 0 to toggle it on/off. It will be "full swing" so should give a nice clean square wave on a scope. Something like:

int main(void) {
    // make the timer output pin (PD6) an output
    DDRD = (1 << 6);
    // set to toggle OCoA pin and run CTC
    TCCR0A = (1 << COMA0) | (1 << WGM01);
    // Set some frequency
    OCR0A = 13;
    // start the timer
    TCCR0B = (1 << CS00);
    // get on with other stuff...
}

Vary the 13 put in OCR0A to vary the frequency.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you want to have a nice square wave (even if your scope is a slow one, or has bad connections ), did you think of the Arduino - to be linked with this forum chapter- library "tone" https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/

 edited : maybe it is redundant with Clawson post ; but I use this, with a LCd and some buttons, to generate arbitrary frequency square waveforms -eats very little CPU, as it uses HW timers...

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 I wanted to see both work at the same time to visually compare.

why???  I thought you just wanted to verify your clock rate was proper.

When in the dark remember-the future looks brighter than ever.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Answer in #24 was "Just to learn"

edited : I bet OP got a new oszilloscope (Xmas gift?)  and begins to play with it (and idea of having Arduino as a square wave generator to test is a way to play with it - a NE555 could do the same job, then)

 

Last Edited: Wed. Feb 14, 2018 - 04:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
I thought you just wanted to verify your clock rate was proper.

sounds like it's going to be another of those threads that goes on & on wandering from one topic to another ...

 

frown

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
that goes on & on wandering from one topic to another
And the issue with that is? That is the kind of MO here. No harm that I can see.

 

(he said derailing the thread so it's even more off-topic ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AVR_Beginner wrote:

I guess flipping a pin on and off to make a square wave will work but then won't my 9600 baud "hello world" on pin 3 get messed up... I wanted to see both work at the same time to visually compare.

 

So just enable the CLKOUT fuse.

"This forum helps those that help themselves."

"How have you proved that your chip is running at xxMHz?" - Me

"If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
And the issue with that is?

The discussion no longer bears any relation to the Topic Title.

 

Makes searching / browsing much harder.

 

Better to stick to one topic per thread, IMO.

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
Makes searching / browsing much harder.
Like ANYONE ever really does that!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Don't people experiment anymore?

Are we afraid to try things?

Do we need to run to the 'net and ask before we try?

 

 

Top is 16MHz on the CLKO pin

Bottom is the rising edge of a 9600 baud bit on the TX pin

 

Total pin to run that test was about 2 minutes.

"This forum helps those that help themselves."

"How have you proved that your chip is running at xxMHz?" - Me

"If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, having an arduino is a good way to learn things -seems it was "how to use an oscilloscope" ;

perhaps modifying fuse settings is not a good idea : arduino IDE does hide fuse settings.

Remain Clawson (HW timer) solution in #28 or Arduino (HW + very fast interrupts; can be easily controlled and is very flexible) if OP wants to have square waves easy to display (hooking a probe on a resonator is complicated; Ardiono has ready to use plugs for ordinary pins) while a program does other things...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Don't people experiment anymore?

Are we afraid to try things?

Do we need to run to the 'net and ask before we try?

Don't people experiment anymore?...No, it is prohibited for your own protection and our legal team strongly recommends against it.  laugh

Are we afraid to try things?  ....Only if you are willing to void our warrantyindecision

Do we need to run to the 'net and ask before we try?  ...Yes, we have a permission slip available online  crying

 

When in the dark remember-the future looks brighter than ever.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How did you manage to have 9600 bauds triggering your oscilloscope?

How did you mnage to have some signal **before* 9600 bauds rise?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

cheeky

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

How did you mnage to have some signal **before* 9600 bauds rise?

That's the supreme power of the digital storage scope...it's essentially storing away the waveform(s) all the time, then when desired trigger occurs, you can view what happened after or before the trigger.  Old analog scopes could only give the afterwards, since there was no storage (neglecting analog storage scopes, which were somewhat like a photographic plate).  

 

 

 

edit: changed their to there!!!  hate when that happens

When in the dark remember-the future looks brighter than ever.

Last Edited: Wed. Feb 14, 2018 - 05:57 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dbrion0606 wrote:
How did you manage to have 9600 bauds triggering your oscilloscope?

He's just triggering on the rising endge of CH2:

 

How did you mnage to have some signal **before* 9600 bauds rise?

The clock signal is just running continuously 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If he was triggering at the edge of CH2, display would be either unstable or depending upon luck to syncronize with rising edge of 9600 bauds.

 

I prefer avrcandies story. But the "supreme power  of digital storage" can be a circular buffer (or something else, but I do not know what).

If it is a circular buffer, oscilloscope should be circular, too... (else, there is unoccupied space)

Last Edited: Wed. Feb 14, 2018 - 06:48 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If he was triggering at the edge of CH2, display would be either unstable or depending upon luck to syncronize with rising edge of 9600 bauds

Note, with storage scopes ...you can set it to trigger one time only (single shot acquisition)--like taking a picture!!

 

But many scopes are now "sophisticated"  enough to find  the leading edge of even a strange wave like a uart character (with enough timing gap between chars)..There are also advanced triggering modes for the real tough situations (A must be high for xxx before B falls low for xxx after C rises 5 times).

When in the dark remember-the future looks brighter than ever.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My serial signal is 0x55 being continuously sent as 1 start bit, 8 data bits, and a 1 stop bit, giving me a square wave output.

 

And yes, as it is a digital scope, I can see signals both before and after the trigger point. Think of it as a sliding window on a set of signals.

"This forum helps those that help themselves."

"How have you proved that your chip is running at xxMHz?" - Me

"If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Because of all that has been discussed above, one of the important parameters when choosing a digital scope is the sample memory size.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:
Don't people experiment anymore? Are we afraid to try things? Do we need to run to the 'net and ask before we try?     Top is 16MHz on the CLKO pin Bottom is the rising edge of a 9600 baud bit on the TX pin   Total pin to run that test was about 2 minutes.

 

Brian: His is what i am hoping to see eventually!  I hope to see clean square waves to make eye patterns and the like and compare that to the clock signal.. If

 I could see this (what your screen shot shows) with clean rise and fall times, etc , as square waves then I have exactly what I hope to see.

 

dbrion0606:  

I did not get this cheep oscilliscope as a gift.  I bought it with the money I earn (It was ~ $300 and I bring home less then $500 a week after taxes and all). I bought with the express intent to learn. I work all day in a totally unrelated field (logging). I am in my mid 50's with a family. I am doing this (learning as time permits with a kid to care for) because I want to. Because I am genuinely interested and curious.  This is not for a class assignment and not for an employer. Its just for me. 

 

Everyone thank you for all the help. 

 

My goal with this small step is to see the skirts on the clock line up with the skirts on the Serial waves. Its just another small step for me to learn. But in doing so opens doors to other things in the future as I learn more. 

I am a new AVR programmer. I am learning alone out of books, the Internet, etc. Please excuse me if I ask simple questions. Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oops!  Typo on my last post. I ment to say 
 

 

Brian: This is what i am hoping to see eventually!

I am a new AVR programmer. I am learning alone out of books, the Internet, etc. Please excuse me if I ask simple questions. Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My goal with this small step is to see the skirts on the clock line up with the skirts on the Serial waves.

That isn't likely, and as the O'scope image above already shows, that isn't the case.

 

There are multiple clock signals running around inside the micro, and some systems have internal 1/2 clock time and 1.5 clock time synchronizers, etc.

 

Plus who knows how many gates the USART's final data transmission module's signals have to go through, perhaps many.

The Clock Out signal likely has relatively few gates to go through from the original master clock signal to the I/O pin.

 

Each gate the signal transitions though has a small delay.

Different paths for different signals through the chip will lead to an offset in the leading edge signal transitions.

 

The offset is likely pretty fixed, (stable), but isn't 0.0000... seconds.

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, I hope I did not make any blunder (in this case, would be an unintended one) .

Your 100 Mhz samples, a priori, at a 10 ns rate ; A 16 Mhz Arduino has a period of 62.5 ns . Makes at most 7 samples per period.

Try to draw a square wave/sinusoid/trinagular wave and pick 6 ot 7 samples: you will see it is unsufficient..

 

With such an oscilloscope you can : verify an oscillator oscillates , show PWM output  (a voltmmeter and a lowpass filer may work, too, but it is not as beautiful; needs synchro) test low/middle  frequency response (BTW Arduino can generate arbitrary wave forms : see http://interface.khm.de/index.ph... and its links -changing their sine table leads to arbitrary form-).

Maybe there a mixed logical/analog part (sniffs I2C, serial -displays chars-, many other : gabotronic oscilloscope (google tagss)  has a very cheap -40E$- jewel, ATMEL based, which handles mixed signals but samples at "only" 40k/s IIRC)

 

I had noticed, from your 1rst post, there were instabilities -and I asked stupid questions w/r trigger, and you got intelligent answers, in good Omericon-

(I tried -and manage to "make" oscilloscope with Arduino -15 ksamples/second, in the best case- and Ti (1000 ks/s, 60 times faster than arduino) + RPi and a big screen (I hid trigger, because I decided it would be "one shot" -no worry for memory size, when I typed a given character, it was THE sync/trigger  -my eyes, optical nerve and brain -sous réserve d'existence-  are very slow...)

Last Edited: Thu. Feb 15, 2018 - 09:49 AM

Pages