--- In lpc2000@yahoogroups.com, "suyash" <suyash_shembekar@...> wrote: > > Hi all, > > I am using ARM LPC2106, I have following doubts about the > configuration of PINSEL0 and PINSEL1. > > 1)where exactly should I define it in the initialsation? > In common system initialisation or at the eac and every periphral > (ex. UART0 or SPI etc.) initialisation. It's your choice! I do most of the initialization in just one place in a function I call from main(). But, I don't think I like this approach. Next time I will set the USART pins in an initialization routine in the serial IO file. Same for SPI, I2C, etc. > > 2) suppose I want to use a single pin as multipurpose functioning, so > how do I have to take care of PINSELn. > will it be always overwritten everytime or else we need to mask it > and then modify it(for retaining its previous status). Again, it's a choice! You can modify a pin and leave it changed assuming any other function using the pin will change it as required. Or, you can change it back to the way you found it. There are certainly arguments for both. Either approach gets hairy if the pin is changed inside interrupt handlers... I don't have any code where this occurs - at least on ARM. I just wrote some code for the AVR where I spent a lot of time tri-stating a bidirectional data bus and in this case, every function left the bus floating. That was required because the external DRAM that was connected to the bus was also the frame buffer for the LCD display. So, I don't think there are rules. Put all the initialization in one place versus initialize in the same file where the device is used. Either way... Just get it done before you use the pin. Unless, of course, there is something connected to the pin that needs to be in a particular state quickly. In this case, you can put the code in crt.s and that's about as fast as you can get. Richard
Message
Re: PINSEL Queries
2006-05-31 by rtstofer
Attachments
- No local attachments were found for this message.