HiFi Audio CODEC Module - AK4558 evaluation board in a square inch PCB

Status
Not open for further replies.
Hi there, quick update:

syso sent me an email and he noticed that in my lib there's an hardcoded digitalwrite() on pin 0 instead of PIN_PDN; also, he is now using pin 0 as PDN but I #DEFINEd it as 1. This may solve his issue.

We'll see.
 
Sorry for the late update, been busy with some other work.
Unfortunately I never got the board to work. Can anyone confirm that the code from Git is functional?

If I know that the code is right, I will see what else can be wrong.
 
Sorry for the late update, been busy with some other work.
Unfortunately I never got the board to work. Can anyone confirm that the code from Git is functional?

If I know that the code is right, I will see what else can be wrong.

I'm working again with this CODEC and I'm facing I2C issues too; this time it looks like using an AudioOutputI2S object breaks the Wire library from working properly. Actually, it's the begin() function that is called in the AudioOutputI2S object that causes this issue.

I tested my function that reads the 10 registers from the AK4558 in a single sketch withtou anything else and I can get proper data out of the chip; I also tried to comment the begin() function from the AudioOutputI2S object constructor to call it manually after the codec has been enabled and this works too, but using the normal AudioOutputI2S object breaks it...

I'll investigate further.

PS: @syso if you look at one of your previous posts you never got audio output from the DAC because you set the volumes to 0
 
looks like using an AudioOutputI2S object breaks the Wire library from working properly.

All of the tutorial and most of the examples use I2S output together with the Wire library to control the SGTL5000 chip.

Maybe you're doing something nobody has tried that is triggering a previously unknown bug in the Wire lib? Hard to know...
 
It looks like the AK4558 doesn't like anymore if you first configure the I2S clocks then you configure the codec through the I2C bus.

The AudioOutputI2S and AudioInputI2S objects call their begin() function in the constructor; if I comment that, then call it manually AFTER having configured the codec, then it works properly; otherwise, the AK4558 just responds with a NACK on every attempt of I2C communication.

I said "the AK4558 doesn't like anymore" because I never had this issue when I wrote the library 3 years ago... the datasheet also shows that the I2S clocks can be input anytime before or after the configuration. It used to work, now it doesn't. Maybe they changed something in the chip in the last 3 years? Who knows.

PS I'm not doing anything strange; the enable() function of the AudioControlAK4558 acts much like the SGTL one, that is it simply starts communication on the I2C bus and sets some registers on the codec. I'm going to send an email to AKM to see if they really did some mods on their chip.

PPS I also found out a bug on the volume() function; when I wrote the library I used to bitshift a float (cast to uint32_t) by 22 bits, to convert it to an integer between 0 and 255; now that stopped working. Workaround: I just multiply that float by 255 :)
 
Sorry for reviving an older thread, but I just came across this, thought I would add my discoveries.

I also had the exact same issues when using the WM8731 codec on my TGA Pro board which I reported in this thread. Turning on the I2S first, then attempting to configure the codec with I2C has reliability issues where the CODEC I2C transfers are occasionally corrupted. I was unable to produce the problem with the SGTL5000 board. Suffice it to say, the SGTL is robust to the the I2S bus being active before the codec has been properly configured. I think the other codecs (at least the WM8731 and perhaps the AK4558) have issues if you don't configured the CODEC first.

Since the I2S Audio objects turn on the I2S bus in their constructors, and usually the objects are global, the bus will always turn on before you can configure the codec in the setup() function.

I found several workarounds:

1) Modify the audio library so that the I2S objects do not turn on the bus in their constructor, basically don't call begin() in the constructor. Make the user call it manually at a time of their choosing (after you have configured the codec). This would be a great addition to the Audio library, add a new constructor that allows you to call begin() later.
2) Hit the teensy with a sledgehammer (i.e. manually shut down the I2S clocks at the register level). Not an ideal solution.
Code:
// On the T3.6:
CORE_PIN9_CONFIG = PORT_PCR_MUX(1); // disable the clock to stop the I2S
// ...configure the codec...
CORE_PIN9_CONFIG = PORT_PCR_MUX(6); // turn the I2S clock back on
3) Modify the AudioControlWM8731 class to detect failed I2C transfers and retry. This is the solution I went with, you can see the implementation in the BAAudioControlWM8731::write() method here
 
1) Modify the audio library so that the I2S objects do not turn on the bus in their constructor, basically don't call begin() in the constructor. Make the user call it manually at a time of their choosing (after you have configured the codec). This would be a great addition to the Audio library, add a new constructor that allows you to call begin() later.
here

This seems like the ideal solution, it would just take one line of code added to the input_i2s.h and output_i2s.h files :)
 
Status
Not open for further replies.
Back
Top