void EMIF_Init(void)
{
EALLOW;
ClkCfgRegs.PERCLKDIVSEL.bit.EMIF1CLKDIV = 0x1;
EDIS;
EALLOW;
//Disable Access Protection (CPU_FETCH/CPU_WR/DMA_WR)
Emif1ConfigRegs.EMIF1ACCPROT0.all = 0x1; // DMA写保护允许 EMIF1MSEL:找不到寄存器配置说明
// Commit the configuration related to protection. Till this bit remains set
// content of EMIF1ACCPROT0 register can't be changed.
Emif1ConfigRegs.EMIF1COMMIT.all = 0x1;
// Lock the configuration so that EMIF1COMMIT register can't be
// changed any more.
Emif1ConfigRegs.EMIF1LOCK.all = 0x1; // 锁定写入保护
EDIS;
Emif1Regs.ASYNC_CS2_CR.bit.ASIZE =1; // 16Bit Memory Interface
Emif1Regs.ASYNC_CS2_CR.bit.R_HOLD =14; // Read Hold time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.R_SETUP =6; // Read Strobe time of 4 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.R_STROBE=6; // Read Setup time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.W_HOLD =14; // Write Hold time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.W_SETUP =6; // Write Strobe time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.W_STROBE=6; // Write Setup time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.TA =8; // Turn Around time of 2 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.SS =1; // EMIF_ASYNC_SS_EnABLE
Emif1Regs.ASYNC_CS2_CR.bit.EW =1; // Extended Wait Enable.
Emif1Regs.INT_MSK_SET.bit.AT_MASK_SET = 1;
setup_emif1_pinmux_async_16bit(0);
}
user5177434:
这是EMIF配置,希望大神帮帮忙。谢谢啦。
void EMIF_Init(void){ EALLOW; ClkCfgRegs.PERCLKDIVSEL.bit.EMIF1CLKDIV = 0x1; EDIS;
EALLOW; //Disable Access Protection (CPU_FETCH/CPU_WR/DMA_WR) Emif1ConfigRegs.EMIF1ACCPROT0.all = 0x1; // DMA写保护允许 EMIF1MSEL:找不到寄存器配置说明 // Commit the configuration related to protection. Till this bit remains set // content of EMIF1ACCPROT0 register can't be changed. Emif1ConfigRegs.EMIF1COMMIT.all = 0x1; // Lock the configuration so that EMIF1COMMIT register can't be // changed any more. Emif1ConfigRegs.EMIF1LOCK.all = 0x1; // 锁定写入保护 EDIS;
Emif1Regs.ASYNC_CS2_CR.bit.ASIZE =1; // 16Bit Memory Interface Emif1Regs.ASYNC_CS2_CR.bit.R_HOLD =14; // Read Hold time of 1 Emif Clock Emif1Regs.ASYNC_CS2_CR.bit.R_SETUP =6; // Read Strobe time of 4 Emif Clock Emif1Regs.ASYNC_CS2_CR.bit.R_STROBE=6; // Read Setup time of 1 Emif Clock Emif1Regs.ASYNC_CS2_CR.bit.W_HOLD =14; // Write Hold time of 1 Emif Clock Emif1Regs.ASYNC_CS2_CR.bit.W_SETUP =6; // Write Strobe time of 1 Emif Clock Emif1Regs.ASYNC_CS2_CR.bit.W_STROBE=6; // Write Setup time of 1 Emif Clock Emif1Regs.ASYNC_CS2_CR.bit.TA =8; // Turn Around time of 2 Emif Clock Emif1Regs.ASYNC_CS2_CR.bit.SS =1; // EMIF_ASYNC_SS_EnABLE Emif1Regs.ASYNC_CS2_CR.bit.EW =1; // Extended Wait Enable.
Emif1Regs.INT_MSK_SET.bit.AT_MASK_SET = 1; setup_emif1_pinmux_async_16bit(0);}
void EMIF_Init(void)
{
EALLOW;
ClkCfgRegs.PERCLKDIVSEL.bit.EMIF1CLKDIV = 0x1;
EDIS;
EALLOW;
//Disable Access Protection (CPU_FETCH/CPU_WR/DMA_WR)
Emif1ConfigRegs.EMIF1ACCPROT0.all = 0x1; // DMA写保护允许 EMIF1MSEL:找不到寄存器配置说明
// Commit the configuration related to protection. Till this bit remains set
// content of EMIF1ACCPROT0 register can't be changed.
Emif1ConfigRegs.EMIF1COMMIT.all = 0x1;
// Lock the configuration so that EMIF1COMMIT register can't be
// changed any more.
Emif1ConfigRegs.EMIF1LOCK.all = 0x1; // 锁定写入保护
EDIS;
Emif1Regs.ASYNC_CS2_CR.bit.ASIZE =1; // 16Bit Memory Interface
Emif1Regs.ASYNC_CS2_CR.bit.R_HOLD =14; // Read Hold time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.R_SETUP =6; // Read Strobe time of 4 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.R_STROBE=6; // Read Setup time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.W_HOLD =14; // Write Hold time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.W_SETUP =6; // Write Strobe time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.W_STROBE=6; // Write Setup time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.TA =8; // Turn Around time of 2 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.SS =1; // EMIF_ASYNC_SS_EnABLE
Emif1Regs.ASYNC_CS2_CR.bit.EW =1; // Extended Wait Enable.
Emif1Regs.INT_MSK_SET.bit.AT_MASK_SET = 1;
setup_emif1_pinmux_async_16bit(0);
}
mangui zhang:没明白意思配置好EMIF后进行写和读对比看看数据是否一样
总线上片选只能选中其中一个外设如果同时选中多个外设会出现竞争
void EMIF_Init(void)
{
EALLOW;
ClkCfgRegs.PERCLKDIVSEL.bit.EMIF1CLKDIV = 0x1;
EDIS;
EALLOW;
//Disable Access Protection (CPU_FETCH/CPU_WR/DMA_WR)
Emif1ConfigRegs.EMIF1ACCPROT0.all = 0x1; // DMA写保护允许 EMIF1MSEL:找不到寄存器配置说明
// Commit the configuration related to protection. Till this bit remains set
// content of EMIF1ACCPROT0 register can't be changed.
Emif1ConfigRegs.EMIF1COMMIT.all = 0x1;
// Lock the configuration so that EMIF1COMMIT register can't be
// changed any more.
Emif1ConfigRegs.EMIF1LOCK.all = 0x1; // 锁定写入保护
EDIS;
Emif1Regs.ASYNC_CS2_CR.bit.ASIZE =1; // 16Bit Memory Interface
Emif1Regs.ASYNC_CS2_CR.bit.R_HOLD =14; // Read Hold time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.R_SETUP =6; // Read Strobe time of 4 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.R_STROBE=6; // Read Setup time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.W_HOLD =14; // Write Hold time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.W_SETUP =6; // Write Strobe time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.W_STROBE=6; // Write Setup time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.TA =8; // Turn Around time of 2 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.SS =1; // EMIF_ASYNC_SS_EnABLE
Emif1Regs.ASYNC_CS2_CR.bit.EW =1; // Extended Wait Enable.
Emif1Regs.INT_MSK_SET.bit.AT_MASK_SET = 1;
setup_emif1_pinmux_async_16bit(0);
}
Susan Yang:能否请您详细说明下您的问题?感觉有点没理解您的意思
void EMIF_Init(void)
{
EALLOW;
ClkCfgRegs.PERCLKDIVSEL.bit.EMIF1CLKDIV = 0x1;
EDIS;
EALLOW;
//Disable Access Protection (CPU_FETCH/CPU_WR/DMA_WR)
Emif1ConfigRegs.EMIF1ACCPROT0.all = 0x1; // DMA写保护允许 EMIF1MSEL:找不到寄存器配置说明
// Commit the configuration related to protection. Till this bit remains set
// content of EMIF1ACCPROT0 register can't be changed.
Emif1ConfigRegs.EMIF1COMMIT.all = 0x1;
// Lock the configuration so that EMIF1COMMIT register can't be
// changed any more.
Emif1ConfigRegs.EMIF1LOCK.all = 0x1; // 锁定写入保护
EDIS;
Emif1Regs.ASYNC_CS2_CR.bit.ASIZE =1; // 16Bit Memory Interface
Emif1Regs.ASYNC_CS2_CR.bit.R_HOLD =14; // Read Hold time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.R_SETUP =6; // Read Strobe time of 4 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.R_STROBE=6; // Read Setup time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.W_HOLD =14; // Write Hold time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.W_SETUP =6; // Write Strobe time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.W_STROBE=6; // Write Setup time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.TA =8; // Turn Around time of 2 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.SS =1; // EMIF_ASYNC_SS_EnABLE
Emif1Regs.ASYNC_CS2_CR.bit.EW =1; // Extended Wait Enable.
Emif1Regs.INT_MSK_SET.bit.AT_MASK_SET = 1;
setup_emif1_pinmux_async_16bit(0);
}
user5177434:
回复 Susan Yang:
您好,就是我使用F28377S与FPGA进行EMIF通讯。然后片选EM1CS2区域。
如下为CMD配置: ZONE2A : origin = 0x110000, length = 0x000020 /*读取与ram的中FPGA所放数的地址*/ ZONE2B : origin = 0x110120, length = 0x0000E0 /*写FPGA_RAM的地址*/ ZONE2D : origin = 0x200000, length = 0x020000
RD_FPGA : > ZONE2A, PAGE = 1 WR_FPGA : > ZONE2B, PAGE = 1
主函数定义:
#pragma DATA_SECTION(RD_FPGA1,"RD_FPGA"); #pragma DATA_SECTION(WR_FPGA1,"WR_FPGA");
我理解的是这样配置的话,读的数据只会出现在 0x110000, length = 0x000020 区域,写的数据只会出现在 origin = 0x110120, length = 0x0000E0区域。但是现在debug模式下查看,整个EMIF数据区 0x0010 0000~0x003D FFFF都有数据显示。不知道为什么?
void EMIF_Init(void)
{
EALLOW;
ClkCfgRegs.PERCLKDIVSEL.bit.EMIF1CLKDIV = 0x1;
EDIS;
EALLOW;
//Disable Access Protection (CPU_FETCH/CPU_WR/DMA_WR)
Emif1ConfigRegs.EMIF1ACCPROT0.all = 0x1; // DMA写保护允许 EMIF1MSEL:找不到寄存器配置说明
// Commit the configuration related to protection. Till this bit remains set
// content of EMIF1ACCPROT0 register can't be changed.
Emif1ConfigRegs.EMIF1COMMIT.all = 0x1;
// Lock the configuration so that EMIF1COMMIT register can't be
// changed any more.
Emif1ConfigRegs.EMIF1LOCK.all = 0x1; // 锁定写入保护
EDIS;
Emif1Regs.ASYNC_CS2_CR.bit.ASIZE =1; // 16Bit Memory Interface
Emif1Regs.ASYNC_CS2_CR.bit.R_HOLD =14; // Read Hold time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.R_SETUP =6; // Read Strobe time of 4 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.R_STROBE=6; // Read Setup time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.W_HOLD =14; // Write Hold time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.W_SETUP =6; // Write Strobe time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.W_STROBE=6; // Write Setup time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.TA =8; // Turn Around time of 2 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.SS =1; // EMIF_ASYNC_SS_EnABLE
Emif1Regs.ASYNC_CS2_CR.bit.EW =1; // Extended Wait Enable.
Emif1Regs.INT_MSK_SET.bit.AT_MASK_SET = 1;
setup_emif1_pinmux_async_16bit(0);
}
Green Deng:配置错误的情况下有可能发生这种情况。对于基础调试,你可以参考这个文档(www.ti.com/…/sprac96a.pdf)。同时也可以用EMIF配置工具,位置在:C2000Ware: \C2000Ware_XXXX\boards\TIDesigns\F28379D_EMIF_DC\C2000-EMIF_ConfigurationTool.xlsx
void EMIF_Init(void)
{
EALLOW;
ClkCfgRegs.PERCLKDIVSEL.bit.EMIF1CLKDIV = 0x1;
EDIS;
EALLOW;
//Disable Access Protection (CPU_FETCH/CPU_WR/DMA_WR)
Emif1ConfigRegs.EMIF1ACCPROT0.all = 0x1; // DMA写保护允许 EMIF1MSEL:找不到寄存器配置说明
// Commit the configuration related to protection. Till this bit remains set
// content of EMIF1ACCPROT0 register can't be changed.
Emif1ConfigRegs.EMIF1COMMIT.all = 0x1;
// Lock the configuration so that EMIF1COMMIT register can't be
// changed any more.
Emif1ConfigRegs.EMIF1LOCK.all = 0x1; // 锁定写入保护
EDIS;
Emif1Regs.ASYNC_CS2_CR.bit.ASIZE =1; // 16Bit Memory Interface
Emif1Regs.ASYNC_CS2_CR.bit.R_HOLD =14; // Read Hold time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.R_SETUP =6; // Read Strobe time of 4 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.R_STROBE=6; // Read Setup time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.W_HOLD =14; // Write Hold time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.W_SETUP =6; // Write Strobe time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.W_STROBE=6; // Write Setup time of 1 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.TA =8; // Turn Around time of 2 Emif Clock
Emif1Regs.ASYNC_CS2_CR.bit.SS =1; // EMIF_ASYNC_SS_EnABLE
Emif1Regs.ASYNC_CS2_CR.bit.EW =1; // Extended Wait Enable.
Emif1Regs.INT_MSK_SET.bit.AT_MASK_SET = 1;
setup_emif1_pinmux_async_16bit(0);
}
user5177434:
回复 mangui zhang:
您好,我只有一个外设。我查看了片选信号,也没有什么问题。