Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: SPI and chip select
PostPosted: Wed Jul 01, 2009 12:46 pm 
Offline

Joined: Sat Jun 27, 2009 3:53 pm
Posts: 1
Hello.

I'm successfully able to communicate with an accelerometer using the SPI (at91sam7x256). However, it was necessary to use a command line that I still kind of don't understand.

For example, when I want to get the accel. values, I just send the command byte and then a dummy byte to get the values:

// Request accel. values
write_spi(READ_BYTE | SINGLE_BYTE | REG_OUTX_L);
// X_axis low byte
xlow = write_spi(0xFF);

It's been working because after writing the command byte to SPI_TDR, if the dummy byte is sent, I set the LASTXFER bit to rise the NPCS. And there is the point that I got stuck: When using SPI and clearing CSSAT bit, the datasheet says that the NPCS rises after the TDR data has been sent. However, it NEVER happens unless a set the LASTXFER after the last byte of my wish...

Could anyone explain it to clear my mind please?

I really thank for the attention.

Sylvio


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: