AnsweredAssumed Answered

Waveform Generator

Question asked by capitano88 on May 3, 2017
Latest reply on May 11, 2017 by NeoXu

Hi Guys,


I have a problem. I have to do an hardware debug on a PCB based on ADUCM350. I want to generate a sine on the AFE7 pin using a waveform generator. (obviously I am trying to programm this without using library).


I write this code in order to generate a sine of 100mV amplitude and 50Hz frequency:


#include <stdlib.h>
#include <stdio.h>

#define AFE_CFG *((long*)0x40080000) // AFE Configuration Register

#define AFE_DAC_CFG *((long*)0x40080010) // DAC Configuration Register

#define AFE_WG_CFG *((long*)0x40080014) // Waveform Generator Configuration Register

#define AFE_WG_FCW *((long*)0x40080030) //Sinusoid Frequency Control Word Register -> pag 316 come programmare
#define AFE_WG_PHASE *((long*)0x40080034) //Sinusoid Phase Offset Register
#define AFE_WG_OFFSET *((long*)0x40080038) //Sinusoid Offset Register
#define AFE_WG_AMPLITUDE *((long*)0x4008003C) //Sinusoid Amplitude Register

#define AFE_SW_FULL_CFG_MSB *((long*)0x40080048) // Switch Matrix Full Configuration (MSB) Register
#define AFE_SW_FULL_CFG_LSB *((long*)0x4008004C) //Switch Matrix Full Configuration (LSB) Register



AFE_DAC_CFG = 0x1; //Enable attenuation output of 0.025

AFE_SW_FULL_CFG_MSB = 0x4040; // switch D7 e P7 closed (AFE7)
AFE_SW_FULL_CFG_LSB= 0x4000; //switch N7 closed

AFE_WG_FCW = 0x92; //210 in hex -> 210=fout/fclock*2^26 (fout=50Hz; fclock=16MHz)
AFE_WG_AMPLITUDE = 0X4; //4 in hex -> 4=V_dac_out/0.025 (4 is obtained usin V_dac_out = 100mV)
AFE_WG_CFG = 0x4; //Select sine

AFE_CFG = 0x4040; // bit 6 high, DAC enable; bit 14 high waveform_gen enable



what's the problem?