The first version of the Mongoose AHRS (Attitude and Heading Reference System) firmware and the PC GUI (with VB.net source code) are both working and are available for
download on the website. There is still a bit of work that needs to be done to make sure the soft iron compensation is working, but for the most part it is working pretty well.
In a previous post I mentioned how I thought found a bug in the operation of the RTC and that it was fixed by a seemingly unrelated change to the RTC prescale divider. Well, I was right it wasn’t related to the prescaler at all.
I’ve been having a problem with the RTC and power down mode on a project using the LPC2148. I am using EINT3/INTWAKE and the RTC alarm as sources to wake the processor from power down and I find that occasionally, when I’m in power down mode, the RTC peripheral seems to lock up and neither the alarm or EINT3 are able to wake the processor . The only way to recover is to do a hard reset.
Searching for a solution, I found this post
that said to setup the PREINT and PREFRAC even if you are using an external RTC crystal.
PREINT = ( int )( ( 60000000UL / 32768UL ) – 1 ) & ( ( 1 << 14 ) – 1 );
PREFRAC = ( int )( 60000000UL – ( ( ( unsigned long )PREINT + 1UL ) * 32768UL ) );
I’ve just tried this on a few pieces of hardware that were consistently locking up in power down and it seems to be working so far. When I switch back and forth between firmware with and without those two lines it seems to follow that if I don’t set up PREINT and PREFRAC it locks up. If this is in fact the solution I would really like to know why this works since it makes no sense.
So here goes the first post to the ckdevices blog. It occurred to me that I seem to have no shortage of interesting projects on the go relating to electronics, PCB design, microcontrollers, embedded firmware, automation and CNC machining. So in an effort to give back and share my experience I thought I would start blogging about it. I hope you find it as interesting as I do.