1. 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.
    Dismiss Notice

Simple PIC storage digital oscilloscope

Discussion in 'Oshonsoft' started by camerart, Jan 29, 2017.

  1. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,324
    Likes:
    11
    Location:
    Dorset UK.
    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.
     
  2. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,254
    Likes:
    961
    Location:
    Loveland, CO USA
    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.
     
  3. dougy83

    dougy83 Well-Known Member

    Joined:
    May 18, 2008
    Messages:
    2,672
    Likes:
    215
    Location:
    Brisbane, Australia
    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.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,254
    Likes:
    961
    Location:
    Loveland, CO USA

    Maybe we should think about why.
    What is the clock frequency for the SPI?
    What ancient oscilloscope?
     
  6. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,324
    Likes:
    11
    Location:
    Dorset UK.
    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.
     
  7. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,324
    Likes:
    11
    Location:
    Dorset UK.
    Hi D,
    Logic analyser good idea, I prefer something smaller if possible.

    I'll look into fast PICs.

    C.
     
  8. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,324
    Likes:
    11
    Location:
    Dorset UK.
    Hi R,
    HAMEG HM512.
    I tried videoing two channels, and it almost works, but the camera is blinded by me turning up the intensity for the purpose.
    C.
     
  9. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,324
    Likes:
    11
    Location:
    Dorset UK.
    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.
     

    Attached Files:

    • OSC.jpg
      OSC.jpg
      File size:
      104 KB
      Views:
      190
  10. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,187
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi,
    You have not stated the X timebase scale on the image.
    This is a clip from the manual.
    E
    A008.gif
     
  11. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,254
    Likes:
    961
    Location:
    Loveland, CO USA
    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.

    [​IMG]
    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)
    [​IMG]
    Is there a way to slow down the SPI clock? Can you change the code?
     
  12. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,324
    Likes:
    11
    Location:
    Dorset UK.
    Hi Eric,
    I don't remember the X timebase setting, and I couldn't repeat the test, as the oscilloscope isn't consistant.
    Thanks for the manual snippet, leider spreche ich kein deutsch, but I get much of it.
    C.
     
  13. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,324
    Likes:
    11
    Location:
    Dorset UK.
    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.
     
  14. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,254
    Likes:
    961
    Location:
    Loveland, CO USA
    Last edited: Jan 30, 2017
  15. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,324
    Likes:
    11
    Location:
    Dorset UK.
  16. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,324
    Likes:
    11
    Location:
    Dorset UK.
    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: Jan 31, 2017
  17. sagor1

    sagor1 Member

    Joined:
    Dec 11, 2014
    Messages:
    52
    Likes:
    2
    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...
     
  18. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,324
    Likes:
    11
    Location:
    Dorset UK.
    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.
     
  19. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,324
    Likes:
    11
    Location:
    Dorset UK.
    Hi R,
    The PIC in question is running on it's internal crystal, could this have any relevance?
    C.
     
  20. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,254
    Likes:
    961
    Location:
    Loveland, CO USA
    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.
     
  21. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,324
    Likes:
    11
    Location:
    Dorset UK.
    Hi R,

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

    Thanks, C.
     

Share This Page