Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let's start small and let ScratchMonkey show up in Arduino 1.6+ #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DCEM
Copy link

@DCEM DCEM commented Mar 4, 2017

No description provided.

@microtherion
Copy link
Owner

microtherion commented Apr 16, 2017

Sorry it took me so long to start reviewing this. Some initial questions:

  • What's in the .zip file. It appears to duplicate the contents of latest?
  • It appears you're setting up ScratchMonkey as a "platform". Given that it defines only a set of programmer protocols, and no boards or cores, doesn't this interfere with the actual platform to be used to e.g. program an ?
  • How do I try this? I both put ScratchMonkey in the sketchbook folder and added https://github.com/DCEM/ScratchMonkey/blob/master/IDE_Board_Manager/package_microtherion_index.json to the "Additional Boards Manager URLs". So far this has not worked for me in IDE 1.8.2

Copy link
Owner

@microtherion microtherion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still trying to understand that index format. Once we have things working, it would be great if you could also contribute a manual section on how to install this, but that can be done in a separate PR.

@@ -0,0 +1,31 @@
{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the documentation in https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.6.x-package_index.json-format-specification I understand that the index name is supposed to contain both the "Manufacturer" and the package name, so I guess package_microtherion.scratchmonkey_index.json.

{
"packages": [
{
"name": "microtherion",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't that be "scratchmonkey" ?

@per1234
Copy link

per1234 commented May 9, 2017

What's in the .zip file. It appears to duplicate the contents of latest?

The compressed file used for Boards Manager installation must have the package files in the root of the folder, which means that with the current structure of this repository the archive files that GitHub automatically generates for releases can not be used for that purpose. So you need to manually create them with the right structure for each release. It's a bit messy to have these files in the master branch. I usually recommend creating a branch to store the JSON file and the release archive files so they don't clutter things up. I like to use the gh-pages branch because you can use a shorter URL but I see you're already using that branch.

It appears you're setting up ScratchMonkey as a "platform". Given that it defines only a set of programmer protocols, and no boards or cores, doesn't this interfere with the actual platform to be used to e.g. program an ?

It's a bit unorthodox but I have done this for a two different 3rd party programmers and it does work, though there can be some limitations depending on the situation. It will be functionally identical to manually installing it in the sketchbook/hardware folder. It's a very user friendly installation process. If the user has them enabled they will get a notification whenever a new version is released and they can easily update with three clicks. The downside in this case is that the user still needs to get the ScratchMonkey sketch but that's a much more simple process than installing the hardware definition for the programmers because the sketch doesn't need to be put in and specific location..

I both put ScratchMonkey in the sketchbook folder and added https://github.com/DCEM/ScratchMonkey/blob/master/IDE_Board_Manager/package_microtherion_index.json to the "Additional Boards Manager URLs". So far this has not worked for me in IDE 1.8.2

You would need to use the raw URL:
https://raw.githubusercontent.com/DCEM/ScratchMonkey/master/IDE_Board_Manager/package_microtherion_index.json
but that won't work either because it specifies the installation file url in your repository, where the file would be after this is merged, rather than where it is now. I could create a testing version of the JSON file if you wanted to try it.

@microtherion
Copy link
Owner

I think a testing version would work best. Sorry to be so demanding (and slow), but right now I'm having difficulties understanding how all of this works.

If this contains an archive of the entire code, would it make sense to distribute it separately, e.g. as a separate repo that repackages ScratchMonkey releases periodically?

@per1234
Copy link

per1234 commented May 24, 2017

OK, I made a test JSON file that points to the Boards Manager installation archive file located in @DCEM's fork. I also made your requested changes to the filename and package name.

  1. Uninstall ScratchMonkey from the traditional location on your system
  2. File > Preferences > Additional Boards manager URLs > https://gist.githubusercontent.com/per1234/9d29bc8a3ef079641457de621be8c807/raw/268fb58d7ae9a0befbb9ee51e946bfbd920f651e/package_microtherion.scratchmonkey_index.json
  3. Tools > Board > Boards Manager...
  4. Wait for downloads to complete
  5. Scroll down until you see the ScratchMonkey entry. Click on it.
  6. Click "Install"
  7. Wait for installation to complete.
  8. Click "Close".
  9. You will now see the ScratchMonkey programmers in the Tools > Programmer menu

If you do a Sketch > Upload Using Programmer you will notice it fails with an error:

Error while uploading: missing 'program.params.verbose' configuration parameter

or

Error while uploading: missing 'program.params.quiet' configuration parameter

depending on your upload output verbosity preferences setting. This can be fixed by defining that property in ScratchMonkey's platform.txt. This is not specific to a Boards Manager installation of ScratchMonkey. The same problem would occur if the user installed ScratchMonkey manually to {sketchbook folder}/hardware.

The reason you won't encounter that error when you do a Tools > Burn Bootloader is that the Arduino IDE has a strange behavior: The platform.txt associated with the selected board is used for Burn Bootloader. However, the platform.txt associated with the selected programmer is used for Upload Using Programmer. This means that it would be possible to provide a patched avrdude.conf file with the ScratchMonkey hardware package but it will only be used for Upload Using Programmer.

It is possible to include sketches with a hardware package as examples for a dummy library. Unfortunately for us, libraries bundled with a hardware package are only recognized by the Arduino IDE when one of the boards of that hardware package are selected in the Tools > Board menu. So it would be possible to bundle the ScratchMonkey firmware sketch with the hardware package if we added a dummy board. The firmware installation process would be:

  1. Tools > Board > ScratchMonkey
  2. File > Examples > ScratchMonkey > ScratchMonkey
  3. Tools > Board > select the board you will use as a ScratchMonkey programmer
  4. Upload the ScratchMonkey sketch to your board.

If this contains an archive of the entire code, would it make sense to distribute it separately, e.g. as a separate repo that repackages ScratchMonkey releases periodically?

That would be reasonable. As I said, I don't like the idea of cluttering up the master branch with these files. Another option would be to create an orphan branch of this repository (something like boards_manager) for the JSON file and the archive file for each release. It doesn't make any functional difference where you put the files so that just comes down to your preference.

@ingegno
Copy link

ingegno commented Mar 30, 2018

Tried this PR. I reach error
avrdude: Can't find programmer id "scratchmonkey_hvsp"
Error while burning bootloader.
If I add patch avrdude.patch part avrdude.conf I hit error that there is error in avrdude with scratchmonkey not found. Should I apply the entire patch? Compile also?
This is with Arduino 1.8.5.

@jLynx
Copy link

jLynx commented Jun 1, 2022

Any update here? I am using 1.8.19 and I cant see the programmer in the dropdown. Not show how I get it visible

@jLynx
Copy link

jLynx commented Jun 1, 2022

@ingegno How do I apply this patch file?

@per1234
Copy link

per1234 commented Jun 1, 2022

I am using 1.8.19 and I cant see the programmer in the dropdown.

Unfortunately, this project was a casualty of an otherwise very helpful change to the Arduino IDE made in the 1.8.13 release:

arduino/Arduino#9900

The support for distributing custom programmer definitions as boards platforms required by this project is only available in previous versions of the Arduino IDE, so it can only be used with Arduino IDE 1.8.12 and older.

If you still want to try it for some reason, you can get the old IDE versions here:

https://www.arduino.cc/en/software/OldSoftwareReleases#arduino-18x


Since @microtherion was not capable of evaluating this PR even back when it was more clearly of benefit, I don't think there is any chance it would be merged now so I would go ahead and close this PR @DCEM.


I see two possible ways forward from here:

  • Document how the programmer definition can be merged into arbitrary Arduino boards platforms
  • Submit pull requests to add the definition into common Arduino boards platforms

@jLynx
Copy link

jLynx commented Jun 1, 2022

In that case, I will have to fire up a VM and install the older version to get this working. Such a shame. I did try and get it working with the current version but I got stuck with the .patch file as I was unsure how to merge it into the real file. I did manage to get the programmer options in the dropdown though

@jLynx
Copy link

jLynx commented Jun 1, 2022

As when I try to run it I get avrdude: Can't find programmer id "scratchmonkey_pp"

@jLynx
Copy link

jLynx commented Jun 1, 2022

I managed to get further with ScratchMonkey HVPP (STK500 Mode).

Now with the changes you mentioned above @per1234 I get the following when trying to edit the fuses (burn bootloader) ir uploading a sketch on my ATTiny2313

avrdude: Version 6.3-20201216
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\jLynx\AppData\Local\Arduino15\packages\ATTinyCore\hardware\avr\1.5.2/avrdude.conf"

         Using Port                    : COM7
         Using Programmer              : stk500pp
         Overriding Baud Rate          : 115200
         Setting bit clk period        : 5.0
avrdude: stk500v2_getsync(): got response from unknown programmer SCRATCHMONKEY, assuming STK500
         AVR Part                      : ATtiny2313a
         Chip Erase delay              : 15000 us
         PAGEL                         : PD4
         BS2                           : PD6
         RESET disposition             : possible i/o
         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     6     4    0 no        256    4      0  4000  4500 0xff 0xff
           flash         65     6    64    0 yes      2048   32     64  4500  4500 0xff 0xff
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 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
           calibration    0     0     0    0 no          2    0      0     0     0 0x00 0x00

         Programmer Type : STK500PP
         Description     : Atmel STK500 V2 in parallel programming mode
         Programmer Model: STK500
         Hardware Version: 0
         Firmware Version Master : 2.00
         Topcard         : Unknown
         Vtarget         : 5.0 V
         SCK period      : 8.7 us
         Varef           : 5.0 V
         Oscillator      : Off

avrdude: AVR device initialized and ready to accept instructions

An error occurred while uploading the sketch
Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x000102
avrdude: Expected signature for ATtiny2313a is 1E 91 0A
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.

@bmcage
Copy link

bmcage commented Jun 1, 2022

Why do you want to use scratchmonkey? There is no need. For example, for attiny, just use attinycore to write flags with latest eg with latest arduino IDE:

./avrdude -C/home/cristina/.arduino15/packages/ATTinyCore/hardware/avr/1.3.2/avrdude.conf -v -pattiny85 -cstk500v1 -P/dev/ttyACM0 -b19200 -Uhfuse:w:0b01010111:m

Only use for scratchmonkey would be to undo burning the reset pin, but you need high voltage for that, better just buy a rescue board. I use MightyOhm HV Rescue Shield 2.1, look it up on google.
So, do you have a valid use case for reviving scratchmonkey?

@jLynx
Copy link

jLynx commented Jun 1, 2022

That's exactly what I am doing. It has the wrong fuses set so I cant do anything with it, hence why I am trying to recover it with a DIY HVPP (ScratchMonkey)

@bmcage
Copy link

bmcage commented Jun 1, 2022

I have a scratchmonkey setup, but that was done with Arduino IDE 1.0.6, then it works fine. You do need to combine it with an old version of https://github.com/damellis/attiny/ for 1.0.x to have access to attiny. I work with @ingegno, with Arduino 1.8.x we moved to the rescue shield or 1.0.6 with scratchmonkey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants