View previous topic :: View next topic |
Author |
Message |
Ttelmah
Joined: 11 Mar 2010 Posts: 19546
|
|
Posted: Wed Dec 18, 2019 2:15 pm |
|
|
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
|
|
Posted: Wed Dec 18, 2019 5:13 pm |
|
|
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: 19546
|
|
Posted: Wed Dec 18, 2019 11:58 pm |
|
|
Yes, that would make a lot more sense. |
|
|
eddfish
Joined: 09 Dec 2019 Posts: 9 Location: United Kingdom
|
|
Posted: Thu Dec 19, 2019 6:09 am |
|
|
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
|
|
Posted: Thu Dec 19, 2019 6:13 am |
|
|
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. |
|
|
|