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.

Trigger a burst operation on GPMC

Other Parts Discussed in Thread: AM3715

Hi,

I am working with AM3715, and a FPGA is connected to processor on GPMC bus, on synchronous burst mode. As a hardware guy, I using u-boot instead of real linux to verify the communication between CPU and FPGA.

I found that the mw.l and md.l command of u-boot can only trigger a burst operation with burst length = 2. Some topic (http://e2e.ti.com/support/dsp/omap_applications_processors/f/447/t/36314.aspx) in E2E forum has mentioned using u64 pointer can trigger 4-word burst, but I still measured 2 consecutive burst operations, each burst length is 2. I have set up the GPMC register, and following are my codes. Can any one give me some ideas about how to trigger a 4-word burst in U-Boot (Non-DMA mode)?

Regards,

Jun Ma

---------------------------------------------------------------------------------

/*
 * GPMC configuration for FPGA-CPU communication
 * based on CORE_L3_ICLK = GPMC_FCLK = 200MHz
 */
#define FPGA_ACCESS_GPMC_CONFIG1 0x7d671202
#define FPGA_ACCESS_GPMC_CONFIG2 0x000a0d00
#define FPGA_ACCESS_GPMC_CONFIG3 0x00030300
#define FPGA_ACCESS_GPMC_CONFIG4 0x03000d05
#define FPGA_ACCESS_GPMC_CONFIG5 0x030b0b0e
#define FPGA_ACCESS_GPMC_CONFIG6 0x88050384
#define FPGA_ACCESS_GPMC_CONFIG7 0x00000f60

---------------------------------------------------------------------------------

/* Trigger a burst READ (LEN = 4) to FPGA on GPMC bus */
void fpga_reg_access_test(void)
{
 u64* pVal;
 u64* ptr = (u64*)(CONFIG_FPGA_COMM_BASE);
 u32 a, b;

 pVal = (u64*)malloc(sizeof(u64));

 *pVal = *ptr;


 a = (u32)(*pVal);
 b = (u32)((*pVal) >> 32);


 printf("Read FPGA reg value: 0x%08x 0x%08x\n", b, a);

}

---------------------------------------------------------------------------------

 

  • Jun,

    You've to write ARM assembly to achieve the same. You can do upto 32 or even 40 bytes of burst on GPMC. This depends on how you write the code. But a minimum of 32 is possible.

  • Hi Tomas,

    Thanks for your suggestion! I create a simple function with asm code. Unfortunately, the processor is stopped after execute the asm instructions of this function. As I am a HW guy and have limit knowledge about Cortex A8 assembly language, could you take a look at my code?

    Regards,

    Jun

    void fpga_burst_test(void)
    {
     u32* pVal;
     volatile u32* ptr = (u32*)(CONFIG_FPGA_COMM_BASE + 0x10);
     u16 i;
     volatile u16* pa;

     pVal = (u32*)malloc(8*sizeof(u32));

     asm volatile(
       "ldmia %[in]!, {r3-r10} \n\t"
       "stmia %[out]!, {r3-r10} \n\t"
       :[out]"+r" (pVal)
       :[in]"r" (ptr)
       :"r3","r4","r5","r6","r7","r8","r9","r10","memory"
          );

     pa = (u16*)pVal;


     printf("FPGA burst test:\n");
     for(i = 0; i < 16; i ++) {
      printf("Read FPGA reg value: 0x%08x \n", *pa);
      pa++;
     }

     free(pVal);

    }

  • Jun,

    The problem with your code is that you are allocating the registers directly. Basically you've to let the compiler allocate registers for you. You can follow this http://www.ethernut.de/en/documents/arm-inline-asm.html

  • Hi Renjith,

    I read the cookbook you suggested, but I don't find the section about how to make the compiler allocate registers. Could show me which section is about this topic?

    I know I asked for too much... If you have time...

    Regards,
    Jun

  • Jun,

    If you write code like this compiler will allocate it for you.

    asm volatile("ldr %0, [%1]"     "\n\t"
                 "str %2, [%1, #4]" "\n\t" 
                 : "=&r" (rdv) 
                 : "r" (&table), "r" (wdv)
                 : "memory");