I'm working on polishing up the code that runs on my board before attempting a full-on test of the system. Remember, you can check out the most recent version of the code here or in the links section of the project page. However, there's been a problem that I haven't been able to get around: the chip just freezes up sometimes. It usually stops in the middle of a printf() call, and since I don't have a fancy debugger, I can't actually see what's going on inside the chip's memory at that exact moment. I suspect the problem is caused when one of the input interrupts is triggered while the chip is writing something out of the serial port. Hard to tell though.
The problem seems to go away upon reset. Since I don't want to include a reset button in the final design (that seems unprofessional), I decided to use a Watchdog Timer. Watchdog timers are found in nearly every modern microcontroller. They are used to reset the chip if the chip halts or gets stuck in a loop. While I had never used one before, it sounded like the perfect thing.
The mbed platform that I'm using doesn't have an official watchdog timer library, but I did find this example program on their site. However, when I loaded it up on my board (modified slightly for where I had soldered my LEDs), I found it didn't work at all. Upon further searching, I discovered that that example was for the LPC1768 which has a slightly different watchdog timer than the LPC1114. The main differences are that the timer control registers a) have different names and b) are in different places. I downloaded the User Manuals for both chips, read through the documentation for the watchdog timer, and about three hours later I had a watchdog timer program that actually worked! You can look it over here.
It's something that I plan on changing in the future because I'm sure it's not perfect, but it does seem to do the job so far. If you are an ARM expert, please feel free to correct anything in that program. I'd love to make it better and maybe eventually into an open-source mbed library. The next immediate step is to integrate it into my main program for my Touchscreen project. I'll keep you posted. Thanks for reading!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.