This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Dears,
I have a problem on TMS320C6457 interrupt,。
what i want to do is:
1.trigger a GPIO interrupt by GPIO 15
2.Jump to my ISR
and the emulation result is:
1.GPIO configuration is right
2.IFR, EVTFLAG, IER, CSR are all right
but the problem is:
1.The ISTP doesn't change to the valve which i expect, what i expect is 0x00800080, but it is 0x00800000
2.Program doesn't jump to the my ISR
so my question is:
1. Am i wrong with the use of ISTP? In SPRU732J, it said that the ISTB's maximum value is 0x3ffff, but the 6457's minimun memory address is 0x00800000, i am puzzled.
2. Are there other problems with my program?
My program is as follow: _c_int04 is the ISR i expect jump to
Memory allocation:
MEMORY
{
VECTORS: o = 0x00800000 l = 0x00000400
L2RAM: o = 0x00800400 l = 0x001FFC00 /* 2MB L2 Internal SRAM */
L1PRAM: o = 0x00E00000 l = 0x00008000 /* 32kB L1 Program SRAM/CACHE */
L1DRAM: o = 0x00F00000 l = 0x00008000 /* 32kB L1 Data SRAM/CACHE */
EMIFA_CE2: o = 0xA0000000 l = 0x00800000 /* 8MB EMIFA CE2 */
EMIFA_CE3: o = 0xB0000000 l = 0x00800000 /* 8MB EMIFA CE2 */
EMIFA_CE4: o = 0xC0000000 l = 0x00800000 /* 8MB EMIFA CE2 */
EMIFA_CE5: o = 0xD0000000 l = 0x00800000 /* 8MB EMIFA CE2 */
DDR2_CE0: o = 0xE0000000 l = 0x20000000 /* 512MB EMIFB CE0 */
}
IST defination:
.align 1024
_vectors:
_vector0: VEC_ENTRY _c_int00 ;RESET
_vector1: VEC_ENTRY _vec_dummy ;NMI
_vector2: VEC_ENTRY _vec_dummy ;
_vector3: VEC_ENTRY _vec_dummy ;
_vector4: VEC_ENTRY _c_int04 ;c_int04 ISR,this is my ISR
_vector5: VEC_ENTRY _vec_dummy
_vector6: VEC_ENTRY _vec_dummy
_vector7: VEC_ENTRY _vec_dummy
_vector8: VEC_ENTRY _vec_dummy
_vector9: VEC_ENTRY _vec_dummy
_vector10: VEC_ENTRY _vec_dummy
_vector11: VEC_ENTRY _vec_dummy
_vector12: VEC_ENTRY _vec_dummy
_vector13: VEC_ENTRY _vec_dummy
_vector14: VEC_ENTRY _vec_dummy
_vector15: VEC_ENTRY _vec_dummy
Interrupt init:
void InitInterrupt(void)
{
*IECRH = 0xFFFFFFFF; // IECRH (disable high interrupts enable)
*EECRH = 0xFFFFFFFF; // EECRH (disable high events enable)
*ICRH = 0xFFFFFFFF; // ICRH (clear high interrupts pending)
*ECRH = 0xFFFFFFFF; // ECRH (clear high events pending)
*IECR = 0xFFFFFFFF; // IECR (disable low interrupts enable)
*EECR = 0xFFFFFFFF; // EECR (disable low events enable)
*EICR = 0xFFFFFFFF; // ICR (clear low interrupts pending)
*ECR = 0xFFFFFFFF; // ECR (clear low events pending)
*EVTMASK0 = 0xffffffff;//disable combine
*EVTMASK1 = 0xffffffff;
*EVTMASK2 = 0xffffffff;
*EVTMASK3 = 0xffffffff;
*EVTCLR0 |= 0xfffffff;
*EVTCLR1 |= 0xfffffff;
*EVTCLR2 |= 0xfffffff;//clear all event(including 66) flag before the new interrupt come
*EVTCLR3 |= 0xfffffff;
//temp = *EVTFLAG2;
ICR = 0xfffffffe;//clear IFR
asm( " NOP");
asm( " NOP");
*INTMUX1 |= 0x00000042;//INT04 responding to event 66,GPIO 15
*INTMUX1 &= 0xffff0042;
IER |= 0x00000012; // IE4=1,NMIE=1
ISTP = 0x00800080; //point to my ISR , _c_int04
//*EVTSET2 |= 0x00000004;
CSR |= 0x00000001; // enable GIE
}
Zhang Dexian,
Please download and use the Chip Support Library (CSL) for the C6457, named sprc924. You can go to the TI Wiki Pages and search for "C6457 CSL" (no quotes) to find a link to download it. The CSL includes examples and support files, and these have been tested and debugged. There is a GPIO example included that may be similar to what you are trying to do.
We have already debugged these CSL examples. It is very difficult to debug register-level programming such as yours, and there are very subtle problems that may exist when you try writing to registers without understanding the details of the registers and the system implications of ordering and specific values. These problems have already been debugged, so you will save a lot of time by using the tools we provide instead of trying to start from scratch.
I will assume that you will follow the advice above, but will make a few comments on your many questions. It is not possible for me to debug your program, especially since we offer code that is already debugged in the CSL examples.
zhang dexian said:1.The ISTP doesn't change to the valve which i expect, what i expect is 0x00800080, but it is 0x00800000
You do not want to set the value of ISTP to 0x00800080. Your VECTORS section is at 0x00800000 and your _vectors label is at 0x00800000 so you want to set ISTP to 0x00800000 which correctly sets the beginning address of the interrupt service table.
zhang dexian said:1. Am i wrong with the use of ISTP? In SPRU732J, it said that the ISTB's maximum value is 0x3ffff, but the 6457's minimun memory address is 0x00800000, i am puzzled.
ISTB is a 22-bit field in the ISTP register. The maximum value for a 22-bit field is 0x3FFFFF. If ISTB=0x3FFFFF then ISTP=0xFFFFFC00 which is much higher than you would use.
zhang dexian said:2. Are there other problems with my program?
Please build a working example using the CSL that I mentioned above. Then you can compare the register settings from the working example with your register settings in your example. This is the most efficient way to debug low-level code.
zhang dexian said:IER |= 0x00000012; // IE4=1,NMIE=1
Your comment is wrong. NMIE is not in the IER register. Please search the CPU & Instruction Set Reference Guide for NMIE to learn about its location and use. This is also handled by the code in the CSL examples.
Regards,
RandyP
Hi RandyP,
Thank your suggestion, i got this problem done, my program is right, i should set breakpoint in ISR, run step by step is not right.