Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: AK4556 codec library?

  1. #1
    Junior Member
    Join Date
    Nov 2017
    Posts
    5

    AK4556 codec library?

    I'm going to use a Teensy 3.6 and would like to interface it to the AK4556. Any libraries out there?

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,459
    Michele Perla contributed code to the audio library for controlling AK4558. Maybe that's similar?

    https://hackaday.io/project/8567-hif...o-codec-module

    https://www.pjrc.com/teensy/gui/?inf...oControlAK4558

  3. #3
    Junior Member
    Join Date
    Nov 2017
    Posts
    5
    Thank you! I know that the AK4552 is compatible with the AK4556 (minus some control pins). I'll have to look at the AK4558 in more detail.

  4. #4
    Senior Member MickMad's Avatar
    Join Date
    Feb 2013
    Location
    Essonne, France
    Posts
    154
    It looks like the AK4556 doesn't need any code to program it, that is it does not have a serial interface for configuration of its parameters but rather an hardware interface; if you wish to configure the codec in real time using the Teensy you should wire pins DEM1, DEM0, and CSK3-0 to 6 digital pins of the Teensy and pull them high or low as defined in the tables at datasheet pages 15 and 16.

    The configuration seems to be the same as the AK4558 when used in hardware control mode, but since I use the I2C interface to control the AK4558 in my library I don't think you'll find anything worth copying other than the structure of the API maybe.

  5. #5
    Junior Member
    Join Date
    Nov 2017
    Posts
    5
    Thanks for the info. The more I look at the AK4558 the more I like it.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,459
    Was there a lingering issue with the I2S starting before the I2C config causing trouble? Or am I remembering wrong from some other chip?

  7. #7
    Senior Member Blackaddr's Avatar
    Join Date
    Mar 2017
    Location
    Canada
    Posts
    170
    Quote Originally Posted by PaulStoffregen View Post
    Was there a lingering issue with the I2S starting before the I2C config causing trouble? Or am I remembering wrong from some other chip?
    On a related note, I had some problems regarding I2S starting before I2C on one of my other projects. In order to work around it, I had to modify the I2S object code locally (in a backwards compatible manner) such that a new constructor was added that did not immediately call begin(). This allowed me to delay the the I2S bus becoming active until a time of my choosing.

    I used the Key-Pass constructor pattern where you define a type, then make a constructor that takes that type. The neat thing is there is no need for a dummy variable.

    I don't have the code in front of me but it went something like this (similar for i2s output, omitted for brevity).

    Code:
    // Changes to input_i2s.h
    AudioInputI2S(void) : AudioStream(0, NULL) { begin(); } // original default constructor, no change
    struct NOSTART {}; // create a constructor key
    AudioInputI2S(NOSTART) : AudioStream(0, NULL) { } // when the NOSTART key is passed, do not call begin. Note no variable is needed, you can pass the key type directly without an instance of it.
    
    // Changes to sketch.ino
    // AudioInputI2S input; // results in default constructor calling begin() before setup()
    AudioInputI2S input(NOSTART); // I2S bus will not become active
    
    setup() {
        // do stuff that requires I2S silent
        do_stuff();
        input.begin(); // now start up the i2s bus
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •