Project Objective: Develop an open source AIS Alarm that alerts sailors that a new marine vessel with AIS is within range

 

Project Update:

In the last post I described the hardware state and showed a photo of the new boards.  This past week I have been testing the refactored firmware and chasing a bug that caused me to get out the logic analyzer.

Debugging with the Logic Analyzer

Logic Analyzer to the Rescue:

When I refactored the code one of the changes was to the ring buffer which I described in an earlier post.  This was very elegant code which I have used before but it requires the ring buffer size to be a power of 2.  Since the microcontroller being used only has 4k of FRAM I decided it would be good to have a less constrained ring buffer size and completely rewrote the code.

 

However, there was a bug that caused stored AIS messages to be lost in some instances after the first time the "replay" button was pushed.  I was pretty sure the cause was the ring buffer and spent an inordinate amount of time trying to find it.  Finally I stopped trying to fix the nonexistent problem and started tracing the signals between the alarm and the dAISy board with a logic analyzer.  To do this I separated the boards and used jumpers to a small breadboard to give access.  In addition, I soldered a 0.1" header onto the alarm PCB where I usually use pogo pins for programming so I could use the Code Composer Studio debugger to step through the code and set breakpoints.

 

Found it!  The problem was occurring during an UART RX interrupt when the dAISy was sending AIS data back during the replay and the alarm was doing a TX.  Messages passing each other in the night and the ring buffer trying to manage it...  Problems with interrupts can be tricky.  Anyway, I seem to have that fixed now.  A logic analyzer is a very valuable tool indeed...

 

The firmware now does a self test on power up which was a feature I wanted to add.  And at the moment there are no known bugs hardware or firmware :-)

 

Coming Next:

This coming week I am going to a "hacker" camp where I hope to do a project review, perform additional testing, and maybe get some thoughts from others as well as have a good time.  I also need to revisit the "User Manual", sad document that it is.  And when I get around to it, there are some minor changes to the PCBs to aid in assembly in case I make another run of the boards.

 

Past Posts from this Project:

AIS Alarm

AIS Alarm - The Process

AIS Alarm - Prototype Hardware

AIS Alarm - Timers and GPIO

AIS Alarm - Prototype Code Outline

AIS Alarm - UART

AIS Alarm - First AIS Messages

AIS Alarm - First FRAM Storage

AIS Alarm - Debouncing Momentary Button Switches

AIS Alarm - FRAM Ring Buffer

AIS Alarm - Schematic

AIS Alarm - PCB Version 0.1

AIS Alarm - PCB Version 0.1 Arrived

AIS Alarm - PCB Version 0.2

AIS Alarm - PCB Version 0.2 Populated

AIS Alarm - PCB Version 0.2 Tested

AIS Alarm - Faceplates Received

AIS Alarm - Everything Working

AIS Alarm - First Version 1.0 Hardware Assembled