• 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

Active 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.
 

dougy83

Well-Known Member
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.
 

camerart

Active Member
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.
 

camerart

Active Member
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.
 

camerart

Active Member
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

ericgibbs

Well-Known Member
Most Helpful Member
hi,
You have not stated the X timebase scale on the image.
This is a clip from the manual.
E
A008.gif
 

ronsimpson

Well-Known Member
Most Helpful Member
HAMEG HM512 = Two channels, 0-15 MHz (-3 dB)
Found this picture at http://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?
 

camerart

Active Member
HAMEG HM512 = Two channels, 0-15 MHz (-3 dB)
Found this picture at http://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.
 

camerart

Active Member
http://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: http://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:

sagor1

Active Member
Oshonsoft does have a digital scope license for building your own digital sampling software scope:
http://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...
 

camerart

Active Member
Oshonsoft does have a digital scope license for building your own digital sampling software scope:
http://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.
 

camerart

Active Member
HAMEG HM512 = Two channels, 0-15 MHz (-3 dB)
Found this picture at http://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.
 

ronsimpson

Well-Known Member
Most Helpful Member
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.
 

camerart

Active Member
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

EE World Online Articles

Loading
Top