需要考虑的问题 | 实现方法 | 备注 |
如何设定工作模式 | sram_config.syncMode = kSEMC_AsyncMode; | |
– 同步/异步 |
如何设定工作模式 | sram_config.addrMode = kSEMC_AddrDataNonMux; | |
– 复用/非复用 |
如何设定工作模式 | sram_config.portSize = kSEMC_PortSize16Bit; | |
– 8 bit / 16 bit |
使用哪个片选 | sram_config.cePinMux = kSEMC_MUXCSX2; | |
如何设定片选对应的地址空间 | #define SRAM_BASE 0x90000000 | 注意这里的单位是KB, 1024代表1MB。 |
sram_config.address = SRAM_BASE; |
sram_config.memsize_kbytes = 1024*1; |
如何使能ready/wait | sram_config.waitEnable = true; | 如果使能read/wait,waitSample需要配置为1 |
sram_config.waitSample = 1; |
访问周期/时序参数如何设定 | sram_config.tCeSetup_Ns = 20; // CS setup and hold | 为了简单起见,小编这里把所有参数都配置成20ns, |
sram_config.tCeHold_Ns = 20; | 只是为了做基础的时序测试。 |
sram_config.tCeInterval_Ns = 20; // CS interval | 实际应用中,如果对访问的带宽要求比较高,这些参数 |
sram_config.readHoldTime_Ns = 20; // Only for sync mode | 需要进行具体的调教。 |
sram_config.tAddrSetup_Ns = 20; // ADDR setup and hold | 后继如果小编有在具体的器件上实现了进一步的参数调校, |
sram_config.tAddrHold_Ns = 20; | 小编会在后继的软件中进行更新。 |
sram_config.tWeLow_Ns = 20; // WRITE feature | |
sram_config.tWeHigh_Ns = 20; | |
sram_config.tReLow_Ns = 20; // READ feature | |
sram_config.tReHigh_Ns = 20; | |
sram_config.tTurnAround_Ns = 20; // TA, do not set it to be 0 | |
sram_config.tAddr2WriteHold_Ns = 20; // ? | |
sram_config.tWriteSetup_Ns = 20; // For sync mode. | |
sram_config.tWriteHold_Ns = 20; // For sync mode. | |
sram_config.latencyCount = 20; // For sync mode. | |
sram_config.readCycle = 20; // For sync mode. | |
sram_config.delayChain = 20; // typically not used in SRAM. | |
如何启动读访问周期 | char * p0; | SEMC – SRAM配置完成后,通过地址访问进行读/写操作 |
char c; |
p0 = (char *)0x91000000; |
c = p0[0]; |
如何启动写访问周期 | char * p0; | SEMC – SRAM配置完成后,通过地址访问进行读/写操作 |
char c; |
p0 = (char *)0x91000000; |
p0[0] = 0; |