This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

interrupts, large program, hang

Hi,

I have a problem with the interrupts, I am working with the LPC1768. In the main() function I have an infinite while() loop. In this loop is a complex program that analyzes data from the ADC. I use SysTick to periodically perform other tasks. Until this moment everything works fine. But if I get a UART interrupt then SysTick no longer works. Please help.

Regards,
Lukas

Parents Reply Children
  • Hi,
    I am not using any RTOS.
    This problem is strange, because few days earlier I made changes in UART code and the program began to work (I don't know why). Today I was programming SSP1 and the problem occurs again. Does anyone have an idea how to detect the cause of the problem?

    Regards

  • Does anyone have an idea how to detect the cause of the problem?

    Well, being able to reproduce the bug reliably and frequently helps a lot. Sometimes it requires a bit of creativity. Once you've done that, it's time to make some educated guesses as to why you are experiencing the bug. Since you can reproduce it reliably by now, you can test your theories one by one. Hopefully, one of those theories proves correct.
    Sometimes, a long hard look at the code helps too. But since you call your program 'large', it sounds unlikely that this approach will work. Which is a shame, really. You should structure your program in such a way that it is more or less easily analyzed at every level of abstraction.
    By the way, since you mentioned interrupts, you should analyze shared resources in your program. Unprotected access to shared resources from the main thread as well as interrupt context can lead to very hard-to-detect bugs.
    Don't rule out compiler bugs, either. But those are unlikely.
    Debugging can be a lot of fun...

  • Whith a strage bug as you have,
    can be usefull to change the problem view.
    Yes maybe it is a stack overflow problem or not, a memory leak or other mistake with buffer or pointer.

    Experience can help: in the past I was fight with a similar problem: the project was RTX based and almost complex.

    After a lot of time the timer0 used by RTX stop to working...a USB host driver from another vendor that I used on my project was affected by an subdule bug:

    on particular circumstances the ISR of USB routine are not clear/assert the interrupt!!!

    Before review the code of thirty part software that my project was use, I'm view the problem on the wrong side: searching stack problem and so on.

    I hope that you can fix soon as possible your problem.

    Regards
    Maurizio

  • Hi,

    I also use the USB in my project, but I have the code from NXP.
    Thank you for the tip. I will check it.

    Regards

  • Hi,
    the example of USB is to said ceck all ISR routine.
    The usb host driver that I have used was from NXP anyway.

    Maurizio