Other Parts Discussed in Thread: SYSCONFIG, SYSBIOS
Thread 中讨论的其他器件:SysConfig、 SYSBIOS
我已经编写了一个代码来打开 am572x EVM 上的用户 LED1。 在原理图中、它位于 GPIO7_9上。
问题是 、当我运行代码时、LED 不会亮起。
我从第7088页读取 AM572x TSM、其中提供了控制 GPIO 所需采取的步骤。
以下是我的代码
GPIO.h
*
*创建日期:2018年2月23日
*作者:Afua
*
#ifndef GPIO_INIT_H_
#define GPIO_INIT_H_
#define GPIO_CTRL_PAD (*(volatile UINT32_t *) 0x4A0037AC)//页4088
#define CM_L4PER_CLKSTCRL (*(volatile UINT32_t *) 0x4A009810)
#define GPIO_SysConfig (*(volatile UINT32_t *) 0x48051010)
#define GPIO_SYSSSTATUS (*(volatile UINT32_t *) 0x48051114)
#define GPIO_CTRL (*(volatile UINT32_t *) 0x48051130)
#define GPIO_OE (*(volatile UINT32_t *) 0x48051134)
#define GPIO_datain (*(volatile UINT32_t *) 0x48051138)
#define GPIO_DATAOUT (*(volatile UINT32_t *) 0x4805113C)
#define GPIO_CLEARDATAOUT (*(volatile UINT32_t *) 0x48051190)
#define GPIO_SETDATAOUT (*(volatile UINT32_t *) 0x48051194)
void GPIO_Init (void);
void GPIO_write (int value);
int GPIO_read (int 值);
void AppDelay (unsigned int delayVal);
#endif /* GPIO_init_H_*/
gpio.c
#include
#include
#include "GPIO_Init.h"
void GPIO_Init (void)
{
CM_L4PER_CLKSTCRL |= 0x101;
while (!(CM_L4PER_CLKSTCRL 和0x30000)=0){};
GPIO_CTRL_PAD |= 0x0E;
GPIO_SysConfig |= 0x0;
while (((GPIO_SYSSSTATUS & 0x1)=0){};
GPIO_SysConfig |= 0x18;
GPIO_CTRL |= 0x02;
GPIO_OE |= 0xFFFFFF;
}
void GPIO_write (int value){
GPIO_DATAOUT =值;
}
int GPIO_read (int 值)
{
返回(GPIO_datain 和 value);
}
void AppDelay (unsigned int delayVal)
{
while (delayVal)
{
DelayVal---;
}
}
/**
* main.c
*
#include
#include
#include "GPIO_Init.h"
#define DELAY_VALUE (0x6FFFFFU)
int main (空)
{
GPIO_Init();
while (1){
GPIO_WRITE (0x200);
AppDelay (delay_value);
GPIO_WRITE (0x000);
}
}
我按照下面的步骤操作、但我知道我错过了一些东西、希望有人可以告诉我