From 32b7b87d3dcd0d0f780fdfa8d5c2859bda8b175a Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 10 Jan 2014 23:15:55 -0600 Subject: [PATCH] Lower the uLab FPGA viewer GPMC clock to reduce errors on prototype lashup Add memory stress tests to GPMC test program --- .../gpmc/test/bbb-gpmc-test.c | 127 +++++++++++++++++- servers/fpga_server_lin/src/bbb-gpmc-init.cpp | 16 ++- servers/fpga_server_lin/src/fpga_conn.cpp | 13 ++ 3 files changed, 148 insertions(+), 8 deletions(-) diff --git a/fpga/interface/beaglebone_black/gpmc/test/bbb-gpmc-test.c b/fpga/interface/beaglebone_black/gpmc/test/bbb-gpmc-test.c index 9b17634..2c5dc99 100644 --- a/fpga/interface/beaglebone_black/gpmc/test/bbb-gpmc-test.c +++ b/fpga/interface/beaglebone_black/gpmc/test/bbb-gpmc-test.c @@ -34,7 +34,7 @@ #include #include -#define MEMORY_SPACE_ADDRESS_BITS 15 +#define MEMORY_SPACE_ADDRESS_BITS 16 #define GPMC_BASE 0x50000000 #define GPMC_REGLEN 0x10000000 @@ -119,11 +119,17 @@ static void gpmc_setup(void) // *(gpmc + displacement + GPMC_CONFIG4) = 0x06020802; // Assert WE on fclk2, deassert WE on fclk6, assert OE on fclk2, deassert OE on fclk8 // *(gpmc + displacement + GPMC_CONFIG5) = 0x00060808; // Data valid on fclk 6, cycle time 8 fclks - // 100MHz compatible SRAM device - *(gpmc + displacement + GPMC_CONFIG2) = 0x00001000; // Assert CS on fclk0, deassert CS on fclk16 +// // 100MHz compatible SRAM device +// *(gpmc + displacement + GPMC_CONFIG2) = 0x00001000; // Assert CS on fclk0, deassert CS on fclk16 +// *(gpmc + displacement + GPMC_CONFIG3) = 0x00000400; // Assert ADV on fclk 0, deassert ADV on fclk 4 +// *(gpmc + displacement + GPMC_CONFIG4) = 0x0c041004; // Assert WE on fclk4, deassert WE on fclk12, assert OE on fclk4, deassert OE on fclk16 +// *(gpmc + displacement + GPMC_CONFIG5) = 0x000c1010; // Data valid on fclk 12, cycle time 16 fclks + + // 50MHz compatible SRAM device + *(gpmc + displacement + GPMC_CONFIG2) = 0x00001f00; // Assert CS on fclk0, deassert CS on fclk31 *(gpmc + displacement + GPMC_CONFIG3) = 0x00000400; // Assert ADV on fclk 0, deassert ADV on fclk 4 - *(gpmc + displacement + GPMC_CONFIG4) = 0x0c041004; // Assert WE on fclk4, deassert WE on fclk12, assert OE on fclk4, deassert OE on fclk16 - *(gpmc + displacement + GPMC_CONFIG5) = 0x000c1010; // Data valid on fclk 12, cycle time 16 fclks + *(gpmc + displacement + GPMC_CONFIG4) = 0x1f041f04; // Assert WE on fclk4, deassert WE on fclk31, assert OE on fclk4, deassert OE on fclk31 + *(gpmc + displacement + GPMC_CONFIG5) = 0x00101f1f; // Data valid on fclk 16, cycle time 31 fclks *(gpmc + displacement + GPMC_CONFIG6) = 0x00000000; // No back to back cycle restrictions *(gpmc + displacement + GPMC_CONFIG7) = 0x00000e50; // CS0: Set base address 0x10000000, 32MB region, and enable CS @@ -180,6 +186,117 @@ static void io_setup(void) // for (j=0;j<0x3ff; j++) { // *(gpio + j) = j; // } + + // DEBUG ONLY + // Looping memory test + unsigned int test_base = (MEMORY_SIZE/2); + unsigned int test_length = (MEMORY_SIZE/2); + unsigned int total_errors; + unsigned char error_count[MEMORY_SIZE]; + int i; + int loop; + unsigned int overall_total_errors; + overall_total_errors = 0; + for (loop=0; loop<10;loop++) { + printf("Memory test loop %d\n", loop); + for (i=0; i 0) { + printf("\t%d\terror(s) found at offset 0x%02x\n", error_count[i], i); + } + } + + printf("\tTesting all ones/zeros\n"); + // Test with 0xff + for (i=0;i 0) { + printf("\t%d\terror(s) found at offset 0x%02x\n", error_count[i], i); + } + } + printf("\tTest region size:\t%d\n", test_length); + printf("\tTotal errors found:\t%d\n", total_errors); + fflush(stdout); + overall_total_errors = overall_total_errors + total_errors; + } + for (i=0;i= dsp_ram_size) { m_stateImageRXRequested = false; m_stateImageTXRequested = true; + + // Start user processing + write_gpmc(0x0a, read_gpmc(0x0a) | 0x01); } } else { @@ -398,6 +401,16 @@ void FPGASocket::commandLoop() { write_gpmc(0x05, buffer[read_offset+4]); read_offset = read_offset + 6; } + else if (buffer[read_offset+0] == 'R') { + write_gpmc(0x0c, read_gpmc(0x0c) | 0x01); + usleep(100); + write_gpmc(0x0c, read_gpmc(0x0c) & ~0x01); + read_offset = read_offset + 2; + } + else { + printf("[WARNING] Received invalid command '%c' from client! Dazed and confused, but continuing...\n", buffer[read_offset+0]); + read_offset = read_offset + 2; + } } if (m_stateImageTXRequested) { m_stateImageTXRequested = false;