Part Number: TMS320VC5502
Tool/software:
I am encountering an issue with initializing the C5502 hardware.
When I try to execute the main.c code, CCS continuously shows 'Trouble Reading Memory' and jumps to the location in SYS_INI.asm where PLL initialization is attempted, but none of the contents in SYS_INI.asm are executed.
I have tried checking the GEL file, the VC5502.cmd file, and performing a test connection, but I can't identify any issues.
Therefore, I would like to ask for advice from all the experts:
What other approaches can I take to debug this issue?
If there are other files or details you need me to provide, please let me know!
This problem has been troubling me for weeks, and I'm very grateful for your help!
Console log:
C55xx: GEL Output: OnReset.
C55xx: GEL Output: C5502_Init Complete.
C55xx: Trouble Reading Memory Block at 0x4ed1 on Page 1 of Length 0x1: (Error -1143 @ 0x4ED0) Device core was hung. The debugger has forced the device to a ready state and recovered debug control, but your application's state is now corrupt. You should have limited access to memory and registers, but you may need to reset the device to debug further. (Emulation package 9.12.0.00150)
main.c:
#include "main.h"
/**
* main.c
*/
int main(void)
{
hardware_init();
asm(" rsbx XF"); // LED light on
UART_Send("RTI start running\r\n",19);
while(1) //main loop
{
//this is an example of how pcm get and put from McBSP(DMA)
if(PCM.Rx_flag == 1)
{
memcpy(&PCM.Rx_pcm[0], &PcmRx[PCM.Rx_indx][0], PCM_CHANNEL);
PCM.Rx_flag = 0;
}
if(PCM.Tx_flag == 1)
{
memcpy(&PcmTx[PCM.Tx_indx][0], &PCM.Tx_pcm[0], PCM_CHANNEL);
PCM.Tx_flag = 0;
}
//timer for LED blink
if(Tmr.Tmr_1s_flag == 1)
{
Run_LED();
Tmr.Tmr_1s_flag = 0;
}
UART_Recv();
}
}
void hardware_init()
{
_disable_interrupts();
SYS_INI();
UART_init(); //8-N-1,115200bps
Timer_par_init();
McBSP_DMA_init(0); //PCM
_enable_interrupts();
}
void Run_LED()
{
static short LED_state = 1;
if(LED_state == 1)
{
asm(" ssbx XF"); // LED light off
LED_state = 0;
}
else
{
asm(" rsbx XF"); // LED light on
LED_state = 1;
}
}
void Delay(unsigned long i)
{
while(i--)
{
if(i <= 0)
break;
}
return;
}
SYS_INI.asm:
.include "SYS_INI.inc"
.def _SYS_INI
.text
_SYS_INI:
psh dbl(AC0)
psh mmap(AC0G)
psh dbl(AC1)
psh mmap(AC1G)
psh T0
pshboth XAR2
pshboth XAR3
psh mmap(RPTC)
psh mmap(BRC0)
psh mmap(RSA0L)
psh mmap(RSA0H)
psh mmap(REA0L)
psh mmap(REA0H)
;==Interrupt==
bset INTM ;disable global interrupt
mov #0ffffh,mmap(IFR0) ;write 1 to clear all inturrept flag
mov #0ffffh,mmap(IFR1) ;write 1 to clear all inturrept flag
mov #00000h,mmap(IER0) ;disable all interrupt
mov #00000h,mmap(IER1) ;disable all interrupt
mov #00001h,mmap(IVPD) ;VECS start addr:xx00h,IVPD=xxh
mov #00001h,mmap(IVPH) ;IVPD=IVPH, all interrupt in same page
;==PLL (SubSystem clock group)==
mov #1h,port(#CLKMD) ;clock input=1, point A=CLKIN=24.576MHz //19.6608MHz
and #1111111111111110b,port(#PLLCSR) ;PLLEN=0, bypass mode(Point C=Point A)
or #0008h,port(#PLLCSR) ;PLLRST=1, Reset mode
; mov #000fh,port(#PLLM) ;PLL倍數=15, PLLOUT=PLLREFx15
mov #000ch,port(#PLLM) ;PLL倍數=12, PLLOUT=PLLREFx12
mov #8000h,port(#PLLDIV0) ;D0EN=1, enable D0; DIV0倍數=0, PLLREF=Point A/1
rpt #30000 ;wait 1us
nop
and #1111111111110111b,port(#PLLCSR) ;PLLRST=0, Release mode
Wait_LOCK: ;set a LOCK interrupt, wait for LOCK=1
mov port(#PLLCSR),T0
and #0020h,T0
;bcc Wait_LOCK,T0==#0 //0710 sandy建議註釋
or #0001h,port(#PLLCSR) ;PLLEN=1, PLL mode(Point C=PLLOUT)
rpt #30000
nop
;SYSCLK1 to DMA, HPI, Timer
mov #8001h,port(#PLLDIV1) ;D1EN=1, D1 enable; DIV1倍數=1, SYSCLK1=Point C/2
rpt #30000
nop
;SYSCLK2 to McBSP,I2C,UART
mov #8001h,port(#PLLDIV2) ;D2EN=1, D2 enable; DIV2倍數=1, SYSCLK2=Point C/2
rpt #30000
nop
;SYSCLK3 to EMIF
mov #8003h,port(#PLLDIV3) ;D3EN=1, D3 enable; DIV3倍數=3, SYSCLK3=Point C/4
rpt #30000
nop
mov #000bh,port(#CK3SEL) ;CK3SEL=1011b, Core Clock=Point C
mov #0005h,port(#CLKOUTSR) ;CLKOUTDIS=1, CLKOUT disable; CLKOSEL=2, CLKOUT=SYSCLK2
........


































