CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

SPI Slave Select Issue
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ttelmah



Joined: 11 Mar 2010
Posts: 19326

View user's profile Send private message

PostPosted: Wed Dec 18, 2019 2:15 pm     Reply with quote

Good.

However I have to say if you want speed use the spi_read and spi_write.
Unfortunately, though I like what spi_xfer offers, it is poorly written.
It is a lot slower. The code to handle multiple bytes is there even if you
don't use it, and this makes the instructions much less efficient.
It is silly, since it'd be easy for the optimiser to remove the extra
overhead, if single byte is selected. It just doesn't do so... :(
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 18, 2019 5:13 pm     Reply with quote

The CCS manual doesn't mention that ENABLE is used in SPI slave
mode to turn on the \SS pin. It implies that it's an optional setting to
be used in Master mode:
Quote:
ENABLE=pin - Optional pin to be active during data transfer.


I think CCS should add a new parameter as shown below:
Quote:

SS_ENABLE=pin - Enables the \SS pin in hardware SPI Slave mode.
(The default is \SS disabled). For PICs with fixed pins for SPI functions,
the hardware \SS pin must be specified here or the compiler will give an error.
Ttelmah



Joined: 11 Mar 2010
Posts: 19326

View user's profile Send private message

PostPosted: Wed Dec 18, 2019 11:58 pm     Reply with quote

Yes, that would make a lot more sense.
eddfish



Joined: 09 Dec 2019
Posts: 9
Location: United Kingdom

View user's profile Send private message

PostPosted: Thu Dec 19, 2019 6:09 am     Reply with quote

temtronic wrote:
Dang frustating to say the least.
Mighty happy you're 'up and running' though !! Got ANY hair left ??


My hair is rapidly dissapearing, soon I will have more forehead than humpty dumpty. I would note that it dissappears faster working on embedded elements of projects than on anything mechanical.

PCM programmer wrote:
The CCS manual doesn't mention that ENABLE is used in SPI slave
mode to turn on the \SS pin. It implies that it's an optional setting to
be used in Master mode:
Quote:
ENABLE=pin - Optional pin to be active during data transfer.


I think CCS should add a new parameter as shown below:
Quote:

SS_ENABLE=pin - Enables the \SS pin in hardware SPI Slave mode.
(The default is \SS disabled). For PICs with fixed pins for SPI functions,
the hardware \SS pin must be specified here or the compiler will give an error.


Whilst it doesn't mention it in the manual (which really is frustrating), personally on reflection it looks like ENABLE was always entirely intended for Slave Select, both for the master and the slave.

ENABLE DELAY and ENABLE ACTIVE are both functions that you might well want for SS from the master but wouldn't need for a diagnostic pin (plus they have specced a diag output)

Whilst what you suggest would be more robust, certainly for me even if they just changed the manual to say:

ENABLE=pin - Slave Select. Optional pin to be active during data transfer. Gives a Slave Select pin output in MASTER mode. Must be specified for Slave Select input in SLAVE mode.

I would have specced it right in the first place.
eddfish



Joined: 09 Dec 2019
Posts: 9
Location: United Kingdom

View user's profile Send private message

PostPosted: Thu Dec 19, 2019 6:13 am     Reply with quote

Ttelmah wrote:
Good.

However I have to say if you want speed use the spi_read and spi_write.


I will bear that in mind for the future. In this particular project, speed isn't that much of a major limitation, but its good to understand the pros and cons.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group