ΣSigmaStudio Ask AI Русский Log in

data format confusion, 2.14? or  5.23?

SigmaDSP & SigmaStudio michaelc21 Jan 5, 2010 00:00 8 replies Original on forum ↗
Subscribe
michaelc21 Question
Jan 5, 2010 00:00

hi, I am a new guy with ADI dsp. I am using the 1940, and the board is EVAL-AD1940AZ.

I just design a simple project, to control the volume.

I just don't know the data format of the "Single Volume Control".

When I adjust the slew, the capture window will show the data, the "data" filed is 5 bytes (HEX).

When I make it to +20dB, the data is: 0x00, 0x85, 0x00, 0x000x00

when 0 dB, the data is : 0x00, 0x80, 0x80, 0x00, 0x00

when -80dB, the data is: 0x00, 0x80, 0x00, 0x03 ,0x47,

Why it should be so ?

I read the datasheet of 1940, the 0x00, 0x8x, i konw it , may be it is "Constant Time Ramp Data Write",

datasheet Page20~22.

But the datafiled , I confused!

I know the format of 5.23, but the 2.14?? Above data right? Why it should like this?

The attach is the project file.

Thank you.

communication

ADIApproved Reply
Jan 5, 2010 00:00

The data that you're seeing in the capture window when you are updating the volume control parameters is a 5-byte write to the Target/Slew RAM. This RAM is used because the volume is being automatically ramped to the target value using the hardware slew function of the AD1940. The data format of the write that you see in the capture window is shown in Tables 19 and 20 of the AD1940 datasheet. Since the first byte of your write is 0x00, then it seems that the curve_type is set to "linear." The actual volume level parameter that is changing is the bottom 28 bits of the 5-byte write. These 28 bits are in 5.23 format. In your examples, these 5.23 numbers are:

+20 dB: 0x5 0x00 0x00 0x00

0 dB: 0x0 0x80 0x00 0x00

-80 dB: 0x0 0x00 0x03 0x47

michaelc21 Reply
Jan 6, 2010 00:00

JeradL, Thank you for your reply.

But I still be confusion.

michaelc21 Reply
Jan 6, 2010 00:00

JeradL,Thank you for your reply.

But I still being confusion.

I think 0dB, it should be 0x0,x00,0x00,0x00

When I adjust to -6dB, the capture window shows:0x00, 0x80, 0x40, 0x26, 0xE7,

As you say, the 5.23 format is : 0x0, 0x40,0x26, 0xE7.

But , I calculate it: 6 ----> binary: 0110,

-6---> bynary: 1010 ,

so, I think -6dB the 5.23 format is: 0xd, 0x00,0x00,0x00

Anothe thing, 5.23 format can denote the data range is +16 ~ -16 ?

because the point's left is 5, it only 4bits is data, the msb is sign.

when +20dB, how to denote?

Am I right?

I should know the data format , because I have to make the design to control by a MCU.

And the source data , input from the device's panel, I should convert it into the 5.23 format before sending to 1940 DSP .

The function is :

// Microcontroller code - functions: convert a float number to 5.23 format

void To523(float param_dec, byte* param_hex)

{

long param223;

long param227;

//multiply decimal number by 2^23

param223 = param_dec * (1 << 23);

//convert to positive binary

param227 = param223 + (1 << 27);

param_hex[3]=(byte)param227; //get byte 3 (LSBs) of parameter value

param_hex[2]=(byte)(param227>>8); //get byte 2 of parameter value

param_hex[1]=(byte)(param227>>16); //get byte 1 of parameter value

//get byte 0 (MSBs) of parameter value

param_hex[0]=(byte)(param227>>24);

//invert sign bit to get correct sign

param_hex[0] = param_hex[0] ^ 0x08;

}

Thank you.

ADIApproved Reply
Jan 6, 2010 00:00

It looks like the confusion is in whether the parameter values written to the AD1940 are linear or dB numbers. The volume control parameters that you need to write to the SigmaDSP are linear values. You do not directly write the dB values to the parameter RAM. The volume control settings are shown on a dB scale in SigmaStudio for convenience, since that's the format most useful for displaying this parameter setting. When the data is written from the PC to the AD1940's control port, it is a linear value, though. The table below shows the linear values of the corresponding dB values and the hex representation of that linear value.

dB setting
Linear Value

Hex number

0
1.0
0x0 0x80 0x00 0x00

+20
10
0x5 0x00 0x00 0x00

-80
0.0001
0x0 0x00 0x03 0x47

The full range of the 5.23 number is a linear value of +/-16, which allows +24 dB of headroom above 0 dB. This is because there are 4 extra headroom bits, and each bit provides +6 dB additional possible gain over 0 dB.

I hope that this clears up the confusion on the number formats.

michaelc21 Reply
Jan 7, 2010 00:00

That is great!

Thank you very much.

I am clean about it now .

I still think there is not enough guide ,manual, for us to full use of the sigma DSP.

I think I will encounter other confusion about ADI 1940dsp.

My design has a MCU + 1940, sound system.

Will need more about Filters, Crossover, including their address, where to write......

Etc.

Again, thank you very much!

ADIApproved Reply
Jan 7, 2010 00:00

All of the addresses and data for parameters that you're writing to the AD1940 can be found in SigmaStudio's Capture Window. This shows all communication between the software and the DSP. You can use the information in this window to develop your microcontroller code. There are also quite a few other topics on this forum related to integrating the SigmaDSP with a microcontroller. Some examples can be found through these links:

https://ez.analog.com/thread/2351?tstart=0

https://ez.analog.com/thread/1983?tstart=0

michaelc21 Reply
Jan 8, 2010 00:00

JeradL, thank you for your passion about this.

Just several days ago , my design (MCU control) was already able to control the 1940 EVAL-BOARD .

I am able to control the volume, the EQ filter' level and freq, and the effect is ok. (With my MCU)

But, I use the method is : look for tables. (put the data into arrays in the code, then read out the bytes to send)

Obvious, this is not a good method.

I shoud get the adust parameters from "control PANEL", and then convert it into the bytes (coefficients ) to send.

The difficulty is how to convet, and where to send.

Yes, I knew this forum just a week ago.

This forum help me a lot.

I think I should put more time to study, to read more about Sigma Studio DSP ,datasheets,etc.

Thand you for your passion again.

ADIApproved Reply
Jan 8, 2010 00:00

There are a few tools in SigmaStudio that help for creating data tables for EQ coefficients.

First, the Fixed-Point Filter Table Generator (found in SigmaStudio's Tools menu):

You can generate tables here for different EQ curves. The data output in the value table can be integrated directly into a microcontroller data array.

https://ez.analog.com/cfs-file/__key/communityserver-discussions-components-files/396/375ea1a8b66b89ed96f66e44aa2608b2.bin

https://ez.analog.com/cfs-file/__key/communityserver-discussions-components-files/396/22e8315acddd6f7d1e8042e1ee9ca507.bin

Second, the coefficient equations displayed in the help file:

You can implement these equations in the microcontroller to have it calculate the coefficients for you.

https://ez.analog.com/cfs-file/__key/communityserver-discussions-components-files/396/378878204e98043bef7059f62681e958.bin