majicdesigns / md_ad9833 Goto Github PK
View Code? Open in Web Editor NEWLibrary for using a AD9833 Programmable Waveform Generator hardware by Analog Devices.
License: GNU Lesser General Public License v2.1
Library for using a AD9833 Programmable Waveform Generator hardware by Analog Devices.
License: GNU Lesser General Public License v2.1
Before submitting this issue
[x] Have you tried using the latest version of the library?
[x] Have you checked this has not already been submitted and/or resolved?
[x] If you are requesting help a better choice may be the Arduino forum
In the example sketch MD_AD9833_Test.ino
on line 12 is a comment and link to the required MD_cmdProcessor library. This link is incorrect and points to the repository for MD_AD9833. Correct link address should be: https://github.com/MajicDesigns/MD_cmdProcessor
Library Version: 1.2.4
Arduino IDE version: NA
Microcontroller hardware: NA
OS and Version: NA
Open example: https://github.com/MajicDesigns/MD_AD9833/blob/main/examples/MD_AD9833_Test/MD_AD9833_Test.ino
Link should point to correct library.
Link points to this library.
// Dependencies:
// MD_cmdProcessor is available at https://github.com/MajicDesigns/MD_AD9833
//
Before submitting this issue
[x] Have you tried using the latest version of the library?
[x] Have you checked this has not already been submitted and/or resolved?
[ ] If you are requesting help a better choice may be the Arduino forum
When switchiung to MODE_OFF from MODE_SQUARE1, the output stays high. Switching off from all other modes results in the expected low output
Library Version:1.2.0
Arduino IDE version:platformio
Hardware model/type:esp32
OS and Version:windows10
Just turn Square1 on, then off, and check the output
output should be low after OFF
output is high, but only after OFF from square1
AD.setMode(MD_AD9833::MODE_SQUARE1);
delay(1000);
AD.setMode(MD_AD9833::MODE_OFF);
//output is now high
AD.setMode(MD_AD9833::MODE_SQUARE2);
delay(1000);
AD.setMode(MD_AD9833::MODE_OFF);
//output is now low
AD.setMode(MD_AD9833::MODE_TRIANGLE);
delay(1000);
AD.setMode(MD_AD9833::MODE_OFF);
//output is now low
AD.setMode(MD_AD9833::MODE_SINE);
delay(1000);
AD.setMode(MD_AD9833::MODE_OFF);
//output is now low
I can´t set the Frequency over 30kHz, is their a lock in the library that blocks everything over a specific Frequency?
I try to build a sweep sine generator with this library and can't find a method to reset the ad9833 chip.
The problem is - when I start the sweep, the phase accumulator of ad9833 is not zero and each new sweep starts from a random phase.
Existing MD_AD9833::begin() method does the job but it is too slow - it takes 220us (which is almost quarter of 1kHz wave).
If there would be a method that triggers the reset bit of ad9833 and works fast it would be great!
Before submitting this issue
[X] Have you tried using the latest version of the library?
[X] Have you checked this has not already been submitted and/or resolved?
[0] If you are requesting help a better choice may be the Arduino forum
Describe your issue here.
I get errors while compiling example
Library Version: 1.2.2
Arduino IDE version:2.1.1
**Hardware model/type: ESP32S3DEV **
OS and Version: Windows 10 22h2
Explain how to reproduce this issue. Please provide working code below to demonstrate the issue.
Compiling the folowing code
Explain what should happen.
Succesful Compiling
Explain what happens instead. Provide log messages if relevant.
C:\Users\cob01\AppData\Local\Temp.arduinoIDE-unsaved2023710-9084-8c2zpa.xot4\MD_AD9833_Cycle\MD_AD9833_Cycle.ino:13: warning: "FSYNC" redefined
#define FSYNC 10 ///< SPI Load pin number (FSYNC in AD9833 usage)
c:\Users\cob01\Documents\Arduino\libraries\MD_AD9833\src\MD_AD9833.cpp:282:23: error: 'freq_select' may be used uninitialized in this function [-Werror=maybe-uninitialized]
spiSend(freq_select | (uint16_t)((_regFreq[chan] >> 14) & 0x3fff));
// Basic MD_AD9833 test file
//
// Initialises the device to default conditions
//
// Connect a pot to A0 to change the frequency by turning the pot
//
#include <MD_AD9833.h>
#include <SPI.h>
// Pins for SPI comm with the AD9833 IC
#define DATA 11 ///< SPI Data pin number
#define CLK 13 ///< SPI Clock pin number
#define FSYNC 10 ///< SPI Load pin number (FSYNC in AD9833 usage)
MD_AD9833 AD(FSYNC); // Hardware SPI
// MD_AD9833 AD(DATA, CLK, FSYNC); // Arbitrary SPI pins
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
void setup(void)
{
AD.begin();
/*
AD.setMode(MD_AD9833::MODE_TRIANGLE);
delay(2000);
AD.setMode(MD_AD9833::MODE_OFF);
delay(2000);
//output is now low
AD.setMode(MD_AD9833::MODE_SINE);
delay(2000);
AD.setMode(MD_AD9833::MODE_OFF);
delay(2000);
//output is now low
AD.setMode(MD_AD9833::MODE_SQUARE1);
delay(2000);
AD.setMode(MD_AD9833::MODE_OFF);
delay(2000);
//output is now high
AD.setMode(MD_AD9833::MODE_SQUARE2);
delay(2000);
AD.setMode(MD_AD9833::MODE_OFF);
delay(2000);
//output is now low
*/
}
void loop(void)
{
static bool bOff = false;
static uint8_t m = 0;
static MD_AD9833::mode_t modes[] =
{
MD_AD9833::MODE_TRIANGLE,
MD_AD9833::MODE_SQUARE2,
MD_AD9833::MODE_SINE,
MD_AD9833::MODE_SQUARE1
};
if (bOff)
AD.setMode(MD_AD9833::MODE_OFF);
else
{
AD.setMode(modes[m]);
m++;
if (m == ARRAY_SIZE(modes)) m = 0;
}
bOff = !bOff;
delay(2000);
}
Insert your code here.
Before submitting this issue
[X] Have you tried using the latest version of the library?
[X] Have you checked this has not already been submitted and/or resolved?
[X] If you are requesting help a better choice may be the Arduino forum
I would like to be able to change the clock frequency without changing the .h file for my projects.
Library Version: 1.2.3
Arduino IDE version: 2.1.1
Microcontroller hardware: RP2040
OS and Version: Mac OSX 13.5.1
I have low frequency requirements in some projects, therefore I use a 2.5MHz clock instead of the 25MHz clock. To make the calculations correct in my project, I change the MD_AD9833_lib.h file to reflect this.
Would it be possible to change the line 86 to:
#ifndef AD_MCLK
#define AD_MCLK 25000000UL ///< Clock speed of the AD9833 reference clock in Hz
#endif
to allow setting the clock frequency in the sketch? Then I do not need to edit the .h file in between projects with different clock frequencies.. Now this edit in the .h file is overwritten during an update of the library.
Thanks!
Before submitting this issue
[X ] Have you tried using the latest version of the library?
[X ] Have you checked this has not already been submitted and/or resolved?
[X ] If you are requesting help a better choice may be the Arduino forum
AD9833 Frequency Setting is currently not an atomic operation.
Library Version: 1.2.0
Arduino IDE version: 1.8.13
Hardware model/type: Arduino Uno and cheap AD9833 module
OS and Version: Windows 10
Perform a continual sweep of frequency, or derive the value of the frequency from a potentiometer.
As the input value changes, there should be a smooth transition between frequencies.
At certain values, there is an audible "click" when changing frequency.
In the function setFrequency, the library states the assumption that B28 is continually set and therefore does not need a control register write to set it every time prior to writing out the two frequency values using spiSend. However experimentation suggests that this results in a "click" at certain frequencies when attempting to smoothly change the frequency in the audio ranges and viewing the signal on a scope does show discontinuities in the frequency as it changes around certain values.
The datasheet seems somewhat ambiguous on the topic however Figure 28 (the flowchart for a write) does imply that the B28 bit ought to be set for every frequency update to ensure an atomic update.
Adding the line spiSend(_regCtl); prior to the two spiSend calls to update the frequency does seem to remove the click and results in a smooth frequency update which seems to confirm that B28 has to be set for every write.
void loop () {
// Assuming a 10k pot on A0
AD.setFrequency(MD_AD9833::CHAN_0, analogRead(A0));
}
This library, just like every other library I have found on this chip, has no ability to enable pin control. the AD9834 can be register controlled (Reset, Phase0/1, Freq0/1) as well as Pin controlled.
I need the ability to have pin control so I can use a physical chip pin to reset the chip, but more importantly, so I can Phase and Frequency modulate the output from external hardware.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.