Hi all, I often see the frequency of the incoming digital signal on a DAC shown on a display. But I cannot figure out how this is done. Does anyone have a circuit to show how the sampling frequency is read, or know how it is done in the first place?
Last edited:
You need to measure the frequency of the word clock. This signal may be known as WCLK, LRCLK (left/right clock), or another similar name. There are other clocks used by the DAC, which may be called SYSCLK, SCLK, MCLK, BCLK, etc. You don't care about those. The word clock toggles at the sampling frequency, so 44100 Hz or 48000 Hz, etc.
If you are lucky, then the clock signal names may be labelled on the silkscreen of the PCB, or you may have a copy of the schematic. Otherwise you may need to find datasheets for the DAC (or S/PDIF receiver) to find the location of the signals. Once you find the signal, you need to measure and display it. For a microcontroller geek, it is easy to create a simple program that will count the number of transistions on that clock in a second (or a fraction of a second) and display that value on a LCD or other display. These days, microcontrollers such as the Arduino are available for the less geeky (i.e. not interested in writing assembly code and pouring over datasheets). I have never used Arduino, as I am one of the aforementioned geeks, but they are immensely popular.
If you are lucky, then the clock signal names may be labelled on the silkscreen of the PCB, or you may have a copy of the schematic. Otherwise you may need to find datasheets for the DAC (or S/PDIF receiver) to find the location of the signals. Once you find the signal, you need to measure and display it. For a microcontroller geek, it is easy to create a simple program that will count the number of transistions on that clock in a second (or a fraction of a second) and display that value on a LCD or other display. These days, microcontrollers such as the Arduino are available for the less geeky (i.e. not interested in writing assembly code and pouring over datasheets). I have never used Arduino, as I am one of the aforementioned geeks, but they are immensely popular.
If you are going to invest in a microcontroller to determine the sample rate, it's probably easier to read the rate from the channel status block that is stored in the S/PDIF receiver.
Some S/PDIF receivers can not discriminate between 88.1 kHz and 96 kHz. It is also much easier to do count-and-display than to implement I2C or SPI to read registers in the S/PDIF chip. The exception is if there are direct hardware/pin outputs to convey this information, noting the caveat above for 88.1/96. From memory, I know that the TI DIR1703 does have "format" pins that can tell you the sampling frequency, but 88.1 and 96 are identified as the same.
Wow! I am the worst coder that I have ever come across. Hardware is another matter. This might be above me, but at the same time it looks like a possible good project. I can't find anything on the net in terms of DIY attempt by anyone else.
macboy, the Channel Status bits are set by the transmitter, not the receiver, and the transmitter usually knows the data rate of the signal it is transmitting and can set the bits appropriately. The problems you allude to are due to S/PDIF receivers who's design predates the formal adoption of the bit assignments for additional sample rates or don't have enough pins to specifically identify all possible sample rates.
Most modern microcontrollers have dedicated interfaces for SPI and I2C. High-level development environments, such as Arduino, have libraries that use those interfaces. The APIs are trivial. I think its easier to do a simple function call to read a specific byte from the Channel Status and decode the bits to identify transmitted sample rate than count signal transitions in a defined time period.
Most modern microcontrollers have dedicated interfaces for SPI and I2C. High-level development environments, such as Arduino, have libraries that use those interfaces. The APIs are trivial. I think its easier to do a simple function call to read a specific byte from the Channel Status and decode the bits to identify transmitted sample rate than count signal transitions in a defined time period.
- Status
- Not open for further replies.