Hacking Branches

Hello people,
After some time of playing with arduinos I figured it is high time I hack one of my MI modules.
The first “victim” is going to be a branches module as it is the easiest instrument to understand and it is based on an atmega μC that I have some familiarity with.

I intent to use platform.io which to my understanding is a middleware that sits on top of avrdude.

Now, I have some questions:

  • I can see that the branches buttons do not have a pull up/down resistor, so I assume that the internal pullup resistors of the atmega are used here. Is there any chance I burn the μC if I forget to set properly the input pins that correspond to the buttons?
  • Does the SPI provide debugging? If I write a Serial.println() with the serial data be sent through SPI or do I have to have another kind of connection established?
  • Does the SPI connection provide the power the module needs to operate? If I make a blink program, should I provide power to the module via eurorack or will the SPI programmer I’m using (tinyusb) will provide the power needed for this task?
  • Everytime I upload a program to branches, do I have to set the fuses? Is there a sensible set of fuses to set to that μC or do these depend on the application uploaded?

I think these are for now.
Wish me luck!

Yes, the internal pull-ups are used. A short can occur if you press the button while the pin is configured as an output with a HIGH output level – but the default status for all pins is to be configured as inputs.

You mean ISP? It only allows the programming of the IC, it doesn’t support breakpoints, variable inspection, etc. Serial.println is another story, since this requires a serial connection between the MCU and the host computer (typically provided by an FTDI chip or dedicated AVR emulating a USB serial interface on the Arduino boards). On Branches, the RX/TX pins of the UART are not available, so you won’t be able to use Serial.println. My favorite way of debugging code is to make it platform-independent and run the hell of it on a desktop computer!

You need to power the board through the Eurorack connector.

The fuses are not erased when you write a program.

There is a sensible set of fuses, in particular to run the MCU with its internal oscillator (there’s no crystal on the board, so the wrong fuses might “brick” the module), and to specify whether a bootloader should be used or not. I assume your development environment is not compatible with preserving the bootloader that comes with the module.

In the end, you’ll probably spend more time finding workarounds to make the module work with this development environment, compared to learning the “mutable” way of doing things (avrdude, command-line, no IDE and no libraries) – especially on a chip with such a limited amount of memory. Maybe you should try both approaches in parallel and see which one will create the most issues first!

1 Like

For some reason I cannot install the tinyISP device I got to the mutable vagrant environment so that is why I don’t use it as a starting point. I’ll try to find a way to install it though.

Can you elaborate on this please? It sounds very intriguing :slight_smile:

Do you mean these?
image

I’ll try :slight_smile:

I see… Isn’t it compatible with an equivalent device? You can modify this line to specify which programming device should be used https://github.com/pichenettes/avril/blob/276b2887e4110ca913294fcbb313163dfb28a448/makefile.mk#L19 (maybe it’s usbtiny?)

Branches is kind of an exception here because what the module does is very dumb, so there’s very little advantage of separating the actual algorithm/logic from the hardware, but if you look at the source code of Plaits or Rings or Stages, you’ll find that the “core” functionality of the module is in C++ classes that can be used and tested independently of the hardware platform.

Most projects have a test directory with a command line C++ program “exercising” this code with test signals, and producing wav files that can be played, inspected, etc. with your tools of choice. And testing a specific condition (say this configuration of the module’s settings, with this specific CV input) is only a matter of providing the right inputs to the test program – it’s much easier to set up than on the actual hardware with test equipment.

Yes. If you look at the schematics of an Arduino board, you’ll see that these are routed to a chip doing USB<->serial conversion. For example, on an Arduino Uno, these pins are routed to an ATMEGA16U2 with a USB interface.

1 Like

I’m at work now so I cannot verify it. I think is it usbtinyisp, something like that.
I will check it though.

Can somebody reproduce some of these tests on the mutable environment? I was listening to a podcast where you said something like (c++ tool) and I was searching for what was that “tool”.

:slight_smile: