Menu

peripheral pin select for SPI

Help
2017-02-23
2017-02-23
  • David Stephenson

    I'm having trouble understanding how use the PPS to assign pins to for SPI communication.
    I am using a 16F18326. The assignment of SCK and SDO seem normal, but how do I assign the SDI to a pin?

     
  • Anobium

    Anobium - 2017-02-23

    The Send me a personal message.. I will send you the new PpSTool for GCB. It due for release next week but if you take the release candidate.. It has the tool included.

    Pete Everett has developed and it is very very simple.   We will formally launch next week.

    tool will set the port up with ease.

    Evan

     
  • Anobium

    Anobium - 2017-02-23

    The Send me a personal message.. I will send you the new PpSTool for GCB. It due for release next week but if you take the release candidate.. It has the tool included.

    Pete Everett has developed and it is very very simple.   We will formally launch next week.

    tool will set the port up with ease.

    Evan

     
  • Anobium

    Anobium - 2017-02-23

    Meanwhile for record, a working example, this is for the Ethernet Adapater.

    ~~~~'#option explicit
    #chip 16f18855,32
    #Config FEXTOSC_OFF, RSTOSC_HFINT32
    #Config WRT_OFF, CPD_ON, MCLRE_ON

    #include "ivalid35.htm"
    #include "..\ENC28j60_035.h"
    #include "..\ENC28j60_035_Aliases.h"
    
    
    'Set the PPS of the ports.
    UNLOCKPPS
      'USART
      RC0PPS = 0x0010     'RC0->EUSART:TX;
      RXPPS  = 0x0011     'RC1->EUSART:RX;
    
      'SPI
      RB3PPS = 0x0014     'RB3->MSSP1:SCK1;
      SSP1CLKPPS = 0x000B 'RB3->MSSP1:SCK1;
      SSP1DATPPS = 0x000C 'RB4->MSSP1:SDI1;
      RB5PPS = 0x0015     'RB5->MSSP1:SDO1;
    LOCKPPS
    ' more code.
    
    This is direct from the new tool.
    
    'Generated by PIC PPS Tool for Great Cow Basic
    'PPS Tool version: 0.0.3.0
    'PinManager data: 05/02/2017
    '
    'Template comment at the start of the config file
    '
    #startup InitPPS, 85
    
    Sub InitPPS
    
     'Module: MSSP1
     RB5PPS = 0x0015    'SDO1 > RB5   
    SSP1DATPPS = 0x000C    'RB4 > SDI1
    RB3PPS = 0x0014    'SCL1 > RB3
    SSP1CLKPPS = 0x000B    'RB3 > SCL1 (bi-directional)
    
    End Sub
    'Template comment at the end of the config file
    

    ~~~~

     
  • David Stephenson

    The tool seems to work nicely.
    Seems I was getting confused with uni-directional and b-directional pins.
    I take it the SS pin does not have to be specified through the PPS settings.

     
    • Anobium

      Anobium - 2017-02-24

      Really pleased the tool worked.

      Any changes recommended? Please send via a email.

       
  • Anobium

    Anobium - 2017-02-24

    Correct - SS pin does not have to be specified through the PPS settings.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.