SPI clock always running...how to do that?

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have at90usb1287 and I want to use spi hardware to connect to external ADC which supports SPI. Here, I am able to see data and clock signal out only when controller sends the data out. After that clock is unavailable at SCK pin. Is there a way to keep it running all the time?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Is there a way to keep it running all the time?

Perhaps, using USART as SPI master. But why do you want/need such a facility? What device is this?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There are ADCs that use the SPI clock to clock themselves.

One solution is to write a couple of bytes when the conversion is to be done, simply ignoring the returned data. Maybe select something else that is not physically present. Then, read the ADC. OR, maybe it returns data bits, bit by bit, as it is clocked. So, you need to tell us more about what the ADC is.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The ADC LTC1404 from linear technology. http://cds.linear.com/docs/en/da...
It requires enable pulse (Conv) to be applied during clock is present. So I wonder when I give pulse to Conv. pin, clock would be there or not.
Is this a possibility that I ignore SCK pin and connect external crystal to clock pin of ADC? Or any other way to do that?
I just want to read bytes form ADC, it does not require to send bytes to ADC, just clock and Conv. signal pulse.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

msd wrote:

It requires enable pulse (Conv) to be applied during clock is present. So I wonder when I give pulse to Conv. pin, clock would be there or not.

Looking at Figure 13, and their code, it looks like you can connect ADC-CONV to SPI Data OUT, and simply send data with a leading HI, other 7 bits low, then send 00.
That totals 16 clocks as they mark and the first clock starts conversion.

You then need to shuffle the reply, to bit-align as needed.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Who-me wrote:

Looking at Figure 13, and their code, it looks like you can connect ADC-CONV to SPI Data OUT, and simply send data with a leading HI, other 7 bits low, then send 00.
That totals 16 clocks as they mark and the first clock starts conversion.

You then need to shuffle the reply, to bit-align as needed.

Does receiving buffer UDR stores 2 bytes or overrides with the second incoming byte? I am using SPI in USART mode.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One byte is in the RX buffer. The second byte is in the shifter. So you can get all 16 bits.

Just try it and see for yourself.

Looking at the timing diagrams, there are several ways to start the conversion. e.g. clocking a 0x80 out on MOSI and receiving on MISO then shifting the result.

You could even clock 0x40 out on MOSI, and do one less shift. And doing 0x20 would mean no shifts at all.

Untested.

Yes, I can see that USART_MSPI could give you a seamless clock signal on XCK pin. However, I doubt if the ADC is particularly fussy about the exact timing.

David.

p.s. the regular SPI has got a RX buffer. So you can receive 16 bits just like USART_MSPI. e.g. one from SPDR and the second from the shifter.

The biggest advantage of USART_MSPI is that it has a TX buffer. So it will immediately refill the shifter from the TX buffer as soon as the current shift has completed. ---- no gaps !

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I am using SPI in USART mode.

USART in SPI mode :)
Quote:
Does receiving buffer UDR stores 2 bytes or overrides with the second incoming byte?

It can hold two bytes in RX FIFO and third one in a shift register. Same applies to USART in USART mode. So it overwrites with the fourth incoming byte.

No RSTDISBL, no fun!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey...everyone I need some help again, regarding USART in SPI mode, I am interfacing different serial ADC.
http://www.mouser.com/ds/2/256/M...
It requires 24 continuous clock pulses for one conversion, however I can only get continuos 16 clock pulses by giving one control byte and padding 8 0's. I tried to give padding 16 0's but clock stops after 16 clock pulses. I don't know how to get 24 continuos clock at XCK pin for conversion to complete?
Thanks.