SPI Using PIC18F4550 Question


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    637

    Default SPI Using PIC18F4550 Question

    Hi all,

    I'm trying to use the SHIFTOUT and SHIFTIN commands on a 18F4550 to control and NFC module. The port labels on the 18F4550 refer as SCK, SDI, and SDO. However, the SPI ports on the NFC module are named MOSI, MISO, SCK, SSEL.

    The SSEL can be any of the PIC I/O digital pins. All it's needed is a change of state to LOW to enable the SPI communication. Now, are we talking about two different types of SPIs here since the names are different. How do the SDI and SDO relate to the MISO and the MOSI?

    Any help will be greatly appreciated. Thank you,

    Robert
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,387


    Did you find this post helpful? Yes | No

    Default Re: SPI Using PIC18F4550 Question

    How do the SDI and SDO relate to the MISO and the MOSI?
    THE mssp module of the pic can be either spi or i2c so the pin names aren't exactly the same
    miso is sdo would connect to mosi on your device
    misi is sdi would connect to miso on your device
    sck is sck would connect to sck on your device

    pbp has no spi hardware module commands at all , shiftin /out they can bit bang on any pins

    in you examples folder there are demo spi slave/master programs

  3. #3
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    637


    Did you find this post helpful? Yes | No

    Default Re: SPI Using PIC18F4550 Question

    Quote Originally Posted by richard View Post
    miso is sdo would connect to mosi on your device
    misi is sdi would connect to miso on your device
    Hmm, I'm not sure about that. I know that SDI (Master) goes connected to SDO (Slave) and SDO (Master) goes to SDI (Slave). But, a quick search in Google for SPI wiring will bring you some circuits like this,

    Name:  2000px-SPI_three_slaves.svg.png
Views: 788
Size:  30.4 KB

    As you can see MOSI goes to MOSI and MISO goes to MISO. . I am trying to connect my PIC to an NFC module that only accepts SPI. The ports of the module are labeled as MOSI, MISO, SCK, and SSEL. I haven't had any luck getting a response from the module yet. Can I use SHIFTIN and SHIFTOUT in this case?
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,387


    Did you find this post helpful? Yes | No

    Default Re: SPI Using PIC18F4550 Question

    you will need to refer to the docs of your nfc module to verify what is an input and what is an output to be sure. as a general rule inputs connect to outputs , connecting outputs together is bad and connecting inputs together is going to go nowhere
    see this extract for a rfm69w module the pins function and role is explicitly defined
    Attached Images Attached Images  

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,387


    Did you find this post helpful? Yes | No

    Default Re: SPI Using PIC18F4550 Question

    Can I use SHIFTIN and SHIFTOUT in this case?
    shiftin/out will work just fine once you know what's an input and what's an output

  6. #6
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    637


    Did you find this post helpful? Yes | No

    Default Re: SPI Using PIC18F4550 Question

    Richard, I've finally got it to work. Thanks for your help. My next step would be to use the hardware MSSP as SPI after I have all my commands working right.
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

Similar Threads

  1. Newbie SPI question
    By Scampy in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 7th June 2015, 10:20
  2. question about the pin to pin connections on a SPI interface
    By wdmagic in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th January 2013, 13:03
  3. Replies: 9
    Last Post: - 15th September 2012, 02:29
  4. PIC18F4550 question VS PIC16F887
    By lerameur in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 20th February 2011, 23:54
  5. Question on 3v to 5v SPI
    By BertMan in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 11th October 2005, 02:17

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