Modules

Programming the Pingable Envelope Generator

Posted in AVR chips, Modules on March 29th, 2012 by Dann Green – Be the first to comment

How to re-program your P.E.G.

In a nutshell:

  1. Set up the hardware and software: Updating Firmware on AVR chips
  2. Download the current release of PEG code
  3. Connect ISP to red channel and flash code from your computer (see photo below)
  4. Remove blue channel jumper
  5. Connect ISP to blue channel and flash code from your computer  (see photo below)
  6. Re-install blue channel jumper
  7. Cycle power
  8. Play time!

(see bottom of post for detailed instructions)

Programming the Red channel

Programming the blue channel. Note the blue jumper has been removed so that the 6-pin ISP cable can fit. Replace the jumper after programming, and cycle power before using the PEG.

Detailed Instructions:
First, if don’t already have your computer set up for programming AVR chips, then read the article on programming firmware. You’ll need software installed on your computer (AVR Fuses or CrossPack for OSX, or AVRStudio).

Now, remove your PEG from your rack and power it up. You may need a longer ribbon cable, or somehow rig something up so you can keep it powered on while programming.

Next, connect the AVR ISP programmer to the 6-pin header under the red channel chip. Note the red stripe orientation. On your computer, flash the code to the PEG. See photo below.

Next, connect the 6-pin ISP cable to the blue channel header that’s to the right of the blue channel chip. You’ll have to remove the blue jumper from this header, and replace it when you’re done. Flash the code onto the blue channel.

Finally, disconnect the AVR ISP and turn off the PEG, and then turn it back on. This final step is necessary because the jumper on the blue channel is only read at boot-time, so the PEG must be turned off and back on with this jumper installed.

To clear up any confusion, notice that there’s a second blue jumper on the PEG that’s located near the power cable. Just leave this alone during programming. The blue jumper that’s mentioned above is located next to the blue channel AVR chip (towards the top, center of the board).

Technical Note on fuses:

Normally, you won’t have to do anything to the fuses. But if your chips got a static shock, or if you are using brand-new chips from mouser or an electronics supplier (as opposed to chips that you bought from 4ms) then you will need to program the fuses.

With avrdude (which is installed if you have AVRFuses running in OSX) the command is this:

avrdude -F -B 16 -P usb -c avrispmkII -p atmega328p -U hfuse:w:0xd9:m -U lfuse:w:0xce:m

Note that it contains -B 16, which forces avrdude to run at a slower bit-rate since the chips come pre-set at 8Mhz (internal RC osc). When we run this command, we are enabling the external 20MHz ceramic resonator on the PEG pcb, so future commands can be run at a faster bit rate. For example, after executing the above command, we can execute:

avrdude -F -B 0.5 -P usb -c avrispmkII -p atmega328p -U flash:w:peg.hex

(Assuming that the file peg.hex is in the current directory). This runs at -B 0.5 which is must faster!

If you are using AVRStudio, simply type in the following values on the fuses section of the programmer page:

High Fuses: 0xD9

Low Fuse 0xCE

Or, simply go with the default fuse settings, but change the clock settings to Ext. Crystal Res, >8Mhz (fastest), 258 CK/14CK + 4.1ms

Building an RCD Breakout Module

Posted in Modules on September 2nd, 2010 by Dann Green – Be the first to comment

How to make an RCD Breakout

Intro

The Rotating Clock Divider is a Euro-rack format module from 4ms that takes an incoming clock signal and outputs 8 simultaneous divided clocks, each in the range of /1 to /64. It also has a Rotate CV input that re-assigns the divide-amount on the jacks. More information is at 4mspedals.

The RCD features 6 jumpers that can control various features. The User Manual goes into depth about what these do. The breakout panel is a way to bring those jumpers to the front, so you can use flip switches to change the jumper settings on the fly.

For PCB version 1.0.2 and later….

You will need:

  • RCD with PCB 1.0.2 or later (see the bottom for instructions on pcb version 1.0.1 and 1.0)
  • 4HP panel
  • 6 SPST switches
  • 16-conductor cable with a 2×8 connector on one end (standard Doepfer power cable, cut in half).

Here’s how it goes together in a nutshell:

PCB 1.0.2 RCDBO

Let’s start by looking at the connection to the board. There’s only 12 pins on the board, but the connector has 16 holes. That’s OK! Just let the bottom four holes hang off (those four wires don’t go to anything anyways, as you can see in the first diagram). To be clear, by the “bottom four holes” I mean the four holes on the right hand side in the photo below (they are on the bottom in the photo above). The edge of the connector should not stick over the edge of the board.

Cable connection to RCD board -- Click to enlarge

Cable connection to RCD board -- Click to enlarge

OK, now let’s look at the wiring of the panel. There are six switches, each has two connections.

Notice the Max Divide 1 and 2 switches are flipped from the other 4 switches: the lugs are on the right side. That’s just because of the way I labeled the panel (which is the same one included in the 4ms kit, so do it exactly like this if you got the panel in the kit). For the top two switches, flipping the switch lever to the left will open the connection (same as removing the jumper) and flipping it to the right will close the connection (same as putting on the jumper). For the bottom 4 switches, flipping the switch to the right is like removing the jumper, flipping to the left is like installing the jumper. See the User Manualfor a description of what the jumpers do!

 

PCB version 1.0.1 (and 1.0)

For PCB version 1.0.1, it’s the same process, but the switches are in a different order. Using the same cable above, it goes:

1 (Red) & 2: Max Div 32
3 & 4: Max Div 16
5 & 6: Spread
7 & 8: Auto-Reset
9 & 10: Counting
11 & 12: Gate/Trig
13-16: not used

RCD PCB 1.0.1 wiring to RCDBO

Obviously you will have to upgrade your chip firmware to v1.1 if you want to use Gate/Trig or Up/Down counting or Spread. You can read about upgrading on the RCD page on 4mspedals.com

PCB version 1.0

For PCB 1.0, there’s only 4 switches hard-wired to the breakout connector pins, so you have to solder wires from the back of the PCB to some jumper pins which you insert into the breakout’s connector. Look at the photo:

PCB 1.0, solder the three wires to the 4-pin connector

You will be soldering the red, yellow, and black wires from the PCB to the back of a 4-pin (2×2) connector. Note that the black wire connects to BOTH pins in a row, but the red and yellow wires connect to one pin each. The inset photo shows the back of the 4-pin connector.

To use your new 4-pin, just push it into the breakout’s 16-pin connector where the Up/Down and Gate/Trig jumpers are supposed to go. Follow the pin numbering from the PCB 1.0.1 section (above). The red wire is Up/Down and that should be closest to the existing breakout pins. The yellow wire is next to the red, farthest from the existing pins. The black wires should be on the top.

Updating firmware on AVR chips

Posted in Autonomous Bassline, Modules on May 10th, 2010 by Dann Green – Be the first to comment

A number of 4ms devices use an AVR microcontroller. These chips run a small program. On most 4ms devices that use an AVR chip, there’s a 6-pin header (2 rows of 3 pins) near the chip. This header lets you update, upgrade, or hack the AVR chip.

Here’s how to do it:

You will need…

  1. AVR ISP mk2

    AVR ISP mk2

    ISP (In-circuit Programmer): I recommend the AVR ISP MKII available from Mouser for $34, or elsewhere sometimes cheaper! In Europe, try Farnell

  2. A computer with a USB port. Windows actually has the most seamless installer, but I also use Mac and Linux to burn code just fine. Download and install one of these:
    • Windows: AVR Studio 4, download it from atmel.com. I have not tested AVR Studio 6, I still use AVR Studio 4 (4.18, build 6), so consider downloading anarchived version. You’ll have to “register” by typing in a real email address.
    • Mac OS X: Download and install Crosspack-AVR and then AVRFuses
    • Linux: You just need the avrdude program to burn code, but can install the whole avr-gcc toolchain if you might be compiling your own firmware.
  3. The hex file: This is the actual file that contains the firmware update. If you’re upgrading a device, this will be available for download on the device’s web page. If you’re an advanced hacker, you’ll probably compile your own code using avr-gcc (part of AVR Studio and OSX_SAVE/Crosspack) which will generate a hex file for you. The file should be in intel hex format, ending in .hex

Detailed instructions:

Read this article specifically about the PEG, if that’s the device you’re programming. The article references this one, so you need to read them both.

Click the image for instructions specific to the PEG

 

PLuig the AVR ISP mkII into the 6-pin header of your device, making sure to line the red stripe up with the printed white box on the PCB

Windows (AVR Studio 4):

  1. Download and install AVR Studio 4 from atmel.com. Make sure you are downloading AVRStudio4Setup.exe, not just a service pack upgrade!
  2. Run the installer and click OK/Next to everything. Yes, you want the “Jungo/USB” driver to be installed.
  3. Plug in your AVR ISP mkII into the USB port and make sure Windows finds and automatically installs the drivers. The green light near the USB plug should come on.
  4. Power your device up (that is, plug your Rotating Clock Divider into your Eurorack system, or power up your Bend Matrix, etc…). Your device should be running normally, but don’t plug any patch cables into it
  5. Plug the 6-pin ISP header of the AVRISP mkII into your device. Note the orientation: the red stripe should go towards the white box that’s printed on the PCB: see photo above.
  6. The light near the 6-pin cable on the AVRISP mkII should turn green, indicating that it detects power. If you plugged it in backwards, it might flash orange. Nothing’s damaged, just flip it around…
  7. Run AVRStudio 4
  8. Click the little “AVR Programmer” icon: AVR Programmer
  9. If it doesn’t automatically detect your AVR ISP mkII, then select it from the box on the left, and click “USB”, and then click “Connect…”
  10. Click on the “Main” tab, and select “ISP mode” from the bottom box. Click “Settings” and choose an ISP Frequency of 125kHz.
  11. Select “ATmega168″ for the RCD, or ATtiny84 for the ABG, or ATmega32 for the BM, or ATmega328 for the PEG, from the top drop-down box. Click “Read Signature” and it should say “Signature matches device”
  12. Click the “Program” tab. Under “Flash” click the “…” button next to “Input HEX File” (the top one). Make sure you’re not under EEPROM! Select your hex file that you downloaded (or compiled yourself)
  13. Now, click “Program” (under the Flash section, not under the EEPROM section). It should give you no errors at the bottom of the window
  14. Unplug your ISP 6-pin header and you should be good to go!

Please let me know if you have any problems!

Mac OSX (AVR Fuses) –the easy way to upgrade your firmware:

  1. Download and install Crosspack-AVR
  2. Download and install AVR Fuses
    • For programming an atmega328 chip (such as used in the P.E.G.), download and install this hacked version of AVRFuses and follow the README.txt instructions for installation
  3. Download the hex file for your upgrade from 4mspedals.com
  4. Plug in your AVR ISP mkII. The green light by the USB plug might not come on.
  5. Do steps 4, 5, and 6 of the Windows installation (power up your device, plug in the AVR ISP mkII, make sure the green light comes on)
  6. Open up the AVR Fuses program that you downloaded. 
  7. Select the AVR chip type that you’re using (the name of the chip is also printed on the chip itself, use a flashlight to read the tiny letters!)
  8. Pingable Envelope Generator (PEG) uses ATMEGA328
    Bend Matrix uses ATMEGA32 or ATMEGA32A
    RCD and SCM: ATMEGA168 or ATMEGA168P
    AutoBassGen: ATTINY84
  9. Select the hex file you downlaoded in step 2, and burn it onto your chip!

Mac OSX (Crosspack) –the advanced way to hack your code:

  1. Download and install Crosspack from here: http://www.obdev.at/products/crosspack/index.html]
  2. Download the hex file for your upgrade. Save the file in your Home directory, so you can find it easily with the Terminal.
  3. Plug in your AVR ISP mkII. The green light by the USB plug might not come on.
  4. Do steps 4, 5, and 6 of the Windows installation (power up your device, plug in the AVR ISP mkII, make sure the green light comes on)
  5. Open up your Terminal program (in Utilities folder)
  6. In Terminal, type “ls” and hit enter. You should see the name of the hex file that you saved in your Home directory (along with everything else in your Home directory). If not, you didn’t save it in the right place.
  7. Now tell it to burn the code. For the RCD, type this command:
    avrdude -P usb -c avrispmkII -p atmega168  -U flash:w:clocker.hex -v -v

    And press enter. This assumes your hex file is named “clocker.hex”. It should say “avrdude: Thank you” and have no errors above that. If all goes well, unplug your 6-pin cable and your RCD is updated!

    If you’re using a fresh chip, you’ll need to use this command to burn the fuses:

    avrdude -P usb -c avrispmkII -p atmega168 -U hfuse:w:0xd7:m -U lfuse:w:0xef:m -U efuse:w:0x01:m -U flash:w:clocker.hex

Linux:

  1. Install avrdude. You can probably install it with your package manager, such as Aptitude: (type “sudo aptitude install avrdude”), or Ubuntu’s Synaptic
  2. Follow the OSX instructions starting at step 2. Hint, if avrdude is not finding a usb connection, you might need to type “sudo” before the avrdude commands. Then it’ll ask you for your password before running avrdude.