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  [ 8 posts ] 
Author Message
 Post subject: spi chipselect configuration - by user?
PostPosted: Thu Sep 10, 2009 10:38 am 
Offline

Joined: Thu Sep 10, 2009 10:23 am
Posts: 2
Hi,

I have a question:
Is there any way to use user-defined chipselect for the SPI?
Meaning, use another line as a chipselect instead of the peripheral chipselect?

I saw that I can configure the PCS field of the SPI_MR (Mode Register) to 0xF (the forbidden value). If I do so, can I use a user-defined GPIO as a chipselect line?

thanks.

P.S.
I use ATMEL AT91sam7x256


Top
 Profile  
 
 Post subject: Re: spi chipselect configuration - by user?
PostPosted: Thu Sep 10, 2009 1:26 pm 
Offline

Joined: Thu Dec 02, 2004 2:28 pm
Posts: 454
hello,
you can use any gpio port as long as your software cares about the state of the port.
as soon as your software would like to use the pdc you have to use the dedicated cs ports.

regards
gerhard


Top
 Profile  
 
 Post subject: Re: spi chipselect configuration - by user?
PostPosted: Thu Sep 10, 2009 1:44 pm 
Offline

Joined: Thu Sep 10, 2009 10:23 am
Posts: 2
Hello,

My software is using the PDC and do cares of the GPIO's state.
But how do I configure the periph to use a user-defined chipselect?
Should I write in the PCS field of SPI_MR the value 0xF?
Could you please post here an example code? It will be very helpful.

Thanks again.


Top
 Profile  
 
 Post subject: Re: spi chipselect configuration - by user?
PostPosted: Fri Sep 11, 2009 7:05 am 
Offline

Joined: Thu Dec 02, 2004 2:28 pm
Posts: 454
NNewUser wrote:
My software is using the PDC and do cares of the GPIO's state.

this will work as long as you don't change the slave.

NNewUser wrote:
But how do I configure the periph to use a user-defined chipselect?
Should I write in the PCS field of SPI_MR the value 0xF?

don't care about the PCSD field.

regards
gerhard


Top
 Profile  
 
 Post subject: Re: spi chipselect configuration - by user?
PostPosted: Tue Feb 16, 2010 7:32 pm 
Offline

Joined: Sat Feb 13, 2010 1:05 am
Posts: 6
Hello,

I to am using the AT91SAM7S256 in my design and am trying to do the same thing. The solution doesn't seem quite clear from the previous posts.

gerhardf:

What do you mean when you say "as soon as your software would like to use the pdc you have to use the dedicated cs ports?" The dedicated cs ports are already being used for something else, does this mean I will never be able to use the pdc?

I am unsure whether to use fixed peripheral or variable. I would like the functionality of variable in that I can determine the SPI port configuration by simply setting bits 16-19 in the TX register when I am transmitting but when I set it up that way (the dedicated pins are not programmed to operate with the SPI but as GPIO instead) i can not transfer.

Should I be in fixed or variable mode? Can I program NPCS0-NPCS3 to be GPIO and leave it that way?


Top
 Profile  
 
 Post subject: Re: spi chipselect configuration - by user?
PostPosted: Tue Feb 16, 2010 10:28 pm 
Offline

Joined: Thu Dec 02, 2004 2:28 pm
Posts: 454
hello lusher,
if you use the pdc you have to use the dedicated NPCS0-NPCS3 port.
so you have to initialize the port multiplexer in the right way.

regards
gerhard


Top
 Profile  
 
 Post subject: Re: spi chipselect configuration - by user?
PostPosted: Wed Feb 17, 2010 12:23 pm 
Offline

Joined: Sat Feb 13, 2010 1:05 am
Posts: 6
Anyone care to take a crack at the other questions? I am still unsure as to how to set up the port. I am past needing example code but id still like to know how to set the configuration registers so that I don't mess with NPCS0-NPCS3 because I will be using them for other functions.


Top
 Profile  
 
 Post subject: Re: spi chipselect configuration - by user?
PostPosted: Wed Feb 17, 2010 9:36 pm 
Offline

Joined: Thu Dec 02, 2004 2:28 pm
Posts: 454
hello lusher,
enclosed you can find an older example of an spi interface with pdc.

regards
gerhard


Attachments:
AT91SAM7S64-SPI-PDC-VARIABLE-IAR430A-1_3.zip [290.58 KiB]
Downloaded 90 times
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

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: