RE: Problems with SPI and ADS8320

"Jeremy Kongs" <jeremy.kongs-6tN4nzCoH/[email protected]>
Newsgroups gmane.comp.hardware.microcontrollers.tini
Message-ID <[email protected]>
Try setting the spi delay to 1.  There is a bug with a Delay of 0 in the spi
of 1.12.

Let me know if you still see incorrect behavior.

Jeremy

> -----Original Message-----
> From: tini-admin-6tN4nzCoH/[email protected] [mailto:[email protected]]On Behalf Of
> Erio Magnoni
> Sent: Tuesday, February 03, 2004 9:28 AM
> To: tini-6tN4nzCoH/[email protected]
> Subject: [TINI]Problems with SPI and ADS8320
>
>
> Hi everyone!
> I'm using Tini 1.12 on a DS80C400 with an ADS8320 and I have some
> problems
> understanding the bits this ADC returns me. I use the xmit method
> of the SPI
> class to send 3 empty bytes of data and the ADC, as I see watching the
> oscilloscope, returnes digital data. I also see from the datasheet
> of the ADS8320 that timing is correct, as I have 5 clock edges for the
> sample&hold of the ADC and the 16 bit data following with MSB
> first. As the
> xmit method detail says, read data is returned in the same
> positions within
> the array, but I have some problems understanding the bits the
> ADC gives out.
> In fact on the oscilloscope I view different bits than the ones I
> print out on
> screen.
> Is my code incorrect? Can SPI library only execute 8-bit
> transfers? Do I have
> to modify it to execute 16-bit transfers as the ADS8320 is a
> 16-bit ADC? How
> can I do it?
> SPI in initialized as follows:
>
> spi = new SPI(0, true, true, false, false, false, false, true);
>
> Here is a part of my JAVA source code where I perform reading
> from the ADC:
> ...
> void convertAtoD(double samples) {
>
>                 System.out.println("Converting...");
>
>                 byte[] spidata = new byte[3];
>
>                 for(int i=0; i<3; i++)
>                 {
>                         spidata[i] = (byte) 0x00;
>                 }
>
>                 spi.xmit(spidata, 0, spidata.length);
>
>
>                 for(int i=0; i<3; i++)
>                 {
>                         System.out.print("Bitstream: ");
>                         printBinary(spidata[i]);
>                 }
>
>
>                 samples = (samp * V_MAX) / 65535.0;
>
>                 System.out.println();
>                 System.out.println(samples);
>                 System.out.println("Conversion completed.");
>
> }
>
> private static void printBinary(byte b) {
>                 for (int val = 7; val >= 0; val--) {
>                         System.out.print((b >> val) & 1);
>                 }
>
>                 System.out.println();
> }
> ...
>
> Thanks a lot!
>
> Best regards,
> Erio Magnoni.
>
> SUPSI-DTI, Manno, Switzerland
>
>
> -------------------------------------------------
> This mail sent through IMP: https://mail.die.supsi.ch
> _______________________________________________
> TINI mailing list
> TINI-6tN4nzCoH/[email protected]
> To UNSUBSCRIBE, edit your profile, or see list archives:
> http://lists.dalsemi.com/mailman/listinfo/tini

_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.