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

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
    18,191
    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
    Italy
    Posts
    160
    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
    18,191
    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
    176
    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
    }

  8. #8
    Hi there,

    Happy to read people interested in the AK4558 chip.
    I'm facing an issue with my prototype.
    My design is pretty standard and use only one teensy 3.6, one AK4558 and one dedicated 3.3v analog regulator for the analog part. Nothing special, but maybe not perfect of course...
    I'll post my console return, code and shematics soon if people interested in. I dont have these under the hand right now.

    I just cant make it to work anymore. The i2s comunication return something and the AK4558 seems to "communicate" with the controler well, but impossible to input-output any signal (only quite artefacts and sometimes random loud clicks).

    I've tryed to modify the startup sequence at the i2s library level. Like suggested by Blackaddr. Now I can just choose the exact place for the i2s begin(). Unfortunatly, trying differents positions inside setup(), nothing changed.

    I've also fix the volume bug as suggested in this thread (last post by MickMad) : https://forum.pjrc.com/threads/32276...inch-PCB/page2
    Now outputs volumes looks ok. But nothing more.

    Because I'm a noob in low level register things. I would apreciate some shared experiences.

    In my case, for the begining of investigation, I just need to know if it's only a software issue or hardware issue, or both. Is someone have a solid solution for the sofware side? It'll help me to diagnostise things the best.

    PS : my code is just an adapted version of the passThrought example in "Hardware testing"

    All the best
    Thanks

    Q

  9. #9
    Senior Member MickMad's Avatar
    Join Date
    Feb 2013
    Location
    Italy
    Posts
    160
    Quote Originally Posted by quentin aurat View Post
    Hi there,
    Is someone have a solid solution for the sofware side? It'll help me to diagnostise things the best.
    Hi there,

    this is the setup() of the last sketch I wrote for the AK4558:

    Code:
    void setup() {
      AudioMemory(16);
      //while(!Serial);
      ak4558_1.enable();
      ak4558_1.enableIn();
      ak4558_1.enableOut();
      i2s1.begin();
      i2s2.begin();
      //setup your other stuff here
    }
    you might want to uncomment the while(!Serial); line so that you can open the serial monitor and check if the data returned by the AK4558 debug functions makes sense.

    Also, for some reason the AK4558 requires that the input_i2s.h and output_i2s.h files to be modified; in particular, you have to comment the begin() in their constructors, as shown in this snippet:

    Code:
    AudioInputI2S(void) : AudioStream(0, NULL) { }//begin(); }
    I have yet to understand why the I2C communication with the chip won't work if the I2S objects call their begin() function before configuring the chip (maybe the chip doesn't like that it starts receiving clock signals before being configured).

    Try doing this and let me know if you still got issues.

    Regarding the I2C stuff, I might tackle this issue if I will use the AK4558 in my products; being in Europe it is a pain to order these chips so I might resort to using more easily available chips (like Cirrus/Wolfson ones).

  10. #10
    Thanks a lot for the quick reply. I'll try this.

    I might tackle this issue if I will use the AK4558 in my products; being in Europe it is a pain to order these chips so I might resort to using more easily available chips (like Cirrus/Wolfson ones).
    Me too! I can't order on Digikey everytime for small qte. There is no reseller in EU as far as I know. It's a big problem, I know.
    As mentioned in this thread, the AK4556 seems interesting and even more easily solderable. but it's AKM also, again... Difficult to buy.
    Let me know if you find a good substitute from another brand in the same quality/price range/package. I'm interested!

Posting Permissions

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