Author Topic: Sub-par ad9833 sweep using arduino.  (Read 2288 times)

0 Members and 1 Guest are viewing this topic.

Offline etiTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 1801
  • Country: gb
  • MOD: a.k.a Unlokia, glossywhite, iamwhoiam etc
Sub-par ad9833 sweep using arduino.
« on: January 16, 2022, 01:15:38 am »
Link: https://www.instructables.com/Signal-Generator-AD9833/ (thanks to ataradov for telling me I’d forgotten to include it 🤦🏻‍♂️)


Okay. I know we have to USE software, it’s an occupational hazard, but the continual “evolution” of it, coupled with the egos and personal interpretations of software - ahem - “engineers” - makes it a time sink and one which drags me down a rabbit hole, the likes of software and bytes and utter piffle, the likes of which I’d rather not have to go down, were the entire internet not so overly enamoured with computers and an endless array of digital modules that take the long way round the houses, only to reinvent the wheel of what could be achieved with discrete components (were people not so lazy - me included).

Rant over… almost… I digress. This link tells me how to create a sweep generator; I’ve done so, and it’s trivial - it’s built. What I can work out (this whole rant is likely my misunderstanding the utter bollocks that is arduino, and the inability of “makers” (ugh!!!) to document things in a thorough fashion)

Why does this “sweep generator” not generate a continuously increasing or decreasing frequency output? Instead, it JUMPS to the next increment or decrement. 

I’ve no desire AT ALL to delve into the nonsense that is arduino, nor the bollocks that is the code that powers it all.

Could someone, if possible, please tell me why this code jumps, and doesn’t generate a smooth linear sweep?

Thanks. Ranting through misunderstanding, possibly, and the anticipation of people coming along here and telling me how stupid I am to not be able to mentally cope with taking  all this in, merely to achieve a simple freq sweeper.


Ps: this is what springs to my mind when I think of “makers” and arduino users in a general sense; this person's worded it spot on:

https://forum.arduino.cc/t/are-arduino-users-inheriently-stupid-basic-electronics-knowledge/448914
« Last Edit: January 16, 2022, 02:05:12 am by eti »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11905
  • Country: us
    • Personal site
Re: Sub-par ad9833 sweep using arduino.
« Reply #1 on: January 16, 2022, 01:38:50 am »
So, you took someone else work, because you are not capable of doing the same yourself, it did not do EXACTLY what you wanted, but again, you are not knowledgeable enough to fix it, yet you are shitting on the author that could make things work? Sure, Arduino is the problem here.

And instead of linking to the project you failed to use, you have linked to some other misguided rant about Arduino.

You are the problem here, not Ardiuno or its users.

If you think all Arduino code is bad, then simply don't use it. Just forget it exists. You need to understand that nobody owes anything to you, not delivering working code, nor documenting it. You've got it for free, you have no standing to dictate what the author should or should not have done.
« Last Edit: January 16, 2022, 01:41:46 am by ataradov »
Alex
 
The following users thanked this post: tom66, nali, newbrain, Buriedcode, MK14

Offline etiTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 1801
  • Country: gb
  • MOD: a.k.a Unlokia, glossywhite, iamwhoiam etc
Re: Sub-par ad9833 sweep using arduino.
« Reply #2 on: January 16, 2022, 01:40:32 am »
So, you took someone else work, because you are not capable of doing the same yourself, it did not do EXACTLY what you wanted, but again, you are not knowledgeable enough to fix it, yet you are shitting on the author that could make things work? Sure, Arduino is the problem here.

And instead of linking to the project you failed to use, you have linked to some other misguided rant about Arduino.

You are the problem here, not Ardiuno or its users.

Oh there you are! You pop up like a mole 😁 don’t make me waste the mods valuable time by reporting you for provocation. You have a track record of jumping into my threads, adding nothing but antagonist smart guy replies. I’m not reporting this for respect for the mod’s time, but if you’d kindly go away, it would save me getting out the fly spray. 

Happy Old New year. Спокойной ночи
« Last Edit: January 16, 2022, 01:42:51 am by eti »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11905
  • Country: us
    • Personal site
Re: Sub-par ad9833 sweep using arduino.
« Reply #3 on: January 16, 2022, 01:42:07 am »
You are an old bitter man. All you do is rant and complain.
Alex
 

Offline etiTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 1801
  • Country: gb
  • MOD: a.k.a Unlokia, glossywhite, iamwhoiam etc
Re: Sub-par ad9833 sweep using arduino.
« Reply #4 on: January 16, 2022, 01:44:26 am »
You are an old bitter man. All you do is rant and complain.

Rise above it. Be the better person and walk away then, set a standard. Are you being held at gunpoint, against your will? Nope.
 

Online xrunner

  • Super Contributor
  • ***
  • Posts: 7836
  • Country: us
  • hp>Agilent>Keysight>???
Re: Sub-par ad9833 sweep using arduino.
« Reply #5 on: January 16, 2022, 01:45:16 am »
Oh there you are! You pop up like a mole 😁

So do you.  :-DD

But - thank you for reaching out to us about this issue.  :P
I told my friends I could teach them to be funny, but they all just laughed at me.
 

Offline etiTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 1801
  • Country: gb
  • MOD: a.k.a Unlokia, glossywhite, iamwhoiam etc
Re: Sub-par ad9833 sweep using arduino.
« Reply #6 on: January 16, 2022, 01:50:33 am »
Oh there you are! You pop up like a mole 😁

So do you.  :-DD

But - thank you for reaching out to us about this issue.  :P

I probably do. Then again, I’m human, and none of us is above anyone else, as much as we delude ourselves that this is the case, and we each falsely believe “there’s no flies on me” as they say.

I’m going to point out VERY CLEARLY HERE that I’d made it very clear and openly admitted  in the OP that I’m frustrated and confused by this code.

No need to pour fuel on the fire, folks. I asked a question - a technical question. If you can’t help me that’s fine, but snotty replies only serve to boost egos, and belittling people is exceptionally childish.

Again, I posted in frustration - I do not expect NOR feel “entitled” to help, I’m here asking, that’s all n
 

Online xrunner

  • Super Contributor
  • ***
  • Posts: 7836
  • Country: us
  • hp>Agilent>Keysight>???
Re: Sub-par ad9833 sweep using arduino.
« Reply #7 on: January 16, 2022, 01:56:05 am »
It's Arduino - I wouldn't expect any of it to work right (although there are some very well-written libraries I've used for my projects). Most of the time I might look at someone's code to get an idea of how to do what I want, but I don't think I've ever used an Arduino program without modding it (unless it was a trivial example of lighting up LEDs).  :)
I told my friends I could teach them to be funny, but they all just laughed at me.
 

Offline etiTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 1801
  • Country: gb
  • MOD: a.k.a Unlokia, glossywhite, iamwhoiam etc
Re: Sub-par ad9833 sweep using arduino.
« Reply #8 on: January 16, 2022, 01:58:41 am »
It's Arduino - I wouldn't expect any of it to work right (although there are some very well-written libraries I've used for my projects). Most of the time I might look at someone's code to get an idea of how to do what I want, but I don't think I've ever used an Arduino program without modding it (unless it was a trivial example of lighting up LEDs).  :)

Thank you. Appreciate the gracious reply. Feel free to lock it if you want to.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11905
  • Country: us
    • Personal site
Re: Sub-par ad9833 sweep using arduino.
« Reply #9 on: January 16, 2022, 02:01:01 am »
But you have not actually posted a link to the code. What help do you expect? Do you think there is only one AD9833 project using Arduino and we are supposed to find it ourselves?

Also, what is even continuous? AD9833 is not capable of producing truly continuous sweep. There will be steps as you reprogram it. So how big were the steps in your case? And how big you were expecting them to be?
Alex
 
The following users thanked this post: MK14

Offline etiTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 1801
  • Country: gb
  • MOD: a.k.a Unlokia, glossywhite, iamwhoiam etc
Re: Sub-par ad9833 sweep using arduino.
« Reply #10 on: January 16, 2022, 02:03:01 am »
But you have not actually posted a link to the code. What help do you expect? Do you think there is only one AD9833 project using Arduino and we are supposed to find it ourselves?

Also, what is even continuous? AD9833 is not capable of producing truly continuous sweep. There will be steps as you reprogram it.

Yes, thanks for pointing that out - I forgot 😁 lol. I’m not afraid to face my faults - thanks for telling me - see! You’ve done something constructive, now you can smile. 😉

As much as I want to be kind to you and forgive you, and I do, I’d rather not interact with you. You have a history of jumping into my posts and being unkind. Your intellect is not enough to make me want help from you. Thanks for trying to help. Now, would you please refrain from future interactions, as I feel it’s detrimental for us both. I have no desire to defend this wish, you bring out the worst in people when you’re snotty.

Note to mods: should ataradov CHOOSE to wilfully ignore this civil request, I shall report each and every single interaction he attempts to make, and since my concern is from respecting your time as mods and very busy ones, this is advanced notice - not to be unkind to him, but he’s only here to provoke.

Thanks
« Last Edit: January 16, 2022, 02:11:41 am by eti »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11905
  • Country: us
    • Personal site
Re: Sub-par ad9833 sweep using arduino.
« Reply #11 on: January 16, 2022, 02:10:52 am »
This code updates frequency every millisecond. Feel free to remove the delay and modify the formula for the next frequency accordingly. You steps will be limited by the SPI's ability to write a new value into the register. This is the best AD9833 can do. The phase of the signal will remain continuous, this is guaranteed by the AD9833, but the frequency would change in steps, you can't avoid it. You can pick a very small step, bu then you won't be in control of the sweep time. You need to pick one.

This is a very reasonable code, BTW. The step selection is purely arbitrary, but you need to make one. Author made a choice of 1 ms. There is absolutely nothing wrong with that.

Also, you should not make comments about other's ability to code if you can't figure out 200 lines of easy to read code.

I will interact with whoever I want, thank you. Feel free to not post nonsense if you don't want to be called out.
« Last Edit: January 16, 2022, 02:14:07 am by ataradov »
Alex
 
The following users thanked this post: tom66, PlainName, newbrain, MK14

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15797
  • Country: fr
Re: Sub-par ad9833 sweep using arduino.
« Reply #12 on: January 16, 2022, 02:41:03 am »
Also, you should not make comments about other's ability to code if you can't figure out 200 lines of easy to read code.

I would agree with this point. ;D

And reading the AD9833 datasheet would tell the OP what can and cannot be done. =)
 
The following users thanked this post: CJay, newbrain, MK14

Offline nali

  • Frequent Contributor
  • **
  • Posts: 732
  • Country: gb
Re: Sub-par ad9833 sweep using arduino.
« Reply #13 on: January 16, 2022, 09:49:02 am »
And reading the AD9833 datasheet would tell the OP what can and cannot be done. =)

Not to mention the data sheet of the MCU used by whichever Arduino. Why for example don't you change the code from using delays to timer interrupts, add a potentiometer to load timer values and give yourself a sweep speed control? Then you can publish it for someone else to have a play with...

What I can't fathom is why you even have an Arduino in the 1st instance, given your vitriolic hatred of the whole ecosystsm. There are plenty of ways to do the same thing in the analogue domain.
 
The following users thanked this post: MK14

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9963
  • Country: us
Re: Sub-par ad9833 sweep using arduino.
« Reply #14 on: January 17, 2022, 03:24:14 pm »
Worth noting (I think I got this right!):

The step size is logarithmic - ideal for Bode' Plots
The function SG_StepSweep() isn't referenced.  That's good because:
The variable SG_nSweep isn't initialized (so it is probably 0) and is used as a divisor (as well as a comparison value) in SG_StepSweep().  Division by 0 would be bad!

They made a movie about legacy code hanging around...
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9963
  • Country: us
Re: Sub-par ad9833 sweep using arduino.
« Reply #15 on: January 17, 2022, 03:29:09 pm »
And reading the AD9833 datasheet would tell the OP what can and cannot be done. =)

Not to mention the data sheet of the MCU used by whichever Arduino. Why for example don't you change the code from using delays to timer interrupts, add a potentiometer to load timer values and give yourself a sweep speed control? Then you can publish it for someone else to have a play with...

What I can't fathom is why you even have an Arduino in the 1st instance, given your vitriolic hatred of the whole ecosystsm. There are plenty of ways to do the same thing in the analogue domain.

What should happen is for the calculation to be one step ahead and the value transferred on an interrupt.  As it is, there is some calculation in the loop with delay(1) so the update occurs at some period much greater than 1 ms.  Depending on the actual values being computed, the computation time can probably vary somewhat.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf