Home > Arduino, Code > ES9018K2M Code Fully Tested

ES9018K2M Code Fully Tested

A new version of the code has been posted in the CODE tab [link].

This version has been fully tested with an Amanero USB interface [link] connected to the DIYINHK DAC board with an 80 MHz clock. Both PCM and DSD files of various sample rates were used together with foobar [link]






Make the proper adjustment for your specific implementation in the code.

/******************* Code Customization Section *********************/

/* First: Choose the clock frequency you have and comment the other */

#define USE80MHZ  
//#define USE100MHZ

/* Second: Choose stereo or mono

   | CONFIGURATION       | #define DUALMONO | #define STEREO   |
   | Dual mono           | un-comment       | comment          |
   | Stereo              | comment          | un-comment       | 
   |---------------------|------------------|------------------|    */
#define STEREO
//#define DUALMONO

/* Third, optionally choose the number of inputs. 6 is the max without 
   modifying the code. You could lower the number of input choices
   here. for example if you only want to see 2 choices, modify the
   code like this: #define ICHO 2                                   */

#define ICHO 6

/* Fourth, optionally change the name of the inputs. Keep 6 characters
   Use blanks if necessary. If you use less number of inputs, only the
   top ones matter.

char no0[] = "INPT-A";
char no1[] = "INPT-B";
char no2[] = "INPT-C";
char no3[] = "INPT-D";
char no4[] = "INPT-E";
char no5[] = "INPT-F";

/* These inputs choices can be virtual or real. In the ES9018 there
   were 8 data lines. One could simultanously connect one I2S/DSD input
   plus 3 additional SPDIF input (thus 4 physical inputs). 
   In the ES9018K2M there are two additional input lines for SPDIF so 
   one can potentially connect one I2S/DSD input plus 2 additional SPDIF
   inputs.In addition one could choose different parameters -such as the
   DPLL bandwidh or filter selection- 
/* Fifth, adjust the interrupt routine to match your rotary encoder by
   adjusting the mode parameter in the following routine
   (search for it in the code):
   "attachInterrupt(0, rotEncoder, LOW);"
   The mode parameter defines when the interrupt should be triggered:
       LOW to trigger the interrupt whenever the pin is low,
       CHANGE to trigger the interrupt whenever the pin changes value
       RISING to trigger when the pin goes from low to high,
       FALLING for when the pin goes from high to low. 
   You can also read the following link:

/***************** End Code Customization Section *******************/   

This code should also work with syllable’s DIY DAC [link] which is also described in this builders thread [link]


  1. January 30, 2015 at 16:23

    Quote: “In the ES9018K2M there are two additional input lines for SPDIF so one can potentially connect one I2S/DSD input plus 2 additional SPDIF inputs.”
    the diyinhk-pcb seems to offer only one SPDIF connection (GPIO2). Could you tell me how one could connect the second SPDIF-IN? Thanks! Stephan

  2. September 14, 2016 at 14:57

    how to get rid of arm fat

  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