DSP

DSP28335 GPIO口配置概述

2019-07-13 10:38发布

刚开始学DSP  想来想去 还是从他的英文手册 慢慢的啃吧   凭借百度&各种翻译软件  总算 懂了 一点 现在为了 更好的理解也算加深一下套路记忆吧  把配置IO一个 小步骤 翻译一下 哟很多都是绝逼不通顺 的   不喜勿喷   纯粹为了学习!!! To plan configuration of the GPIO module, consider the following steps:
Step 1.
Plan the device pin-out:
Through a pin multiplexing scheme, a lot of flexibility is provided for assigning functionality to the   GPIO-capable pins. Before getting started, look at the peripheral options available for each pin, and  plan pin-out for your specific system. Will the pin be used as a general purpose input or output (GPIO) or as one of up to three available peripheral functions? Knowing this information will help determine  how to further configure the pin. 
为了配置GPIO口的模式  考虑以下的步骤  步骤一:规划设备的引脚 凭借一个引脚有多路复用组合方案   这为给引脚的功能分配提供了很大的灵活性  在开始配置之前  看一下每个引脚可用外围的选择 并且为你的特定的系统规划引脚   你是想该引脚用作通用的输入输出功能呢 还是用作他三个可用的外围功能呢 ?了解这些将有助于你进一步的配置这个引脚。
Step 2.Enable or disable internal pullup resistors:
To enable or disable the internal pullup resistors, write to the respective bits in the GPIO pullup disable(GPAPUD, GPBPUD, and GPCPUD) registers. For pins that can function as ePWM output pins(GPIO0-GPIO11), the internal pullup resistors are disabled by default. All other GPIO-capable pins   have the pullup enabled by default.
步骤2:使能或者禁止内部上拉电阻
为了使能或者禁用内部的上拉电阻,可以向GPIO上拉禁止寄存器的特定位写入数据  用于作为ePWM输出引脚的引脚 其内部的上拉电阻默认是禁止的(GPIO0-GPIO11)   所有其他的GPIO口引脚的上拉电阻默认是使能的
Step 3.Select input qualification:
If the pin will be used as an input, specify the required input qualification, if any. The input qualification  is specified in the GPACTRL, GPBCTRL, GPAQSEL1, GPAQSEL2, GPBQSEL1, and GPBQSEL2  registers. By default, all of the input signals are synchronized to SYSCLKOUT only
步骤3:选择输入限定
如果这个引脚将被用作输入引脚    指定这个引脚的输入限定  如果有 这个输入限定将在 GPACTRL, GPBCTRL, GPAQSEL1, GPAQSEL2, GPBQSEL1, and GPBQSEL2  这些寄存器中被指定 默认情况下  所有的输入信号和系统时钟同步
Step 4.Select the pin function:
Configure the GPxMUXn registers such that the pin is a GPIO or one of three available peripheral  functions. By default, all GPIO-capable pins are configured at reset as general purpose input pins.
步骤4:选择引脚功能 
配置GPxMUXn寄存器  这个引脚是一个通用的IO口还是三个可用的外围设备中的一个功能  默认情况下  所有的引脚都是为输入引脚来用的 Step 5.For digital general purpose I/O, select the direction of the pin:
If the pin is configured as an GPIO, specify the direction of the pin as either input or output in the  GPADIR, GPBDIR, and GPCDIR registers. By default, all GPIO pins are inputs. To change the pin 
from input to output, first load the output latch with the value to be driven by writing the appropriate value to the GPxCLEAR, GPxSET, or GPxTOGGLE registers. Once the output latch is loaded, change the pin direction from input to output via the GPxDIR registers. The output latch for all pins is cleared at reset.  步骤5:对于数字通用IO  选择引脚的方向 如果这个引脚被配置为GPIO口   那么在 GPADIR, GPBDIR, and GPCDIR 这些寄存器中指定这个引脚是是作为输入或者输出方向    默认情况下  引脚为输入方向  为了使引脚从输入变为输出  首先向GPxCLEAR, GPxSET寄存器中写入适当的值来驱动加载输出锁存 或者操作翻转寄存器GPxTOGGLE  一旦输出锁存被加载    就可以通过 GPxDIR 来更改IO的方向  所有引脚的输出锁存在复位的时候被清除  Step 6.Select low power mode wake-up sources:
Specify which pins, if any, will be able to wake the device from HALT and STANDBY low power  modes. The pins are specified in the GPIOLPMSEL register. 
步骤6:选择低功耗模式唤醒源 指定那个引脚  如果有的话   将可以在HALT和 STANDBY的低功耗模式下唤醒设别   这个引脚可以在GPIOLPMSEL寄存器中指定 Step 7.Select external interrupt sources:
Specify the source for the XINT1 - XINT7, and XNMI interrupts. For each interrupt you can specify one of the port A signals (for XINT1/2/3) or port B signals (XINT4/5/6/7) as the source. This is done by specifying the source in the GPIOXINTnSEL, and GPIOXNMISEL registers. The polarity of the interrupts can be configured in the XINTnCR, and the  registers as described inSection 8.6. 
步骤7:选择外部中断源  指定XINT1 - XINT7, and XNMI的中断源   对于每一个中断可以指定A或者B端口作为其中断源  这是通过在 GPIOXINTnSEL, and GPIOXNMISEL 寄存器实现的  这些中断源的极性可以在XNMICR寄存器中配置完成

NOTE:There is a 2-SYSCLKOUT cycle delay from when a write to configuration registers such as
GPxMUXn and GPxQSELn occurs to when the action is valid


注释:比如当你向配置寄存器GPxMUXn and GPxQSELn 写东西时  当这个操作有效之前将会有两个系统时钟的延时

 有些理解真的是超级不对  希望以后理解好好了在改吧 哈哈