Home > Arduino, Code > Code compatible with Arduino 1.0

Code compatible with Arduino 1.0

I’ve updated the Buffalo Code to make it compatible with Arduino 1.0. Check the code section


Preceding the sample rate number there is an oversampling indicator

  • Oversampling: (^)
  • Oversampling bypass: (.)

Next to the DPLL setting there is a “mode” indicator

  • Normal: DPLL setting is x1: (NOR)
  • Multiplier: DPLL bandwidth is x128: (MUL)
  • Jitter Eliminator is off: (OFF)

These setting are probably only useful if you use the DAC in synchronous mode (feeding an external clock that is synchronous with the data).


Based on previous experimentation and also as suggested by others, I attempted to turn off oversampling in order to play 352KHz material without the noise problem. I added code to automatically turn off oversampling when high sample rate was detected.

Unfortunately, it didn’t work. Oversampling bypass works 0nly if the incoming sample rate is 384KHz. I simulated this by having the Musiland o3 USB interface do the upsampling (it could have been Quicktime doing it but all I had to do is set the sample rate in the Musiland control panel to 384KHz), and I confirmed the sample rate in the Arduino display.

With incoming sample rate below 384KHz, the following was observed:

  • DPLL locks if there is no music playing. The measured frequency is 64x smaller
  • DPLL is unable to lock if music is playing. When the SR is 352K, it can intermittently lock (very rapid lock/unlock). When the sample rate is 192K or below, there is no music output.



The normal mode of operation is the “display mode”. In this mode, moving the rotary encoder only changes the volume level: clockwise increase volume (decreases attenuation); ccw: decreases volume (increases attenuation)


To enter select mode, you press down on the rotary encoder (to activate the switch in the rotary encoder). If there is no activity within 4 seconds (adjustable in the code), the code reverts to normal mode.

In select mode, a right pointing arrow indicates which parameter may be changed. Every click of the switch of the rotary encoder switch moves the arrow one position; to change the parameter, rotate the rotary encoder. In this mode the sample rate is NOT updated.


  • Button 1: Increase volume
  • Button  3: Decrease volume
  • Button 5: Mute/unmute

The mute function is implemented to kill the volume instantly but softly restore the volume level to the previous setting.

  1. January 9, 2012 at 15:14

    Thanks so very much for such a quick update! Looking forward to testing it and reporting back🙂

  2. Bunpei
    January 11, 2012 at 09:25

    As for OSF Bypass on BII/80MHz, I remember my experience.
    There was no similar problem when I connected I2S output of SDTrans though my experiment was limited to 44.1 – 352.8 kHz.

    • BlogGeanDo
      January 11, 2012 at 17:13

      Hi Bunpei, thanks for your comment. I am not sure what is going on. I’ve tried tweaking other registers such as the turning dpll off, manual relocking the signal and changing to I2S-24bit, but there is no improvement. I wouldn’t think it would be a jitter problem since it plays fine when the sample frequency is 384KHz. The only other factor is that the Musiland sends 32 bit of real data to the DAC…

  3. Bunpei
    January 11, 2012 at 22:16

    How about setting for “I2S” and “S/PDIF Auto-detect”?
    I think explicit setting for I2S, 32bit and disabling “S/PDIF Auto-detect” might be necessary.

    • BlogGeanDo
      January 13, 2012 at 06:30

      I rechecked the register programming and that is how select I2S. Still, no sound. The really strange part is that if sample rate is 384k (Using the OS/Driver upsampler) I get music…

  4. Rodrigo Rocha
    January 12, 2012 at 03:24

    The Hifiduino is compatible with the Buffalo III?

    • BlogGeanDo
      January 12, 2012 at 06:24

      Yes, but you need to know how you are configuring the inputs and outputs because the code assume that the inputs are wired like BII.

  5. Michele
    January 12, 2012 at 08:13

    Hi GLT, which part of code should be modified to use a 2×20 instead 4×20 display?

    • BlogGeanDo
      January 12, 2012 at 17:12

      More code is dedicated to the user interface than to programming the chip. Moving to a 2×20 display will involve a lot of changing.

  6. K Y Chan
    June 10, 2012 at 08:43


    As I am using a iSteadstudio Graphic TFT display, pin 2 & 4 already used by the touch screen input, I re-assigned the input pin for Voluppin and Voldownpin to 9 and 11 respectively. I also changed the selectpin to 10. After the change, only the select function of the rotary encoder is working, Voluppin and Voldownpin not function. The Volume display goes down when I touch the screen, this may indicate the program is still looking at pin 2 instead of pin 11.

    Another problem on remote control, when I press the center button of Apple remote, it doesn’t mute, when I press again, the volume drops to -70dB and then ramps up.

    Can you advise me how to debug these problems?

    • BlogGeanDo
      June 10, 2012 at 14:52

      Check the line of code:
      // Attach Interrupts
      attachInterrupt(0, rotEncoder, CHANGE); // ISR for rotary encoder on pin 2

      In the code, it is using interrupt “0” which applies to pin 2. Depending on the board, you need to find a pin that supports interrupts. Thus if your touch controller is connected to pin 2, every time there is a change on pin 2, it will generate an interrupt and cause volume change. Read the comments on “interrupt” in the code.

      The remote problem, let me think about it.

      • K Y Chan
        June 11, 2012 at 05:45

        Thanks for you advise and I will try pin 18 with interrupt “3”.

        I found the bug on the remote problem, in the route for “Mute” key, the if – else should dispVol (DIM) instead of dispVol (currAttnu).

  7. September 14, 2016 at 16:18

    discount cologne online

  8. September 14, 2016 at 18:35

    digital goods with MRR and giveaway rights for free

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s