This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
I am using ek-tm4c1294xl based Tiva board, here I am trying to interface this board with Uart-16550 module which has got data: D0-D7, Address: A0-A2, RD, WR, CE lines
I am using "tiva-c-master" firmware source, I had configured EPI interface using API's given in epi.h and after configuration when I am trying to write data it is getting stuck in write API
so can anyone tell me what is wrong in my flow of EPI interface and tell me the right way to configure the EPI interface?
Thank you and Regard
Pavankumar
#include <stdint.h> #include <stdbool.h> #include "inc/hw_ints.h" #include "inc/hw_memmap.h" #include "driverlib/debug.h" #include "driverlib/gpio.h" #include "driverlib/interrupt.h" #include "driverlib/pin_map.h" #include "driverlib/rom.h" #include "driverlib/rom_map.h" #include "driverlib/sysctl.h" #include "driverlib/uart.h" #include "inc/hw_epi.h" #include "driverlib/epi.h" #include "utils/uartstdio.h" #include "drivers/pinout.h" //***************************************************************************** // //! \addtogroup example_list //! <h1>UART Echo (uart_echo)</h1> //! //! This example application utilizes the UART to echo text. The first UART //! (connected to the USB debug virtual serial port on the evaluation board) //! will be configured in 115,200 baud, 8-n-1 mode. All characters received on //! the UART are transmitted back to the UART. // //***************************************************************************** //**************************************************************************** // // System clock rate in Hz. // //**************************************************************************** uint32_t g_ui32SysClock; //***************************************************************************** // // The error routine that is called if the driver library encounters an error. // //***************************************************************************** #ifdef DEBUG void __error__(char *pcFilename, uint32_t ui32Line) { } #endif uint32_t epi_base_val = 0x400D0000; uint32_t epi_mem_map = 0x00; uint32_t epi_cfg_val = 0x00; uint32_t epi_frame_count = 0x00; uint32_t epi_max_wait = 0x00; uint8_t mbwrt_cmd[8] = {0x01,0x04,0x00,0x0C,0x00,0x10,0x31,0xC5}; uint8_t byte_read = 0x00; uint32_t count = 0; void ConfigureUART(void) { // // Enable the GPIO Peripheral used by the UART. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); // // Enable UART0 // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); // // Configure GPIO Pins for UART mode. // ROM_GPIOPinConfigure(GPIO_PA0_U0RX); ROM_GPIOPinConfigure(GPIO_PA1_U0TX); ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); // // Initialize the UART for console I/O. // UARTStdioConfig(0, 115200, g_ui32SysClock); } int main(void) { // // Set the clocking to run directly from the crystal at 120MHz. // g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480),120000000); PinoutSet(false, false); ConfigureUART(); /* * Enable the peripherals used by this example. * */ ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_EPI0); /* EPI Config */ UARTprintf("Gp init\n"); 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);//A0 GPIOPinConfigure(GPIO_PA7_EPI0S9);//A1 GPIOPinConfigure(GPIO_PG1_EPI0S10);//A2 GPIOPinConfigure(GPIO_PB3_EPI0S28);//WR GPIOPinConfigure(GPIO_PN2_EPI0S29);//RD GPIOPinTypeEPI(GPIO_PORTK_BASE,GPIO_PIN_0);//D0 GPIOPinTypeEPI(GPIO_PORTK_BASE,GPIO_PIN_1);//D1 GPIOPinTypeEPI(GPIO_PORTK_BASE,GPIO_PIN_2);//D2 GPIOPinTypeEPI(GPIO_PORTK_BASE,GPIO_PIN_3);//D3 GPIOPinTypeEPI(GPIO_PORTC_BASE,GPIO_PIN_7);//D4 GPIOPinTypeEPI(GPIO_PORTC_BASE,GPIO_PIN_6);//D5 GPIOPinTypeEPI(GPIO_PORTC_BASE,GPIO_PIN_5);//D6 GPIOPinTypeEPI(GPIO_PORTC_BASE,GPIO_PIN_4);//D7 GPIOPinTypeEPI(GPIO_PORTA_BASE,GPIO_PIN_6);//A0 GPIOPinTypeEPI(GPIO_PORTA_BASE,GPIO_PIN_7);//A1 GPIOPinTypeEPI(GPIO_PORTG_BASE,GPIO_PIN_1);//A2 GPIOPinTypeEPI(GPIO_PORTB_BASE,GPIO_PIN_3);//WR GPIOPinTypeEPI(GPIO_PORTN_BASE,GPIO_PIN_2);//RD epi_mem_map = EPI_ADDR_PER_SIZE_256B | EPI_ADDR_PER_BASE_NONE | EPI_ADDR_CODE_BASE_NONE; EPIAddressMapSet(epi_base_val, epi_mem_map); epi_cfg_val = (EPI_GPMODE_ASIZE_NONE | EPI_GPMODE_DSIZE_8); EPIConfigGPModeSet(epi_base_val, epi_cfg_val, 0x00, 0x00); EPIModeSet(epi_base_val, EPI_MODE_GENERAL); UARTprintf("EPI Mode Set \n"); /* * Loop forever echoing data through the UART. */ while(1) { UARTprintf("while loop \n"); for (count = 0; count < 8; count++) { EPIWorkaroundByteWrite(0x00, mbwrt_cmd[count]); UARTprintf("Tx:%x\n",mbwrt_cmd[count]); } /* delay */ SysCtlDelay(g_ui32SysClock / (1000 * 3)); for (count = 0; count < 100; count++) { byte_read = EPIWorkaroundByteRead(0x00); UARTprintf("Rx:%x\n",byte_read); } } }
int main(void) { // // Set the clocking to run directly from the crystal at 120MHz. // g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480),120000000); PinoutSet(false, false); ConfigureUART(); /* * Enable the peripherals used by this example. * */ ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_EPI0); /* EPI Config */ UARTprintf("Gp init\n"); 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);//A0 GPIOPinConfigure(GPIO_PA7_EPI0S9);//A1 GPIOPinConfigure(GPIO_PG1_EPI0S10);//A2 GPIOPinConfigure(GPIO_PB3_EPI0S28);//WR GPIOPinConfigure(GPIO_PN2_EPI0S29);//RD GPIOPinTypeEPI(GPIO_PORTK_BASE,GPIO_PIN_0);//D0 GPIOPinTypeEPI(GPIO_PORTK_BASE,GPIO_PIN_1);//D1 GPIOPinTypeEPI(GPIO_PORTK_BASE,GPIO_PIN_2);//D2 GPIOPinTypeEPI(GPIO_PORTK_BASE,GPIO_PIN_3);//D3 GPIOPinTypeEPI(GPIO_PORTC_BASE,GPIO_PIN_7);//D4 GPIOPinTypeEPI(GPIO_PORTC_BASE,GPIO_PIN_6);//D5 GPIOPinTypeEPI(GPIO_PORTC_BASE,GPIO_PIN_5);//D6 GPIOPinTypeEPI(GPIO_PORTC_BASE,GPIO_PIN_4);//D7 GPIOPinTypeEPI(GPIO_PORTA_BASE,GPIO_PIN_6);//A0 GPIOPinTypeEPI(GPIO_PORTA_BASE,GPIO_PIN_7);//A1 GPIOPinTypeEPI(GPIO_PORTG_BASE,GPIO_PIN_1);//A2 GPIOPinTypeEPI(GPIO_PORTB_BASE,GPIO_PIN_3);//WR GPIOPinTypeEPI(GPIO_PORTN_BASE,GPIO_PIN_2);//RD epi_mem_map = EPI_ADDR_PER_SIZE_256B | EPI_ADDR_PER_BASE_NONE | EPI_ADDR_CODE_BASE_NONE; EPIAddressMapSet(epi_base_val, epi_mem_map); epi_cfg_val = (EPI_GPMODE_ASIZE_NONE | EPI_GPMODE_DSIZE_8); EPIConfigGPModeSet(epi_base_val, epi_cfg_val, 0x00, 0x00); EPIModeSet(epi_base_val, EPI_MODE_GENERAL); UARTprintf("EPI Mode Set \n"); /* * Loop forever echoing data through the UART. */ while(1) { UARTprintf("while loop \n"); for (count = 0; count < 8; count++) { EPIWorkaroundByteWrite(0x00, mbwrt_cmd[count]); UARTprintf("Tx:%x\n",mbwrt_cmd[count]); } /* delay */ SysCtlDelay(g_ui32SysClock / (1000 * 3)); for (count = 0; count < 100; count++) { byte_read = EPIWorkaroundByteRead(0x00); UARTprintf("Rx:%x\n",byte_read); } } }
Hello Pavankumar,
This is very specific to your application so I am not sure how much help I can be, and I am honestly not sure if the EPI is the right way to go here (not that I have an alternative in mind...)
One thing I noticed from your setup is this:
epi_cfg_val = (EPI_GPMODE_ASIZE_NONE | EPI_GPMODE_DSIZE_8); EPIConfigGPModeSet(epi_base_val, epi_cfg_val, 0x00, 0x00);
So you are setting no Address but, you have "Address: A0-A2" pins. How are you controlling these? This is probably the biggest issue here, as the address is probably not being sent correctly. That's my first guess as to a possible issue anyways, so I would advise looking into that piece first.
Also I would recommend placing EPIModeSet before EPIConfigGPModeSet or EPIAddressMapSet.