Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lewispg228/Pi_grammer
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: sparkfun/SparkFun_Pi_AVR_Programmer_HAT
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.

Commits on Jul 14, 2017

  1. Serial upload working for RedBoards

    Note, I had to install arduino onto the Pi. And then I just watched
    verbose debug while using the IDE and copied the avrdude calls. See
    /SERIAL_UPLOAD/readme.txt for more info.
    
    Also adjusted/added to the test.py module. It now has a proper
    parse_results_serial() function to verify that the target was written to
    (although I omitted actual hex read-back verification to save time).
    
    Also, There is support for Serial upload pass/fail LEDs, however I have
    not yet tried this with hardware... just getting ready for when
    Pi_grammer v2.0 is built up.
    lewispg228 committed Jul 14, 2017
    Copy the full SHA
    aef915f View commit details

Commits on Aug 16, 2017

  1. BOM update - library and PROD_ID stuff

    No change to design, just did a replace to correct parts in library.
    
    Note, I also had to manually adjust the PROD_ID for the RA header,
    because I didn't want to muddy up the device for this part.
    lewispg228 committed Aug 16, 2017
    Copy the full SHA
    3171ee4 View commit details

Commits on Nov 17, 2017

  1. Serial upload stuff

    Added in LOCK_BITS_PASS variable so that I can avoid attempting a serial
    upload if there is any failures upstream.
    
    Also, started checking a "temp" copy of readout from serial program, to
    adetify if it's looking hopeful. If it's going to fail, then it usually
    takes about 30 seconds to timeout, and can appear to the tech that the
    pi_grammer has frozen. This helps avoid this illusion.
    
    Also, this is still not killing the subprocess, and I'm not sure how to
    do that properly. So even though I move on in the python module, the
    serial upload bash file is still going and timeing out again and again
    until it's totally done in about 30 seconds.
    lewispg228 committed Nov 17, 2017
    Copy the full SHA
    072c841 View commit details

Commits on Dec 14, 2017

  1. fixing clean_results bug

    If you are not using the SERIAL_UPLOAD feature, it will no longer try to clean up that file.
    
    Note, previously, it would try to truncate a file that doesn't exist and lock up the program :(
    
    fixed now!!
    Pete Lewis committed Dec 14, 2017
    Copy the full SHA
    48b120f View commit details
  2. panel

    adamsilva committed Dec 14, 2017
    Copy the full SHA
    c9ce731 View commit details

Commits on Dec 18, 2017

  1. pi_grammer shell script $CHIP variable

    Added a "CHIP" variable to the script that holds the chip to be
    programmed. Saves us a small amount of time not updating both fush and
    flash individually. Changed in both linuxspi folder and in the main file
    structure.
    Elias Santistevan committed Dec 18, 2017
    Copy the full SHA
    0e85394 View commit details
  2. Variable CHIP changed to DEVICE

    Elias Santistevan committed Dec 18, 2017
    Copy the full SHA
    3204624 View commit details

Commits on Dec 21, 2017

  1. pi_serial_upload default settings and variables

    I added a device and baud rate to the top of this script similar to the
    pi_upload shell script. I changed the programmer command (-c) to default
    to arduino instead of wiring, the default device to atmega328p, and the
    baud to 115200. I also put notes in the script to pick a slower baud
    rate for slower clock speesd ( <= 8mHz)
    Elias Santistevan committed Dec 21, 2017
    Copy the full SHA
    cede6da View commit details

Commits on Dec 22, 2017

  1. Auto update test.py

    If you put a new test.py file on a media device, then plug it into the pi_grammer, it will now pull that in and overwrite the local test.py file.
    
    Still need to create a RE-launching of python with the new test.py... coming soon.
    Pete Lewis committed Dec 22, 2017
    Copy the full SHA
    2892a7e View commit details
  2. test.py will now update itself and RE-launch python

    Note, I had to add in a file compare, so that it wouldn't keep updating every relaunch. This might be worth adding into the other auto updates stuff (pi_program.sh and *hex)
    Pete Lewis committed Dec 22, 2017
    Copy the full SHA
    7b7476b View commit details
  3. need this sh file for the actual relaunch

    must be saved in the home/pi/ folder
    Pete Lewis committed Dec 22, 2017
    Copy the full SHA
    caaf445 View commit details
  4. Pi_grammer ADD-ON board to isolate programmer from target

    My idea here is to be able to swtich the lines to completely disconnect the pi_grammer from the target.
    
    *This stemmed from a programming procedure on the lilypad MP3 where the SPI lines are used by the product's ATmega328 to take to the uSD card, so the pi_grammer is stopping that. I hope to free up those lines after programming and let the product do it's thing.
    Pete Lewis committed Dec 22, 2017
    Copy the full SHA
    871ccfe View commit details

Commits on Dec 28, 2017

  1. Re-creating pi_program on Raspi to avoid strange CR behavior

    Note, I was seeing some errors being thrown in the raspi when I tried to run pi_program.sh - it was showing that the command "sleep 0.1\r" was an invalid value for sleep. I'm assuming that the "\r" is some annoying carrage return from editing the file on a windows machine.
    
    Added comments around the device variable
    Pete Lewis committed Dec 28, 2017
    Copy the full SHA
    c84cac9 View commit details

Commits on Jan 3, 2018

  1. Adding useful desktop links

    I find myself typing in these three commands a lot, so I turned them into double-click-able "links" that you can copy to the desktop.
    
    The shell files themselves (the ".sh" files) must live in /home/pi/Pi_grammer_utililties
    
    And you must copy the desktop link files to you desktop.
    Pete Lewis committed Jan 3, 2018
    Copy the full SHA
    66f5517 View commit details
  2. open permissions and flash dump ultilities added

    Pete Lewis committed Jan 3, 2018
    Copy the full SHA
    2062789 View commit details

Commits on Jan 19, 2018

  1. on serial upload failure - added killall avrdude

    When serial upload fails, it will take FOREVER for avrdude to attempt (like 10 times) to serial upload, and it will timeout on each of those attempts. Rather than waiting for that to finish (which looks like the pi is frozen to the user), I take a snapshot of the results and parse them a bit. I can tell that it's going south, and then kill it. Previously the "process.terminate()" wasn't working  - and I think it still doesn't do much. But the call to "sudo killall avrdude" really does the trick.
    
    Also note, in the previous test.py, even though the python module would move on, the avrdude instance would continue. This would lock up the com port and cause more failures down the road.
    
    Seems to be working pretty darn well now. wahoo!
    Pete Lewis committed Jan 19, 2018
    Copy the full SHA
    d80db67 View commit details

Commits on Jan 22, 2018

  1. Increased Serial upload "timeout" time to 1.5 seconds

    I found while deving the FJ, that sometimes the serial upload would need a bit more time to indicate success or failure. 1.5 seconds seems to do the trick.
    Pete Lewis committed Jan 22, 2018
    Copy the full SHA
    81f20a9 View commit details

Commits on Feb 13, 2018

  1. Default images for v20 - includes serial LED

    Pete Lewis committed Feb 13, 2018
    Copy the full SHA
    4a21fa9 View commit details

Commits on Mar 8, 2018

  1. Update README.md

    Add tutorial link. =)
    bboyho authored Mar 8, 2018
    Copy the full SHA
    580624b View commit details
  2. Update README.md

    bboyho authored Mar 8, 2018
    Copy the full SHA
    d543edc View commit details

Commits on Mar 13, 2018

  1. Copy the full SHA
    2ce1715 View commit details
  2. Copy the full SHA
    2c02c10 View commit details

Commits on Mar 16, 2018

  1. adding instruction to get to pi_grammer from NOOBs

    note, this is not tested yet, but I'm 99% sure this is all you need to do. Will test ASAP.
    Pete Lewis committed Mar 16, 2018
    Copy the full SHA
    71f390c View commit details
  2. added in avrdude_gpio.conf as necessary step in setup

    Pete Lewis committed Mar 16, 2018
    Copy the full SHA
    9f4bac3 View commit details

Commits on Mar 23, 2018

  1. optional delay before serial program

    Note, this is commented out by default, but will be needed for doing any serial programming to micros that need a sec to enumerate the com port. See the following comment thread on the tutorial for more info about how the problem was discovered/fixed
    
    [https://learn.sparkfun.com/tutorials/raspberry-pi-stand-alone-programmer/discuss#comment-5ab2d42d7e7fa89f378b4567](https://learn.sparkfun.com/tutorials/raspberry-pi-stand-alone-programmer/discuss#comment-5ab2d42d7e7fa89f378b4567)
    Pete Lewis committed Mar 23, 2018
    Copy the full SHA
    01add03 View commit details

Commits on Mar 26, 2018

  1. picture of ISOLATE add-on solder wire

    Note, this is controlled via GPIO (36) in test.py. It allows you to "totally" isolate the target from the programmer.
    Pete Lewis committed Mar 26, 2018
    Copy the full SHA
    241d072 View commit details

Commits on Mar 29, 2018

  1. pi_grammer v21

    Added in isolation switch
    lewispg228 committed Mar 29, 2018
    Copy the full SHA
    7796cda View commit details
  2. deleting old ADD ON boards

    These are now baked into the MAIN board v21
    lewispg228 committed Mar 29, 2018
    Copy the full SHA
    4ffc6ba View commit details

Commits on Apr 5, 2018

  1. Added troubleshooting tip #1 to readme

    cerberus cable tip
    Pete Lewis authored Apr 5, 2018
    Copy the full SHA
    7f3acfc View commit details

Commits on Apr 20, 2018

  1. Swapped out package to paste-closed jumper for TARGET VCC

    This needed a default target logic select. It is now closed (selected) via paste on the "TARGET VCC" option.
    Pete Lewis committed Apr 20, 2018
    Copy the full SHA
    5becc3f View commit details

Commits on Apr 24, 2018

  1. Adapter updates for storefront product

    -Added open source hardware logo
    -sparkfun flame
    -"product" board name
    -schematic cleanup
    -removed rounded cornders for easier board de-panelization
    -lengthened board to eliiminate overhaning parts
    -moved to SMT parts for easier assembly
    Pete Lewis committed Apr 24, 2018
    Copy the full SHA
    d5fec1f View commit details
  2. correcting adapter name to "AVR_ADAPTER"

    Pete Lewis committed Apr 24, 2018
    Copy the full SHA
    0d74b43 View commit details
  3. pi_grammer_MAIN updates for storefront product

    -moved to RA SMT 1x6 header for programming lines to cable, had to re-route a few things, MISO and MOSI have a much better direct route now.
    -Enlarged most silk to standard 0.05
    -changed text silk on "blank boxes" to more generic use case terms - project name, version, date etc.
    -added prod ID to switch IC
    -updated copper and sch version number to v22
    -added large sparkfun logo to bottom side silk
    -removed passive component values silk - this is only used during QC testing hardware assembly (when we build them by hand)
    Pete Lewis committed Apr 24, 2018
    Copy the full SHA
    024fede View commit details

Commits on Apr 25, 2018

  1. updated AT42QT1010 to pull from the proper sparkfun eagle sensor libr…

    …ary dev
    Pete Lewis committed Apr 25, 2018
    Copy the full SHA
    45043c9 View commit details
  2. updated switch (U2) to use sparkfun eagle library

    also updated all libraries and the LEDs silk changed to updated versions of 1206 packages
    Pete Lewis committed Apr 25, 2018
    Copy the full SHA
    97a24ac View commit details
  3. RA SMD 6 pin header updated to have correct prod ID

    Pete Lewis committed Apr 25, 2018
    Copy the full SHA
    59e405f View commit details
  4. schematic frame update to CC 4.0

    Pete Lewis committed Apr 25, 2018
    Copy the full SHA
    974d2fc View commit details
  5. schematic cleanup and notes

    Pete Lewis committed Apr 25, 2018
    Copy the full SHA
    0fb73b8 View commit details
  6. prod_ID correction on at42QT1010

    manually adjusted from the old package part in sparkle to the new UDFN
    Pete Lewis committed Apr 25, 2018
    Copy the full SHA
    49f3b8d View commit details
  7. sch cleanup

    Pete Lewis committed Apr 25, 2018
    Copy the full SHA
    3ea6f2d View commit details
  8. dimention width to 8 mil

    Pete Lewis committed Apr 25, 2018
    Copy the full SHA
    4a5a756 View commit details
  9. Selective solder path on layer 48

    Pete Lewis committed Apr 25, 2018
    Copy the full SHA
    edadeff View commit details
  10. measures on 47

    Pete Lewis committed Apr 25, 2018
    Copy the full SHA
    ab6c034 View commit details

Commits on Apr 30, 2018

  1. Changed a 3.3V net flag to a proper "VCC" symbol

    Note, this flag was for the 3.3V hitting the resistor for the "POWER" LED.
    lewispg228 committed Apr 30, 2018
    Copy the full SHA
    aa21ff8 View commit details

Commits on May 9, 2018

  1. Changing program_serial command assignment

    The previous call to bash using 'sh' limits what the given bash script can execute. Changing it to 'bash' (superset of 'sh') allows for a greater range of functions available to use in executed script.
    edspark committed May 9, 2018
    Copy the full SHA
    58c4355 View commit details

Commits on May 21, 2018

  1. Copy the full SHA
    c968958 View commit details
  2. Adjusted silk for new product name

    Also updated all silk to sweet buzzard style labels
    lewispg228 committed May 21, 2018
    Copy the full SHA
    879e020 View commit details

Commits on May 22, 2018

  1. reverting to default "SH" in serial upload shell call

    Note, I kept "BASH" option commented out to have nearby for reference with comments.
    lewispg228 committed May 22, 2018
    Copy the full SHA
    ec557d8 View commit details

Commits on May 29, 2018

  1. fixed hatch ground pour under capsense pad

    Due to inverted sPlace (silk), it was hard to see that the hatched GND was actually gone. I must have ripped up a "floating" GND trace that connects the hatched GND polygon to the main GND polygon on the botton copper.
    Pete Lewis committed May 29, 2018
    Copy the full SHA
    537dfb3 View commit details

Commits on May 30, 2018

  1. panel v22 created

    dpender committed May 30, 2018
    Copy the full SHA
    5c8aff4 View commit details
Showing with 47,740 additions and 22,077 deletions.
  1. +3 −0 .gitignore
  2. BIN Documentation_ example_&_pics/ISOLATE_ADD-ON_control_line.jpg
  3. BIN Documentation_ example_&_pics/V20_pics/power.jpg
  4. BIN Documentation_ example_&_pics/V20_pics/stat.jpg
  5. BIN Documentation_ example_&_pics/V20_pics/success.jpg
  6. BIN Documentation_ example_&_pics/V20_pics/success_no_serial.jpg
  7. BIN Documentation_ example_&_pics/V20_pics/tap.jpg
  8. +0 −526 HARDWARE/ADAPTER/Pi_grammer_ADAPTER.brd
  9. +0 −1,771 HARDWARE/ADAPTER/Pi_grammer_ADAPTER.sch
  10. +3,043 −0 HARDWARE/ADAPTER/SparkFun_Pi_AVR_Programmer_ADAPTER.brd
  11. +1,016 −2,131 ...ic_Level_Converter/Pi_grammer_SPEEDY_SPI_V3.sch → ADAPTER/SparkFun_Pi_AVR_Programmer_ADAPTER.sch}
  12. +10,499 −0 HARDWARE/HAT/SparkFun_Pi_AVR_Programmer_HAT.brd
  13. +12,937 −1,466 HARDWARE/{MAIN/Pi_grammer_MAIN.sch → HAT/SparkFun_Pi_AVR_Programmer_HAT.sch}
  14. +0 −1,694 HARDWARE/MAIN/Pi_grammer_MAIN.brd
  15. +0 −607 HARDWARE/SERIAL_UPLOAD_ADD_ON/Pi_grammer_SERIAL_UPLOAD_ADD_ON.brd
  16. +0 −962 HARDWARE/SERIAL_UPLOAD_ADD_ON/Pi_grammer_SERIAL_UPLOAD_ADD_ON.sch
  17. +0 −1,065 HARDWARE/SPEEDY_SPI_ADD_ON/V1_TXB0104/Pi_grammer_SPEEDY_SPI_V1.brd
  18. +0 −9,885 HARDWARE/SPEEDY_SPI_ADD_ON/V1_TXB0104/Pi_grammer_SPEEDY_SPI_V1.sch
  19. +0 −1,122 HARDWARE/SPEEDY_SPI_ADD_ON/V3_Logic_Level_Converter/Pi_grammer_SPEEDY_SPI_V3.brd
  20. +0 −265 HARDWARE/SPEEDY_SPI_ADD_ON/V3_Logic_Level_Converter/~Library_work/SparkFun-Boards.lbr
  21. +55 −0 License.md
  22. +19,394 −0 Production/SparkFun_Pi_AVR_Programmer_HAT-Panel_v22.brd
  23. +42 −7 README.md
  24. +0 −550 SERIAL_UPLOAD/Flying_Jalapeno_selftest_v01.ino.mega.hex
  25. +10 −0 SERIAL_UPLOAD/Readme.txt
  26. +195 −0 SERIAL_UPLOAD/blink.hex
  27. +10 −6 SERIAL_UPLOAD/pi_serial_upload.sh
  28. +80 −0 SERIAL_UPLOAD/serial_upload_results.txt
  29. +61 −0 SERIAL_UPLOAD/serial_upload_results_temp.txt
  30. +12 −0 SERIAL_UPLOAD/serial_upload_results_temp_1_sec_BAD.txt
  31. +61 −0 SERIAL_UPLOAD/serial_upload_results_temp_1_sec_good.txt
  32. BIN Setup_Instructions/General/Creating_Programmer_image_from_NOOBS.doc
  33. BIN Setup_Instructions/General/Creating_Programmer_image_from_NOOBS.pdf
  34. BIN Setup_Instructions/General/{Pi_Grammer_Setup_Instructions.doc → Setup_Instructions.doc}
  35. BIN Setup_Instructions/General/{Pi_Grammer_Setup_Instructions.pdf → Setup_Instructions.pdf}
  36. +7 −0 Utilities/Desktop_links/edit.test.py.desktop
  37. +7 −0 Utilities/Desktop_links/killall.python.desktop
  38. +7 −0 Utilities/Desktop_links/open.permissions.desktop
  39. +7 −0 Utilities/Desktop_links/start.test.desktop
  40. +8 −0 Utilities/edit.test.py.sh
  41. +7 −0 Utilities/flash_dump.sh
  42. +7 −0 Utilities/killall.python.sh
  43. +8 −0 Utilities/open.permissions.sh
  44. +8 −0 Utilities/start.test.sh
  45. +1 −1 avrdude_gpio.conf
  46. +16 −0 disable_switch.py
  47. +16 −0 enable_switch.py
  48. +5 −2 linuxpsi_versions/pi_program.sh
  49. +35 −0 optiboot_atmega328_2012_with_1s_watchdog.hex
  50. +26 −6 pi_program.sh
  51. +20 −0 relaunch_python.sh
  52. +137 −11 test.py
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -172,3 +172,6 @@ pip-log.txt

# Mac crap
.DS_Store

## openoffice backups
*.doc#

Unable to render rich display

Invalid image source.

Binary file added Documentation_ example_&_pics/V20_pics/power.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation_ example_&_pics/V20_pics/stat.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation_ example_&_pics/V20_pics/tap.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
526 changes: 0 additions & 526 deletions HARDWARE/ADAPTER/Pi_grammer_ADAPTER.brd

This file was deleted.

1,771 changes: 0 additions & 1,771 deletions HARDWARE/ADAPTER/Pi_grammer_ADAPTER.sch

This file was deleted.

3,043 changes: 3,043 additions & 0 deletions HARDWARE/ADAPTER/SparkFun_Pi_AVR_Programmer_ADAPTER.brd

Large diffs are not rendered by default.

Large diffs are not rendered by default.

10,499 changes: 10,499 additions & 0 deletions HARDWARE/HAT/SparkFun_Pi_AVR_Programmer_HAT.brd

Large diffs are not rendered by default.

14,403 changes: 12,937 additions & 1,466 deletions HARDWARE/MAIN/Pi_grammer_MAIN.sch → ...RE/HAT/SparkFun_Pi_AVR_Programmer_HAT.sch

Large diffs are not rendered by default.

1,694 changes: 0 additions & 1,694 deletions HARDWARE/MAIN/Pi_grammer_MAIN.brd

This file was deleted.

607 changes: 0 additions & 607 deletions HARDWARE/SERIAL_UPLOAD_ADD_ON/Pi_grammer_SERIAL_UPLOAD_ADD_ON.brd

This file was deleted.

962 changes: 0 additions & 962 deletions HARDWARE/SERIAL_UPLOAD_ADD_ON/Pi_grammer_SERIAL_UPLOAD_ADD_ON.sch

This file was deleted.

1,065 changes: 0 additions & 1,065 deletions HARDWARE/SPEEDY_SPI_ADD_ON/V1_TXB0104/Pi_grammer_SPEEDY_SPI_V1.brd

This file was deleted.

9,885 changes: 0 additions & 9,885 deletions HARDWARE/SPEEDY_SPI_ADD_ON/V1_TXB0104/Pi_grammer_SPEEDY_SPI_V1.sch

This file was deleted.

This file was deleted.

This file was deleted.

55 changes: 55 additions & 0 deletions License.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
SparkFun License Information
============================

SparkFun uses two different licenses for our files — one for hardware and one for code.

Hardware
---------

**SparkFun hardware is released under [Creative Commons Share-alike 4.0 International](http://creativecommons.org/licenses/by-sa/4.0/).**

Note: This is a human-readable summary of (and not a substitute for) the [license](http://creativecommons.org/licenses/by-sa/4.0/legalcode).

You are free to:

Share — copy and redistribute the material in any medium or format
Adapt — remix, transform, and build upon the material
for any purpose, even commercially.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:

Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
Notices:

You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation.
No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material.


Code
--------

**SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).**

The MIT License (MIT)

Copyright (c) 2016 SparkFun Electronics

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
19,394 changes: 19,394 additions & 0 deletions Production/SparkFun_Pi_AVR_Programmer_HAT-Panel_v22.brd

Large diffs are not rendered by default.

49 changes: 42 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# Pi_grammer
A shield for Raspberry Pi 2, used for programming AVR ICs. Includes capsense pad to engage, 3x2 ISP header for connectivity and status LEDs.
SparkFun Pi AVR Programmer HAT
========================================

![SparkFun Raspberry Pi Stand-Alone Programmer w/ the Pi-Grammer Hat](https://cdn.sparkfun.com/r/600-600/assets/learn_tutorials/7/3/9/Pi_Grammer.jpg)

[*SparkFun Pi AVR Programmer HAT (DEV-14747)*](https://www.sparkfun.com/products/14747)

A shield for Raspberry Pi 2, used for programming AVR ICs. Includes capsense pad to engage, 2x3 ISP header for connectivity and status LEDs.

Documentation
--------------
* **[Hookup Guide](https://learn.sparkfun.com/tutorials/pi-avr-programmer-hat-hookup-guide)** - Basic hookup guide for the Pi AVR Programmer Hat.
* **[Raspberry Pi Stand-Alone Programmer](https://learn.sparkfun.com/tutorials/raspberry-pi-stand-alone-programmer)** - more information about the prototype can be found in the article.

Additional Notes
--------------
This project originated from Adafruits tutorial here:

https://learn.adafruit.com/program-an-avr-or-arduino-using-raspberry-pi-gpio-pins/overview
@@ -9,14 +22,36 @@ This shield makes it a bit easier to program AVRs with a headless Raspberry Pi.

This repo also contains some other useful files:

RCLOCAL - calls /home/pi/test.py and ensure that this python module will run automatically at boot up (useful when running headless)
* **RCLOCAL** - calls /home/pi/test.py and ensure that this python module will run automatically at boot up (useful when running headless)

AVRDUDE config file - sets the GPIO used for programming (in avrdude) to work with the shield design. It's located at the very end of this file.
* **AVRDUDE config file** - sets the GPIO used for programming (in avrdude) to work with the shield design. It's located at the very end of this file.

test.py - the python module that is auto called during bootup. This also listens to the capsense IC and engages programming when pressed.
* **test.py** - the python module that is auto called during bootup. This also listens to the capsense IC and engages programming when p ressed.

note, test.py called pi_program.sh to actually begin programming.
**Note:** test.py called pi_program.sh to actually begin programming.

note, test.py also checks for MEDIA drives plugged into the USB ports of the Raspi. If there is a HEX file on the MEDIA drive (any name, it just has to have the ".hex" extension) it will copy it in and use that for programming.
**Note:** test.py also checks for MEDIA drives plugged into the USB ports of the Raspi. If there is a HEX file on the MEDIA drive (any name, it just has to have the ".hex" extension) it will copy it in and use that for programming.

KEYWORDS: RASPI PROGRAMMER

Troubleshooting Tips
--------------

1) USB port issues. If you are having trouble with com port enumeration. That is, you are plugging in something like an FTDI serial basic, and the Raspi will not recognize it. This may be fixed by using one of SparkFun Cerberus USB hub cables. We found that after plugging in 20+ FTDI basics into a pi, then it stops recognizing the devices. But if you use a hub (like the cerberus) inbetween the pi USB and the serial bridge IC, then it always pops up as "/dev/ttyUSB0" for 1000s of boards in a row. Wahoo!

![SparkFun Cerberus USB Cable](https://cdn.sparkfun.com/r/92-92/assets/parts/8/5/3/9/12016-01.jpg)

[SparkFun Cerberus USB Cable](https://www.sparkfun.com/products/12016)

License Information
-------------------

This product is _**open source**_!

Please review the LICENSE.md file for license information.

If you have any questions or concerns on licensing, please contact techsupport@sparkfun.com.

Distributed as-is; no warranty is given.

- Your friends at SparkFun.
550 changes: 0 additions & 550 deletions SERIAL_UPLOAD/Flying_Jalapeno_selftest_v01.ino.mega.hex

This file was deleted.

10 changes: 10 additions & 0 deletions SERIAL_UPLOAD/Readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Note, you must install arduino for the serial upload to work. The latest Pigrammer image should have this done already, but if needed, here is the command:

sudo apt-get install arduino




////////////////
Note, you will need to plug in an ethernet cable to your pi 2, to connect to the internet. I found that I needed to open a browser a couple times for it to actually connect to the internet (which you need for the apt-get to work).

195 changes: 195 additions & 0 deletions SERIAL_UPLOAD/blink.hex
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
:100000000C94B5000C94BF000C94BF000C94BF007E
:100010000C94BF000C94BF000C94BF000C94BF0064
:100020000C94BF000C94BF000C94BF000C94BF0054
:100030000C94BF000C94BF000C94BF000C94BF0044
:100040000C94BF000C94BF000C94BF000C94BF0034
:100050000C94BF000C94BF000C94BF000C94BF0024
:100060000C94BF000C94BF006E616E00696E660058
:1000700000407A10F35A00A0724E18090010A5D45F
:10008000E80000E87648170000E40B54020000CABC
:100090009A3B000000E1F505000080969800000002
:1000A00040420F000000A086010000001027000061
:1000B0000000E803000000006400000000000A00E7
:1000C000000000000100000000002C76D888DC67EA
:1000D0004F0823DFC1DFAE59E1B1B796E5E3E45342
:1000E000C63AE651997696E8E6C28426EB898C9B5F
:1000F00062ED407C6FFCEFBC9C9F40F2BAA56FA5FF
:10010000F490055A2AF75C936B6CF9676DC11BFC80
:10011000E0E40D47FEF520E6B500D0ED902E03009B
:10012000943577050080841E080000204E0A0000E8
:1001300000C80C333333330F986E12831141EF8DA7
:100140002114893BE65516CFFEE6DB18D1844B38E7
:100150001BF77C1D901DA4BBE424203284725E2218
:100160008100C9F124ECA1E53D2711241FBECFEF8A
:10017000D8E0DEBFCDBF0E94C1000C940B060C94EA
:100180000000259A20E931E02D9888E893E1F901F3
:100190003197F1F70197D9F72D9A88E893E1F901A2
:1001A0003197F1F70197D9F7EFCFA1E1B0E0EBED8F
:1001B000F0E00C945C043C017F876E876A01FC01CF
:1001C00017821682838181FD03C06FEF7FEF6FC3BB
:1001D0009E012F5F3F4F398B288BF3012381EE85E2
:1001E000FF8523FD859123FF8191FF87EE8788237B
:1001F00009F45AC3853251F4EE85FF8523FD8591BC
:1002000023FF8191FF87EE87853229F490E0B301C7
:100210000E948105E2CF982F10E0882499241032A3
:10022000B0F49B3269F09C3228F4903251F0933252
:1002300071F40BC09D3239F0903349F4116028C03D
:100240001260146025C0186023C0106121C017FD22
:100250002AC0892F80538A3078F416FF06C0FAE04E
:100260009F9E902C1124980E13C03AE0839E802C00
:100270001124880E10620CC09E3221F416FD14C3A6
:10028000106406C09C3611F4106802C0983659F408
:10029000EE85FF8523FD959123FF9191FF87EE87E2
:1002A000992309F0BCCF892F8554833020F4812F06
:1002B0008061905E07C0892F8556833008F09FC10A
:1002C000812F8F7E86FD02C076E0972E6FE3F62E9B
:1002D000F822953619F4F0E4FF2A07C0963619F48F
:1002E00020E8F22A02C091109A94F7FE0AC03BE37C
:1002F000391518F45CE3B52E02C0B92CB39427E08D
:1003000009C047E0491520F4BB2447E0942EF7CFFD
:10031000292DBB24C60104969D878C87F601608138
:10032000718182819381AE014F5F5F4F0B2D0E94DF
:1003300093046C010981202E332400FF04C003FDC7
:1003400002C01DE209C0F1FE02C01BE205C0F2FCC2
:1003500002C010E001C010E2C1018C709070892BC6
:10036000B9F1112311F483E001C084E0881510F085
:1003700088240AC0881AF3FC07C080E290E0B30129
:100380000E9481058A94C9F7112329F0812F90E0FA
:10039000B3010E94810523FE03C008E610E00EC0F1
:1003A0000CE610E00BC0E114F10409F0805290E07B
:1003B000B3010E9481050F5F1F4F05C0EF2CFF2482
:1003C000F0E1EF22FF24F8018491882361F714C142
:1003D000F7FE12C0BC0C24FE04C08A81813309F4EC
:1003E000BA941B141CF0BB24B3942DC0F8E0FB1589
:1003F00050F538E0B32E27C0F6FC25C0892D90E0DB
:100400008C159D054CF02CEFC2162FEFD20624F070
:1004100030E8F32A01C09A94992049F0E2E0F0E034
:10042000EC0FFD1FE90DF11D80818033A1F3F7FE74
:100430000AC0B92CB394892D90E0C816D90614F0DF
:10044000992401C09C18F7FC03C025E030E009C0E6
:100450001C141D041CF021E030E003C096012F5F46
:100460003F4F112311F02F5F3F4F992029F0892D25
:1004700090E00196280F391F882D90E02817390742
:1004800014F0882401C0821A4F2C5524C2018970AF
:100490009070892B39F008C080E290E0B3010E948F
:1004A00081058A948820C1F7112329F0812F90E0DB
:1004B000B3010E94810543FE07C008C080E390E0BD
:1004C000B3010E9481058A948820C1F7F7FE46C0D7
:1004D0008601D7FE02C000E010E076010894E11C1E
:1004E000F11CE01AF10A41E050E04C0F5D1FE40EF0
:1004F000F51E26014B185108892D90E0AA24BB2433
:10050000A81AB90A5FEF0F3F150729F48EE290E0B1
:10051000B3010E948105C016D10634F04016510681
:100520001CF4F701808101C080E301501040089461
:10053000E11CF11C0A151B052CF090E0B3010E9490
:100540008105E0CF0C151D0539F49A81963318F416
:10055000953311F424FE81E390E04BC08A8181330E
:1005600009F00F7E90E0B3010E9481059920A1F06F
:100570008EE290E0B3010E94810512E0E1E0F0E03C
:10058000EC0FFD1FE10FF11D1F5F808190E0B301B3
:100590000E9481059A9491F744FC03C085E690E09F
:1005A00002C085E490E0B3010E948105D7FC05C03C
:1005B000C114D10441F404FF06C0D094C194D10801
:1005C000D3948DE201C08BE290E0B3010E948105DB
:1005D00080E305C08F5F26EF3FEFC20ED31E3AE0E7
:1005E000C316D104BCF790E0B3010E948105C60197
:1005F000C096B3010E948105CC84DD8452C193363C
:1006000031F0933799F0933509F059C023C0F601C2
:10061000808189835E010894A11CB11C22E030E036
:10062000C20ED31E21E0E22EF12C12C0F601A080F2
:10063000B18016FD03C06FEF7FEF02C0692D70E03F
:1006400022E030E0C20ED31EC5010E9476057C0177
:100650001F7713C0F601A080B18016FD03C06FEFB5
:100660007FEF02C0692D70E022E030E0C20ED31EA1
:10067000C5010E946B057C01106813FF07C01BC0F9
:1006800080E290E0B3010E9481058A94882D90E079
:10069000E816F906A8F30FC0F50117FD859117FFBD
:1006A00081915F0190E0B3010E94810581108A94DD
:1006B0000894E108F108E114F10471F7F2C09436EE
:1006C00011F0993689F517FF08C0F60120813181B4
:1006D0004281538184E090E00AC0F60180819181DB
:1006E0009C01442737FD4095542F82E090E0C80ECE
:1006F000D91E9FE6F92EF12257FF09C0509540956B
:10070000309521953F4F4F4F5F4F90E8F92ACA012E
:10071000B901AE014F5F5F4F2AE030E00E94AD05A6
:10072000E82EE889EE1A41C0953721F41F7E2AE0B1
:1007300030E01CC0197F9F3661F0903720F4983567
:1007400009F0B2C00FC0903739F0983709F0ACC04B
:1007500004C028E030E00AC0106114FD146020E1FC
:1007600030E004C014FD166020E132E017FF08C03D
:10077000F601608171818281938144E050E008C07C
:10078000F60180819181BC0180E090E042E050E080
:10079000C40ED51EAE014F5F5F4F0E94AD05E82E1F
:1007A0005889E51A8FE7F82EF122F6FE0BC08EEF7E
:1007B000F822E91438F4F4FE07C0F2FC05C09FEEFD
:1007C000F92202C01E2D01C0192DF4FE0DC0FE013C
:1007D000EE0DF11D8081803319F4E9EEFE2208C090
:1007E0001F5FF2FE05C003C08F2D867809F01F5FE2
:1007F0000F2DF3FC14C0F0FE0FC0181510F09E2C46
:100800000BC09E2C980C911A182D06C080E290E027
:10081000B3010E9481051F5F1815C0F304C01815AD
:1008200010F4811A01C0882404FF0FC080E390E017
:10083000B3010E94810502FF1DC001FD03C088E7CE
:1008400090E00EC088E590E00BC0802F867891F094
:1008500001FF02C08BE201C080E2F7FC8DE290E074
:10086000B3010E94810506C080E390E0B3010E94BD
:1008700081059A94E914C0F3EA94E1E0F0E0EC0F0A
:10088000FD1FEE0DF11D808190E0B3010E948105F6
:10089000EE2091F706C080E290E0B3010E9481054E
:1008A0008A948820C1F799CCF30166817781CB01C6
:1008B0006196E2E10C9478042F923F924F925F92FE
:1008C0006F927F928F929F92AF92BF92CF92DF9260
:1008D000EF92FF920F931F93CF93DF93CDB7DEB7C5
:1008E000CA1BDB0B0FB6F894DEBF0FBECDBF099459
:1008F0002A88398848885F846E847D848C849B84B0
:10090000AA84B984C884DF80EE80FD800C811B81BD
:10091000AA81B981CE0FD11D0FB6F894DEBF0FBEEC
:10092000CDBFED010895283008F027E03327DA0124
:10093000990F311D87FD916000966105710539F4AD
:1009400032602E5F3D9330E32A95E1F708959F3F93
:1009500030F080387105610509F03C5F3C5F3D93E4
:10096000913008F08068911DDF93CF931F930F9310
:10097000FF92EF92192F987F9695E92F969596956D
:10098000E90FFF27E653FF4F99273327EE24FF2473
:10099000A701E70105900894079428F4360FE71E95
:1009A000F81E491F511D660F771F881F991F069457
:1009B000A1F70590079428F4E70EF81E491F561F6B
:1009C000C11D770F881F991F661F0694A1F7059018
:1009D000079428F4F80E491F561FC71FD11D880F12
:1009E000991F661F771F0694A1F70590079420F4BE
:1009F000490F561FC71FD81F990F661F771F881FE3
:100A00000694A9F784911095177041F0D695C79573
:100A100057954795F794E7941A95C1F7E0E7F0E00A
:100A200068941590159135916591959105907FE2A7
:100A30007395E118F10A430B560BC90BD009C0F7A7
:100A4000E10CF11E431F561FC91FD01D7EF47033E9
:100A500011F48A95E6CFE894015030F0080F0AF4BB
:100A60000027021708F4202F2395022F7A3328F04D
:100A700079E37D932A95E9F710C07D932A9589F64D
:100A8000069497956795379517951794E118F10A8D
:100A9000430B560BC90BD00998F023957E917395A3
:100AA0007A3308F070E37C932013B8F77E9170617D
:100AB0007D9330F0839571E37D9370E32A95E1F7A0
:100AC0001124EF90FF900F911F91CF91DF91992703
:100AD00087FD90950895FC010590615070400110CC
:100AE000D8F7809590958E0F9F1F0895FC01615057
:100AF000704001900110D8F7809590958E0F9F1F40
:100B000008950F931F93CF93DF938C01EB018B819B
:100B100081FF1BC082FF0DC02E813F818C819D8192
:100B20002817390764F4E881F9810193F983E88390
:100B300006C0E885F985802F0995892B31F48E81CF
:100B40009F8101969F838E8302C00FEF1FEFC80124
:100B5000DF91CF911F910F910895FA01AA272830B4
:100B600051F1203181F1E8946F936E7F6E5F7F4F7A
:100B70008F4F9F4FAF4FB1E03ED0B4E03CD0670FF6
:100B8000781F891F9A1FA11D680F791F8A1F911D49
:100B9000A11D6A0F711D811D911DA11D20D009F499
:100BA00068943F912AE0269F11243019305D3193DB
:100BB000DEF6CF010895462F4770405D4193B3E0C4
:100BC0000FD0C9F7F6CF462F4F70405D4A3318F06B
:100BD000495D31FD4052419302D0A9F7EACFB4E01C
:100BE000A6959795879577956795BA95C9F70097D4
:100BF0006105710508959B01AC010A2E0694579575
:100C0000479537952795BA95C9F7620F731F841FCB
:0A0C1000951FA01D0895F894FFCF72
:00000001FF
16 changes: 10 additions & 6 deletions SERIAL_UPLOAD/pi_serial_upload.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#!/bin/bash

echo "Programming beginning..."
echo "Serial Upload beginning..."

# Device and Baudrate. The default baudrate of 115200 will work with
# all chips above an 8mHz clock speed. 57600 is recommended for slower chips.
DEVICE=atmega328p
BAUD=115200

# get firmware file name
firmware=$(find /home/pi/SERIAL_UPLOAD/*.hex)
$firmware .= "/home/pi/SERIAL_UPLOAD/$firmware"

#Serial upload via com port
sudo avrdude -p atmega2560 -P /dev/ttyUSB0 -c stk500v2 -b 115200 -C /home/pi/avrdude_gpio.conf -v -U flash:w:$firmware:i 2>/home/pi/SERIAL_UPLOAD/serial_upload__results.txt

$firmware .= "home/pi/SERIAL_UPLOAD/$firmware"
echo "firmware: "
echo $firmware

sudo /usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -v -p$DEVICE -carduino -P/dev/ttyUSB0 -b$BAUD -D -Uflash:w:$firmware:i 2>/home/pi/SERIAL_UPLOAD/serial_upload_results.txt
80 changes: 80 additions & 0 deletions SERIAL_UPLOAD/serial_upload_results.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@

avrdude: Version 6.1, compiled on Jul 7 2015 at 10:29:47
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "/usr/share/arduino/hardware/tools/avrdude.conf"
User configuration file is "/root/.avrduderc"
User configuration file does not exist or is not a regular file, skipping

Using Port : /dev/ttyUSB0
Using Programmer : wiring
Overriding Baud Rate : 115200
AVR Part : ATmega2560
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :

Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00
flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

Programmer Type : Wiring
Description : Wiring
Programmer Model: AVRISP
Hardware Version: 15
Firmware Version Master : 2.10
Vtarget : 0.0 V
SCK period : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: reading input file "/home/pi/SERIAL_UPLOAD/Flying_Jalapeno_selftest_v01.ino.mega.hex"
avrdude: writing flash (8780 bytes):

Writing | ################################################## | 100% 1.29s

avrdude: 8780 bytes of flash written
avrdude: verifying flash memory against /home/pi/SERIAL_UPLOAD/Flying_Jalapeno_selftest_v01.ino.mega.hex:
avrdude: load data flash data from input file /home/pi/SERIAL_UPLOAD/Flying_Jalapeno_selftest_v01.ino.mega.hex:
avrdude: input file /home/pi/SERIAL_UPLOAD/Flying_Jalapeno_selftest_v01.ino.mega.hex contains 8780 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.99s

avrdude: verifying ...
avrdude: 8780 bytes of flash verified

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK (E:00, H:00, L:00)

avrdude done. Thank you.

61 changes: 61 additions & 0 deletions SERIAL_UPLOAD/serial_upload_results_temp.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

avrdude: Version 6.1, compiled on Jul 7 2015 at 10:29:47
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "/usr/share/arduino/hardware/tools/avrdude.conf"
User configuration file is "/root/.avrduderc"
User configuration file does not exist or is not a regular file, skipping

Using Port : /dev/ttyUSB0
Using Programmer : wiring
Overriding Baud Rate : 115200
AVR Part : ATmega2560
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :

Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00
flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

Programmer Type : Wiring
Description : Wiring
Programmer Model: AVRISP
Hardware Version: 15
Firmware Version Master : 2.10
Vtarget : 0.0 V
SCK period : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: reading input file "/home/pi/SERIAL_UPLOAD/Flying_Jalapeno_selftest_v01.ino.mega.hex"
avrdude: writing flash (8780 bytes):

Writing | #
12 changes: 12 additions & 0 deletions SERIAL_UPLOAD/serial_upload_results_temp_1_sec_BAD.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

avrdude: Version 6.1, compiled on Jul 7 2015 at 10:29:47
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "/usr/share/arduino/hardware/tools/avrdude.conf"
User configuration file is "/root/.avrduderc"
User configuration file does not exist or is not a regular file, skipping

Using Port : /dev/ttyUSB0
Using Programmer : wiring
Overriding Baud Rate : 115200
61 changes: 61 additions & 0 deletions SERIAL_UPLOAD/serial_upload_results_temp_1_sec_good.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

avrdude: Version 6.1, compiled on Jul 7 2015 at 10:29:47
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "/usr/share/arduino/hardware/tools/avrdude.conf"
User configuration file is "/root/.avrduderc"
User configuration file does not exist or is not a regular file, skipping

Using Port : /dev/ttyUSB0
Using Programmer : wiring
Overriding Baud Rate : 115200
AVR Part : ATmega2560
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :

Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00
flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

Programmer Type : Wiring
Description : Wiring
Programmer Model: AVRISP
Hardware Version: 15
Firmware Version Master : 2.10
Vtarget : 0.0 V
SCK period : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: reading input file "/home/pi/SERIAL_UPLOAD/Flying_Jalapeno_selftest_v01.ino.mega.hex"
avrdude: writing flash (8780 bytes):

Writing |
Binary file not shown.
Binary file not shown.
7 changes: 7 additions & 0 deletions Utilities/Desktop_links/edit.test.py.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Desktop Entry]
Name=Edit test.py
Comment=heyhey
Exec=/home/pi/Pi_grammer_utilities/edit.test.py.sh
Icon=
Terminal=true
Type=Application
7 changes: 7 additions & 0 deletions Utilities/Desktop_links/killall.python.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Desktop Entry]
Name=Kill Python
Comment=heyhey
Exec=/home/pi/Pi_grammer_utilities/killall.python.sh
Icon=
Terminal=true
Type=Application
7 changes: 7 additions & 0 deletions Utilities/Desktop_links/open.permissions.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Desktop Entry]
Name=Open Permissions
Comment=hey
Exec=/home/pi/Pi_grammer_utilities/open.permissions.sh
Icon=
Terminal=true
Type=Application
7 changes: 7 additions & 0 deletions Utilities/Desktop_links/start.test.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Desktop Entry]
Name=Start test.py
Comment=hey
Exec=/home/pi/Pi_grammer_utilities/start.test.sh
Icon=
Terminal=true
Type=Application
8 changes: 8 additions & 0 deletions Utilities/edit.test.py.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

echo Starting Idle test.py now...
echo

sudo idle /home/pi/test.py

sleep 2
7 changes: 7 additions & 0 deletions Utilities/flash_dump.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# read flash and save it to a hex file names flash_dump.hex

# save results to a text file named flash_dump_results.txt

sudo avrdude -p atmega328p -C /home/pi/avrdude_gpio.conf -c linuxspi -P /dev/spidev0.0 -b 1000000 -D -v -u -U flash:r:flash_dump.hex:i 2>flash_dump_results.txt
7 changes: 7 additions & 0 deletions Utilities/killall.python.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

echo killing all python now...

sudo killall python

sleep 2
8 changes: 8 additions & 0 deletions Utilities/open.permissions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

echo Opening permissions now...
echo
FOLDER=/home/pi
sudo chmod 777 $FOLDER/test.py $FOLDER/*hex $FOLDER/flash_results.txt $FOLDER/fuse_results.txt $FOLDER/avrdude_gpio.conf $FOLDER/pi_program.sh

sleep 2
8 changes: 8 additions & 0 deletions Utilities/start.test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

echo Starting python test.py now...
echo

sudo python /home/pi/test.py

sleep 2
2 changes: 1 addition & 1 deletion avrdude_gpio.conf
Original file line number Diff line number Diff line change
@@ -10718,7 +10718,7 @@ part
avr910_devcode = 0x20;
signature = 0x1e 0x93 0x0c;
reset = io;
chip_erase_delay = 4500;
chip_erase_delay = 15000;

pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
"x x x x x x x x x x x x x x x x";
16 changes: 16 additions & 0 deletions disable_switch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Raspberry Pi stand alone AVR programmer
# DISable Isolation switch for programming via command line
# SparkFun Electronics
# Pete Lewis 7/13/2018

import RPi.GPIO as GPIO

GPIO.setwarnings(False)

GPIO.setmode(GPIO.BOARD)

PGM_SWITCH = 36

GPIO.setup(PGM_SWITCH, GPIO.OUT)

GPIO.output(PGM_SWITCH, GPIO.LOW)
16 changes: 16 additions & 0 deletions enable_switch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Raspberry Pi stand alone AVR programmer
# Enable Isolation switch for programming via command line
# SparkFun Electronics
# Pete Lewis 7/13/2018

import RPi.GPIO as GPIO

GPIO.setwarnings(False)

GPIO.setmode(GPIO.BOARD)

PGM_SWITCH = 36

GPIO.setup(PGM_SWITCH, GPIO.OUT)

GPIO.output(PGM_SWITCH, GPIO.HIGH)
7 changes: 5 additions & 2 deletions linuxpsi_versions/pi_program.sh
Original file line number Diff line number Diff line change
@@ -6,14 +6,17 @@ echo "Programming beginning..."
firmware=$(find /home/pi/*.hex)
$firmware .= "/home/pi/$firmware"

#CHIP
DEVICE=atmega328p

#FUSE BITS
HIGH_FUSE=0xDA
LOW_FUSE=0xFF
EXT_FUSE=0x07 # due to masking, 0x05 = 0xFD, 0x07 = 0xFF
LOCK=0x0F #due to masking, 0x0F = 0xCF

#erase and fuse bits, note the -i 100 to add delay and slow down initial com to fresh chips
sudo avrdude -p atmega328p -C /home/pi/avrdude_gpio.conf -c linuxspi -P /dev/spidev0.0 -b 125000 -D -v -e -u -U hfuse:w:$HIGH_FUSE:m -u -U lfuse:w:$LOW_FUSE:m -u -U efuse:w:$EXT_FUSE:m 2>/home/pi/fuse_results.txt
sudo avrdude -p $DEVICE -C /home/pi/avrdude_gpio.conf -c linuxspi -P /dev/spidev0.0 -b 125000 -D -v -e -u -U hfuse:w:$HIGH_FUSE:m -u -U lfuse:w:$LOW_FUSE:m -u -U efuse:w:$EXT_FUSE:m 2>/home/pi/fuse_results.txt

# hard toggle of reset line, necessary to see successful programming on fresh ICs
sudo gpio -g mode 26 output
@@ -23,4 +26,4 @@ sudo gpio -g write 26 1
sleep 0.1

#program flash and lock bits
sudo avrdude -p atmega328p -C /home/pi/avrdude_gpio.conf -c linuxspi -P /dev/spidev0.0 -b 3000000 -D -v -u -U flash:w:$firmware:i -u -U lock:w:$LOCK:m 2>/home/pi/flash_results.txt
sudo avrdude -p $DEVICE -C /home/pi/avrdude_gpio.conf -c linuxspi -P /dev/spidev0.0 -b 3000000 -D -v -u -U flash:w:$firmware:i -u -U lock:w:$LOCK:m 2>/home/pi/flash_results.txt
35 changes: 35 additions & 0 deletions optiboot_atmega328_2012_with_1s_watchdog.hex
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
:107E0000112484B714BE81FFF0D085E080938100F7
:107E100082E08093C00088E18093C10086E0809377
:107E2000C20080E18093C4008EE0C9D0259A86E02C
:107E300020E33CEF91E0309385002093840096BBD3
:107E4000B09BFECF1D9AA8958150A9F7CC24DD24C4
:107E500088248394B5E0AB2EA1E19A2EF3E0BF2EE7
:107E6000A2D0813461F49FD0082FAFD0023811F036
:107E7000013811F484E001C083E08DD089C08234E0
:107E800011F484E103C0853419F485E0A6D080C0E4
:107E9000853579F488D0E82EFF2485D0082F10E0AE
:107EA000102F00270E291F29000F111F8ED06801E7
:107EB0006FC0863521F484E090D080E0DECF843638
:107EC00009F040C070D06FD0082F6DD080E0C81688
:107ED00080E7D80618F4F601B7BEE895C0E0D1E017
:107EE00062D089930C17E1F7F0E0CF16F0E7DF06D8
:107EF00018F0F601B7BEE89568D007B600FCFDCFD4
:107F0000A601A0E0B1E02C9130E011968C91119780
:107F100090E0982F8827822B932B1296FA010C0160
:107F200087BEE89511244E5F5F4FF1E0A038BF0790
:107F300051F7F601A7BEE89507B600FCFDCF97BE46
:107F4000E89526C08437B1F42ED02DD0F82E2BD052
:107F50003CD0F601EF2C8F010F5F1F4F84911BD097
:107F6000EA94F801C1F70894C11CD11CFA94CF0C13
:107F7000D11C0EC0853739F428D08EE10CD085E9AC
:107F80000AD08FE07ACF813511F488E018D01DD067
:107F900080E101D065CF982F8091C00085FFFCCF94
:107FA0009093C60008958091C00087FFFCCF809118
:107FB000C00084FD01C0A8958091C6000895E0E648
:107FC000F0E098E1908380830895EDDF803219F02E
:107FD00088E0F5DFFFCF84E1DECF1F93182FE3DFCA
:107FE0001150E9F7F2DF1F91089580E0E8DFEE27F6
:047FF000FF270994CA
:027FFE00040479
:0400000300007E007B
:00000001FF
32 changes: 26 additions & 6 deletions pi_program.sh
Original file line number Diff line number Diff line change
@@ -6,14 +6,34 @@ echo "Programming beginning..."
firmware=$(find /home/pi/*.hex)
$firmware .= "/home/pi/$firmware"

# DEVICE
# Here are some commonly used "part no"s in avrdude at SFE
# UN-comment the one you wish to use, or plug in something different
# Use "avrdude -p?" for a list of supported devices
DEVICE=atmega328p
#DEVICE=m32u4
#DEVICE=t2313

#FUSE BITS
HIGH_FUSE=0xD6
HIGH_FUSE=0xD8
LOW_FUSE=0xFF
EXT_FUSE=0x05 # due to masking, 0x05 = 0xFD, 0x07 = 0xFF
LOCK=0x0F #due to masking, 0x0F = 0xCF
EXT_FUSE=0x05 # due to masking, 0x05 = 0xFD, 0x07 = 0xFF, ***Note on an ATMEGA2560, ext fuse writes and verifies as 0xFD
LOCK=0x0F # due to masking, 0x0F = 0xCF

#enable programming isolation switch
sudo python enable_switch.py

#erase and fuse bits, note the -i 100 to add delay and slow down initial com to fresh chips
sudo avrdude -p atmega328p -C /home/pi/avrdude_gpio.conf -c pi_1 -i 1000 -D -v -e -u -U hfuse:w:$HIGH_FUSE:m -u -U lfuse:w:$LOW_FUSE:m -u -U efuse:w:$EXT_FUSE:m 2>/home/pi/fuse_results.txt
#erase and then write FUSE bits
sudo avrdude -p $DEVICE -C /home/pi/avrdude_gpio.conf -c linuxspi -P /dev/spidev0.0 -b 125000 -D -v -e -u -U hfuse:w:$HIGH_FUSE:m -u -U lfuse:w:$LOW_FUSE:m -u -U efuse:w:$EXT_FUSE:m 2>/home/pi/fuse_results.txt

sudo gpio -g mode 26 output
sudo gpio -g write 26 0
sleep 0.1
sudo gpio -g write 26 1
sleep 0.1

#program flash and lock bits
sudo avrdude -p atmega328p -C /home/pi/avrdude_gpio.conf -c pi_1 -D -v -u -U flash:w:$firmware:i -u -U lock:w:$LOCK:m 2>/home/pi/flash_results.txt
sudo avrdude -p $DEVICE -C /home/pi/avrdude_gpio.conf -c linuxspi -P /dev/spidev0.0 -b 2000000 -D -v -u -U flash:w:$firmware:i -u -U lock:w:$LOCK:m 2>/home/pi/flash_results.txt

#DISable programming isolation switch
sudo python disable_switch.py
20 changes: 20 additions & 0 deletions relaunch_python.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

echo "Killing current python..."

# kill

sudo killall python

sleep 3

# change permissions on all related programming files, to avoid nasty debug errors

sudo chmod 777 flash_results.txt fuse_results.txt *.hex test.py pi_program.sh avrdude_gpio.conf

# launch

echo "Relaunching python test.py..."

sudo python test.py

148 changes: 137 additions & 11 deletions test.py
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@
import serial
import time
import RPi.GPIO as GPIO
import filecmp

STAT = 7
FUSE_P = 15
@@ -23,6 +24,9 @@
FLASH_F = 11
LOCK_P = 32
LOCK_F = 22
SERIAL_P = 16
SERIAL_F = 18
PGM_SWITCH = 36

CAPSENSE = 33
SHUTDOWN = 29
@@ -39,6 +43,9 @@
GPIO.setup(FLASH_F, GPIO.OUT)
GPIO.setup(LOCK_P, GPIO.OUT)
GPIO.setup(LOCK_F, GPIO.OUT)
GPIO.setup(SERIAL_P, GPIO.OUT)
GPIO.setup(SERIAL_F, GPIO.OUT)
GPIO.setup(PGM_SWITCH, GPIO.OUT)

GPIO.setup(SHUTDOWN, GPIO.IN, pull_up_down=GPIO.PUD_UP) # with internal pullup enabled - trying this out to avoid accidental shutdowns.
#GPIO.setup(SHUTDOWN, GPIO.IN) # NO INTERNAL PULLUP
@@ -51,6 +58,9 @@
GPIO.output(FLASH_F, GPIO.LOW)
GPIO.output(LOCK_P, GPIO.LOW)
GPIO.output(LOCK_F, GPIO.LOW)
GPIO.output(SERIAL_P, GPIO.LOW)
GPIO.output(SERIAL_F, GPIO.LOW)
GPIO.output(PGM_SWITCH, GPIO.LOW) # LOW is OFF, this is active high, hardware has 10K pullup

firmware_path_media = ' '
new_hex = False
@@ -60,8 +70,14 @@
new_bash = False
copy_flag_bash = False

test_dot_py_path_media = ' '
new_test_dot_py = False
copy_flag_test_dot_py = False

stat_blink_counter = 0

LOCK_BITS_PASS = False #Used to know if lock bits programming passed or failed, and then determine if we should even both carrying on with Serial upload attempts

def all_leds_on():
GPIO.output(STAT, GPIO.HIGH)
GPIO.output(FUSE_P, GPIO.HIGH)
@@ -70,6 +86,8 @@ def all_leds_on():
GPIO.output(FLASH_F, GPIO.HIGH)
GPIO.output(LOCK_P, GPIO.HIGH)
GPIO.output(LOCK_F, GPIO.HIGH)
GPIO.output(SERIAL_P, GPIO.HIGH)
GPIO.output(SERIAL_F, GPIO.HIGH)

def all_leds_off():
GPIO.output(STAT, GPIO.LOW)
@@ -79,6 +97,8 @@ def all_leds_off():
GPIO.output(FLASH_F, GPIO.LOW)
GPIO.output(LOCK_P, GPIO.LOW)
GPIO.output(LOCK_F, GPIO.LOW)
GPIO.output(SERIAL_P, GPIO.LOW)
GPIO.output(SERIAL_F, GPIO.LOW)

def blink_circle():
GPIO.output(FUSE_P, GPIO.HIGH)
@@ -99,9 +119,15 @@ def blink_circle():
GPIO.output(FUSE_F, GPIO.HIGH)
time.sleep(.1)
GPIO.output(FUSE_F, GPIO.LOW)

def relaunch_python():
command = "sh /home/pi/relaunch_python.sh"
import subprocess
process = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
output = process.communicate()[0]
print output


def update_firmware_and_bash():
def update_firmware_and_bash_and_test_dot_py():
global new_hex
new_hex = False
global firmware_path_media
@@ -112,6 +138,11 @@ def update_firmware_and_bash():
global bash_path_media
global copy_flag_bash

global new_test_dot_py
new_test_dot_py = False
global test_dot_py_path_media
global copy_flag_test_dot_py

for root, dirs, files in os.walk('/media'):
for name in files:
#print (os.path.join(root, name))
@@ -125,7 +156,13 @@ def update_firmware_and_bash():
#print 'new bash file found!!'
new_bash = True
#print tempstring
bash_path_media = tempstring
bash_path_media = tempstring
if 'test.py' in tempstring:
#print 'new test.py file found!!'
if(filecmp.cmp(tempstring, '/home/pi/test.py') == False):
new_test_dot_py = True
#print tempstring
test_dot_py_path_media = tempstring
if(new_hex == False):
#print 'no new hex'
copy_flag = False
@@ -163,7 +200,23 @@ def update_firmware_and_bash():
print 'copying bash file to local folder /home/pi'
shutil.copy(bash_path_media, '/home/pi')
print 'done'

if(new_test_dot_py == False):
#print 'no new bash'
copy_flag_test_dot_py = False
elif((new_test_dot_py == True) and (copy_flag_test_dot_py == False)):
blink_circle()
print 'new test.py found'
print test_dot_py_path_media
# first, delete the old bash file
print 'deleting old test.py file: /home/pi/test.py'
os.remove('/home/pi/test.py')
print 'done'
copy_flag_test_dot_py = True # to avoid copying the file EVERY loop, we only need to do it once
print 'copying test.py file to local folder /home/pi'
shutil.copy(test_dot_py_path_media, '/home/pi')
print 'done'
relaunch_python()

def shut_down():
print "shutting down"
command = "/usr/bin/sudo /sbin/shutdown -h now"
@@ -179,8 +232,18 @@ def clean_results():
f = open('/home/pi/flash_results.txt', 'w')
f.truncate()
f.close()
if (os.path.exists('/home/pi/SERIAL_UPLOAD/pi_serial_upload.sh') == True):
f = open('/home/pi/SERIAL_UPLOAD/serial_upload_results.txt', 'w')
f.truncate()
f.close()
f = open('/home/pi/SERIAL_UPLOAD/serial_upload_results_temp.txt', 'w')
f.truncate()
f.close()

def program():
#GPIO.setup(PGM_SWITCH, GPIO.IN)
GPIO.output(PGM_SWITCH, GPIO.HIGH)
time.sleep(.1)
clean_results()
#command = "/usr/bin/sudo ./pi_program.sh"
#command = "sudo ./pi_program.sh"
@@ -192,15 +255,41 @@ def program():
output = process.communicate()[0]
print output
print "...programming done."
#GPIO.setup(PGM_SWITCH, GPIO.OUT)
GPIO.output(PGM_SWITCH, GPIO.LOW) # LOW is OFF, this is active high, hardware has 10K pullup


def program_serial():
print "serial programming beginning..."
command = "sh /home/pi/SERIAL_UPLOAD/pi_serial_upload.sh"
def killall_avrdude():
command = "sudo killall avrdude"
import subprocess
process = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
output = process.communicate()[0]
print output
print "serial programming done."
print "...killing all avrdude."

def program_serial():
serial_hopeful = False
print "serial programming beginning..."
#command = "bash /home/pi/SERIAL_UPLOAD/pi_serial_upload.sh" #Use BASH for more funcitonality (if coniditionsals etc), but be warned this can add 4-5 seconds before the command begins running
command = "sh /home/pi/SERIAL_UPLOAD/pi_serial_upload.sh" # default to "SH" for immediately running command - useful to still work with serial timeout failure feature
import subprocess
process = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
#output = process.communicate()[0]
#print output
time.sleep(1.5) # WAIT for serial upload to either show successful ping to target (or to not, and indicate that this isn't very hopeful)
shutil.copy('/home/pi/SERIAL_UPLOAD/serial_upload_results.txt', '/home/pi/SERIAL_UPLOAD/serial_upload_results_temp.txt')
f_temp = open('/home/pi/SERIAL_UPLOAD/serial_upload_results_temp.txt', 'r')
for line in f_temp:
if 'avrdude: AVR device initialized and ready to accept instructions' in line:
serial_hopeful = True
print "Serial Upload in progress and looking hopeful :)"
output = process.communicate()[0] #This basically makes us what until the communication from the programming subprocess is done
print "serial upload done."
if (serial_hopeful == False):
process.terminate()
killall_avrdude()
print "Serial Upload failure... killing subprocess and moving on"


def parse_results():
#variables to store success/failure of each programming step
@@ -209,6 +298,8 @@ def parse_results():
efuse = False
flash = False
lock = False
global LOCK_BITS_PASS
LOCK_BITS_PASS = False
hash_verified_count = 0 # need to see 3 of these lines in the programming readout when programming an ESP32 chip
f = open('/home/pi/fuse_results.txt', 'r')
for line in f:
@@ -242,6 +333,7 @@ def parse_results():
elif 'avrdude: 1 bytes of lock verified' in line:
print line
lock = True
LOCK_BITS_PASS = True
elif 'avrdude: AVR device not responding' in line:
print line
elif 'Hash of data verified.' in line:
@@ -264,7 +356,37 @@ def parse_results():
if(lock == True):
GPIO.output(LOCK_P, GPIO.HIGH)
else:
GPIO.output(LOCK_F, GPIO.HIGH)
GPIO.output(LOCK_F, GPIO.HIGH)

def parse_results_serial():
#variables to store success/failure of serial flash writing
# NOTE, I am NOT verifying flash on serial upload to decrease programming time by 50%
# So we are going to show a successful serail program, but only seeing that it was written
serial_flash_written = False

f = open('/home/pi/SERIAL_UPLOAD/serial_upload_results.txt', 'r')
FLASH_SIZE = '00000' # the flash size can vary

for line in f:
if 'avrdude: writing flash (' in line: # This is the line that contains the flash file size
# The complete line looks like this:
# "avrdude: writing flash (32670 bytes):"
FLASH_SIZE = line[24:(line.find('byte')-1)]
print 'FLASH_SIZE:' + FLASH_SIZE
elif 'avrdude: ' + FLASH_SIZE + ' bytes of flash written' in line: # Look for complete line
print line
serial_flash_written = True
elif 'avrdude: AVR device not responding' in line:
print line
f.close()

## display results on serial upload LEDs

if(serial_flash_written == True):
GPIO.output(SERIAL_P, GPIO.HIGH)
print 'Serial Write success!!'
else:
GPIO.output(SERIAL_F, GPIO.HIGH)

def toggle_stat_led():
global STATLED_ON
@@ -288,7 +410,7 @@ def blink_all():
toggle_stat_led()
stat_blink_counter = 0

update_firmware_and_bash()
update_firmware_and_bash_and_test_dot_py()
#print GPIO.input(SHUTDOWN)

if GPIO.input(SHUTDOWN) == False:
@@ -307,8 +429,12 @@ def blink_all():
GPIO.output(STAT, GPIO.HIGH) #indicate programming attempt
program()
parse_results()
if os.path.exists('/home/pi/SERIAL_UPLOAD/pi_serial_upload.sh') == True:
if ((os.path.exists('/home/pi/SERIAL_UPLOAD/pi_serial_upload.sh') == True) and (LOCK_BITS_PASS == True)):
# time.sleep(1) # Delay to allow com port enumeration.
# Note, this delay is only needed with micros that have USB capabilities (like the atmega32u4)
program_serial()
parse_results_serial()
time.sleep(3) # led leds stay on for 3 secs
else:
time.sleep(3) # led leds stay on for 3 secs
all_leds_off()