Drived SRAM by SEMC

cancel
Showing results for 
Search instead for 
Did you mean: 

Drived SRAM by SEMC

428 Views
1668834026
Contributor I

Hello,

我使用RT1052驱动外部SRAM碰到一个很奇怪的现象。

我参照SDRAM的例程修改。。现在是,16字节的方式读写数据(一次读写4096字节,就是基于SDRAM的例程改的)的时候第一次执行不成功(没写入),而第二次执行才成功(而且还需要两次完整的读写操作才能写入,第一次读写和第二次读写加入延时,现象也一样),8位操作现象类似,我关闭DCache后两次执行都不成功(数据没写入)。

pastedImage_1.png

这是我SRAM的配置,更奇怪的是,我将时间参数配置部分全部写0,现象是一样的。请问这是什么原因?

status_t BOARD_InitSEMC(void)
{
semc_config_t config;
semc_sram_config_t sramconfig;
uint32_t clockFrq = EXAMPLE_SEMC_CLK_FREQ;

/* Initializes the MAC configure structure to zero. */
memset(&config, 0, sizeof(semc_config_t));
memset(&sramconfig, 0, sizeof(semc_sram_config_t));

/* Initialize SEMC. */
SEMC_GetDefaultConfig(&config);
// config.dqsMode = kSEMC_Loopbackdqspad; /* For more accurate timing. */
SEMC_Init(SEMC, &config);

/* Configure SRAM. */
sramconfig.cePinMux = kSEMC_MUXCSX0;
sramconfig.addr27 = kSEMC_MORA27_NONE;
sramconfig.address = EXAMPLE_SEMC_START_ADDRESS;
sramconfig.memsize_kbytes = 128 * 1024; /* 128MB = 128*1024*1KBytes*/;
sramconfig.addrPortWidth = 16;
sramconfig.advActivePolarity = kSEMC_AdvActivehigh;
sramconfig.addrMode = kSEMC_AddrDataMux;
sramconfig.burstLen = kSEMC_Nor_BurstLen1;
sramconfig.portSize = kSEMC_PortSize16Bit;
sramconfig.tCeSetup_Ns = 7;
sramconfig.tCeHold_Ns = 7;
sramconfig.tCeInterval_Ns = 15;
sramconfig.tAddrSetup_Ns = 5;
sramconfig.tAddrHold_Ns = 2;
sramconfig.tWeLow_Ns = 20;
sramconfig.tWeHigh_Ns = 0;
sramconfig.tReLow_Ns = 20;
sramconfig.tReHigh_Ns = 7;
sramconfig.tTurnAround_Ns= 8;
sramconfig.tAddr2WriteHold_Ns = 10;
sramconfig.tWriteSetup_Ns = 0;
sramconfig.tWriteHold_Ns = 0;
sramconfig.latencyCount = 0;
sramconfig.readCycle = 0;

return SEMC_ConfigureSRAM(SEMC, &sramconfig, clockFrq);
}

原理图部分:

MCU

pastedImage_2.png

SRAM

pastedImage_3.png

另外,还有个问题:

我在RT1052手册中看到有一段描述,这个区域分配是代表地址分配范围吗?如果是,每个区域对应的地址是什么?

pastedImage_4.png

现在我给SRAM的地址是0x8000 0000。

期待你的解答。

Labels (1)
0 Kudos
3 Replies

291 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi 植渲 周,

Thank you for your interest in NXP Semiconductor products and
for the opportunity to serve you.
1) For the first question, I think you need to use a logic analyzer or oscilloscope to adjust the configuration of SRAM config struct.
2) 这个区域分配是代表地址分配范围吗?如果是,每个区域对应的地址是什么?
-- Region 对应给个Base register, 在寄存器中可以配置对应设备的基地址。

pastedImage_1.png

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

291 Views
1668834026
Contributor I

Hello, jeremyzhou,

关于第二个问题,我还有些疑问:

1.假如我挂载两片SRAM,这个地址我怎么分配,是按SRAM的大小来分吗,还有片选线怎么连接,因为我看见SRAM的片选线只有CS6,这么说SEMC不支持挂载多片SRAM是吗?

pastedImage_1.png

2.关于SDRAM的区域分配问题,下图可以看到SDRAM分为四个区域,地址区域和片选信号有什么联系,如果我没理解错的话,区域划分是自己填写的,假设我设置SDRAM1 ADDR = 0X8000 0000,SDRAM2 ADDR = 0X8001 0000,当我访问 0X8000 0000时SEMC会自动发送一个CS0信号选中SDRAM1,这样理解是否正确?

pastedImage_2.png

0 Kudos

291 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi 植渲 周,

感谢回复。

1)假如我挂载两片SRAM,这个地址我怎么分配,是按SRAM的大小来分吗,还有片选线怎么连接,因为我看见SRAM的片选线只有CS6,这么说SEMC不支持挂载多片SRAM是吗?

-- 是的,不支持挂载多片SRAM。

2) 2.关于SDRAM的区域分配问题,下图可以看到SDRAM分为四个区域,地址区域和片选信号有什么联系,如果我没理解错的话,区域划分是自己填写的,假设我设置SDRAM1 ADDR = 0X8000 0000,SDRAM2 ADDR = 0X8001 0000,当我访问 0X8000 0000时SEMC会自动发送一个CS0信号选中SDRAM1,这样理解是否正确?

-- 是的,理解正确。

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos