Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Simple PIC storage digital oscilloscope

Status
Not open for further replies.

camerart

Well-Known Member
Hi,
I'm trying to check up to four channels of SPI signals (For controlling devices using a PIC)
My ancient oscilloscope can't be used for this purpose.
I wonder if a PIC with 4x analogue inputs (analogue as there are different voltages 3.3-5V) could be used to monitor 4x channels to capture and store the times these channels switch?
Any ideas welcome.

Camerart.
 
Why can't you use a logic analyser? They are made for recording and analysing digital signals. You just need to have an input threshold voltage to suit the inputs.

If you use a PIC, you could power the PIC from 3V3 and use a series resistor to protect the input from the 5V SPI signals. You may find that the ADC is way too slow on most PICs for most SPI traffic. You still have to ensure that the PIC can handle the frequency of the SPI. If your PIC has enough timer capture modules, you can get them to record the timestamp of the edges precisely.
 
How fast do you want to sample? (bandwidth)

There is a thread on this forum, 2 years ago maybe, about a PIC scope. Very long thread.
Hi R,
I searched for the PIC scope, but didn't find it, no probs.

A quick search gave the SPI speed as 125kbps and anther 20mHz
C.
 
Why can't you use a logic analyser? They are made for recording and analysing digital signals. You just need to have an input threshold voltage to suit the inputs.

If you use a PIC, you could power the PIC from 3V3 and use a series resistor to protect the input from the 5V SPI signals. You may find that the ADC is way too slow on most PICs for most SPI traffic. You still have to ensure that the PIC can handle the frequency of the SPI. If your PIC has enough timer capture modules, you can get them to record the timestamp of the edges precisely.
Hi D,
Logic analyser good idea, I prefer something smaller if possible.

I'll look into fast PICs.

C.
 
Hi,
I've now got an image from the oscilloscope, it's not clear, but it is good enough for me to see enough.
I'm still interested in a PIC logic analyser.
Thanks C.
 

Attachments

  • OSC.jpg
    OSC.jpg
    104 KB · Views: 560
hi,
You have not stated the X timebase scale on the image.
This is a clip from the manual.
E
A008.gif
 
HAMEG HM512 = Two channels, 0-15 MHz (-3 dB)
Found this picture at https://www.radiomuseum.org (museum LOL)
The SPI might be clocking at 10mhz and the scope is 15mhz.

oscilloscope_hm_512_2_1106183.jpg

The falling edges are slow and the rising edges are fast. Strange it is usually the other way around. For TTL type signals. Something is slow! With out knowing the SPI frequency I can't say what is slow.
1) Maybe the SPI is good and this is the scope being slow. BUT Then the going up and the going down speed would be the same.
2) Maybe the scope is OK for this speed and the SPI is too slow. Maybe too much capacitance on the bus. (maybe 20mhz)
osc-jpg.103937

Is there a way to slow down the SPI clock? Can you change the code?
 
HAMEG HM512 = Two channels, 0-15 MHz (-3 dB)
Found this picture at https://www.radiomuseum.org (museum LOL)
The SPI might be clocking at 10mhz and the scope is 15mhz.


The falling edges are slow and the rising edges are fast. Strange it is usually the other way around. For TTL type signals. Something is slow! With out knowing the SPI frequency I can't say what is slow.
1) Maybe the SPI is good and this is the scope being slow. BUT Then the going up and the going down speed would be the same.
2) Maybe the scope is OK for this speed and the SPI is too slow. Maybe too much capacitance on the bus. (maybe 20mhz)

Is there a way to slow down the SPI clock? Can you change the code?

Hi R,
There is a way of slowing down the SPI, and I tried it, but I couldn't get any sensible signals from my scope.
I think I had better equipment, for this kind of thing.
C.
 
https://www.radiomuseum.org/r/hameg_oscilloscope_hm_512_2hm51.html
When I have problems with SPI it is because I have the transmitter and the receiver configured differently. (clock edge)

Hi R,
Thanks for the link, if I had time and inclination, I would restore it, but I really should get a more modern storage type, as I'm busy with other projects.

We've been working through the possible problems here: https://www.electro-tech-online.com/threads/spi-configuration.149998/ and I think from the subtle results I've been getting suggest, I build tighter circuits, with shorter SPI connections.

P.S. I got the scope from a museum where I worked, it was surplus, and I could see it was a fine machine.

Cheers. C.
 
Last edited:
Oshonsoft does have a digital scope license for building your own digital sampling software scope:
https://oshonsoft.com/digitaloscilloscope.php
Only drawback is you have to build it yourself and program the chips with the hex code you get with the license. I don't use it, but may be handy for projects that involve lots of signal transitions such as SPI, I2C, etc...
 
Oshonsoft does have a digital scope license for building your own digital sampling software scope:
https://oshonsoft.com/digitaloscilloscope.php
Only drawback is you have to build it yourself and program the chips with the hex code you get with the license. I don't use it, but may be handy for projects that involve lots of signal transitions such as SPI, I2C, etc...
Hi S,
Thanks for the link, I had forgotten this scope. I have been working on a project for a couple of years now, and this led to the project that I need the scope for, I'm reluctant to start another project or I may never open the curtains again:)
C.
 
HAMEG HM512 = Two channels, 0-15 MHz (-3 dB)
Found this picture at https://www.radiomuseum.org (museum LOL)
The SPI might be clocking at 10mhz and the scope is 15mhz.


The falling edges are slow and the rising edges are fast. Strange it is usually the other way around. For TTL type signals. Something is slow! With out knowing the SPI frequency I can't say what is slow.
1) Maybe the SPI is good and this is the scope being slow. BUT Then the going up and the going down speed would be the same.
2) Maybe the scope is OK for this speed and the SPI is too slow. Maybe too much capacitance on the bus. (maybe 20mhz)

Is there a way to slow down the SPI clock? Can you change the code?

Hi R,
The PIC in question is running on it's internal crystal, could this have any relevance?
C.
 
internal crystal
If you use a RS-232 serial connection, both ends MUST have good clocks.
You are using SPI where the clock is sent with the data. If your clock was running 1/2 speed there would be no problem. Even a little unstable clock would probably be fine.
I can not trust your pictures.....If I did trust your pictures then I would say you must have long wires or some problem like that. too many parts on the bus.
 
If you use a RS-232 serial connection, both ends MUST have good clocks.
You are using SPI where the clock is sent with the data. If your clock was running 1/2 speed there would be no problem. Even a little unstable clock would probably be fine.
I can not trust your pictures.....If I did trust your pictures then I would say you must have long wires or some problem like that. too many parts on the bus.
Hi R,

Yes, I'm using SPI. If you use the other thread in #15, I will update there.

Thanks, C.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top