DSPRelated.com
Forums

Re: Regarding GPIO in TMS320F2812

Started by Tony Zampini May 19, 2005
Yes, you can do what you want.

Basically, in the GP?MUX register (? = A,B,D,...) setting a bit to "0",
configures
it for GPIO, settting it to "1", configures it for its internal peripheral
function (SPI, CAN, etc.)

Now, the GP?DIR registers are used to set the direction. 1=output, 0=input.

Take a look at one of my functions (below) to see how this is done.

***************************************************************
void init_GPIO()
{
EALLOW; // Must execute this ASM instrustion to access certain GPIO
registers

GpioMuxRegs.GPFMUX.bit.MDRA_GPIOF13 = 0; // make F13 GPIO (for LED#1)
GpioMuxRegs.GPFDIR.bit.GPIOF13 = 1; // make an output

GpioMuxRegs.GPFMUX.bit.XF_GPIOF14 = 0; // make F14 GPIO (for LED#2)
GpioMuxRegs.GPFDIR.bit.GPIOF14 = 1; // make an output

EDIS; // Opposite of EALLOW
}
**************************************************

Hope this helps.
Tony

----- Original Message -----
From: "aditya anantha" <aditya_eee_204@adit...>
To: <code-comp@code...>
Sent: Thursday, May 19, 2005 12:53 AM
Subject: [code-comp] Regarding GPIO in TMS320F2812 > hi all,
> I am using TMS320F2812
> In my application i need to output 6 pulses to the inverter , i have
written the logic for that but unable to understand from the manuals
properly what are the pins that can be used to output my pulses it is
mentioned in the manual that any of the pins can be used as GPIO the input
is always enabled but the output is muxed with the peripherals, by setting
the GPMUX we can set any of the pins as GPIO pins
> but its also mentioned we need to disable the functionality of the
specific pin
> I have nothing to do with the PWM1 --PWM 6 in GPIO A module that is i am
not using the Event manager to generate PWM pulses , so can i use those six
pins as my output pins , how do we disable the functionality of the PWM
module to be used as output pins
>
> If anyone has any experience in this regard pls help me
> thx in advance
> bye
> aditya >




Hi,

You have to set the GPxMUX register. To make the pins digital I/O. And the
GPxDIR register to set the direction (input / output).

Other registers to work with GPIO are GPxDATA, GPxSET,GPxCLEAR and
GPxTOGGLE. Download the System Control and Interrupts Reference Guide
(SPRU078B) from www.ti.com.

And maybe the ePWM (SPRU791) is a better choice to drive a inverter as to
generate the PWM pulses by software.

later,
Janko
----- Original Message -----
From: "aditya anantha" <aditya_eee_204@adit...>
To: <code-comp@code...>
Sent: Thursday, May 19, 2005 6:53 AM
Subject: [code-comp] Regarding GPIO in TMS320F2812 > hi all,
> I am using TMS320F2812
> In my application i need to output 6 pulses to the inverter , i have
> written the logic for that but unable to understand from the manuals
> properly what are the pins that can be used to output my pulses it is
> mentioned in the manual that any of the pins can be used as GPIO the input
> is always enabled but the output is muxed with the peripherals, by setting
> the GPMUX we can set any of the pins as GPIO pins
> but its also mentioned we need to disable the functionality of the
> specific pin
> I have nothing to do with the PWM1 --PWM 6 in GPIO A module that is i am
> not using the Event manager to generate PWM pulses , so can i use those
> six pins as my output pins , how do we disable the functionality of the
> PWM module to be used as output pins
>
> If anyone has any experience in this regard pls help me
> thx in advance
> bye
> aditya >