2.3 Programming the Device and Comparing Power Efficiency

Todo: Load the project onto the microcontroller and get power readings.
  1. Program the device and get power consumption readings from the software implementation program.
    1. Connect the Curiosity Nano board to the computer. Connect the two soldered pins together. With the software accumulation program set as main program, press the Make and Program Device button from the toolbar. A pop-up might appear that asks to select the tool that will be programmed. Select the AVR128DA48 Curiosity Nano board.
      Figure 2-24. Make and Program the Device
    2. Open Atmel Studio and connect the Power Debugger to the computer. Connect the Curiosity Nano board to the channel A ammeter of the Power Debugger. Connect the pin closest to the Nano embedded debugger to the inward pointing arrow of the A ammeter and the pin closest to the microcontroller to the outward pointing arrow of the ammeter.
      Figure 2-25. Hardware Setup
    3. In Atmel Studio, go to Tools → Data Visualizer.
    4. Two boxes will appear. Check the one called DGI (Data Gateway Interface) Control Panel. If this does not show up, the Configuration menu on the left side can be accessed and, in the Modules → External Connection section, the Data Gateway Interface can be found.
      Figure 2-26. Data Gateway Interface
    5. Press Connect and a box labeled ‘power’ will appear. Select it and then press the wheel to open the menu. Disable the B channel.
      Warning: In case the Power field does not appear, disconnect the board and connect it again.
      Figure 2-27. DGI Connect
      Figure 2-28. Power Settings
    6. When everything is correctly configured, press Start and a new box that displays the power consumption in real time will appear.
      Tip: To adjust the display, open the control panel on the left side of the box. Unchecking Show zero will provide a clearer picture.
      Figure 2-29. Start Monitoring
    7. After the reading has stabilized, press Stop and then disconnect. The box with the power measurement will remain open.
  2. Get power consumption readings from the hardware accumulation implementation program.
    1. Connect the two soldered pins on the Curiosity board together.
    2. With the hardware accumulation project set as main program, press the Make and Program Device button on the toolbar in MPLAB X.
      Figure 2-30. Make and Program the Device
    3. Connect two soldered pins of the Curiosity Nano Board to the Power Debugger. See Step 1.2.
    4. Go back to the Data Visualizer in Atmel Studio and in the DGI panel press Connect.
      Figure 2-31. DGI Connect
    5. Check the power box and edit the settings to disable the B channel.
      Figure 2-32. Power Settings
    6. Press Start and a new box that displays the real-time power consumption will appear. Disable Show zero for a better picture.
      Figure 2-33. Start Monitoring
    7. When the reading has stabilized, press Stop to have a fixed result.
  3. Compare the two measurements.
    1. Both power consumption graphs are open on the same screen. They can now be analyzed to observe the way the programs behaved.
      Figure 2-34. Software Accumulation Compared to Hardware Accumulation
      Info: The top part displays the software accumulation, while the bottom part, the hardware accumulation. As can be seen from the picture, there is a 3.1 mA difference between the two, making the hardware implementation almost twice as efficient.