CS8416 in Software Mode - Page 2 - diyAudio
Go Back   Home > Forums > Source & Line > Digital Line Level

Digital Line Level DACs, Digital Crossovers, Equalizers, etc.

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 30th May 2011, 04:33 AM   #11
eehobby is offline eehobby  Canada
diyAudio Member
 
Join Date: Aug 2003
Location: Calgary
I've now got this working. The problem was in the init code for the DAC.

Here is the init code for the CS8416 (SPDIF inputs - I2S outputs), in Software mode, with the CS8416 operating as the clock master:
Code:
I2C_W2(RXI2S_A, RXI2S_SADFMT, 0b10000101);		// Master, 24 bit, SODEL, SOLRPOL
I2C_W2(RXI2S_A, RXI2S_CNTRL0, 0b00001100);	// PDUR, TRUNC
I2C_W2(RXI2S_A, RXI2S_CNTRL1, 0b00000000);	// 
I2C_W2(RXI2S_A, RXI2S_CNTRL2, 0b01001001);	// Auto de-emphasis; GPO-0 (red-led) to non-AUDIO
I2C_W2(RXI2S_A, RXI2S_CNTRL3, 0b00110000);	// GPO-1 (green-led) to C bit
I2C_W2(RXI2S_A, RXI2S_RXEMSK, 0b01111111);	// unmask all errors
...
I2C_W2(RXI2S_A, RXI2S_CNTRL4, 0b10000000);
and for anyone who wants it, here is the init code for the MAX9850 (I2S inputs - audio outputs), operating as the clock slave:
Code:
I2C_W2(I2SDAC_B, I2SDAC_DAUDIO, 0b00001011);	// set to Slave mode, DLY, 24 bit
I2C_W2(I2SDAC_B, I2SDAC_LRCLKL, 0b00010000);	// divide iclk by 16 * 16 (typ 44.1 or 48 kHz)
I2C_W2(I2SDAC_B, I2SDAC_LRCLKH, 0b10000000);	// Integer mode,
I2C_W2(I2SDAC_B, I2SDAC_VOLUME, 0b00001111);	// volume to mid-range
I2C_W2(I2SDAC_B, I2SDAC_GENPUR, 0b00100001);	// ZDEN, GPD out, GPO=0
I2C_W2(I2SDAC_B, I2SDAC_CHGPMP, 0b01000000);	// Slew 125 ms, CP internal
...
I2C_W2(I2SDAC_B, I2SDAC_ENABLE, 0b11111101);
I plan to do some further experimenting with the various registers, and then get my ADC card working (based on CS4265).

Jake
  Reply With Quote
Old 30th May 2011, 09:01 AM   #12
diyAudio Member
 
Join Date: Apr 2010
Send a message via Skype™ to Koen Smeets
Congrats!

WRT the left/right polarity of the LRCK: it seems the datasheet is not consistent with 'reality':

I have a piece of music where my transport indicates (via VU meter on screen) that a sound is on the left-channel only. Now, If I configure the CS8416 according the the I2S specs and the datasheet (so SOLRPOL = 1, SDOUT data is valid for the right channel when OLRCK is high), I hear the sound on the RIGHT channel.

So I guess SOLRPOL = 0 is the correct setting, after all??

Anyhow, glad you got it working!
  Reply With Quote
Old 3rd June 2011, 04:02 AM   #13
eehobby is offline eehobby  Canada
diyAudio Member
 
Join Date: Aug 2003
Location: Calgary
FYI - I got the GPOs sorted out too. Here is what I use to set up the outputs that drive the LEDs:
Code:
I2C_W2(RXI2S_A, RXI2S_CNTRL2, 0b01000001);	// Auto de-emphasis; GPO-0 (red-led) to !EPMPH
I2C_W2(RXI2S_A, RXI2S_CNTRL3, 0b01100000);	// GPO-1 (green-led) to NVERR
The LEDs are fed from +5v, and then into the GPOs; so a low voltage on the GPO pin turns on the LED. So, the Green LED comes on when there is no error, and the red LED comes on when there is no de-emphasis. During normal music, the green led is on and red is off. If I unplug the SPDIF coax, the green goes out and the red comes on.
  Reply With Quote
Old 22nd March 2013, 07:37 AM   #14
diyAudio Member
 
Join Date: Jun 2003
Quote:
Originally Posted by Koen Smeets View Post
To answer my own query: I managed to read the channel status registers. Problem turned out to be I have LSB/MSB mixed up. Bit depth, BTW, seems to be set to 24 bits all the time, at least in all the sources I have used so far (on board sound card, EMU0404PCIE card...)

Cheers!!
Hi all folks!

I began to work on CS8416 recently. I was sucessful basicly at least it sounded well. However, by reading the datasheet, I found out the register 18h (OMCK/RMCK Ratio (18h)) can be used to get input frequency like 44.1 48 khz..etc. But I get all 00000000 valus from this register.
Does anyone have experienced in using/reading this register?
Thanks!
  Reply With Quote
Old 22nd March 2013, 12:23 PM   #15
diyAudio Member
 
Join Date: Apr 2010
Send a message via Skype™ to Koen Smeets
Quote:
Originally Posted by Tubeee View Post
Hi all folks!

I began to work on CS8416 recently. I was sucessful basicly at least it sounded well. However, by reading the datasheet, I found out the register 18h (OMCK/RMCK Ratio (18h)) can be used to get input frequency like 44.1 48 khz..etc. But I get all 00000000 valus from this register.
Does anyone have experienced in using/reading this register?
Thanks!
Are you actually applying a clock on OMCK pin? (FWIW: I am reading the sample frequency from the S/PDIF channel data, e.g. from register 19h; works fine if the source is sending this information).
  Reply With Quote
Old 22nd March 2013, 07:25 PM   #16
diyAudio Member
 
Join Date: Apr 2010
Send a message via Skype™ to Koen Smeets
Quote:
Originally Posted by Koen Smeets View Post
Are you actually applying a clock on OMCK pin? (FWIW: I am reading the sample frequency from the S/PDIF channel data, e.g. from register 19h; works fine if the source is sending this information).
I just checked my code: I am using channelA_stat3 an channelA_stat4 registers.

Some of the bits in those registers represent sample frequency and word length. According to IEC 60958-3-2006.
  Reply With Quote
Old 23rd March 2013, 03:58 AM   #17
diyAudio Member
 
Join Date: Jun 2003
Koen,

Thanks a lot.
Now I get from channelA_stat3 with frequency incomming and seems to be correct according to IEC 60958-3.
As for channelA_stat4, I always read 0000 0000 which means …"word length not indicate (default)". Have you get correct word length from channelA_stat4? and in what condition (cd, dvd or .wav..)
  Reply With Quote
Old 23rd March 2013, 08:10 AM   #18
diyAudio Member
 
Join Date: Apr 2010
Send a message via Skype™ to Koen Smeets
Quote:
Originally Posted by Tubeee View Post
Koen,

Thanks a lot.
Now I get from channelA_stat3 with frequency incomming and seems to be correct according to IEC 60958-3.
As for channelA_stat4, I always read 0000 0000 which means …"word length not indicate (default)". Have you get correct word length from channelA_stat4? and in what condition (cd, dvd or .wav..)
Yes, I am successfully reading word length, too. Possibly you are trying to read the metadata before it has all been decoded from the S/PDIF stream?

Here's a the bit of code I have to handle this. Notice the delay after the receiver has acquired the lock to allow channel decoding. One second is probably way too long, but I feel it is kind of classy when the LCD is updated after a while. Like my receiver has done a really hard job decoding the channel metadata. :-)

BTW, I believe the actual metadata is not dependent on the actual source but on the implementation of the S/PDIF transmitter and it's drivers. For example: my computer and satellite receiver always display 24 bits word length, even when playing 16-bit material. It is not until I explicitly set the soundcard to 16-bit wordlength that 16 bit wordlength is indicated. But then 24-bit source material is truncated.

Also see section 11.1, 5th paragraph of the CS8416 datasheet on how to use an interrupt to detect when channel data has been decoded.

Code:
if (!cs8416_rerr && !islocked) { // receiver acquired lock
  __delay32(fcy);		// delay 1s for metadata
  // get stream metadata
  sample_rate = (cs8416_read(channelA_stat3) & 0b00001111);
  bit_depth = (cs8416_read(channelA_stat4) & 0b00001111);
  switch(bit_depth) {         // send bit depth to LCD
    // put your switches here
  }
  Reply With Quote
Old 25th March 2013, 07:55 AM   #19
diyAudio Member
 
Join Date: Apr 2010
Send a message via Skype™ to Koen Smeets
Come to think of it, I actually posted my CS8416 receiver board a while ago, including source files. See here: CS8416 S/PDIF receiver board | fotoloog.org
  Reply With Quote
Old 26th March 2013, 03:04 AM   #20
diyAudio Member
 
Join Date: Jun 2003
Hi Koen,

Thank you very much for your help again.
I have two inputs hook up into CS8416.
1. CD Player, in this device I can read 1C (channelA_stat3), Q-Channel sub code correctly.
2. USB input, in this device I can only read 1C (channelA_stat3), but can not read Q-Channel sub code (00000000).

I still can not read correct 1D (channelA_stat4), in both devices.

I checked the rerr, metadata possibility, but still nothing.

Maybe I have some configuation's problems.

Will work on this issue further.

Thanks again.
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CS8416 in sw slave mode with external clock milandks Digital Line Level 0 29th March 2009 09:45 PM
Help me set up CS8416 in HW mode ezkcdude Digital Source 6 2nd May 2006 10:08 PM
Using a spdt switch to select between triode mode and pentode mode on a guitar amp. G Tubes / Valves 19 15th March 2006 09:15 AM
Calculating watt requirements for multi-mode/tri-mode operation? Datoyminaytah Solid State 1 14th August 2004 07:43 AM
DF1706 and software mode control? WTS Digital Source 8 25th March 2004 10:02 PM


New To Site? Need Help?

All times are GMT. The time now is 08:57 AM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright 1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2