Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Erikk
PostPosted: Sep 30, 2007 - 08:30 PM
Rookie


Joined: Sep 23, 2006
Posts: 22
Location: netherlands

hi,

i have a microcontroller with a ADC connected to its SPI bus. i know how i can start transmitting data over an SPI bus to an slave, thats just filling the TDR register. but i have to read from the adc.
the adc sends a 24 bit value in 3 stages of 8 bits. how do i start a read from the adc? (the uC is the AT91SAM7S256 from atmel) and the adc is an MCP3551.

what do i have to do so the adc starts sending a byte?
 
 View user's profile Send private message  
Reply with quote Back to top
DerAlbi
PostPosted: Sep 30, 2007 - 10:14 PM
Hangaround


Joined: Sep 30, 2007
Posts: 228
Location: Germany

Normally you just have to give the SPI-slave a clock signal to make it send..
If you have to configure the ADC before receiving data depends on its protocol that you may find in the datasheet.

greets
 
 View user's profile Send private message  
Reply with quote Back to top
Erikk
PostPosted: Sep 30, 2007 - 10:19 PM
Rookie


Joined: Sep 23, 2006
Posts: 22
Location: netherlands

well the problem is (and i read the datasheet of both) i dont know how to start te clock. if i want to send ill have to place somthing in the tx register and the uC will do everything for the SPI part like emmiting a clock. but i cant find anything in the datasheet about starting a read.
 
 View user's profile Send private message  
Reply with quote Back to top
vpapadopoulos
PostPosted: Oct 01, 2007 - 12:50 AM
Rookie


Joined: Aug 12, 2007
Posts: 48
Location: Greece, Thessaloniki

Erikk wrote:
well the problem is (and i read the datasheet of both) i dont know how to start te clock. if i want to send ill have to place somthing in the tx register and the uC will do everything for the SPI part like emmiting a clock. but i cant find anything in the datasheet about starting a read.


So let the uC to do the work for you.

Write dummy character to output and the uC will produce the clock that will drive the slave SPI .
After each dummy character send, read the Master SPI receive register. (You will be surprised to find the reply information there!)

SPI is a very simple protocol.
Regards,
Viron.
 
 View user's profile Send private message  
Reply with quote Back to top
Erikk
PostPosted: Oct 01, 2007 - 09:23 AM
Rookie


Joined: Sep 23, 2006
Posts: 22
Location: netherlands

yes i come up with that after i posted.

thanx!
 
 View user's profile Send private message  
Reply with quote Back to top
squidgit
PostPosted: Oct 01, 2007 - 09:25 AM
Raving lunatic


Joined: Sep 14, 2003
Posts: 4228
Location: Queanbeyan, Australia

Erikk wrote:
...AT91SAM7S256 from atmel...
The forum for that part is over at http://www.at91.com/

-S.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits