View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Mar 02, 2009 5:41 pm |
|
|
Look at the SPI timing diagram on page 5 of the data sheet:
http://www.analog.com/static/imported-files/data_sheets/ADIS16209.pdf
The timing diagram shows that SCLK idles high and samples Din on the
rising edge. This is SPI mode 3. See the following web page:
http://www.totalphase.com/support/kb/10045/#modes
To implement this, add the following statements above main().
Code: | #define SPI_MODE_0 (SPI_L_TO_H | SPI_XMIT_L_TO_H)
#define SPI_MODE_1 (SPI_L_TO_H)
#define SPI_MODE_2 (SPI_H_TO_L)
#define SPI_MODE_3 (SPI_H_TO_L | SPI_XMIT_L_TO_H) |
Then put SPI_MODE_3 in your setup_spi() statement.
The SCLK frequency may be limited to only 1 MHz maximum, depending
on the mode of the ADIS16209 chip. You did not post your PIC's clock
speed. Let's assume it's over 16 MHz. Then you need to use this divisor
in your setup_spi() statement:
Also note from the ADSI16209 data sheet that there is a Startup Time
of 190 ms. Don't attempt to read data from the chip before that time
has passed. Put a delay_ms(200) statement at the start of main(). |
|
|
andreluizeng
Joined: 04 Apr 2006 Posts: 117 Location: Brasil
|
|
Posted: Mon Mar 02, 2009 5:44 pm |
|
|
I dont think so Guest. _________________ Andre |
|
|
Guest
|
|
Posted: Tue Mar 03, 2009 2:22 am |
|
|
Have you remembered the required 10K pull-ups on both SDA and SCL?
P.S. is that you Sam?
Gerry |
|
|
Ttelmah Guest
|
|
Posted: Tue Mar 03, 2009 3:11 am |
|
|
Anonymous wrote: | Have you remembered the required 10K pull-ups on both SDA and SCL?
P.S. is that you Sam?
Gerry |
Not on _SPI_.
Pull ups are needed for I2C, which is a 'open collector' bi-directional bus, but SPI does not need these.
Best Wishes |
|
|
libellej8
Joined: 03 Mar 2009 Posts: 2 Location: Dorset UK
|
|
Posted: Tue Mar 03, 2009 7:18 am |
|
|
Ttelmah wrote: | Anonymous wrote: | Have you remembered the required 10K pull-ups on both SDA and SCL?
P.S. is that you Sam?
Gerry |
Not on _SPI_.
Pull ups are needed for I2C, which is a 'open collector' bi-directional bus, but SPI does not need these.
Best Wishes |
Thanks Ttelmah,
I stand corrected.
Sam,
I have some code that I used for an AD rate gyro, ADIS16255 same family, that works. I can't publish it here as it is proprietary, but you have my e-mail address.
Gerry |
|
|
andreluizeng
Joined: 04 Apr 2006 Posts: 117 Location: Brasil
|
|
Posted: Tue Mar 03, 2009 8:14 am |
|
|
Gerry, I would be glad if you send it to me too =)
thanks..
regards. _________________ Andre |
|
|
priesty100
Joined: 16 Oct 2007 Posts: 6 Location: UK
|
|
Posted: Tue Mar 03, 2009 5:28 pm |
|
|
Thank you all for your help,
I hadn't realised about the CS being required to sync the devices. Not sure how I managed to miss that I was only reading in 8bits.
Hey Gerry, yeah, its me, see what happens when I'm removed from your watchful eye, I've been trying to get that to work all day!
Thank you all again.
Regards _________________ Sam |
|
|
mazen82
Joined: 10 Sep 2009 Posts: 22
|
|
Posted: Mon Oct 26, 2009 7:08 am |
|
|
where you able to get it to work? can you post the code? |
|
|
|