Hi Lucy Looks like that will work. The only thing I do differnet is disable the recieve via the RRST in the SPCR1 until I expect data in. Phil --- In c54x@y..., "Lucy Jordan" <screaminglucy@y...> wrote: > > I'm not concerned with wasting cycles while I poll, so do you think the > following would work? > The dsp is the spi master. > > void spi_send () > { > check xrdy > write data to DXR > wait for rrdy //wait for output data to be shifted out > read DRR //clear rrdy for garbage data > } > unsigned char spi_receive() > { > check xrdy > write dummy data to DXR > wait for rrdy //wait for receive to complete > read DRR //this should be correct data? > } > > -----Original Message----- > From: Tony Zampini > Sent: Tuesday, October 08, 2002 9:02 AM > To: c54x@y...; Lucy Jordan > Subject: Re: [c54x] mcbsp spi receive > > Lucy, > Customarily, when you clock data out on an SPI channel, data is > simultaneously > clocked in to your receive register. You have to determine whether this > data > is > useful, or should be ignored. It sounds like in your case, the data > should > be ignored. Then, when you want to receive data, you need to transmit > dummy > data, then immediately do a couple of reads of the SPI receive register > to > flush it > out of any buffered data, and then wait for the real receive dat to come > in. > Ususlly this is done with interrupts to avoid wasted CPU cycles in a > wait > loop. > > All of the above assumes that you are programming the *master* SPI > device. > > Hope this helps, > > Best Regards, > Tony > ______________________________ > Tony Zampini (tony@d...) > Director of Engineering > DSP Global Inc. > 33 Plan Way, Bldg. #4 > Warwick, RI 02886 > Tel. 401-737-9900 > FAX: 401-739-4197 > www.dspglobal.com > > ----- Original Message ----- > From: "Lucy Jordan" <screaminglucy@y...> > To: <c54x@y...> > Sent: Monday, October 07, 2002 10:34 PM > Subject: [c54x] mcbsp spi receive > > When I transmit over spi it also seems to be receiving (when i don't > > want it to). > > Should I transmit whatever I need to. _Then_ enable the receive part > > of the mcbsp, then send a "dummy" transmit to get the clocks, then > > read DRR, then disable receive, and transmit again...? will this give > > me the correct data? as of now, i am getting the wrong data despite > > the fact that the data is being correctly output on DR by the ext SPI > > device (verified on a scope). > > > > > > > > > > > > _____________________________________ > > Note: If you do a simple "reply" with your email client, only the > author > of this message will receive your answer. You need to do a "reply all" > if > you want your answer to be distributed to the entire group. > > > > _____________________________________ > > About this discussion group: > > > > To Join: Send an email to c54x-subscribe@y... > > > > To Post: Send an email to c54x@y... > > > > To Leave: Send an email to c54x-unsubscribe@y... > > > > Archives: http://www.yahoogroups.com/group/c54x > > > > Other Groups: http://www.dsprelated.com > > > > > > ">http://docs.yahoo.com/info/terms/ > > > > > > |