Hello,
My objective is to establish a parallel communication bus between this MCU and an FPGA (Lattice Mach X02, or something similar). My design is using the EPI interface with the following configurations:
- General Purpose Mode
- 8-bit data
- 4-bit address
- Clock is gated
- RD and WR bits are used to specify data direction
I have based my project off of the tcpEcho example included in the TI RTOS projects. Furthermore, I have created a initialization function called "InitEpi()", which setups the EPI to function as above. Note - I know that this function works, since I have tested it with a non-RTOS project:
int32_t InitEpi(void)
{
int32_t returnVal = -1;
//
// Sets the usage mode of the EPI module.
// The general purpose 8-bit data mode will be used.
//
EPIModeSet(EPI0_BASE, EPI_MODE_GENERAL);
//EPI CLK is 1/2 of SysClk
EPIDividerSet(EPI0_BASE, 0x1);
EPIConfigGPModeSet
(
EPI0_BASE,
(EPI_GPMODE_CLKPIN | /*EPI_GPMODE_CLKGATE |*/ EPI_GPMODE_ASIZE_20 | EPI_GPMODE_DSIZE_8),
0,
0
);
//NM I am not sure if this is correct for the address map, but saw this configuration used in an example
EPIAddressMapSet(EPI0_BASE, EPI_ADDR_PER_SIZE_256B | EPI_ADDR_PER_BASE_A);
returnVal = 1;
return returnVal;
}
Here is the problem. When I call InitEpi() from main, I place it right after the Board_initEMAC(); function, which was from the tcpEcho example:
int main(void)
{
/* Call board init functions */
Board_initGeneral();
Board_initGPIO();
Board_initEMAC();
InitEpi();
System_printf("Starting the TCP Echo example\nSystem provider is set to "
"SysMin. Halt the target to view any SysMin contents in"
" ROV.\n");
/* SysMin will only print to the console when you call flush or exit */
System_flush();
/* Start BIOS */
BIOS_start();
return (0);
}
This causes the MCU to crash.
Now, I have been doing some reading on GPIO initialization using the TI RTOS, and I know that there is a data structure (GPIO_PinConfig) that handles this. But, I do not know if I need to initialize the EPI using this structure, nor do I know how to do this. Also, can this all be done using the XGCONFIG tool? Lots of sources say that initializing various peripherals with TI RTOS is "easy", but I am struggling.
Thank you!