- FPGA clock period (ns): only used for FPGA synthesis and implementation. This value does NOT affect simulation in Simulink (i.e. it will NOT affect output frequency of the DDS block).
- Simulink System Period: only used in Simulink simulation. This is the lowest sampling period (highest sampling frequency) among all blocks in the model. There is no significance in its absolute value as long as the sampling periods of all other blocks are multiple of the Simulink System Period. Usually it is set to 1 to keep everything simple. (e.g. every tick in a scope is 1 clock cycle).
- DDS System Clock (Mhz): It's used to calculate the phase increment for DDS block (see the DDS datasheet for details). Set it to match the FPGA clock period (i.e. DDS System Clock (Mhz) = 1/FPGA clock period).
- Explicit Sample Period: This is the sample period used for the DDS block. IMPORTANT: if you set Simulink System Period to anything other than 1, "Use explicit period" MUST be checked and "Explicit Period" set to the same value as Simulink System period. Otherwise, Simulink will use the sample period of 1 for the DDS core and the output frequency will be wrong. This is likely a bug.
Test1:
FPGA clock period (ns) = 10
Simulink system period = 1
DDS System Clock (MHz) = 100
Use Explicit Sample Period checked and Explicit Period = 1
DDS Output (MHz) = 1
As shown in the scope below the DDS output matches the SineGen output:
Test2:
FPGA clock period (ns) = 10
Simulink system period = 0.1
DDS System Clock (MHz) = 100
Use Explicit Sample Period checked and Explicit Period = 0.1
DDS Output (MHz) = 1
As shown in the scope below the DDS output matches the SineGen output. Note that the Simulink system period is now 1/10th of the period in Test1, so there are 10x more clock cycles in this test with the same simulation time.
Test3:
FPGA clock period (ns) = 10
Simulink system period = 0.1
DDS System Clock (MHz) = 100
Use Explicit Sample Period unchecked
DDS Output (MHz) = 1
As shown in the scope below the DDS output frequency is 1/10th of SinGen output. The incorrect DDS output frequency is caused by that when "Use Explicit Sample Period" is unchecked Simulink use a sample period of 1 for the DDS block. So it's very important to check this checkbox and set the explicit period to match the Simulink system period if it's not 1. It's worth mentioning that for sampling frequency related issues it's very helpful to turn on "Sample Time Display" (under Format menu) and then update the diagram by pressing CTRL-D. You can easily see if the sample time used for a particular is correct with sampling time displayed on all signals.
Where did the SineGen block come from? I did not find one in my library and using the 'Sine Wave' or 'Sine Wave Function' or 'DSP sine wave' blocks did not work.
ReplyDeleteThanks!
It's the "Sine Wave" block in Simulink->Sources. It's set up to use "Sample Based" for Sine Type.
ReplyDeleteHi I have a virtex 4 xc4vsx35-10ff668 and I did the same step that you put there but it doesnt work, in the scope a see a line.
ReplyDeleteIm using matlab 2010b in win 7 with the ISE suite 12.1 i dont know if thats a problem
Thank yo
Please post a message to http://forums.xilinx.com/t5/Digital-Signal-Processing-IP-and/bd-p/DSP with your model so other people can take a look at it.
ReplyDeleteHi Jim Wu, the DDS doesn't work, do you have a basic .mdl that you can post so I can see you config?
ReplyDeleteThanks
Alan
You can download the test SysGen model from https://sites.google.com/site/jimw567/home/system_period_test.mdl?attredirects=0&d=1
ReplyDeletehi!
ReplyDeletewhat schould i change when i wanna generate a signal with frequency f=75MHz. is it possible also to generate not just one sine but more than wann with this block?
thanks
mary
@hf: If the system clock is higher than 150MHz, you can go to the output frequency tab of the DDS properties window and set your output to 75.
ReplyDeleteYes, if you want more than 1 sine wave outputs, set the "Number of Channel" to the number you want. Please note that the sampling frequency is reduce to Fsys/#_of_chan for each channel.
Hi Jim Wu,
ReplyDeleteI am now designing a program using matlab simulink which the purpose is to simply putting a constant and convert it into binary then display it through the FRGA Xilinx Spartan-3A LED. Can you give me some idea as I wan get stuck for a long time. Sorry for being asking you here...Thanks...
Wei Yang Chee
Hi Jim Wu,
ReplyDeleteI am now designing a program using matlab simulink which the purpose is to simply putting a constant and convert it into binary then display it through the FRGA Xilinx Spartan-3A LED. Can you give me some idea as I wan get stuck for a long time. Sorry for being asking you here...Thanks...
Wei Yang Chee
Please post your question with details on the problem you are getting to the DSP board on the xilinx user forum below:
ReplyDeletehttp://forums.xilinx.com/t5/DSP-Tools/bd-p/DSPTOOL
Its slow in reply which take around 2 month that why I am asking here...Anyway thanks.
ReplyDeleteHi Jim,
ReplyDeleteI have had a lot of confusion with the system clock rate and simulink rates when using a spectrum scope the measure the frequency. The output is different (by a factor of 10, e.g. 10MHz instead of 1MHz). Can you explain?
I believe the Explicit period and SYG Sim sys period should be set to the same as the System DDS clock (1/100e6) to see the correct frequency on the Spectrum Scope??
Please advise
Email: andy.gd2712@googlemail.com
@Hacksen can you provide the link to the question that you asked on the Xilinx forum? I will take a look when I get a chance.
ReplyDelete@andy.gd2712 Two things:
ReplyDelete1. When using the spectrum scope, keep in mind that the actual unit is not all that important as long as the ratio to the Fs is the same. For example, if you set up the DDS to generate a 1MHz sine wave with a 100MHz system clock, the ratio is 1:100. If you use the spectrum scope with a system period of 1 (or 1Hz), you should see a peak at 0.01Hz (10mhz or 1/100 of the system period).
2. Spectrum scope uses FFT. Make sure the FFT length is big enough to have enough resolution to look at the signals of interest.
This comment has been removed by the author.
ReplyDeleteHello Jim Wu,
ReplyDeleteI'm currently at the Test2 of your tutorial and the output is not what shows on your figure.
I do see the frequency increase on the DDS output,
but the SinGen shows the same 2 periods of Test1.
I get the exactly the same graph for Test3 as well. Same outputs.
Cheers,
Tiago
@Tiago Can you please post a message to the forum below and attach your model?
ReplyDeletehttp://forums.xilinx.com/t5/Digital-Signal-Processing-IP-and/bd-p/DSP
I will do so.
ReplyDeleteBut the model I'm using is yours :)
Hi,
ReplyDeleteI have a problem with DDS Compiler 4.0 Block of System Generator, actually it is a problem related with CORE Generator.
Messages 13, 14 and 15 of;
http://forums.xilinx.com/t5/DSP-Tools/hwcosim-error-on-spartan-3e-starter-kit/td-p/167302/page/2
Did you ever faced with a problem like this?
Hi Again,
ReplyDeleteI found the problem, it is a silly bug. I changed my regional settings to USA so the CORE Generator start working...
@Burak: great to see that you were able to figure out the problem. Thanks for posting your solution to the Xilinx forum.
ReplyDelete@Tigao: for test2 and test3, you will need to change a few parameters in the test model in this blog. If you can post the final models for test2 and test3 to the Xilinx forum, I or somebody else can take a look to see if something is missing.
ReplyDeleteHi Jim Wu, in new in this topic, is it possible to generate triangular signals with DDS compiler 4.0??and how to? if it is not possible could you give some advice to do it with another block?? Please...
ReplyDeleteThanks in advance
No, the DDS can't generate triangular signals. You can create the triangular waveform in another tool (matlab for example) and store the values in a ROM.
ReplyDeleteHi Jim Wu,i am working on costas loop for carrier recovery of BPSK .can you plz explain how to use DDS in loop as a VCO
ReplyDeleteRaja Sekhar, You have asked Jim Wu a question which requires a very lengthy mathematics.
ReplyDeleteI think you must read the costas loop in detail and then try this because if you understand the Costas Loop you won't have asked this question. Hope it helps for you to proceed.
i mean how to set DDS compiler 4.0 in SysGen such that i can vary output frequency according to the input phase error value.i used VCO in SIMULINK ,it worked well there but i am unable to use DDS in SysGen,when i use DDS it stays in lock for some period and coming out of lock ,again locking and this process is getting repeated. if you know how to overcome this .plz help me.
ReplyDeleteThanks for your response..
i mean how to set DDS compiler 4.0 in SysGen such that i can vary output frequency according to the input phase error value.i used VCO in SIMULINK ,it worked well there but i am unable to use DDS in SysGen,when i use DDS it stays in lock for some period and coming out of lock ,again locking and this process is getting repeated. if you know how to overcome this .plz help me.
ReplyDeleteThanks for your response..
Hi Jim Wu, i want to generate a sine wave of frequency 2MHz.
ReplyDeletesystem clock frequency is 125MHz
phase width is 30.
but i am not getting 2MHz as output frequency.
Can u help me to solve this?
hi i am generating a 64 MHz sine wave using DDS compiler in system generator.
ReplyDeleteflck=250MHz
phase accumulator size=25 bit
its work fine during simulation but during implementation i am unable to observe the output on LED.im using vertex5-110t board
It looks nice. I wonder what's the maximum frequency of sine wave you could generate? You mention the clock for FPGA is in ns, is it possible to generate sine wave with time resolution like 4ns or less? Any product can do that?
ReplyDeleteHi there
ReplyDeleteDo you know to use DDS compiler in costas loop to generate 5 mhz with fclk=100mhz?
Hello,
ReplyDeleteCould this issue be occurring due to aliasing? Sampling period is not sufficient to capture the actual frequency.
Hi Jim Wu,
ReplyDeleteI run test1 example but I got the problem: " standard exception: XNetlistEngine:
Exception message could not be parsed:
com.xilinx.sysgen.netlist.NetlistInternal: com.xilinx.sysgen.netlist.NetlistInternal: trouble parsing XTable' "
You said that we need to modify TEMP and TMP enviroment to a new location, but I haven't find the way to do this task. How can I modify TEMp and TMP environment?
Thank you very much!
A couple of my teeth have been aching for the past couple of days but I'm worried because I work too much during the week to go see a dentist. I will be sure to look for practices in my area that can see me at a convenient time so that I don't have to miss work.
ReplyDelete