strict warning: Only variables should be passed by reference in /homepages/26/d141797381/htdocs/drupal-6.38/sites/all/modules/webfm/webfm.module on line 2409.

Hardware Setup and Programming

Build the Esduino CAN shield from the bare board available from this site or from scratch using an Arduino proto-board with point to point wiring.  The schematic and BOM are available from the product page.

Set jumpers on the Esduino board as follows before joining it to the CAN Shield:
  • JB1 = USB
  • JB2 = PT4
  • JB3 = PM4
  • JB5 = 5V
  • JB8 = CAN (Port M)
Installation of FTDI drivers is required on the host computer before it can connect with the Esduino via USB.  The Technological Arts website supplies the instructions and driver software.

Connect the Esduino (with SW1 at "LOAD") to the host computer with a mini-b USB cable.  Windows may not recognize the Esduino as a USB Serial Port when it is connected for the very first time, even after the FTDI drivers are loaded.  If prompted by Windows to select a driver, manually select the direcctory where the FTDI drivers reside.  After the Esduino is recognized as a USB serial port It is likely that you will have to go into Device Manager to change the comport number to COM2 so that CodeWarrior can detect SerMon.  The screen capture below shows the steps necessary to navigate within Windows 7.

(view larger image)

When the Esduino USB connection has been properly established, open the CodeWarrior project, build without errors and click on the "Debug" button.  This will open the debug software which will connect with the SerMon firmware of the Esduino (provided if it has been powered up with SW1 set to "LOAD").  By default the connection will automatically erase any flash contents (the monitor itself is protected against erasure), load the S19 file of the project into the mcu flash and load the debug symbols to into the debugger software to allow source debugging.  Execution of the program will begin after clicking on the start button (green arrow) or by pressing the F5 key.  Note that the 9S12 flash memory can be reburned many thousands of times without issue.  I date back to a time when this wasn't true and so I don't like reprogramming when it isn't necessary.

To set a breakpoint in the IDE, reset the target by clicking on the reset icon, click in the "Source" window of the debugger then click on the "source" menu item and then on the "Open Source File..." menu item.  A list of the source files will appear to select from.  The selected file will appear in the "Source" window.  Use the mouse to locate the line where a breakpoint is to be set and use the right mouse button to open a context menu from which the breakpoint item is selected.  Restart the program.  If it encounters the breakpoint, execution will be stopped and all registers and memory are available for inspection.  The program can resume normal execution with F5 or be stepped forward with F10 (step over functions) or F11 (step into functions).  There are a limited number of breakpoints available so it is normal to deactivate/delete these control points as one drills down into the code while debugging.

Now that the program resides in the mcu flash memory, it will automatically execute upon reset when SW1 is in the "RUN" position.  If for some reason it does not start with SW1 set to "RUN", then a 10K external pullup resistor might need to be applied to pin PS0 (JB4 pin 5).