Hi,
I'm begginer in the subject of programming in microcontrollers, and I'm working with EPI in TM4C1294NCPDT board and I'm having some issues with the configuration of EPI bus interface (host bus 16 mode) for parallel communication to SRAM. I'm not getting desired output waves, only noises in the oscilloscope. Is something wrong in the code below?
I must set the bit in AFSEL register or it's already included in some of the functions that I put in the code?? Is necessary to put the GPIOPadConfigSet and GPIODirModeSet when the GPIOPinTypeEPI is already included in the code??
Code:
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/epi.h"
#include "driverlib/debug.h"
#include "driverlib/systick.h"
#include "driverlib/timer.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_epi.h"
#include "inc/hw_gpio.h"
void main(void)
{
volatile uint16_t *mem;
volatile uint16_t data;
SysCtlClockFreqSet((SYSCTL_OSC_INT | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_320), 120000000);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOM);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ);
GPIOPinConfigure(GPIO_PB3_EPI0S28); //RD
GPIOPinConfigure(GPIO_PP2_EPI0S29); //WR
GPIOPinConfigure(GPIO_PK0_EPI0S0); //D0
GPIOPinConfigure(GPIO_PK1_EPI0S1); //D1
GPIOPinConfigure(GPIO_PK2_EPI0S2); //D2
GPIOPinConfigure(GPIO_PK3_EPI0S3); //D3
GPIOPinConfigure(GPIO_PC7_EPI0S4); //D4
GPIOPinConfigure(GPIO_PC6_EPI0S5); //D5
GPIOPinConfigure(GPIO_PC5_EPI0S6); //D6
GPIOPinConfigure(GPIO_PC4_EPI0S7); //D7
GPIOPinConfigure(GPIO_PA6_EPI0S8); //D8
GPIOPinConfigure(GPIO_PA7_EPI0S9); //D9
GPIOPinConfigure(GPIO_PG1_EPI0S10); //D10
GPIOPinConfigure(GPIO_PG0_EPI0S11); //D11
GPIOPinConfigure(GPIO_PM3_EPI0S12); //D12
GPIOPinConfigure(GPIO_PM2_EPI0S13); //D13
GPIOPinConfigure(GPIO_PM1_EPI0S14); //D14
GPIOPinConfigure(GPIO_PM0_EPI0S15); //D15
GPIOPinConfigure(GPIO_PL0_EPI0S16); //A0
GPIOPinConfigure(GPIO_PL1_EPI0S17); //A1
GPIOPinConfigure(GPIO_PL2_EPI0S18); //A2
GPIOPinConfigure(GPIO_PL3_EPI0S19); //A3
GPIOPinConfigure(GPIO_PQ0_EPI0S20); //A4
GPIOPinConfigure(GPIO_PQ1_EPI0S21); //A5
GPIOPinConfigure(GPIO_PQ2_EPI0S22); //A6
GPIOPinConfigure(GPIO_PQ3_EPI0S23); //A7
GPIOPinConfigure(GPIO_PK7_EPI0S24); //A8
GPIOPinConfigure(GPIO_PK6_EPI0S25); //A9
GPIOPinConfigure(GPIO_PL4_EPI0S26); //A10
GPIOPinConfigure(GPIO_PB2_EPI0S27); //A11
GPIOPinConfigure(GPIO_PP3_EPI0S30); //CHIP SELECT - ALE
GPIOPinConfigure(GPIO_PK5_EPI0S31); //CLK
GPIOPinConfigure(GPIO_PK4_EPI0S32); //IRDY
GPIOPinConfigure(GPIO_PN5_EPI0S35); //CRE
SysCtlPeripheralEnable(SYSCTL_PERIPH_EPI0);//ENABLE EPI0
EPIDividerSet(EPI0_BASE, 6);//CONFIGURE EPI0
GPIOPinTypeEPI(GPIO_PORTA_BASE, 0xC0);
GPIOPinTypeEPI(GPIO_PORTB_BASE, 0x0C);
GPIOPinTypeEPI(GPIO_PORTC_BASE, 0xF0);
GPIOPinTypeEPI(GPIO_PORTG_BASE, 0x03);
GPIOPinTypeEPI(GPIO_PORTK_BASE, 0xFF);
GPIOPinTypeEPI(GPIO_PORTL_BASE, 0x1F);
GPIOPinTypeEPI(GPIO_PORTM_BASE, 0x0F);
GPIOPinTypeEPI(GPIO_PORTN_BASE, 0x20);
GPIOPinTypeEPI(GPIO_PORTP_BASE, 0x0C);
GPIOPinTypeEPI(GPIO_PORTQ_BASE, 0x0F);
EPIModeSet(EPI0_BASE, EPI_MODE_HB16);
EPIConfigHB16Set(EPI0_BASE, EPI_HB16_MODE_ADMUX | EPI_HB16_WRWAIT_1 | EPI_HB16_RDWAIT_1 | EPI_HB16_ALE_LOW | EPI_HB16_WORD_ACCESS, 0);
EPIAddressMapSet(EPI0_BASE, EPI_ADDR_PER_BASE_C | EPI_ADDR_PER_SIZE_64KB);
mem = (uint16_t*) 0xC0000000;
while(1)
{
data = *mem;
data++;
*mem = data;
}
}