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

Add clock cycle to SPI

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



Joined: 14 May 2007
Posts: 33

View user's profile Send private message

Add clock cycle to SPI
PostPosted: Wed May 01, 2013 12:26 pm     Reply with quote

#use SPI (MODE=0,FORCE_HW,BITS=8,MSB_FIRST)

this make 8 clk cycle to get/put data on spi interface, i need 1 clk cycle (start condition), send 8 bit (8 clk cycle), and 1 clk cycle (stop condition)

is possible make this or i must make my routine that emulate SPI?

thanks
temtronic



Joined: 01 Jul 2010
Posts: 9229
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed May 01, 2013 12:31 pm     Reply with quote

simple enough to make your own software SPI but we'd like to know WHAT SPI device you're using that needs start-data-stop format?

That 'format' sounds more like good ol' 'sync'ed RS-232' data(8-n-1) not SPI, though it could also be an I2C device.....

Please tell us what the device is, maybe a link to the datasheet !

hth
jay
fastlink30



Joined: 14 May 2007
Posts: 33

View user's profile Send private message

PostPosted: Wed May 01, 2013 12:41 pm     Reply with quote

http://www.ti.com/litv/pdf/slos743f

this device can work with slave select or not, without, need start/stop condition on spi (look 5.9.5.1 on datasheet)
alan



Joined: 12 Nov 2012
Posts: 357
Location: South Africa

View user's profile Send private message

PostPosted: Wed May 01, 2013 1:44 pm     Reply with quote

Your start condition is when you take SPI ENABLE low and stop condition is when SPI ENABLE is high.
fastlink30



Joined: 14 May 2007
Posts: 33

View user's profile Send private message

PostPosted: Wed May 01, 2013 1:46 pm     Reply with quote

I do not use ENABLE signal, to substitute this signal i need 1 clk cycle before and after I have sent bits.
Is required by the chip that i use.
Ttelmah



Joined: 11 Mar 2010
Posts: 19520

View user's profile Send private message

PostPosted: Wed May 01, 2013 4:21 pm     Reply with quote

The hardware SPI can't do this.
Software SPI, can be told to use 10 bits, and then you would need to copy the byte to send into a 16bit variable, and rotate this one bit.
You can also do this with the USART (if your chip has one), but on most chips only in half duplex. However the chip does only seem to only ever receive or send, so with an external logic gate this could be made to work.
However using SS, is easier, and likely to be much more reliable (it'll recover if a bit is lost, which the version without SS won't).....

Best Wishes
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Wed May 01, 2013 6:22 pm     Reply with quote

i had the misfortune to work with the 7960 a while back

honestly - I ended up using a 40 pin pic , and the PARALLEL method of
control for that part

you will need to bit bang the SPI mode- and since you are implicitly a slave,
( for reading)
also -
you will need to use INTs with a pin on port B to handle the IRQ function..
fastlink30



Joined: 14 May 2007
Posts: 33

View user's profile Send private message

PostPosted: Thu May 02, 2013 2:30 am     Reply with quote

to ttelmah: i have implemented my routine for dedicated SPI, in the next revision of the PCB i want use the SS (make the things more 'standard')

asmboy: why misfortune? INT is already connected with port that handle IRQ function Wink

thanks to all the people
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Thu May 02, 2013 6:46 am     Reply with quote

Quote:

INT is already connected with port that handle IRQ function


All to the good - it was not clear that you understood this key point.
Happy for your success.
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