Author Topic: Consecutive SPI Writes  (Read 1969 times)

0 Members and 1 Guest are viewing this topic.

Offline MONODATopic starter

  • Contributor
  • Posts: 22
Consecutive SPI Writes
« on: June 24, 2013, 03:54:40 pm »
Hey I've working on a project which involves interfacing an IC which contains a DAC module via SPI. I'm using TI's TMS320F2807 DSP and am able to interface the DAC.

I want to write to the SPI interface as fast as possible but the SPI peripheral of the TMS320 keeps the /CS pin active between consecutive writes to the SPI channel and the DAC expects a rising edge on /CS between each write.

Any ideas as to how I can force this to occur?

Thanks
 

duskglow

  • Guest
Re: Consecutive SPI Writes
« Reply #1 on: June 24, 2013, 04:29:36 pm »
Use another output pin and AND it with /CS?
 

Offline Harvs

  • Super Contributor
  • ***
  • Posts: 1202
  • Country: au
Re: Consecutive SPI Writes
« Reply #2 on: June 25, 2013, 10:00:59 am »
I had a similar problem with the STM32F0 using the DMA with a DAC that needed exactly what you've just described. 

The easiest answer was to use the DMA to do a single word write (it needed 24bits per write) then trigger a tuned interrupt routine to toggle a GPIO pin that was used for _CS.  The key was to just write this naked ISR in assembly, then it only took a few CPU cycles to write the set and reset GPIO registers with a literal, re-enable the DMA to do another 3Byte transfer and return.
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 26907
  • Country: nl
    • NCT Developments
Re: Consecutive SPI Writes
« Reply #3 on: June 25, 2013, 10:12:54 am »
If the SPI interface has a buffer then you might as well use the interrupt routine to write all the data. Or set the word length longer (does it support 32 bit?).
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf