We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello
I am facing a problem in the following code.
code :-
#include "LPC318x.h" void IRQ_HANDLER(void) __irq { PIO_OUTP_SET = 0x7EFFFFFF; PIO_OUTP_SET = 0x7EFFFFFF; }
int main (void) { unsigned int i=0; SYSCLK_CTRL = 0x00000140; HCLKPLL_CTRL = 0x00014024; UARTCLK_CTRL = 0x0F; MIC_ER = 0x000007C0; U5LCR = 0x03; U5CLK = 0x0000020E; UART_CLKMODE = 0x00000550; U5FCR = 0x00; U5IER = 0x07; U3DLL = 27;
while(1) {
U5THR = 0x55; U5THR = 0xAA; }
}
When i enable UART5 interrupt by using MIC_ER interrupt is generated as it should be. But after transmitting the data it jumps to an unusual location 0x000002d4. But it doesnt go to IRQ handler. If i don't enable the interrupt using MIC_ER then it executes only while(1) loop. The main aim of the program is to blink the LED after send data through UART5 as mentioned in the IRQ interrupt handler.
Thank You,
Ankit Thakkar.
yeah sure.
My code is in external SDRAM which starts from 0x80000000. In the starting of my code interrupt vector table is located then all functions are stored. In my code i defined an IRQ handler function. Which should be called when IRQ is generated. But When IRQ is generated it goes into onchip IRAM (0x00000000 to 0x00004000) instead of going into IRQ handler function. I have verified that if program counter goes into interrupt vector table it calls the desired function. So the problem is that when IRQ is generated why program counter doesnt enter into interrupt vector table.
in case of an IRQ, the processor is supposed to go to 0x18 - which must contain the instruction to just to your function. is that the case?
in meant, of course , "jump to your function"
no. I have stored the whole code in SRAM. And the map file shows the location of IRQ handler function is 0x800001a4. But it doesnt jump to the location 0x800001a4 when IRQ is generated. LPC3180 doesnt have vectored interrupt controller. It contains one main interrupt controller and two sub interrupt controller.
What happens when you single step past the code? do you get the registers bold in the window?
In simple step past memory is updated as it should be. Even in single step everything goes well but when IRQ is generated program counter doesn't jump on IRQ routine while executing in single step. keil doesnt offer simulation capabilities for lpc3180 so its a pain to check memory values everytime.
I managed to enter into the interrupt vector table when IRQ is generated. I mapped IRAM to 0x00000000. At startup interrupt vectors are located. But It doesn't jump to the desired location. Instead of that if i execute LDR PC,[PC,#0x0018] from external SRAM it jumps to the desired location but if i execute this instruction at the remapped location 0x00000018. It doesnt jump to the specific location. Does anybody have any idea?
THANKS GUYS... I MADE IT WORKING FINALLY..
please, tell us what the problem was?