Arduino I2S - Cirrus Logic CS4398

Hi, guys any info would be appreciated. This web site has great ppl and info so thanks for all the great info on SPI and all the other bits.

My problems come from trying to use Arduino uno or mega with a Cirrus Logic CS4398 DAC chip i have set up the SPI for configuration of the chip but realized i cant send audio through SPI from cirrus logic support!! I was told to use the I2S communication method but cant really find any info small snippets but not for me :frowning: to use.

Any info would be really appreciated :slight_smile:

For basic learning wanted to have Arduino to generate a 44.1k, 24bit sine wave sent to the DAC and output from audio outs on chip.

Thanks

Audiobugz

Sorry i did post on another page but it was over 120 days old with out action.

Cleaned up your post in the other thread.
(in that thread you saw how such chips can be communicated to)

Do you have a datasheet of the cs4398?
Please post a link.

Hi, thanks Rob for the reply.

The data sheet for chip is http://www.cirrus.com/en/pubs/proDatasheet/CS4398_F1.pdf

I have just ordered a Arduino due but is there problems with using arduino as the master i have set up the the config of the chip by SPI and i think the CS4398 can only be a slave. Really not sure.

Thanks again

Rob the quote in your profile is well cool gonna add to my research methods portfolio for hand in next week :slight_smile:

Hi, i wishing some one would find time to have a quick look at the date sheet just received the due so wanted to put some thing together. I do respect every ones time and if your busy i understand.

Thanks again

Arduino Due and Teensy 3.1 are the two boards which can do I2S well. (full disclosure: I'm the creator of Teensy).

For Teensy, you'd use this audio library:

http://www.pjrc.com/teensy/td_libs_Audio.html

With multiple playback, synthesis, effects, software mixers and supporting multiple input and outputs, using very efficient DMA, I believe it's safe to say the Teensy Audio Library is by far the most fully featured of all the I2S capable code for Arduino.

However, the Teensy Audio Library really only supports I2S master mode well, where Teensy sends BCLK, LRCLK and MCLK. If your DAC or other external circuitry will be creating the clocks, Teensy probably isn't the best option at this time.

For Arduino Due, this library is probably the best available:

The slow 8-bit boards like Arduino Uno really aren't useful for I2S. However, Open Music Labs did create a sort-of I2S signal using SPI, for use with their codec shield. It's not truly I2S, but close enough for some chips to work.

If you only need to create a fixed sine wave, played directly from a lookup table (no DDS to change frequency, no linear interpolation, etc), ordinary 8 bit Arduino boards are just fast enough to keep the data moving. You just can't do much of anything else.

Hi Paul thanks for the detailed description it does answer many of the question i have on SPI and I2S.

I have looked in to the Teensy 3.1 board and it looks like it would actually fit the project better.

I will be buying one soon as the support and audio options look great.

But i bought the Due board last week :frowning: and have been trying to set the board up with the CS4274 codec and delsauce code. The problem i have know is i cant find any info on the Due I2S pin layout, is this some thing you could help with?

At the moment just trying to get my head around Electronics and coding for a ambitious uni project.

Thanks again Paul for the reply and i look forward to starting a project soon on the Teensy!!

Data Sheet

Just found this and with the Due pin diagram (thanks Graynomad) i got some something!

http://www.atmel.com/Images/doc6020.pdf

Need to convert the CS4272 pins

I can't help much with Due, other than pointing out that library.

If you do try Teensy, I highly recommend getting the audio shield. Your project clearly is about using the Cirrus Logic part, but perhaps having the known-supported SGTL5000 can be a good stepping stone?

Could come in handy for testing the I2S stuff... run the 4 wires to both chips (all 4 are digital output signals) so you compare and confirm whether the signals are good while you're trying different ways to use the CS4398.

Hi, Paul thanks for the reply. The point of my project was to learn the whole process of product development and coding.

Buying a shield is the easy way out and not much knowledge gained. Regarding the Teensy i will be buying one soon but as the Due just been delivered I'm gonna try a bit harder or totally give up lol.
Is the know support for the SGTL 5000 for the Teensy board or Due?

Think first of all i need to get the wiring right then look at the code. I have bought all the manufacturers recommend components to help setting it up. I'm now struggling with the Atmels used language for I2S and Arduino pin location. From Greynomad's Due pin map the data sheet for chip and Atmels I2S i
have found

Arduino pins CS4272 Pins

TD-A0 SD-OUT 6-SDOUT

RD-A9 SDIN 9-SDIN

TK-23 Clock SCK ? i guess this has to be SCLK

TF-Word Select WS 4- LRCK

Don't know how to figure out if this is correct. If any one could help or know of any books related to this it would help.

Sorry Paul my search on SGTL 5000 brings up another codec? NXP® Semiconductors Official Site | Home

The audio library on Teensy is very well tested with the SGTL5000 chip, because that's the chip on the shield. Even though you're designing your own stuff, if you get stuck, I highly recommend trying the known-good shield. When you have a lot of possible unknowns, it's very hard to make any progress. Having a well supported chip for testing and comparison can save you a lot of time and trouble as you work to get the CS4398 working.

SGTL5000 might be difficult with Arduino Due. It requires a MCLK signal (can't create its own MCLK). I believe CS4398 is the same, but I only looked at the CS4398 briefly. The readme on the ArduinoDueHiFi library says Arduino Due "doesn't appear to be able to generate the appropriate MCLK signal to drive external converters". If you're going to stick with Due, you might need to use a chip that generates its own MCLK and sends the other clock signals to Due.

Teensy 3.1 absolutely can create MCLK. Almost all the examples are written for the SGTL5000 chip, which needs to receive MCLK.

Hey, Paul thanks the chips been changed to the CS4272. I changed it after the initial feedback and finding the Hifi library on git hub. The datasheet was added to the post above for the new chip. The CS4272 has a internal clock.

I totally get what your saying about the Teensy and the SGTL 5000. Build on existing knowledge and it looks like the support with the Teensy is much better the Arduino support!!!

Thanks again :slight_smile: