This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
How do i convert linear or dB values into hex values for the mini-DSP in the TLV320AIC CODECs?
Regards,Collin WellsPrecision ADC Applications
TLV320AIC3254-like devices (24-bit C-RAM)
TLV320AIC3111-like devices (16-bit C-RAM)
TASxxxx miniDSP devices (24-bit C-RAM)
To convert from a dB or linear value into a format the device understands it is necessary to understand the data format of the device. The miniDSP devices store user-accessible variables in Coefficient Memory (C-RAM). The bit width of C-RAM may be different from device to device as shown above.
As an example, the volume control volume level is determined by the value stored its C-RAM location. A 0dB volume level (1x gain) corresponds to 0x400000 (24-bit device) or 0x4000 (16-bit device). This means that the volume control assumes a 2.xx format, where the MSB is the sign bit, the MSB-1 is a magnitude bit and xx are the fractional bits. This is a 2's complement format, meaning that numbers will range [0x800000, 0x7FFFFF], where 0x80... is the most negative number and 0x7F...is the most positive number. Some examples:
In general, a number can be converted from decimal to a M.xx format hex value as follows:
ValueHEX = DEC2HEX(ValueDEC x 2N-M), where N is the bit resolution of the memory location.
If the value is provided in decibels (dB), it can be converted as follows:
ValueHEX = DEC2HEX(10Value(dB)/20 x 2N-M)
Note that values greater than 2N-1-1 and less than -2N-1 are out of bounds if converting to hex.
As an example, for the volume control found in PurePath Studio (2.xx format), a gain of 0dB will result in:
ValueHEX = DEC2HEX(100/20 x 224-2) = 0x400000
The table below shows additional values:
Example Volume Control Values in Hex
To convert from hexadecimal back to decimal:
ValueDEC = HEX2DEC(ValueHEX) / 2N-M
To convert a decimal value back to dB:
ValuedB = 20 x log10(ValueDEC)
As an example, 0x400000 (as a 2.xx hexadecimal number) can be converted to linear as follows:
ValueDEC = HEX2DEC(400000) / 224-2 = 1
The dB / Linear to Hexadecimal calculator can be downloaded below:
We are glad that we were able to resolve this issue, and will now proceed to close this thread.
If you have further questions related to this thread, you may click "Ask a related question" below. The newly created question will be automatically linked to this question.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.