关于DSP28335外扩SRAM写数据后数据跳变的问题及SRAM赋值问题
<p> </p><p> </p>
<p>我使用是是普中科技的28335开发板。因为要存储数组数据,所以外扩了SRAM。定义了ZONE7区域,并将数组变量指定存储到该区域。在定时器中断程序中给该变量赋值,但是在Expression中观察,赋值过后的变量值仍然会跳变,而且在memory browser中观察该值,好像并没有赋值成功。以下是相关程序及截图:</p>
<p>图一CpuTimer0.InterruptCount已经超过了数组的范围,然后y_out数据发生了跳变(黄色就代表发生了变化)。</p>
<p>图二在memory browser中观察y_out数据空间,但是并没有值被赋值进来?</p>
<p>另外就是,我写了给u_ff初始化赋值的语句,但是并没有赋值成功,见图三,这种怎么初始化赋值呢?</p>
<div style="text-align: center;"></div>
<div style="text-align: center;"></div>
<div style="text-align: center;"></div>
<p> </p>
<pre>
<code>//=============================
// ----------- time.c----------------
#pragma DATA_SECTION(y_out,"ZONE7DATA");
volatile float y_out = {0.0};
#pragma DATA_SECTION(u_ff,"ZONE7DATA");
volatile float u_ff = {
{0},
{-5.48168582231433},
{-28.0960788724069},
{-33.2755709254560},
{-28.4364523855368}
};
interrupt void TIM0_IRQn(void){
//省略其他无关代码
y_out = Pos;
CpuTimer0.InterruptCount++;
}
//==============================
// --------------28335_RAM_lnk.cmd----------------
PAGE 1 :
ZONE7B : origin = 0x201000, length = 0x0F0000 /* XINTF zone 7 */
SECTIONS
ZONE7DATA : > ZONE7B, PAGE = 1
//==============================
// -------------init_zone7.c --------------------------
void init_zone67(void)
{
EALLOW;
// Make sure the XINTF clock is enabled
SysCtrlRegs.PCLKCR3.bit.XINTFENCLK = 1;
EDIS;
// Configure the GPIO for XINTF with a 16-bit data bus
// This function is in DSP2833x_Xintf.c
InitXintf16Gpio();
// All Zones---------------------------------
// Timing for all zones based on XTIMCLK = SYSCLKOUT
EALLOW;
XintfRegs.XINTCNF2.bit.XTIMCLK = 0;
// Buffer up to 3 writes
XintfRegs.XINTCNF2.bit.WRBUFF = 3;
// XCLKOUT is enabled
XintfRegs.XINTCNF2.bit.CLKOFF = 0;
// XCLKOUT = XTIMCLK
XintfRegs.XINTCNF2.bit.CLKMODE = 0;
XintfRegs.XTIMING7.bit.XWRLEAD = 3;
XintfRegs.XTIMING7.bit.XWRACTIVE = 7;
XintfRegs.XTIMING7.bit.XWRTRAIL = 3;
// Zone read timing
XintfRegs.XTIMING7.bit.XRDLEAD = 3;
XintfRegs.XTIMING7.bit.XRDACTIVE = 7;
XintfRegs.XTIMING7.bit.XRDTRAIL = 3;
// don't double all Zone read/write lead/active/trail timing
XintfRegs.XTIMING7.bit.X2TIMING = 1;
// Zone will not sample XREADY signal
XintfRegs.XTIMING7.bit.USEREADY = 1;
XintfRegs.XTIMING7.bit.READYMODE = 1;
// 1,1 = x16 data bus
// 0,1 = x32 data bus
// other values are reserved
XintfRegs.XTIMING7.bit.XSIZE = 3;
EDIS;
//Force a pipeline flush to ensure that the write to
//the last register configured occurs before returning.
asm(" RPT #7 || NOP");
}</code></pre>
<p>工程中还使用了串口、spi等,但已经排除其接口与SRAM地址线数据线的复用问题</p>
<p>大概率是SRAM通信时许的问题。</p>
wangerxian 发表于 2024-6-26 20:31
大概率是SRAM通信时许的问题。
<p>抱歉,之前问题这个一直搁置了。以下是zone7的初始化,请问这个时序存在问题嘛?</p>
<p>/*<br />
* init_zone7.c<br />
*<br />
* Created on: 2024年6月11日<br />
* Author: Saturday<br />
*/</p>
<p><br />
#include <APP/xint_zone67/init_zone67.h></p>
<p><br />
void init_zone7(void)<br />
{<br />
EALLOW;<br />
// Make sure the XINTF clock is enabled<br />
SysCtrlRegs.PCLKCR3.bit.XINTFENCLK = 1;<br />
EDIS;<br />
// Configure the GPIO for XINTF with a 16-bit data bus<br />
// This function is in DSP2833x_Xintf.c<br />
InitXintf16Gpio();</p>
<p><br />
// All Zones---------------------------------<br />
// Timing for all zones based on XTIMCLK = SYSCLKOUT<br />
EALLOW;<br />
XintfRegs.XINTCNF2.bit.XTIMCLK = 0;<br />
// Buffer up to 3 writes<br />
XintfRegs.XINTCNF2.bit.WRBUFF = 3;<br />
// XCLKOUT is enabled<br />
XintfRegs.XINTCNF2.bit.CLKOFF = 0;<br />
// XCLKOUT = XTIMCLK<br />
XintfRegs.XINTCNF2.bit.CLKMODE = 0;</p>
<p> // Zone 7------------------------------------<br />
// When using ready, ACTIVE must be 1 or greater<br />
// Lead must always be 1 or greater<br />
// Zone write timing<br />
XintfRegs.XTIMING7.bit.XWRLEAD = 3;<br />
XintfRegs.XTIMING7.bit.XWRACTIVE = 7;<br />
XintfRegs.XTIMING7.bit.XWRTRAIL = 3;<br />
// Zone read timing<br />
XintfRegs.XTIMING7.bit.XRDLEAD = 3;<br />
XintfRegs.XTIMING7.bit.XRDACTIVE = 7;<br />
XintfRegs.XTIMING7.bit.XRDTRAIL = 3;</p>
<p> // don't double all Zone read/write lead/active/trail timing<br />
XintfRegs.XTIMING7.bit.X2TIMING = 0;</p>
<p> // Zone will not sample XREADY signal<br />
XintfRegs.XTIMING7.bit.USEREADY = 0;<br />
XintfRegs.XTIMING7.bit.READYMODE = 0;</p>
<p> // 1,1 = x16 data bus<br />
// 0,1 = x32 data bus<br />
// other values are reserved<br />
XintfRegs.XTIMING7.bit.XSIZE = 3;<br />
EDIS;<br />
//Force a pipeline flush to ensure that the write to<br />
//the last register configured occurs before returning.<br />
asm(" RPT #7 || NOP");<br />
}<br />
</p>
页:
[1]