View previous topic :: View next topic |
Author |
Message |
fastlink30
Joined: 14 May 2007 Posts: 33
|
Add clock cycle to SPI |
Posted: Wed May 01, 2013 12:26 pm |
|
|
#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: 9243 Location: Greensville,Ontario
|
|
Posted: Wed May 01, 2013 12:31 pm |
|
|
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
|
|
Posted: Wed May 01, 2013 12:41 pm |
|
|
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
|
|
Posted: Wed May 01, 2013 1:44 pm |
|
|
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
|
|
Posted: Wed May 01, 2013 1:46 pm |
|
|
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: 19539
|
|
Posted: Wed May 01, 2013 4:21 pm |
|
|
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
|
|
Posted: Wed May 01, 2013 6:22 pm |
|
|
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
|
|
Posted: Thu May 02, 2013 2:30 am |
|
|
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
thanks to all the people |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Thu May 02, 2013 6:46 am |
|
|
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. |
|
|
|