That is usually the case. In order to read a byte from a slave register you must transmit a "dummy" byte from the master. By putting 0x00 in the SPI data register you will initiate the SPI cycle. Once the dummy byte has been shifted out your SPI data register will hold the value from the slave. Master controls the SPI transfer.. every time you send something from the master by putting something in the data register you will get back something from the slave. Sometimes that might be garbage that you disregard, and at other times it is what you need. I assume that in your case you have to send the control byte to start the AD conversion and then your result is waiting for you in the register of the slave. If you change the MOSI to GPIO the SPI module will not generate the clock signal, hence your AD converter is not going to shift anything out. Hope this helps. Cheers, m. PS: don't forget the famous SSEL that has to be pulled high if LPC210x is your only master on the bus, by means of pull up resistor or by tying it to VDD. _____ From: Rodrigo [mailto:rodrigo@...] Sent: Monday, June 07, 2004 8:57 AM To: lpc2000@yahoogroups.com Subject: [lpc2000] SPI I'm trying to communicate with a AD converter through a SPI interface. In the AD datasheet, it's said that I need to have DIN line (from AD) in low level when it's transmitting. This means that I have to write 0x00 on MOSI line while i'm receiving the data. The problem is, there's just one data register, can I do that? If I can't, can I change just the MOSI pin to GPIO mode and put on low level while I'm receiving data? Rodrigo Martins Dpto. Projeto Intermetric Instrumentos Ltda Yahoo! Groups Sponsor ADVERTISEMENT <http://rd.yahoo.com/SIG=129p4cgm7/M=298184.5022502.6152625.3001176/D=groups /S=1706554205:HM/EXP=1086699357/A=2164331/R=0/SIG=11eaelai9/*http:/www.netfl ix.com/Default?mqso=60183351> click here <http://us.adserver.yahoo.com/l?M=298184.5022502.6152625.3001176/D=groups/S= :HM/A=2164331/rand=566221722> _____ Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/lpc2000/ * To unsubscribe from this group, send an email to: lpc2000-unsubscribe@yahoogroups.com <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe> * Your use of Yahoo! Groups is subject to the Yahoo! <http://docs.yahoo.com/info/terms/> Terms of Service.
Message
RE: [lpc2000] SPI
2004-06-07 by Milos Prokic
Attachments
- No local attachments were found for this message.