Author Topic: AD9910 RAM file how to  (Read 3436 times)

0 Members and 1 Guest are viewing this topic.

Offline BeOTopic starter

  • Contributor
  • Posts: 17
  • Country: fr
AD9910 RAM file how to
« on: September 02, 2017, 09:25:39 am »
Hello

I try to built a RAM file for an AD9910 , factory documentation do not include clear examples , I have the evaluation software with sample files but they have any comments in them

Does someone is able to provide me RAM file with comments to be able to understand how is built a RAM file in decimal

Thanks in advance

BeO
 

Offline ale500

  • Frequent Contributor
  • **
  • Posts: 415
Re: AD9910 RAM file how to
« Reply #1 on: September 04, 2017, 01:52:27 pm »
Very interesting DDS, Did you try the software provided with the evaluation board ? Nothing useful there ? (I have only used ROM-based DDS so far).

http://www.analog.com/media/en/evaluation-boards-kits/evaluation-software/AD9910Setup2.1.0.0.exe
 

Tac Eht Xilef

  • Guest
Re: AD9910 RAM file how to
« Reply #2 on: September 05, 2017, 12:17:26 am »
Check out the two files in this AD forum answer. The .stp file contains the config; although it's not documented/commented there file, the 'regmap' is as explained in the AD9910 datasheet in pp49-60, MSB-first.

E.g. in that .stp file, line 5:
"00","10000000000000000000000000000000"      // CFR1 (addr 0x00) set bit 31 (enable RAM functionality) = 1, etc

(You'll also want to look at bits set / not set in the RAM / Single Tone profiles in register addresses 0x0E - 0x15)

The .txt file contains the RAM data, which is straight 32 bit tuning words (or phase/amplitude data if in RAM modulation mode)

It's all in hex & binary though - learn to think in hex or bin, or at least find a good decimal converter/calculator. You won't get far and will make far too many mistakes, especially with a slightly complicated DDS like this, if you insist on sticking to decimal...
 

Offline BeOTopic starter

  • Contributor
  • Posts: 17
  • Country: fr
Re: AD9910 RAM file how to
« Reply #3 on: September 07, 2017, 10:58:00 am »
Hello

I have the AD9910 software as provided by Analog

I succeed to download RAM samples files and get the right wave shape on my oscilloscope

Regarding file as a extract here after ( square ramped wave ) , that not Hexa as I have 9 and that not binary but AD9910 doc says that decimal are also allowed

3435973837
3403761583
3371549328
3339337073
3307124818
3274912564
3242700309
3210488054
3178275800
3146063545
3113851290
3081639035
3049426781
3017214526
2985002271
2952790016
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

I try to adjust amplitude but I do not know which parameter to change

That quite incredible to do have any documented sample on the net and Analog documentation is quite light for a so powerfull component.

BeO
« Last Edit: September 07, 2017, 07:29:00 pm by BeO »
 

Offline GRA

  • Newbie
  • Posts: 7
Re: AD9910 RAM file how to
« Reply #4 on: June 13, 2020, 11:44:22 am »
For a long time RAM on the DDS AD9910 did not work for me. I bought a DDS9910 board on an eBay https://www.ebay.com/itm/163923312245 board a from GRA & AFCH. I tried the Chinese boards on the AD9910 - it was a terrible experience, a lot of spur, there were also some short circuits on the board.

For a long time RAM on the DDS AD9910 did not work for me. I bought a DDS9910 board on an eBay board a from GRA & AFCH. I tried the Chinese boards on the AD9910 - it was a terrible experience, a lot of spur, there were also some short circuits on the board.

Here is an example of how FM modulation works through RAM. I have to say right away very important sequence !!!
/*****************************************************************************************
   SaveFM_WavesToRAM - calculate and store FM waves to RAM
   Input data:
   * F_carrier - frequency carrier Hz
   * F_mod - frequency modulations Hz
   * F_dev - frequency deviations Hz
*****************************************************************************************/ 
void SaveFMWavesToRAM (uint32_t F_carrier, uint32_t F_mod, uint32_t F_dev)
{
  #define TWO_POWER_32 4294967296.0 //2^32
 
  uint64_t Step_Rate;
  uint16_t Step;
  uint16_t n;
  double Deg;
  double Rad;
  double Sin=0;
  double DegIncrement=0;
  uint32_t FREQ_FM=0;
  uint32_t FTW_FM=0;
  uint8_t FTW_FM_8_bit[4];

  Step=DEFAULT_STEP_VALUE;
  Step_Rate=0;

  calcBestStepRate(&Step, &Step_Rate, F_mod);
     
  PrepRegistersToSaveWaveForm(Step_Rate, Step);

  DegIncrement=360.0/Step;
  //*************************************************************************
 
  Deg = 0; // start set deg
  HAL_GPIO_WritePin(DDS_SPI_CS_GPIO_PORT, DDS_SPI_CS_PIN, GPIO_PIN_RESET);
  uint8_t MemAdr=RAM_Start_Word;
  HAL_SPI_Transmit(&hspi1, &MemAdr, 1, 1000);

     uint32_t RealDDSCoreClock=CalcRealDDSCoreClockFromOffset();
   float64_t f64FREQ_FM;//=f64(FREQ_FM);
   float64_t f64CoreClock=f64(RealDDSCoreClock);
   float64_t TwoPower32=f64(4294967295UL);
   float64_t f64FTW;
   bool a;
   uint_fast8_t softfloat_roundingMode;
   softfloat_roundingMode=softfloat_round_near_maxMag;
 
  for (n = 0; n < Step; n++)
    {
     //Rad = Deg * 0.01745; // conversion from degrees to radians RAD=DEG*Pi/180
     Rad = Deg * PI/180.0;
     Sin = sin(Rad); // Get Sinus
     FREQ_FM = F_carrier + (F_dev * Sin);
     //FTW_FM = round((double)TWO_POWER_32 * ((double)FREQ_FM / (double)DDS_Core_Clock));
     
    f64FREQ_FM=f64(FREQ_FM);
   f64FTW=f64_div(TwoPower32, f64CoreClock);
   f64FTW=f64_mul(f64FTW, f64FREQ_FM);
   
   FTW_FM=f64_to_ui32(f64FTW, softfloat_roundingMode, a);
     
     FTW_FM_8_bit[0]=(FTW_FM>>24);
     FTW_FM_8_bit[1]=(FTW_FM>>16);
     FTW_FM_8_bit[2]=(FTW_FM>>8);
     FTW_FM_8_bit[3]=FTW_FM;
     HAL_SPI_Transmit(&hspi1, FTW_FM_8_bit, 4, 1000); 
     Deg = Deg + DegIncrement;
    }
    HAL_GPIO_WritePin(DDS_SPI_CS_GPIO_PORT, DDS_SPI_CS_PIN, GPIO_PIN_SET);
    DDS_UPDATE();
     Serial.println("FM wave saved to RAM...");
    PlaybackFMFromRAM(A*-1);
}

void PlaybackFMFromRAM(int16_t Amplitude_dB)
{
  //*** RAM Enable ***
   HAL_GPIO_WritePin(DDS_SPI_CS_GPIO_PORT, DDS_SPI_CS_PIN, GPIO_PIN_RESET);   
   strBuffer[0] = CFR1_addr;
   strBuffer[1] = RAM_Playback_Frequency | RAM_enable;// | RAM_enable;//0x00; RAM_Playback_Amplitude;//
   strBuffer[2] = 0;//Continuous_Profile_0_1; //0;//0x80;//0x00;
   strBuffer[3] = OSK_enable;// | Select_auto_OSK;//0x00;
   strBuffer[4] = SDIO_input_only ;
   HAL_SPI_Transmit(&hspi1, (uint8_t*)strBuffer, 5, 1000);
   HAL_GPIO_WritePin(DDS_SPI_CS_GPIO_PORT, DDS_SPI_CS_PIN, GPIO_PIN_SET);
   
   DDS_UPDATE();

   uint16_t AmplitudeRegistersValue=(uint16_t)powf(10,(Amplitude_dB+84.288)/20.0);

   //AmplitudeRegistersValue=AmplitudeRegistersValue<<2;

   HAL_GPIO_WritePin(DDS_SPI_CS_GPIO_PORT, DDS_SPI_CS_PIN, GPIO_PIN_RESET);   
   strBuffer[0] = ASF_addr;
   strBuffer[1] = 0x00;
   strBuffer[2] = 0x00;
   strBuffer[3] = AmplitudeRegistersValue >> 6; //15:8
   AmplitudeRegistersValue = AmplitudeRegistersValue << 2;
   AmplitudeRegistersValue = AmplitudeRegistersValue & B11111100;
   strBuffer[4] = AmplitudeRegistersValue; //7:2
   
   HAL_SPI_Transmit(&hspi1, (uint8_t*)strBuffer, 5, 1000);
   HAL_GPIO_WritePin(DDS_SPI_CS_GPIO_PORT, DDS_SPI_CS_PIN, GPIO_PIN_SET);
   
   DDS_UPDATE();
}
« Last Edit: June 13, 2020, 11:46:05 am by GRA »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf