Programming a MiniMO Synth

April 19, 2020 at 12:03 pm (computers, maker, music, Uncategorized) (, , )

I’ve been playing with a home-grown version of the MiniMO synth as the creator has very kindly put the designs out into the public domain.

But a key issue with programming the ATtiny85 devices used in the synth is incompatibility with the latest versions of the Arduino IDE and the SpenceKonde ATTiny85 core that is now easily installed within it.

Warning: The official advice is still to build using Arduino 1.5.7, so treat all this as unverified and experimental.

I did have a look at this in the past and the issue seems to be one of incompatible timers, that I’ve described before.  The MinoMO uses both timers of the ATTiny85, but by default the core assumes the use of Timer 0 overflow interrupt for the delay/millis function, but several of the programmes for the MiniMO also want to use the overflow interrupt.

Expanding on the solution described in my previous post  – if we are assuming an 8-bit timer then it will overflow at 255, so setting the compare-on-match to 255 should have the same effect, but generate the TIMER0_COMPA_vect interrupt instead (at least for the mode being used here).

However, there is one caveat to all this.  The MiniMO synth code (I’m looking at the DCO code right now) sets the following parameters for Timer 0:

  //Timer Interrupt Generation -timer 0
  TCCR0A = (1 << WGM01) | (1 << WGM00); // fast PWM
  TCCR0B = (1 << CS00);                // no prescale
  TIMSK = (1 << TOIE0);                // Enable Interrupt on overflow

As far as I can see the original use of Timer 0 in the ATTiny Core is Fast PWM but with a prescalar value of 64.  Changing it to no prescale value here means that the “tick” used for the delay and millis functions is now running 64 times faster than previously assumed.

I’m guessing the author had the same issue in the original code though (although presumably with the settings for Timer 1), as in almost all other cases he uses the library function _delay_ms() rather than the Arduino function delay() or millis() – there is one exception – a couple of functions called on power-up prior to changing the timer values, which use the Arduino delay() function.

So from what I can see for the few programmes I’ve used with the MiniMO so far, I believe this is probably the only thing that needs changing if programming your own from the latest Arduino IDE and SpenceKonde ATTiny85 Core.  At least, on manual review of the code so far, I’ve not spotted any potential issues with having delay() and millis() running too fast!  But this isn’t an extensive review, and I repeat, the official advice is still to use an older version!

I don’t have an original MiniMO to compare waveforms to see if all the timing appears correct or not, but so far, I’ve been able to calibrate the frequency of the DCO (required as my ATTiny85 had no pre-set values stored in EEPROM), change waveforms, and see all three frequency ranges.

The fuse settings I used (as detailed by the menus in the SpenceKonde Core for ATTiny85 and then set using “burn bootloader”) were:

  • 8 MHz Internal
  • B.O.D disabled
  • EEPROM not retained (removes calibration data on re-programming)
  • Timer 1 Clock = CPU
  • LTO = Enabled
  • millis = Enabled

Which translates over into the following fuse settings:

  • efuse: 0xFF
  • hfuse: 0xDF
  • lfuse: 0xE2

I’d really like to know if anyone can compare the waveforms and frequencies generated by an original MinoMO DCO with one programmed with the above to see if they are the same.  Either way, for me I have a functioning unit, programmed using a current version of the Arduino IDE and ATTiny85 support and look forward to trying some of the other programmes for it too.

Of course, a massive thanks to Jose of course for putting the designs out there for experimentation like this in the first place.

Kevin

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: