Re: Confirm 18f47k40 MSSP setting and allocation using PSS
in my original drafts of this code [p10 dual colour led panel] i did use cs/ss signals to sync transmission.
it turned out that the time taken to clear/set cs pin and the impost of two extra pins was as waste of resources an an unnecessary
complication. it works fine with out it.
i don't have a k40 chip to test with and don't see why mcc insists on a ss pin . i developed code on a k22 chip
and did not use the ss2 pin , loss of a pin is not tragic.
sheldons comments are cluttering the story and some are just incorrect
this is what i would use
Code:
TRISB = $F2
TRISD = $FF ;ss2
ANSELD = $FE ;ss2
ANSELB = $C0 ; just the spi pins
WPUD = $01 ;ss2
WPUB = $30 ; just the spi pins
RB0PPS = $0F ;RB0->MSSP1:SCK1
RB2PPS = $10 ;RB2->MSSP1:SDO1
RB3PPS = $12 ;RB3->MSSP2:SDO2
SSP1CLKPPS = $08 ;RB0->MSSP1:SCK1
SSP2DATPPS = $0D ;RB5->MSSP2:SDI2
SSP1DATPPS = $0C ;RB4->MSSP1:SDI1
SSP2CLKPPS = $09 ;RB1->MSSP2:SCK2
SSP2SSPPS = $18 ;RD0->MSSP2:SS2 it seems to insist on an ss pin
SSP1STAT = $40 ;bog standard spi
SSP1CON1 = $2A ;fosc/4 with ssp1add divider
SSP1ADD = $01 ; clock divide 2
SSP2STAT = $40 ;bog standard spi
SSP2CON1 = $25 ;bog standard spi no ss
;spi pin allocations
' sck1 PORTB.0
' sck2 PORTB.1 ' wired to portb.0
' sdo1 PORTB.2
' sdo2 PORTB.3
' sdi2 PORTB.4
' sdi1 PORTB.5
' ss2 PORTD.2
Warning I'm not a teacher
Bookmarks