anthonyquek 0 Posted August 20, 2013 Share Posted August 20, 2013 I would like to confirm my understanding of the GPIO setup on the MSP430 - as I am seeing behaviour that suggests that internal Timer A1 functionality takes priority over the GPIO selection for a specific pin. I am using TI's sample application which is using Timer A1 as the source of System Time Scheduling Quote Link to post Share on other sites
spirilis 1,264 Posted August 20, 2013 Share Posted August 20, 2013 The port schematics in the datasheet are the definitive authority for this information. I'll see if I can d/l the datasheet to my phone and take a look... Sent from my Galaxy Note II with Tapatalk 4 Quote Link to post Share on other sites
spirilis 1,264 Posted August 20, 2013 Share Posted August 20, 2013 Hmm, the schematic is confusing here but it looks like both P2SEL and P2DIR connect to the logic block switching between P2OUT and "Module X" (presumed to be Timer_A1 in this case). Not sure what this means. Sent from my Galaxy Note II with Tapatalk 4 Quote Link to post Share on other sites
pabigot 355 Posted August 21, 2013 Share Posted August 21, 2013 The table following the schematic may be more informative. If you want to leave P2.2 as a GPIO, make sure BIT2 (0x04) is clear in P2SEL (P2SEL &= ~BIT2). Then the value of P2DIR & BIT2 determines whether the GPIO is an output (non-zero) or an input (zero). In this case the settings related to TA1 are irrelevant, and the pin's output value or input behavior is completely disconnected from its peripheral function. If you want to use it as a TA1 peripheral function make sure BIT2 is set in P2SEL (P2SEL |= BIT2). Then the following two clauses apply: If P2DIR & BIT2 is non-zero then the peripheral function is TA1.1, i.e. the clock output from CCI 1 of TA1. You might use this, for example, to PWM an LED. If P2DIR & BIT2 is zero then the peripheral function is TA1.CCI1A, i.e. TA1 can be programmed to capture rising and or falling edges of an incoming signal on P2.2 and record the value of TA1's 16-bit clock counter in the corresponding TA1CCR1 register. You might use this, for example, to determine how wide a measured pulse is. I think what's above at best rephrases what's in the data sheet and user's guide, but perhaps a rephrase will help you understand how to make it do what you want. I think the answer to your question is that you can use the pin as an input, you just have to make sure the peripheral function is disabled (which it is, based on your description). Quote Link to post Share on other sites
anthonyquek 0 Posted August 21, 2013 Author Share Posted August 21, 2013 Thanks for everyone's inputs. Quote Link to post Share on other sites
tripwire 139 Posted August 21, 2013 Share Posted August 21, 2013 What's P2REN set to? If bit 2 is high the pull-down resistor would be enabled, since P2OUT bit 2 is clear. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.