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 the GPIO PD3 to high on the Stellaris LM4F211

Other Parts Discussed in Thread: DRV8301, LM3S818

Hello All,

I'm using the base board DRV8301-HC-EVM RevC with the contolCARD MDL-LM4F211CNCD based on the Stellaris LM4F211H5QR.

Actually, I'm trying to set the GPIO pin PD3 of the MCU and the EN_GATE pin of the DRV8301 to high in order to enable the gate driver but without success.

Here is my code:

#1:

    ROM_SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
    ROM_GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_3);    // PD3 -> EN_GATE
    ROM_GPIOPadConfigSet(GPIO_PORTD_BASE, GPIO_PIN_3, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
    ROM_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_3, GPIO_PIN_3);

#2:

    SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOD;
    ROM_SysCtlDelay(10);
    GPIO_PORTD_DIR_R |= 0x08;
    GPIO_PORTD_DEN_R |= 0x08;
    GPIO_PORTD_DATA_R |= 0x08;

Can somebody please tell me what is wrong in my code?



  • Waldemar Hoppe said:
    enable the gate driver but without success.

    Realize you're frustrated - but, "w/out success" illuminates dimly...  Does your output come up at all? 

    Have just entered your code (listing #2) and it ran without flaw on our custom LX4F, 64 pin MCU board.  It is possible that something tied to this pin is preventing it from, "driving high!"   Should any other free GPIO pins exist - you may (temporarily) change your Port/Pin definitions and experiment with these different GPIO - just in case something is "holding down" your PD3.   Again your unmodified listing #2 runs well on our board.

    You should check & insure that you've properly linked & enabled the new cm4f Stellaris Driver Library for use w/ the new M-4 MCUs and that you've included your MCU-Specific .h file.  (i.e. LM4F211H5QR.h)

    Note: this post multiply edited - both the blinky.c file code and poster's code - indeed work as promised.  Earlier issues - imperfectly raised/noted - resulted from over consumption of Thanksgiving fare...  (that's this reporter's story - am sticking to it...)

  • Hello, cb1_mobile,

    thank you for you answer!

    The code #1 work perfectly with the same base board and the controlCARD MDL-LM3S818CNCD, which is based on the Stellaris LM3S818.

    Now, I'm trying to port my code to the Stellaris LM4F211. I can compile and link the both codes using driverlib-cm4f.lib & LM4F211H5QR.h but can not scope any EN_GATE signal on the base board.

  • Can you "break" the connection between your PD3 and the EN_GATE on the 2nd (non MCU) board?  By breaking the connection - you eliminate any 2nd board's ability to hold down your PD3 output.  Should a series R exist - simple to "remove" - which will open your circuit.

    Or - as previously advised - can you run slightly mod'ed code on another "free" GPIO pin?

    Have confirmed that your code #2 - as presented - runs fine on our LX4F custom board.   Don't know how further to advise.

  • Thank you. I will try it tomorrow.

  • Hello, cb1_mobile,

    I founded out that the correct GPIO pin to enable the DRV8301 is PB3 (2) (please see the topic http://e2e.ti.com/support/microcontrollers/stellaris_arm_cortex-m3_microcontroller/f/471/p/229931/807937.aspx#807937)

    I modified the code #1 but can not scope the signal as well.

    #include "inc/hw_memmap.h"
    #include "inc/hw_types.h"
    #include "driverlib/rom.h"
    #include "driverlib/fpu.h"
    #include "driverlib/debug.h"
    #include "driverlib/gpio.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/pin_map.h"
    #include "utils/uartstdio.h"
    #include "inc/lm4f211h5qr.h"


    int
    main(void)
    {
        ROM_SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);

        ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
        ROM_GPIOPinConfigure(GPIO_PB3_T3CCP1);
        ROM_GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_3);    // PB3(2) -> EN_GATE
        ROM_GPIOPadConfigSet(GPIO_PORTB_BASE, GPIO_PIN_3, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
        ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_3, 0x08);

        while(1)
        {
        }
    }

    How can I implement the row " ROM_GPIOPinConfigure(GPIO_PB3_T3CCP1);" in the register style (in the code #2)?

  • Sorry, the issue is closed. My scope probe was defekt.

    The code with the GPIO pin PB3(2) is working now!

    Thank you very much.

  • Hi,

    However, three small observations if I may:

    a) the line  ROM_GPIOPinConfigure(GPIO_PB3_T3CCP1); can be commented out; the parameter passed to the function must be used only in correlation with timer module when setting the pin only for capture/compare/pwm function. Here your program works because you re-configure in the next line.

    b)the line ROM_GPIOPadConfigSet(...) is already included in the previous line so you can comment it out (GPIOPadConfigSet() in driverlib shows you the code) .

    c) you can search and download (and use with care) from TI the PinMuxUtility application - it will ease your work. 

    Petrei