I am currently using the TS7200 with an SPI peripheral (ADXL345 accelerometer)
and am having huge problems reading multiple bytes of data on a single
transmission.
My accelerometer has the capabilities of performing multiple byte reads while
only asserting the chip select once, rather than reading one register on the
accelerometer at a time.
The procedure I use for single byte read is the following:
assert Chip Select
send Read register command //POKE8 -write register address of /
//ADXL345 to SSP Data Register
send 8 bits of data //clocks 8 bits of data into SSPDR
deassert Chip select
read SSP data register //PEEK8 -read SSPDR
print to terminal
For multi-byte transmissions I follow the same procedure except before
deasserting the Chip Select, I continue to send 8 bits of data, for each
register on the ADXL345 I would like to read from (in my case 6 registers, 3
axis and 2 for each axis).
The problem I am having is I am not sure that I am reading the SSP data
register at the correct time or if I am even reading the SSP data register at
all. I see the correct data on the oscilloscope, so I know that I am
communicating with the ADXL345 properly and that it is functioning properly.
However, when I read the SSP data register after each time I send the 8 dummy
bits meaning new data has shifted into the RX FIFO, I don't read what I see on
the scope.
I am using some of the source code provided by TS in the FTP repository called
tempsensor.c and use the POKEXX and PEEKXX functions to write and read to/from
the SSP data register. Because I have to open /dev/mem to perform those POKE
and PEEk functions I think something isn't working properly with the way I am
reading the SSP data register.
How do I know when the end of transmission has occurred? How do I know that
after I have sent out the 8 dummy bits to shift in new data that the data is
actually in the SSP register and is ready to be read?
Can anyone please help me???????? I am working on a school project and have
very limited time to get this done. Anything would help, thank you in advance!!
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|