How to clock SPI for use in bit banging

Discussion in 'Embedded Systems and Microcontrollers' started by emoney123, Dec 27, 2016.

  1. emoney123

    Thread Starter Active Member

    Jun 4, 2012
    32
    0
    hello,

    I am trying to decode asynchronous binary data stream without having to bit bang through the whole process. I assume i can use SPI to do this but am unsure of how to generate a clock for the SPI. Could someone who has some experience with this please give any guidance.
    Thank you
     
  2. MrChips

    Moderator

    Oct 2, 2009
    18,857
    6,032
    Begin by letting us know what processor you are using.
    Then what IDE platform.
    What language are you using, ASM or C?
    Where is the binary data stream coming from?
    What is the format of the data stream? NRZI, phase encoded?
    How many bits?
    Post an oscilloscope screen shot of the binary stream or a drawing of the waveform.
     
  3. shteii01

    AAC Fanatic!

    Feb 19, 2010
    4,667
    745
    Manufacturer does not have library for it?
     
  4. emoney123

    Thread Starter Active Member

    Jun 4, 2012
    32
    0
    I'm using a SAM (ARM) processor programming in C through AVR Studio.
    The binary data stream in coming from another application at 1.5MHz NRZ and I belive it is 80 bits long.
    I don't want to bit bang this so I was hoping there was a better way.
    Thanks
     
  5. dannyf

    Well-Known Member

    Sep 13, 2015
    2,196
    421
    use the hardware spi module.

    that depends on your definition of "better".

    "avr studio" is not "atmel studio". it would be quite difficult for you to use avr studio on a SAM.
     
  6. emoney123

    Thread Starter Active Member

    Jun 4, 2012
    32
    0
    Sorry, that was a typo... I meant to say Atmel Studio. Yes I believe I would like to use the hardware SPI module however I am unfamiliar with how I would do that. Specifically generating a clock for the serial stream.
     
  7. MrChips

    Moderator

    Oct 2, 2009
    18,857
    6,032
    It would help if you told us the application that is sending the data stream.
    SPI clock is generated by the SPI master.
    If the application is sending the data stream then it should be configured as the master and will generate the clock.
     
Loading...