CCS运行程序时将数组加进watch window老是断开与仿真器连接出现这样的错误,Trouble Reading Memory Block at 0x436 on Page 0 of Length 0x2c0: Error 0x80000002/-1143 Fatal Error during: Memory, The memory at 0x000004A4 continually indicated it was 'not ready' All memory operations currently in progress were aborted in order to regain control of the processor. This is considered a catastrophic event, but the debugger should still be able to access memory and CPU registers. System state has been altered. It is strongly advised that the processor should be reset before resuming execution, Sequence ID: 65 Error Code: -1143 Error Class: 0x80000002
有大神知道是什么原因吗?一星期了,一点头绪都没有。
// Disable int frame generation and enable slave w/ext frame signals on FSX
// Frame sync is active high, data clocked on rising edge of clkx
Write(pMCBSP0 -> pcr, PCR_CLKXP);
// Bring transmitter and receiver out of reset
SetMask(pMCBSP0 -> spcr2, SPCR2_XRST);
SetMask(pMCBSP0 -> spcr1, SPCR1_RRST);
}
// Disable int frame generation and enable slave w/ext frame signals on FSX
// Frame sync is active high, data clocked on rising edge of clkx
Write(pMCBSP1 -> pcr, PCR_CLKXP);
// Bring transmitter and receiver out of reset
SetMask(pMCBSP1 -> spcr2, SPCR2_XRST);
SetMask(pMCBSP1 -> spcr1, SPCR1_RRST);
}
void AIC23_Init()
{
I2C_Init();
// Reset the AIC23 and turn on all power
AIC23_Write(AIC23_RESET_REG, 0);
AIC23_Write(AIC23_POWER_DOWN_CTL, 0);
AIC23_Write(AIC23_ANALOG_AUDIO_CTL, 0x10);
AIC23_Write(AIC23_DIGITAL_AUDIO_CTL, 0);
// Turn on volume for line inputs
AIC23_Write(AIC23_LT_LINE_CTL,0x16);
AIC23_Write(AIC23_RT_LINE_CTL,0x16);
// Configure the AIC23 for master mode, 8KHz stereo, 16 bit samples
// Use 12MHz USB clock
AIC23_Write(AIC23_DIGITAL_IF_FORMAT, DIGIF_FMT_MS | DIGIF_FMT_IWL_16 | DIGIF_FMT_FOR_DSP);
AIC23_Write(AIC23_SAMPLE_RATE_CTL, SRC_SR_32 | SRC_BOSR | SRC_MO);
// Turn on headphone volume and digital interface
AIC23_Write(AIC23_LT_HP_CTL, 0x078); // 0x79 for speakers
AIC23_Write(AIC23_RT_HP_CTL, 0x078);
AIC23_Write(AIC23_DIG_IF_ACTIVATE, DIGIFACT_ACT);
// Set McBSP0 to be transmit slave
McBSP0_InitSlave();
McBSP1_InitSlave();
}
void AIC23_Disable()
{
PC55XX_MCSP pMCBSP0 = (PC55XX_MCSP)C55XX_MSP0_ADDR;
I2C_Disable();
// Put the MCBSP in reset
Write(pMCBSP0 -> spcr1, 0);
Write(pMCBSP0 -> spcr2, 0);
}
下面是I2C.c
#include "5509.h"
#include "util.h"
extern DSPCLK dspclk;
I2C_Init()
{
PC55XX_I2C pI2C = (PC55XX_I2C)C55XX_I2C_ADDR;
// Put I2C controller in reset (bad if clock derivatives change out of reset)
ClearMask(pI2C -> icmdr, ICMDR_IRS);
// Set prescaler to generate 12MHz clock
pI2C -> icpsc = dspclk.pllmult;
// Setup clock control registers (100KHz clock out)
Write(pI2C -> icclkl, 10); // For 400KHz, use 47 for 100KHz
Write(pI2C -> icclkh, 10);
// Put I2C controller in reset (bad if clock derivatives change out of reset)
ClearMask(pI2C -> icmdr, ICMDR_IRS);
}
void I2C_Write(unsigned short int device, int count, unsigned char *bytedata)
{
PC55XX_I2C pI2C = (PC55XX_I2C)C55XX_I2C_ADDR;
int i;
// Set the I2C controller to write a stream of count bytes
Write(pI2C -> iccnt, count);
WriteMask(pI2C -> icsar, device, ICSAR_MASK_7);
WriteMask(pI2C -> icmdr,
ICMDR_STT | ICMDR_STP | ICMDR_TRX,
ICMDR_STT | ICMDR_STP | ICMDR_TRX);
// Transmit data
for (i = 0; i < count ; i++) {
Write(pI2C -> icdxr, bytedata);
while(!(pI2C -> icstr & ICSTR_ICXRDY));
}
}
void I2C_Read(unsigned short int device, int count, unsigned char *bytedata)
{
PC55XX_I2C pI2C = (PC55XX_I2C)C55XX_I2C_ADDR;
int i;
// Set the I2C controller to read a stream of count bytes
Write(pI2C -> iccnt, count);
WriteMask(pI2C -> icsar, device, ICSAR_MASK_7);
WriteMask(pI2C -> icmdr,
ICMDR_STT | ICMDR_STP,
ICMDR_STT | ICMDR_STP | ICMDR_TRX);
// Receive the data
for (i = 0; i < count; i++)
{
// Wait for receive data to come back
while(!(pI2C -> icstr & ICSTR_ICRRDY));
// Copy the data out
bytedata = pI2C -> icdrr;
}
}
下面是SDRAM_init.c
void SDRAM_init( void )
{
ioport unsigned int *ebsr =(unsigned int *)0x6c00;
ioport unsigned int *egcr =(unsigned int *)0x800;
ioport unsigned int *emirst=(unsigned int *)0x801;
//ioport unsigned int *emibe =(unsigned int *)0x802;
ioport unsigned int *ce01 =(unsigned int *)0x803;
//ioport unsigned int *ce02 =(unsigned int *)0x804;
//ioport unsigned int *ce03 =(unsigned int *)0x805;
ioport unsigned int *ce11 =(unsigned int *)0x806;
//ioport unsigned int *ce12 =(unsigned int *)0x807;
//ioport unsigned int *ce13 =(unsigned int *)0x808;
ioport unsigned int *ce21 =(unsigned int *)0x809;
//ioport unsigned int *ce22 =(unsigned int *)0x80A;
//ioport unsigned int *ce23 =(unsigned int *)0x80B;
ioport unsigned int *ce31 =(unsigned int *)0x80C;
//ioport unsigned int *ce32 =(unsigned int *)0x80D;
//ioport unsigned int *ce33 =(unsigned int *)0x80E;
ioport unsigned int *sdc1 =(unsigned int *)0x80F;
//ioport unsigned int *sdper =(unsigned int *)0x810;
//ioport unsigned int *sdcnt =(unsigned int *)0x811;
ioport unsigned int *init =(unsigned int *)0x812;
ioport unsigned int *sdc2 =(unsigned int *)0x813;
*ebsr = 0x221;//0xa01
*egcr = 0x200;
*egcr = 0X220;
*ce01 = 0X3000;
*ce11 = 0X3fff;
*ce21 = 0x1fff;
*ce31 = 0x1000;
*emirst = 0;
*sdc1 = 0X5958;
*sdc2 = 0X38F;
*init = 0;
}
下面是util.c
#include "5509.h"
#include "util.h"