Post Go back to editing

AD9102 Triangle wave with 78,125 KHz

Trying to generate a Triangle wave with 78,125 KHz, 156,25 KHz, 312,5 KHz, 625 KHz, 1250 KHz, but I could not find any thing about the frequency for Triangle or Sawtooth wave.

I use the  example2_4096_ramp.txt and example4.regval file, then I have changed:

the WAVE_SEL1 0x027[5:4] to 1

the SAW_STEP1 0x037[7:2] to 4.

So I have no idea how to change the frequency. 

Actually, for the sin wave, I could easily change the frequency, by changing the DDS frequency in the DAC1 tab.

but for the Triangle wave, is vague.

Thank you in advance.



Thank you in advance.
[edited by: akbar at 11:03 AM (GMT 0) on 1 Apr 2019]
Parents
  • Hello,

    Unfortunately the triangular waveform won't fit your need. The triangular waveform always ramp from positive full scale toward  negative full scale and back in 1lsb step. To do what you want, you need to take multiple lsb steps. I suggest you use the on-chip RAM to store your waveform instead.

    Regards,

    Will

  • Hello Will,

    thank u so much for the reply.

    below lsb 1 step:

    lsb 1 step

    and this one, lsb 3 step:

    lsb 3 step

    1- Is that what u mentioned ?

    As u mentioned, I used SRAM, to load my waveform (1 lsb and 3 lsb) and as Regval File, I use example1.regval to have triangular waveform.

    2- How can I have Continuos triangle waveform ?

    2.1- in this case, should I use the example6.regval ? (Actually, for the sin wave, I used the example6.regval and could easily change the frequency, by changing the DDS frequency in the DAC1 tab.)

    3- Still I do not konw how to change the frequency !!!

    Best regards,

    Akbar

  • Hello Akbar,

    Sorry for the delayed response! I was in a conference the last few days.

    1. Right. But you can't have 3lsb step in the triangular waveform function, you can with SRAM.

    2. You set PATTERN_RPT (reg0x1F[0]) to 0, and PATTERN_PERIOD (reg0x29) to the number of samples in the triangulare wave period.

    3.You can either store multiple waveforms and change the start and stop address as you change frequency; or you can load a different waveform.

    Regards,

    Will

Reply
  • Hello Akbar,

    Sorry for the delayed response! I was in a conference the last few days.

    1. Right. But you can't have 3lsb step in the triangular waveform function, you can with SRAM.

    2. You set PATTERN_RPT (reg0x1F[0]) to 0, and PATTERN_PERIOD (reg0x29) to the number of samples in the triangulare wave period.

    3.You can either store multiple waveforms and change the start and stop address as you change frequency; or you can load a different waveform.

    Regards,

    Will

Children
  • Hello again Will,

    and thank u again for the reply.

    I guess almost I did the same!! 

    Yes, the PATTERN_RPT (reg0x1F[0]) to '0', is clear, as it is mentioned in the data sheet, but regarding the 'PATTERN_PERIOD (reg0x29)', I thought when I choose to read from the SRAM (WAVE_SEL 0x0027[2:0] to '0'), I can not change the 'PATTERN_PERIOD (reg0x29)' anymore. But suddenly I varried the value to the number of samples in the SRAM, so there was useful, and then, I set the 'START_DLY 0x005C[15:0]' to '0'.

    Regarding the 3rd answer,

    I loaded different waveforms.

    At the end, your answer was absolutely useful. There are enough post, about the same question in the forum, but they're not actually useful for me. at least, I could not find such a answer like yours.

    0
    16
    32
    48
    64
    80
    96
    112
    128
    144
    160
    176
    192
    208
    224
    240
    256
    272
    288
    304
    320
    336
    352
    368
    384
    400
    416
    432
    448
    464
    480
    496
    512
    528
    544
    560
    576
    592
    608
    624
    640
    656
    672
    688
    704
    720
    736
    752
    768
    784
    800
    816
    832
    848
    864
    880
    896
    912
    928
    944
    960
    976
    992
    1008
    1024
    1040
    1056
    1072
    1088
    1104
    1120
    1136
    1152
    1168
    1184
    1200
    1216
    1232
    1248
    1264
    1280
    1296
    1312
    1328
    1344
    1360
    1376
    1392
    1408
    1424
    1440
    1456
    1472
    1488
    1504
    1520
    1536
    1552
    1568
    1584
    1600
    1616
    1632
    1648
    1664
    1680
    1696
    1712
    1728
    1744
    1760
    1776
    1792
    1808
    1824
    1840
    1856
    1872
    1888
    1904
    1920
    1936
    1952
    1968
    1984
    2000
    2016
    2032
    2048
    2032
    2016
    2000
    1984
    1968
    1952
    1936
    1920
    1904
    1888
    1872
    1856
    1840
    1824
    1808
    1792
    1776
    1760
    1744
    1728
    1712
    1696
    1680
    1664
    1648
    1632
    1616
    1600
    1584
    1568
    1552
    1536
    1520
    1504
    1488
    1472
    1456
    1440
    1424
    1408
    1392
    1376
    1360
    1344
    1328
    1312
    1296
    1280
    1264
    1248
    1232
    1216
    1200
    1184
    1168
    1152
    1136
    1120
    1104
    1088
    1072
    1056
    1040
    1024
    1008
    992
    976
    960
    944
    928
    912
    896
    880
    864
    848
    832
    816
    800
    784
    768
    752
    736
    720
    704
    688
    672
    656
    640
    624
    608
    592
    576
    560
    544
    528
    512
    496
    480
    464
    448
    432
    416
    400
    384
    368
    352
    336
    320
    304
    288
    272
    256
    240
    224
    208
    192
    176
    160
    144
    128
    112
    96
    80
    64
    48
    32
    16
    0
    -16
    -32
    -48
    -64
    -80
    -96
    -112
    -128
    -144
    -160
    -176
    -192
    -208
    -224
    -240
    -256
    -272
    -288
    -304
    -320
    -336
    -352
    -368
    -384
    -400
    -416
    -432
    -448
    -464
    -480
    -496
    -512
    -528
    -544
    -560
    -576
    -592
    -608
    -624
    -640
    -656
    -672
    -688
    -704
    -720
    -736
    -752
    -768
    -784
    -800
    -816
    -832
    -848
    -864
    -880
    -896
    -912
    -928
    -944
    -960
    -976
    -992
    -1008
    -1024
    -1040
    -1056
    -1072
    -1088
    -1104
    -1120
    -1136
    -1152
    -1168
    -1184
    -1200
    -1216
    -1232
    -1248
    -1264
    -1280
    -1296
    -1312
    -1328
    -1344
    -1360
    -1376
    -1392
    -1408
    -1424
    -1440
    -1456
    -1472
    -1488
    -1504
    -1520
    -1536
    -1552
    -1568
    -1584
    -1600
    -1616
    -1632
    -1648
    -1664
    -1680
    -1696
    -1712
    -1728
    -1744
    -1760
    -1776
    -1792
    -1808
    -1824
    -1840
    -1856
    -1872
    -1888
    -1904
    -1920
    -1936
    -1952
    -1968
    -1984
    -2000
    -2016
    -2032
    -2048
    -2032
    -2016
    -2000
    -1984
    -1968
    -1952
    -1936
    -1920
    -1904
    -1888
    -1872
    -1856
    -1840
    -1824
    -1808
    -1792
    -1776
    -1760
    -1744
    -1728
    -1712
    -1696
    -1680
    -1664
    -1648
    -1632
    -1616
    -1600
    -1584
    -1568
    -1552
    -1536
    -1520
    -1504
    -1488
    -1472
    -1456
    -1440
    -1424
    -1408
    -1392
    -1376
    -1360
    -1344
    -1328
    -1312
    -1296
    -1280
    -1264
    -1248
    -1232
    -1216
    -1200
    -1184
    -1168
    -1152
    -1136
    -1120
    -1104
    -1088
    -1072
    -1056
    -1040
    -1024
    -1008
    -992
    -976
    -960
    -944
    -928
    -912
    -896
    -880
    -864
    -848
    -832
    -816
    -800
    -784
    -768
    -752
    -736
    -720
    -704
    -688
    -672
    -656
    -640
    -624
    -608
    -592
    -576
    -560
    -544
    -528
    -512
    -496
    -480
    -464
    -448
    -432
    -416
    -400
    -384
    -368
    -352
    -336
    -320
    -304
    -288
    -272
    -256
    -240
    -224
    -208
    -192
    -176
    -160
    -144
    -128
    -112
    -96
    -80
    -64
    -48
    -32
    -16

  • Dear Will,

    two more questions:

    4- If you see the waveforms, I guess I need to change the offset. What do u think?

    5- As the highest value, I used 2048 for the samples. Is it possible to use 4096?

    Actually, I loaded a waveform with the 4096 but did not work out correctly. Occurs Clipping.

    Thank u for your consideration.

    Regards, 

    Akbar

  • Hello Akbar,

    4. By changing offset do you want to center it around VDD/2? Unfortunately you can't not do that without a external amplifier or transformer. The output is DAC current from VDD to VSS, thus the minimum output is VSS (when that current is zero).

    5. The 12bit RAM data is signed, so it goes from -2048 to +2047.

    Regards,

    Will

  • Hello Will,

    thank you very much fpr your time and consideration.

    Regards,

    Akbar

  • Forgot to mention that for 4. you could also do AC coupling or resistive level shifting etc. In either case you need some kind of hardware modification.

  • Hello Will,

    concerning the 4- offset, not only VDD/2, but maybe lower or even higher. 

    Does the DAC Digital Offset Register (DACDOF, Address 0x25)  the same ?

    Regards,

    Akbar

  • Hello Akbar,

    Adding a digital offset shifts one output up and the other down. You will need to reduce your swing to avoid clipping the waveform.

    Regards,

    Will

  • Dear Will,

    concerning answer #3. with RAM, can I have 1 RAM file with for instance 512 samples, then, if there is a possibility to set the reading RAM address every 2 (or 3 or 4 or more) in order to change the frequency?

    The goal is changing the frequency via our own Software and via FPGA.

    Regards,

    Akbar

  • Dear Akbar,

    Unfortunately there is no such option, otherwise it would be ideal for your application. But you can store up to 4096 samples, so you can store multiple waveforms, and change the start and stop address (and pattern period) as you change frequency.

    Regards,

    Will