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>>
;
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();
}