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  [ 4 posts ] 
Author Message
 Post subject: Query in PIO
PostPosted: Thu Mar 31, 2011 6:59 pm 
Offline

Joined: Thu Mar 31, 2011 6:35 pm
Posts: 2
Dear Reader,
Please let me know the meaning of the following code supplied by Atmel :

#define PIN_USART0_RXD {1 << 26, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}

In simple words what is the difference bwtween
a. #define(A,B)
b. #define{a,B}

Recently I bought an ARM 926 board and found the above mentioned code as trial software.


Top
 Profile  
 
 Post subject: Re: Query in PIO
PostPosted: Thu Mar 31, 2011 8:18 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 574
a) Passes parameters
b) Is a compound statement / array entry

It sets up a GPIO initialization structure for pin PIOA.26, to the "A" side peripheral mux. So the pin on the device is connected to the receive pin of the UART Zero.

Is this a 9263?


Top
 Profile  
 
 Post subject: Re: Query in PIO
PostPosted: Mon Apr 04, 2011 11:39 am 
Offline

Joined: Thu Mar 31, 2011 6:35 pm
Posts: 2
Yes,
It is for AT91SAM9263_P863. But I am still confusion how this structure is used. I went through the files but could not find where it is being used; not only PIN_USART0_RXD but I tried other macros like PIN_SPI0_MISO, PIN_SPI0_NPCS3.
It is going beyond my comprehension how the structure is used for configuring a pin. I worked earlier on simple processors like 8051 and AVR 8 bit so finding this complex macro and uses a bit difficult.
Any suggestion or link would be highly appreciated.


Top
 Profile  
 
 Post subject: Re: Query in PIO
PostPosted: Mon Apr 04, 2011 5:23 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 574
They are used to build pin tables for the PIO_Configure() subroutine. The include file you found them in defines the board characteristics, whether it is used or not will depend on if the particular pin/peripheral is needed. If you use a slightly different board you just need to update the include file, this is how Atmel deals with the 9260-EK, 9263-EK, etc.

Here's how the text substitution macros work for the SDRAM pins

static const Pin pinsSdram[] = {PINS_SDRAM};

// Enable corresponding PIOs
PIO_Configure(pinsSdram, 1);

where board.h handles D16..D31 thusly..

/// List of all SDRAM pins definitions.
#define PINS_SDRAM {0xFFFF0000, AT91C_BASE_PIOD, AT91C_ID_PIOCDE, PIO_PERIPH_A, PIO_DEFAULT}

You could do this manually by programming the bits in the PIO controller "SFR", but that is prone to error, and you have a lot more pins. This method is cleaner and more efficient.


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

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 1 guest


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: