Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
weatherbox:firmware:firmware_user_manual [2016/05/05 22:39] scottbn [Unit Testing] |
weatherbox:firmware:firmware_user_manual [2021/09/19 21:59] (current) |
||
---|---|---|---|
Line 251: | Line 251: | ||
* Arduino IDE | * Arduino IDE | ||
* Arduino board USB | * Arduino board USB | ||
- | * Battery | + | * Charged battery |
* Floodlight (for Solar Irradiance & Temperature) | * Floodlight (for Solar Irradiance & Temperature) | ||
__Test Environment__: | __Test Environment__: | ||
Line 278: | Line 278: | ||
* Arduino IDE | * Arduino IDE | ||
* FTDI & cable | * FTDI & cable | ||
- | * Battery | + | * Charged battery |
* Floodlight (for Solar Irradiance & Temperature) | * Floodlight (for Solar Irradiance & Temperature) | ||
* ICSP programmer (if "burn the bootloader" wasn't previously run) | * ICSP programmer (if "burn the bootloader" wasn't previously run) | ||
Line 315: | Line 315: | ||
* Arduino IDE | * Arduino IDE | ||
* FTDI & cable | * FTDI & cable | ||
- | * Battery | + | * Charged battery |
* Floodlight (for Solar Irradiance & Temperature) | * Floodlight (for Solar Irradiance & Temperature) | ||
* ICSP programmer (if "burn the bootloader" wasn't previously run) | * ICSP programmer (if "burn the bootloader" wasn't previously run) | ||
Line 350: | Line 350: | ||
===Apple=== | ===Apple=== | ||
__Necessary Components__: | __Necessary Components__: | ||
+ | * Apple board | ||
+ | * Arduino IDE | ||
+ | * FTDI & cable | ||
+ | * XCTU software | ||
+ | * Charged battery | ||
+ | * XBee breakout board and USB | ||
+ | * Two properly configured XBees *See "Configuring XBees" under "Resources" | ||
+ | * ICSP programmer (if "burn the bootloader" wasn't previously run) | ||
__Test Environment__: | __Test Environment__: | ||
+ | * If the bootloader was not burnt | ||
+ | - Connect the ICSP device to the computer and board | ||
+ | - Open Arduino IDE | ||
+ | - Select the board Arduino UNO | ||
+ | - Select the correct programmer (AVRISP mkII) | ||
+ | - Burn the bootloader | ||
+ | * With the bootloader burnt | ||
+ | - Plug the battery and the Xbee(Router) into the Apple board | ||
+ | - Attach the Xbee(Coordinator) to the Xbee breakout board and plug that into your computer using the USB cable | ||
+ | - Open XCTU on your computer | ||
+ | * Click "Add Device" and select the corresponding USB port that your XBee is plugged into | ||
+ | * Switch to the "Console" and "Connect" the Xbee to the network | ||
+ | * Observe the Console log for packets to be received | ||
+ | - Connect the Apple board to the computer using the USB | ||
+ | - In Arduino IDE, under Tools check: | ||
+ | * Board is set to Arduino UNO | ||
+ | * Port is set to the specific USB port that the programmer is plugged into | ||
+ | * Programmer is set to AVRISP mkII | ||
+ | - In config.h verify that only macro "APPLE" is defined | ||
+ | - Run a test compile to ensure libraries are found and no compile-time errors occur | ||
+ | - Upload program to board | ||
__Expected Results__: | __Expected Results__: | ||
+ | * Console log should display "Received Packet" in red font ever ~5 seconds | ||
+ | * UART should contain the string "test yes" | ||
+ | * BINARY should contain: | ||
+ | * Some API packet coding identification | ||
+ | * Schema number: 01 | ||
+ | * Hex code for the Microcontroller address | ||
+ | * Hex code for up time of the program | ||
+ | * Hex code for overflow (if occurred) otherwise: 00 | ||
+ | * Hex code for n count: 0A | ||
+ | * Hex code for Battery mV: 01 | ||
+ | * Hex code for Panel mV: 02 | ||
+ | * Hex code for Pressure: 04 | ||
+ | * Hex code for Temperature: 05 | ||
+ | * Hex code for Humidity: 06 | ||
+ | * Hex code for Solar Irradiance: 03 | ||
===Cranberry=== | ===Cranberry=== | ||
__Necessary Components__: | __Necessary Components__: | ||
+ | * Cranberry board | ||
+ | * Arduino IDE | ||
+ | * FTDI & cable | ||
+ | * XCTU software | ||
+ | * Charged battery | ||
+ | * XBee breakout board and USB | ||
+ | * Two properly configured XBees *See "Configuring XBees" under "Resources" | ||
+ | * ICSP programmer (if "burn the bootloader" wasn't previously run) | ||
__Test Environment__: | __Test Environment__: | ||
+ | * If the bootloader was not burnt | ||
+ | - Connect the ICSP device to the computer and board | ||
+ | - Open Arduino IDE | ||
+ | - Select the board Arduino 3.3V 8MHz | ||
+ | - Select the correct programmer (AVRISP mkII) | ||
+ | - Burn the bootloader | ||
+ | * With the bootloader burnt | ||
+ | - Plug the battery and the Xbee (Router) into the Cranberry board | ||
+ | - Turn on the Cranberry board by flipping the switch to "ON" | ||
+ | - Attach the XBee (Coordinator) to the XBee breakout board and plug that into your computer using the USB cable | ||
+ | - Open XCTU on your computer | ||
+ | * Click "Add Device" and select the corresponding USB port that your XBee is plugged into | ||
+ | * Switch to the "Console" and "Connect" the XBee to the network | ||
+ | * Observe the Console log for packets to be received | ||
+ | - Connect the FTDI programmer to the computer and board | ||
+ | - In Arduino IDE, under Tools check: | ||
+ | * Board is set to Arduino 3.3V 8MHz | ||
+ | * Port is set to the specific USB port that the programmer plugged into | ||
+ | * Programmer is set to AVRISP mkII | ||
+ | - In config.h verify that only macro "CRANBERRY" is defined | ||
+ | - Run a test compile to ensure libraries are found and no compile time errors occur | ||
+ | - Upload program to board | ||
__Expected Results__: | __Expected Results__: | ||
+ | * Console log should display "Received Packet" in red font every ~5 seconds | ||
+ | * UART should contain the string "test yes" | ||
+ | * BINARY should contain: | ||
+ | * Some API packet coding identification | ||
+ | * Schema number: 01 | ||
+ | * Hex code for the Microcontroller address | ||
+ | * Hex code for up time of the program | ||
+ | * Hex code for overflow (if occurred) otherwise: 00 | ||
+ | * Hex code for n count: 0A | ||
+ | * Hex code for Battery mV: 01 | ||
+ | * Hex code for Panel mV: 02 | ||
+ | * Hex code for Pressure: 04 | ||
+ | * Hex code for Temperature: 05 | ||
+ | * Hex code for Humidity: 06 | ||
+ | * Hex code for Solar Irradiance: 03 | ||
===Dragon Fruit=== | ===Dragon Fruit=== | ||
__Necessary Components__: | __Necessary Components__: | ||
+ | * Dragon Fruit board | ||
+ | * Arduino IDE | ||
+ | * FTDI & cable | ||
+ | * XCTU software | ||
+ | * Charged battery | ||
+ | * XBee breakout board and USB | ||
+ | * Two properly configured XBees *See "Configuring XBees" under "Resources" | ||
+ | * ICSP programmer (if "burn the bootloader" wasn't previously run) | ||
__Test Environment__: | __Test Environment__: | ||
+ | * If the bootloader was not burnt | ||
+ | - Connect the ICSP device to the computer and board | ||
+ | - Open Arduino IDE | ||
+ | - Select the board Arduino UNO | ||
+ | - Select the correct programmer (AVRISP mkII) | ||
+ | - Burn the bootloader | ||
+ | * With the bootloader burnt | ||
+ | - Plug the battery and the XBee (Router) into the Dragon Fruit board | ||
+ | - Turn on the Dragon Fruit board by flipping the switch to "ON" (Switch should be flipped towards the battery) | ||
+ | - Attach the XBee (Coordinator) to the XBee breakout board and plug that into your computer using the USB cable | ||
+ | - Open XCTU on your computer | ||
+ | * Click "Add Device" and select the corresponding USB port that your XBee is plugged into | ||
+ | * Switch to the "Console" and "Connect" the XBee to the network | ||
+ | * Observe the Console log for packets to be received | ||
+ | - Connect the FTDI programmer to the computer and board | ||
+ | - In Arduino IDE, under Tools check: | ||
+ | * Board is set to Arduino UNO | ||
+ | * Port is set to the USB port with the programmer plugged into it | ||
+ | * Programmer is set to AVRISP mkII | ||
+ | - In config.h verify that only macro "DRAGONFRUIT" is defined | ||
+ | - Run a test compile to ensure libraries are found and no compile time errors occur | ||
+ | - Upload program to board | ||
__Expected Results__: | __Expected Results__: | ||
+ | * Console log window should display "Received Packet" in red font every ~5 seconds | ||
+ | * UART should contain the string "test yes" | ||
+ | * BINARY should contain: | ||
+ | * Some API packet coding identification | ||
+ | * Schema number: 01 | ||
+ | * Hex code for the Microcontroller address | ||
+ | * Hex code for up time of the program | ||
+ | * Hex code for overflow (if occurred) otherwise: 00 | ||
+ | * Hex code for n count: 0A | ||
+ | * Hex code for Battery mV: 01 | ||
+ | * Hex code for Panel mV: 02 | ||
+ | * Hex code for Pressure: 04 | ||
+ | * Hex code for Temperature: 05 | ||
+ | * Hex code for Humidity: 06 | ||
+ | * Hex code for Solar Irradiance: 03 | ||
---- | ---- | ||
- | |||
====Full Integration Test==== | ====Full Integration Test==== | ||
+ | This test should only be done once both the sensor module and transmit modules tests have been completed and the results verified. This also assumes that the "burn the bootloader step" has already been executed. | ||
===Apple=== | ===Apple=== | ||
__Necessary Components__: | __Necessary Components__: | ||
+ | * Apple board | ||
+ | * Arduino IDE | ||
+ | * FTDI & cable | ||
+ | * XCTU software | ||
+ | * XBee breakout board and USB | ||
+ | * Two properly configured XBees *See “Configuring XBees” under "Resources" | ||
+ | * Charged Battery | ||
+ | * Floodlight (for Solar Irradiance & Temperature) | ||
__Test Environment__: | __Test Environment__: | ||
+ | - Plug the battery and the Xbee(Router) into the Apple board | ||
+ | - Attach the Xbee(Coordinator) to the Xbee breakout board and plug that into your computer using the USB cable | ||
+ | - Open XCTU on your computer | ||
+ | * Click "Add Device" and select the corresponding USB port that your XBee is plugged into | ||
+ | * Switch to the "Console" and "Connect" the Xbee to the network | ||
+ | * Observe the Console log for packets to be received | ||
+ | - Connect the Apple board to the computer using the USB | ||
+ | - In Arduino IDE, under Tools check: | ||
+ | * Board is set to Arduino UNO | ||
+ | * Port is set to the specific USB port that the programmer is plugged into | ||
+ | * Programmer is set to AVRISP mkII | ||
+ | - In config.h verify that only macro "APPLE" is defined | ||
+ | - Run a test compile to ensure libraries are found and no compile-time errors occur | ||
+ | - Upload program to board | ||
__Expected Results__: | __Expected Results__: | ||
+ | * Using XCTU: | ||
+ | - In the Console log, verify that a packet is being received | ||
+ | - Examine the data within the received packet | ||
+ | * Data will be in Hexadecimal | ||
+ | * Requires conversion | ||
+ | - Data (within the REIS room) should be similar to the expected results of the Sensor Module Test | ||
+ | * With decryption script (XBee (Router) is connected to a computer with the decryption script running): | ||
+ | - Verify that a packet is being recieved | ||
+ | - Examine the converted data | ||
+ | - Data (within the REIS room) should be similar to the expected results of the Sensor Module Test | ||
===Cranberry=== | ===Cranberry=== | ||
__Necessary Components__: | __Necessary Components__: | ||
+ | * Cranberry board | ||
+ | * Arduino IDE | ||
+ | * FTDI & cable | ||
+ | * XCTU software | ||
+ | * XBee breakout board and USB | ||
+ | * Two properly configured XBees *See “Configuring XBees” under "Resources" | ||
+ | * Charged Battery | ||
+ | * Floodlight (for Solar Irradiance & Temperature) | ||
__Test Environment__: | __Test Environment__: | ||
+ | - Plug the battery and the Xbee (Router) into the Cranberry board | ||
+ | - Turn on the Cranberry board by flipping the switch to "ON" | ||
+ | - Attach the XBee (Coordinator) to the XBee breakout board and plug that into your computer using the USB cable | ||
+ | - Open XCTU on your computer | ||
+ | * Click "Add Device" and select the corresponding USB port that your XBee is plugged into | ||
+ | * Switch to the "Console" and "Connect" the XBee to the network | ||
+ | * Observe the Console log for packets to be received | ||
+ | - Connect the FTDI programmer to the computer and board | ||
+ | - In Arduino IDE, under Tools check: | ||
+ | * Board is set to Arduino 3.3V 8MHz | ||
+ | * Port is set to the specific USB port that the programmer plugged into | ||
+ | * Programmer is set to AVRISP mkII | ||
+ | - In config.h verify that only macro "CRANBERRY" is defined | ||
+ | - Run a test compile to ensure libraries are found and no compile time errors occur | ||
+ | - Upload program to board | ||
__Expected Results__: | __Expected Results__: | ||
+ | * Using XCTU: | ||
+ | - In the Console log, verify that a packet is being received | ||
+ | - Examine the data within the received packet | ||
+ | * Data will be in Hexadecimal | ||
+ | * Requires conversion | ||
+ | - Data (within the REIS room) should be similar to the expected results of the Sensor Module Test | ||
+ | * With decryption script (XBee (Router) is connected to a computer with the decryption script running): | ||
+ | - Verify that a packet is being recieved | ||
+ | - Examine the converted data | ||
+ | - Data (within the REIS room) should be similar to the expected results of the Sensor Module Test | ||
===Dragon Fruit=== | ===Dragon Fruit=== | ||
__Necessary Components__: | __Necessary Components__: | ||
+ | * Dragon Fruit board | ||
+ | * Arduino IDE | ||
+ | * FTDI & cable | ||
+ | * XCTU software | ||
+ | * XBee breakout board and USB | ||
+ | * Two properly configured XBees *See “Configuring XBees” under "Resources" | ||
+ | * Charged Battery | ||
+ | * Floodlight (for Solar Irradiance & Temperature) | ||
__Test Environment__: | __Test Environment__: | ||
+ | - Plug the battery and the XBee (Router) into the Dragon Fruit board | ||
+ | - Turn on the Dragon Fruit board by flipping the switch to "ON" (Switch should be flipped towards the battery) | ||
+ | - Attach the XBee (Coordinator) to the XBee breakout board and plug that into your computer using the USB cable | ||
+ | - Open XCTU on your computer | ||
+ | * Click "Add Device" and select the corresponding USB port that your XBee is plugged into | ||
+ | * Switch to the "Console" and "Connect" the XBee to the network | ||
+ | * Observe the Console log for packets to be received | ||
+ | - Connect the FTDI programmer to the computer and board | ||
+ | - In Arduino IDE, under Tools check: | ||
+ | * Board is set to Arduino UNO | ||
+ | * Port is set to the USB port with the programmer plugged into it | ||
+ | * Programmer is set to AVRISP mkII | ||
+ | - In config.h verify that only macro "DRAGONFRUIT" is defined | ||
+ | - Run a test compile to ensure libraries are found and no compile time errors occur | ||
+ | - Upload program to board | ||
__Expected Results__: | __Expected Results__: | ||
+ | * Using XCTU: | ||
+ | - In the Console log, verify that a packet is being received | ||
+ | - Examine the data within the received packet | ||
+ | * Data will be in Hexadecimal | ||
+ | * Requires conversion | ||
+ | - Data (within the REIS room) should be similar to the expected results of the Sensor Module Test | ||
+ | * With decryption script (XBee (Router) is connected to a computer with the decryption script running): | ||
+ | - Verify that a packet is being recieved | ||
+ | - Examine the converted data | ||
+ | - Data (within the REIS room) should be similar to the expected results of the Sensor Module Test | ||
---- | ---- | ||
- | |||
===== Unit Testing & Error Library ===== | ===== Unit Testing & Error Library ===== | ||
Unit testing and the error code library go hand in hand. We will apply unit testing to test and improve each small unit of our firmware. With each test we will have an associated error code that can be used to indicate if that test failed during full operation. | Unit testing and the error code library go hand in hand. We will apply unit testing to test and improve each small unit of our firmware. With each test we will have an associated error code that can be used to indicate if that test failed during full operation. | ||
Line 439: | Line 654: | ||
* Generally, unit tests are a design specification of how a certain behavior should work, NOT a list of observations of everything the code happens to do | * Generally, unit tests are a design specification of how a certain behavior should work, NOT a list of observations of everything the code happens to do | ||
* The overall architecture of your code should support testing units before using unit tests | * The overall architecture of your code should support testing units before using unit tests | ||
+ | |||
---- | ---- | ||
Line 471: | Line 687: | ||
---- | ---- | ||
- | |||
- |