Hardware SPI ?


Closed Thread
Results 1 to 4 of 4

Thread: Hardware SPI ?

  1. #1

    Default Hardware SPI ?

    I noticed that some of the PIC chips I use are equipped with what appears to be hardware SPI. This is part of the MSSP module on 12F1822, 16F1823 etc. Yet there doesn't seem to be any hardware SPI commands in PBP3. Are we missing something here (speed, functionality)?

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: Hardware SPI ?

    Hi,
    You're correct, there are no PBP commands for the MSSP-module, neither in SPI mode or I2C.
    However, it's actually quite easy to use "manually", at least for SPI (I've never used I2C so I can't say). There are example programs for both master and slave mode available in the Examples folder of your PBP3 installation.

    /Henrik.

  3. #3
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Hardware SPI ?

    Hi henrik ,

    I have the option of using the hardware spi for the cpu driving 2 x spi bused devices ( SD Card , RF module) with individual select pins for each.

    to date i have found the shiftout/ shiftin arrangements have worked well for the RF spi device and i have the code
    but not tried its with 2 or more SPI , so far or used the registers for the spi HARDWARE.

    i am wondering is there any advantage for multi SPI devices to use the hardware SPI than just use the software SPI in this case , and getting it to work using the hardware SPI

    Cheers

    Sheldon

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: Hardware SPI ?

    Hi,
    The obvious benefit is speed. The hardware SPI is (or can be) SO much faster than using the bit-banged routines. Then of course you can run it interrupt driven so it does its thing in the background instead "blocking" the processor. Then again, it's so fast that there might not be any benefit in using interrupts. It all depends on the amount of data to process etc etc...

    Using SHIFTIN/SHIFTOUT you can still have both devices on the same clock and data pins and run separate CS lines to each, just as you would with the hardware SPI, no special need to use a separate set of pins.

    /Henrik.

Similar Threads

  1. Hardware SPI with AD7680 16 bit ADC
    By Castor in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd June 2008, 09:01
  2. Hardware SPI with MAX3111E
    By KHsu in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 8th August 2007, 01:42
  3. SPI on a pic without hardware SPI?
    By modifyit in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 26th April 2006, 13:29
  4. how can i use I2C and SPI hardware
    By micro in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 22nd December 2005, 15:33
  5. Hardware SPI
    By Ron Marcus in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 7th June 2005, 14:23

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts