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 CCS Technical Support

SPI Driver

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
aaronik19



Joined: 25 Apr 2011
Posts: 297

View user's profile Send private message

SPI Driver
PostPosted: Sun Oct 11, 2015 10:26 am     Reply with quote

Dear All,

at the moment, I am converting SPI library from CC5x to CCS. In the CC5x the SPI file is called as:

Code:
#include <SPI.h>


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

View user's profile Send private message

PostPosted: Sun Oct 11, 2015 10:55 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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