Advice on SPI Master-Slave Using Slave Select

Discussion on projects that are created by users and posted on mikroElektronika website.
Post Reply
Author
Message
Bill Legge
Posts: 235
Joined: 28 Oct 2007 03:16
Location: West Australia

Advice on SPI Master-Slave Using Slave Select

#1 Post by Bill Legge » 02 Jul 2022 02:06

I've just spent a day or two messing round with SPI comms and thought it may help someone else to explain what I've learnt?
The MCUs are 8bit PIC18F8722 with Fosc set to 40MHz.
The problems started when using the SLAVE SELECT (active low) control and eventually forced me to read the manual!
There must be a 'guard time' between the lowering of the SS and the start of data/clock and again after the last data/clock before the SS goes high.
The figures are quite specific but roughly 70Tcy to 80Tcy
The Xtal is 10MHz using 4XPLL. Fosc = 40MHz
So Tosc = 1000/40 = 25nS
1Tcy = 4*Tosc = 4*25 = 100nS
And allowing for a bit of capacitance I put guard delay into my code of 100Tcy = 100*100nS = 10uS
And suddenly everything worked!
I hope this helps someone?

Regards Bill Legge in Australia

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Advice on SPI Master-Slave Using Slave Select

#2 Post by filip » 05 Jul 2022 13:47

Hi,

Bill, thanks for your discovery, I'm sure our users will benefit from this! :)

Regards,
Filip.

Post Reply

Return to “User Projects”