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.

MSP430F417: Error[Pe020]: identifier "P6REN" is undefined

Part Number: MSP430F417

Hello
I want to check the low / high status of the gpio pins on the msp430f417 card.
but I get the error "Error [Pe020]: identifier" P6REN "is undefined".
Is PxREN not supported on the card I am using?
If not, can you give me a suggestion?

How else can I check the low / high status?

  • Datasheet (SLAS340J) "peripheral file map" [p. 19] and P6 schematic [p. 46] indicate that there are no REN resistors, thus no P6REN register.

    To see the current state of the pins, read P6IN.

  • here is my code:

    #include "msp430.h"

    void main (void ) {

    WDTCTL = WDTPW + WDTHOLD;

    P6DIR |= BIT4; 
    // P6SEL &=~BIT4; 
    // P6OUT |= BIT4; 

    while(1){

    if((P6IN & BIT4)==1){        //P6.4 pin high
    P6OUT |=BIT4;                //motor driver
    __delay_cycles(1000);   //wait
    }

    else{                            
    P6OUT ^=BIT4;              //motor stop
    __delay_cycles(6000);   //wait
    }

    }

    }

    What I want to do here is to stop when the stepper motor falls short.
    I see the stepper motor short circuit.
    but it doesn't stop.
    can you tell me my mistake?

  • Hi Sedanur,

    This device doesn't support switchable GPIO input states.  Please see this related thread:

    https://e2e.ti.com/support/microcontrollers/msp430/f/msp-low-power-microcontroller-forum/882448/msp430f417-gpio-default-status

    BR,
    Leo

  • if((P6IN & BIT4)==1){        //P6.4 pin high

    This test will never be true, since the result will either be =0 or =BIT4 (0x10). Try:

    if((P6IN & BIT4)!=0){        //P6.4 pin high

    -------------

    That said: Since you've set P6.4 to be an output, its P6IN state will normally be the same as its P6OUT setting. If you're trying to detect a bus conflict (both ends driving different levels) you probably won't succeed (and you could damage the pin).

    What is connected to P6.4? Do you have a schematic you could post?

  • Sorry, I can't send the schema.
    but there is a voltage divider circuit along with the stepper motor

  • Where does P6.4 fit into the divider -- high-side or Vout? And what stepper pin is it connected to?

    In the absence of the REN resistors, a pin is logically either an input or an output, so I'm not sure what this code is intended to do.

    It is possible to switch between input and output (P6DIR) on the fly, to probe the state of the wire. This is an unusual (and somewhat tricky) application, but sometimes it's useful -- you need to decide that based on the circuit you have.

  • I do not have the hardware project of the card.
    If I will describe it to you:
    Vcc of the stepper motor is connected to P6.5.
    P6.4, on the way to the signal pin connected to the signal pin of the step motor, there is a transistor followed by 10k and 1k resistors.
    The 1k resistor goes to vcc.
    The 10k resistance goes to gnd.
    And what they want me to do is stop the stepper motor when it drops to 0.

  • OK, so it sounds like you want P6.4 to be (always) an input, and P6.5 (always) an output, with something like:

    if ((P6IN & BIT4) != 0){ //P6.4 pin high so OK
       P6OUT |=  BIT5;       //motor driver on
    }
    else {                   // P6.4 low means Overvoltage
       P6OUT &= ~BIT5;       //motor stop
    }