Other Parts Discussed in Thread: SYSCONFIG, SYSBIOS
I have written a code to turn on the user led1 on the am572x evm. From the schematic, it is on gpio7_9.
The issue is that the led does not turn on when i run the code.
I read the AM572x TSM and from page 7088 which provides the steps to take to control a gpio.
Below is my code
GPIO.h
*
* Created on: 23 Feb 2018
* Author: Afua
*/
#ifndef GPIO_INIT_H_
#define GPIO_INIT_H_
#define GPIO_CTRL_PAD (*((volatile uint32_t *)0x4A0037AC)) //page 4088
#define CM_L4PER_CLKSTCRL (*((volatile uint32_t *)0x4A009810))
#define GPIO_SYSCONFIG (*((volatile uint32_t *)0x48051010))
#define GPIO_SYSSTATUS (*((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 value);
void AppDelay(unsigned int delayVal);
#endif /* GPIO_INIT_H_ */
GPIO.c
#include <stdint.h>
#include <stdio.h>
#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_SYSSTATUS & 0x1)==0){};
GPIO_SYSCONFIG |= 0x18;
GPIO_CTRL |= 0x02;
GPIO_OE |= 0xFFFFFDFF;
}
void GPIO_write(int value){
GPIO_DATAOUT = value;
}
int GPIO_read(int value)
{
return (GPIO_DATAIN & value);
}
void AppDelay(unsigned int delayVal)
{
while(delayVal)
{
delayVal--;
}
}
/**
* main.c
*/
#include <stdio.h>
#include<stdlib.h>
#include "GPIO_Init.h"
#define DELAY_VALUE (0x6FFFFFU)
int main(void)
{
GPIO_Init();
while(1){
GPIO_write(0x200);
AppDelay(DELAY_VALUE );
GPIO_write(0x000);
}
}
I followed these steps below but I know there is something I missed and hopefully someone can point me to