This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Initialize unused I/O & peripherals MSP430G2330

Genius 3300 points
Other Parts Discussed in Thread: MSP430G2230, UCD8220, MSP430G2553, MSP430G2233

I am using MSP430G2330 in a battery powered application, so has to be low powered & also all unsued I?O or peripherals should be off. I have made below settings, are these settings ok?

1. Vcc is powered by 3.3V.

2. Reset pin is pulled by 47K & decoupled by 2.2nF.

3. Clk pin is left floating.

4. Three I/O used:

   A) P1.6 as output
   	P1OUT &= (uint8_t)(~REG8_BIT_6);
   	P1DIR |= REG8_BIT_6;
   	P1SEL &= (uint8_t)(~REG8_BIT_6);      
    
   B) P1.7 as output
  	P1OUT &= (uint8_t)(~REG8_BIT_7);
   	P1DIR |= REG8_BIT_7;
   	P1SEL &= (uint8_t)(~REG8_BIT_7);

    C) P1.2 as analog in
      ADC10AE0 |= REG8_BIT_2;

5. Unsued I/O on pinout = p1.5.
Datasheet of MCU says that P1.0, P1.1, P1.3, P1.4, P2.6, and P2.7 are in device but not on pinout so be properly terminated. So I made them as input pull down:

/* unused pin */
	P1OUT &= (uint8_t)(~REG8_BIT_5);       /* pin is pulled down */
	P1DIR &= (uint8_t)(~REG8_BIT_5);       /* pin is input */
	P1SEL &= (uint8_t)(~REG8_BIT_5);

	P1OUT &= (uint8_t)(~(REG8_BIT_0 | REG8_BIT_1 | REG8_BIT_3 | REG8_BIT_4));       /* pin is pulled down */
	P1DIR &= (uint8_t)(~(REG8_BIT_0 | REG8_BIT_1 | REG8_BIT_3 | REG8_BIT_4));       /* pin is input */
	P1SEL &= (uint8_t)(~(REG8_BIT_0 | REG8_BIT_1 | REG8_BIT_3 | REG8_BIT_4));

	P2OUT &= (uint8_t)(~(REG8_BIT_6 | REG8_BIT_7));       /* pin is pulled down */
	P2DIR &= (uint8_t)(~(REG8_BIT_6 | REG8_BIT_7));       /* pin is input */
	P2SEL &= (uint8_t)(~(REG8_BIT_6 | REG8_BIT_7));

6. Are all these settings ok? Is there any other peripherla which needs to be turn off or all peripherals are turn of by default?

  • There is no CLK pin. Do you mean the TEST pin?

    The MSP430G2230 datasheet says that you should configure the VLO as source for ACLK. (I'd guess otherwise, it would try to start up a crystal.)

    • The brownout protection cannot be disabled.
    • The watchdog runs by default, but you can set the HOLD bit.
    • The timer does not run unless configured to do so.
    • The USI is held in software reset unless configured otherwise.

  • In general, pull up/down an IO pin will increase power consumption. So, it is not a good idea to pull up/down an unused IO pin. Sometimes, it is more power saving to set it as output.

    I would suggest you to connect a current meter to your board and test the pin configuration one by one until the minimum current is got.
  • Hi rcfocus,

    Configuring unused I/O's as input with pullups/downs is fine and will not cause increased currents.

    Thanks and best regards,
    Christoph
  • The GPIOs P1.0, P1.1, P1.3, P1.4, P2.6, and P2.7 are implemented but not available on the device pinout.
    To avoid floating inputs, these digital I/Os should be properly configured.
    The pullup or pulldown resistors of the unbounded P1.x GPIOs should be enabled, and the VLO should be selected as the ACLK source

    So just follow that and you should be OK.

    A macro would be nice to clean it up.

    #define read &
    #define clear &= ~
    #define set |=
    #define toggle ^=
    
    #define MYPIN1(y,x)        (P1 ##x y BIT6)
    #define MYPIN2(y,x)        (P1 ##x y BIT7)
    #define XIXO(y,x)          (P2 ##x y (BIT6 | BIT7))
    #define UNBOUNDED(y,x)     (P1 ##x y (BIT0 | BIT1 | BIT3 | BIT4))    // internal on g2230
    
    int main(void){
    BCSCTL3 |= LFXT1S_2;  // selecting VLOCLK for ACLK
    
    XIXO(clear,SEL) ;     // P2.6 and P2.7 are terminated by selecting VLOCLK
    XIXO(clear,SEl2);     // so this may not be needed
    XIXO(clear,DIR);    
    XIXO(clear,OUT);
    XIXO(set,REN);  
    
    UNBOUNDED(clear,DIR);
    UNBOUNDED(clear,OUT);
    UNBOUNDED(set,REN);
    
    MYPIN1(set,DIR);
    MYPIN2(set,DIR);
    ...
  • Hi Christoph,

    Several years ago, I also thought all unused I/O should be set as input. But for some projects requiring as low as 1uA current consumption, I was stuck. I spent a lot of time to study MSP430 I/O structure and realised that there is current leakage when configured as input And the leakage gets worse with pull up/down. Finally, I set all unused pins as output, instead of input, to overcome this issue.

    There are some articles from TI discussing this issue, take this for example.

    If the concerned scale is mA then input is fine. If it is about uA then my suggestion is to test different I/O configurations one be one with current meter.

  • Hi rcfocus,

    if unused ports are just configured as inputs you will see increased currents in your application. To prevent this, I/O's must have a defined state. This can be achieved by configuring them as output and set them high/low or configure them as inputs with enabled pullup/down resistors.

    Thanks and best regards,
    Christoph
  • Hi Christoph,

    Thanks for your advice.

    I understand that an input pin should not be floating. So, I am pretty sure I enabled pull-up/down if I set an unused pin as input. Anyway, it has been years ago and I don't have MSP430 project on hand to do the experiment right now.

  • BTW, what is MSP430G2330? I simply cannot find any information about it.

    There is an Application Note:

    200-VA HF Inverter Design Based on UCD8220 and MSP430G2330 for Automotive Apps Analog & Mixed-Signal slva578 - TI.com


    (www.ti.com/.../litabsmultiplefilelist.tsp

    Despite of fact that the word MSP430G2330 in its title, the body of this document seems to indicate actually either a MSP430G2553 or a MSP430G2233 is being used.

    Is there a such a thing called MSP430G2330?

  • BTW, what is MSP430G2330?

    MSP430G2230 spelled wrong.

**Attention** This is a public forum