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.

Setting a value to an INPUT pin

Hello,

I am using the RM42x Safety MCU.

I have set the direction of a general purpose pin as INPUT. What will happen if I set the value of that pin using the function gioSetBit? Is it potentially harmful to the MCU?

Thanks, 

Abhishek.

  • I'm going to try this (on a TMS570 launchpad).

    I'll define a pin as input and drive it to 0 and 1.

    i'll also put an interrupt on the pin to see if that fires...

  • Hello Abhishek,

    The output and input buffers on our devices are separate structures so setting the dataout register will not impact the state of the pin when it is configured as an output. In effect, the write to the DSET or DCLR or directly to the DOUT registers will have no effect.

  • I made a testdbed on my Hercules Launchpad TMS570LS004, with the pushbutton connected to GIOA[7] calling a toggle of the led attached to GIOA[2]
    I have a high priority interrupt enabled on the falling edge of both pins

    When I define the pin as input it doesn't work. gioToggleBit() has no effect. The led stays out and there's no triggering from GIOA[2].

    When the pin is set to output it seems to work:
    gioToggleBit() sets the output, and the interrupt fires when the pin on GIOA[2] is driven low by that gioToggleBit() call.

    Here's the log of my program when I push the button two times (second time drives GIOA[2] low and fires its interrupt)

    [CortexR4] GIO bit 7 triggered
    GIO bit 7 triggered
    GIO bit 2 triggered

    I did not apply external signal to the pin. I am not heroic enought to try that.

    I have this code in my gioNotification() ISR

    /* USER CODE BEGIN (19) */
        printf("GIO bit %i triggered\n", bit);
        if(bit==7) {
            gioToggleBit(gioPORTA, 2);
        }
    /* USER CODE END */

    And this is my main()

    /* USER CODE BEGIN (3) */
        gioInit();
        _enable_interrupt_();
        while(1) {
        }
    /* USER CODE END */
    }