|
|
View previous topic :: View next topic |
Author |
Message |
aaronik19
Joined: 25 Apr 2011 Posts: 297
|
SPI Driver |
Posted: Sun Oct 11, 2015 10:26 am |
|
|
Dear All,
at the moment, I am converting SPI library from CC5x to CCS. In the CC5x the SPI file is called as:
Am i right to say that in CCS the SPI is included as:
Code: | #USE SPI (MASTER, CLK=PIN_C3, DI=PIN_C5, DO=PIN_C4, ENABLE=PIN_A0, MODE=0, BITS=8, STREAM=SPI_1) |
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Oct 11, 2015 10:55 am |
|
|
Quote: | #USE SPI (MASTER, CLK=PIN_C3, DI=PIN_C5, DO=PIN_C4, ENABLE=PIN_A0, MODE=0, BITS=8, STREAM=SPI_1) |
1. You didn't give your PIC. But the hardware SDI pin on many PICs is
pin C4, and the hardware SDO pin is Pin C5. In other words, you
have them reversed.
The three parameters for the hardware pins could be replaced by one
symbol, SPI1. Then the compiler will automatically use the correct
hardware SPI pins.
2. Also, you are missing the baud rate.
3. Also, even if you have the correct pins listed, the compiler will create
code for software SPI. If you want to use the hardware SPI module,
you have to add the FORCE_HW parameter.
Finally, you must use the spi_xfer() function to send/receive bytes in
your main program. If you are using the stream parameter, then you
must also include the SPI_1 stream name in spi_xfer(). See the CCS manual.
https://www.ccsinfo.com/downloads/ccs_c_manual.pdf |
|
|
|
|
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
|