Enable Cache SDRAM

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

 

I am working with SMA E70 Xplained board.

I am sending data over USB from SDRAM.

 

Data is received correctly until the cache is enabled.

I am enabling cache by adding,

#define CONF_BOARD_ENABLE_CACHE to \Atmel Studio\7.0\Project1\src\config\conf_board.h

Once this is done, the the data is not correctly received over USB.

 

Since the problem occurs after enabling cache, I thought of initializing SDRAM to be non cacheable.

The original initialization in Atmel Studio\7.0\Project1\src\ASF\sam\boards\same70_xplained\init.c is as follows,

​////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/**
 *    SDRAM cacheable memory region --- Normal
 *    START_Addr:-  0x70000000UL
 *    END_Addr:-    0x7FFFFFFFUL
 */

 

    dw_region_base_addr =
        SDRAM_START_ADDRESS |
        MPU_REGION_VALID |
        MPU_DEFAULT_SDRAM_REGION;

    dw_region_attr =
        MPU_AP_FULL_ACCESS    |
        INNER_NORMAL_WB_RWA_TYPE( SHAREABLE ) |
        mpu_cal_mpu_region_size(SDRAM_END_ADDRESS - SDRAM_START_ADDRESS) |
        MPU_REGION_ENABLE;
    mpu_set_region( dw_region_base_addr, dw_region_attr);

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

#define INNER_NORMAL_WB_RWA_TYPE(x)   (( 0x04 << MPU_RASR_TEX_Pos ) | ( DISABLE  << MPU_RASR_C_Pos ) | ( ENABLE  << MPU_RASR_B_Pos )  | ( x << MPU_RASR_S_Pos ))

This is defined in Project1\src\ASF\sam\drivers\mpu\mpu.h

 

As per ARM Cortex M7 documentation, "DUI0646B_cortex_m7_dgug"  Page 4-50

 

> TEX = 0x4, C=0, B=0, S=0

> TEX = 0x1, C=0, B=0, S=0

 

Both above combinations configure the memory to be non-cacheable.

 

I have tried them both, but with none of these USB transmission is working as  when it is working without enabling cache for whole system.

 

Does anybody have any experience on defining SDRAM non cacheable?

Any idea what I am doing wrong/ what is lacking?

Or else is there alternative way of doing this?

 

Thank you.

 

Regards,
-Nirmala.