MATLAB Support For Analog Discovery 2 - Page 1
Forum section: electronics / beginners

author: rstofer
author_rank: Super Contributor
timestamp: October 05, 2018, 07:40:06 pm
content: I just got an email from Digilent announcing MATLAB support for the Analog Discovery 2 and I thought I would post it in 'Beginners' rather than 'Test Equipment' for a broader audience.Here is the MATLAB link:https://www.mathworks.com/hardware-support/digilent-analog-discovery.htmlThis is a really big deal and I look forward to trying it. I have always been a huge fan of the AD2, touting it every chance I get.Of course, there is the issue of buying MATLAB (home license) but that's a separate issue. I like MATLAB as a solver so adding test equipment seems reasonable. There is also an interface to the Arduino.

author: scatha
author_rank: Regular Contributor
timestamp: October 06, 2018, 12:51:47 am
content: Looks like you need an up-to-date version of the Data Acquisition toolbox (makes sense) which makes it a bit less attractive for those with bog-standard Matlab licenses or whose maintenance has expired.

author: rstofer
author_rank: Super Contributor
timestamp: October 06, 2018, 01:34:41 am
content: I already had the Data Acquisition Toolbox but I'm not sure why. It seemed like a new version got installed along with the driver code for the Analog Discovery.I have several toolboxes and there is an annual fee to keep MATLAB and all the toys up to date. I don't know what happens if I don't renew.My favorite toy for MATLAB is Simulink where I can graphically build up analog computer solutions to problems involving Ordinary Differential Equations.In the case of MATLAB, even with the 'home license', the cost may simply be prohibitive for some (or many). I have lots of time to play in my retirement so it makes sense to have the neatest toys.Further, my grandson's lower division engineering curriculum has a mandatory course in using MATLAB. So, those students who might like to carry a lab in their backpack would be well served by the AD2 and MATLAB may be a required tool. Tying them together makes a lot of sense.

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: October 27, 2018, 10:04:24 am
content: word of warning: a lot of complaints re the Software on the AD2 and it is closed source if you want to run it on linux.

author: voltsandjolts
author_rank: Unknown
timestamp: October 27, 2018, 10:52:41 am
content: Quote from: Crazy_Pete on October 27, 2018, 10:04:24 amI have an AD2 just for the FRA and impedance analyzer feature - it's a fantastic tool for the money. For me, the software has worked well in those modes.Dissappointed that they have ignored GNU Octave. I won't be getting a MATLAB license.

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: October 27, 2018, 10:43:42 pm
content: I am glad the software works well for you. It crashed on me the instant i ran it (under Linux) :-) Your Mileage May Vary. However it crashed because it wasn't properly parsing the arguments. (I looked at the core dump.) There is a shell script that calls the Waveforms program. He could have even done the argument parsing in that one line shell script. I wrote the programmer, explained the problem and told him how to fix it. He told me that a third party program library (QT) handles the arguments. Now that is certainly true, but if you don't tell the program libraries what arguments to expect and how many to expect, the program is going to crash! :-)This actually CAN be fixed in the calling shell script. I hate to be so negative but this is closed source software written by a "programmer" who doesn't have the ability to write a one line shell script to call the program he WROTE! :-) I think the AD2 is the best piece of hardware in any class. But until Digilent open sources their software OR someone else clones an open source of waveforms its a brick. In short it is the best piece of hardware, but i am afraid somebody spilt bad software on it and it needs to be cleaned ;-)And i really mean it when i say i think the people at Digilent are hardware GENIUSES. And i am not being Socratic when i say i honestly believe they function mentally on a higher level than i do. Pardon me for a repetitive rant, but i really think this is a serious social problem in our field. Hardware GURUS bricking their genius invention by forcing crippling software upon it.thankspeter

author: Nominal Animal
author_rank: Super Contributor
timestamp: October 28, 2018, 08:56:16 am
content: Quote from: Crazy_Pete on October 27, 2018, 10:43:42 pmThat sounds like a good ideaIt's on my to do list, actually. Haven't even started yet; too much more important stuff to do first. (However, I only do Linux stuff, so anyone expecting a Mac [no more OpenGL support] or Windows port, has to wait for someone else to do it.)

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: October 28, 2018, 09:30:46 am
content: Thanks for trying! I would love to work with you on that. I know there are several levels to such a project. From what i can tell, the Waveforms software sits ontop the Waveforms SDK. The Waveforms SDK sits atop another SDK called "Adept2" which talks directly to the Xilinx FPGA. Adept2 is also closed source. I have never worked with FPGA before but once the fuses are burnt i would guess they act like any MCU? This is a really interesting idea because the AD2 is so well received and the software so poor.thankspeter

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: October 28, 2018, 01:52:54 pm
content: Hi Nominal Animal!I am very interested in writing OScope Software because i think what's out there could be improved. (I haven't the EE skills to talk about scope design ;-) And i really like what i hear about the AD2.However i realise there is a real potential problem. These AD2 are built around an FPGA from Xilinx. The folks at Digilent could just change a register or two on the FPGA just to break the cloned software. Am i too paranoid?ThanksCrazy Pete

author: KWKolb
author_rank: Contributor
timestamp: October 28, 2018, 02:13:56 pm
content: You may want to look at the ADALM2000 and its Scopy software. The hardware is cousin to the AD2 and both the hardware and software are claimed to be open source.While the software is available, Analog Devices isn't shipping hardware yet (long running story is they are waiting on cases - believe it or not). Lots of opportunity for refinement of the Scopy software, too.

author: rstofer
author_rank: Super Contributor
timestamp: October 28, 2018, 03:40:37 pm
content: Quote from: Crazy_Pete on October 28, 2018, 01:52:54 pmThe AD2 is a highly subsidized educational tool and now that MATLAB is on board, there's no reason to make changes in the interface. There used to be an API library for the original Analog Discovery (I don't know if it covered the AD2) but I can't seem to find it. The intent was to allow users to create their own projects.Somebody on this forum (maybe in Projects, maybe in Test Equipment) has created an AD2 app - you might try to search for it. If they did, they used the API.I don't see Digilent trying to screw up people's projects. They have never operated that way. But they might come out with an AD3 with a new interface and put the AD2 on life support. That they do fairly often as FPGAs come and go.

author: Nominal Animal
author_rank: Super Contributor
timestamp: October 28, 2018, 05:41:30 pm
content: It looks like Analog Discovery 2, like the Saleae clones, does not store the firmware on the device, but on the computer host: the host is responsible for loading it every time the device is connected.TheWaveforms packageincludes the SDK, and the firmware files (in/usr/share/digilent/firmwarein x86-64 Linux). The SDK itself is a single C++ library,libdwf.so, which itself depends on the libraries provided byAdept 2. The prevalence ofHungarian notationin the API headers, and using C++ in a low-level hardware abstraction layer library (making language bindings harder than they need be), makes me very suspicious.I do not immediately see why the libraries are not open source. I don't really see how it could be a negative for Digilent or its parent, National Instruments, considering Digilents mission statement:"Digilent's mission is to make electrical engineering and design technologies understandable and accessible to all, by supplying educators and students with high-value, industry-relevant educational tools and curriculum."It's just that if one were to go to the effort of creating a fully open source alternative (via reverse-engineering the USB comms), it would be annoying to be slapped by a cease-and-desist order/attempt -- or, for an academic user such as myself, to alienate/annoy Digilent in any significant way.

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 02, 2018, 04:04:48 am
content: >I do not immediately see why the libraries are not open source. I don't really see how it could be a negative for Digilent.>The prevalence of Hungarian notation in the API headers, and using C++ in a low-level hardware abstraction layer libraryUsing Hungarian Notation with C++ is another red flag they don't know what they are doing. C++ is a polymorphic Language that combines strong compile time type checking with loose run time type checking. Meaning the data types actually change with program flow of control rendering Hungarian Notation not only useless but literally causes it to provide false information. Using Hungarian Notation basically shows that you don't understand C++ in the first place. Of course given that the guy [the Digilent Software Engineer] can't write a 1 line shell script to call his own program kinda makes whether or not he understand the nuances of C++ a less than moot point.Yes i tried to explain all of this to Digilent. I even offered to do all of the work for them while trying to be as polite as possible. I went back to my "you are a brain surgeon, i am a cleaning lady, i accept that you are 100x smarter than i am, but still you have to let the cleaning lady clean your surgery or your skills as a brain surgeon are useless as your patients will die of infection." I made clear that i only intended to help their sales. I also made clear that i had no intention of "crossing their wishes" (my exact words.) I never heard any reply. (Which is why i mentioned about their breaking the software with a hardware change.)As far as a cease and desist order, this is California, they are under court order to release violent felons because the prisons are so over crowded.I don't think a "cease and desist order" is going carry much weight. However there is no point in trying to "help" people who don't want your help. The Siglent reps AND the Saelig Rep bent over backwards to give as much information and open their Siglent Scopes as much as possible. Again i really want to thank Ms. Amanda Harris at Saelig. When she said "I will get the information you requested" i expected to hear from her in a day or two. She responded within a few hours. That sort of cooperation is all i can possibly expect and i am very grateful for it. (Guess why i spent more and bought the Siglent 1104x instead of the AD2.)Open source means different things to different people. Even Linux is not completely open source because some of the firmware is binary only. But the Digilent people acted first as an obstacle and then stopped responding. It was even funnier when i asked Digilent to delete my account that i didn't want anything more to do with them. I still continued to receive marketing spam and "You have an item left in your cart" emails from them. Speaking of Cease and Desist orders, continuing to spam after they have been asked not to is a violation of US Federal Law as well and about as enforceable as a Cease and Desist Order. :-)I do appreciate your pointing me in the "SCOPI" needs improvement direction, one of the Siglent reps pointed me in that direction as well when i explained to them what i was about. I find it very reassuring that the Siglent Reps are telling me the same things (both good and bad) about their stuff and the software that interacts with it that you guys are telling me and that i am reading in the other forums.This is a bit premature since i haven't even received the scope yet, but ANY improvements or suggestions you guys can suggest i am willing to try to make.Although personally i prefer the way Dr. House puts in on TV "Yes, i DO think i am higher than you. However i am not one of those people who think because they have a college degree they know more than anyone else. If any of you patients in this clinic have any drugs that you think are better and that you are willing to give me, i am willing to take them with an open mind!"ThanksCrazy Pete

author: Nominal Animal
author_rank: Super Contributor
timestamp: November 02, 2018, 04:54:02 pm
content: Quote from: Crazy_Pete on November 02, 2018, 04:04:48 amWhen Raspberry Pi was originally announced, I went to their forums, and posted that I'd be happy and willing to help with the kernel side and any Linux distribution work, if I could get one of those early ones in my mitts. (I know that stuff.) I was called names, and even banned from their forums.I wondered what the heck had just happened, but after some digging, realized that Qualcomm hates Linux and GPL with a deep passion. It is in their corporate culture; if there is an option to comply with GPL or violate it, they will choose to violate it unless it is obvious that it will impact severely their business.Some companies (and organizations) are like that. They don't want to support free software or open source development, not even if it would make clear business sense.In cases like AD2, the only thing needed is the details of the protocols on how to upload each firmware (part), and how to communicate with that firmware. Nothing that cannot be observed from the USB comms -- and even perfectly legal when done for interoperability reasons in many jurisdictions.Some companies just don't see beyond the current quartal and business plan. They don't see an opportunity even if it hits them in the face. Others, even "old" companies, do get it, and will be more than happy to provide such protocol information if they have it. (If they do not, sometimes a clean-room documentation effort under an NDA will work; pure reverse-engineering efforts tend to be just "tolerated/accepted", not "endorsed".)(This is also why I recommend against using Raspberry Pi's, unless you use the camera option. Some of the other SBCs are much friendlier; I like Olimex and HardKernel, and have recently backedLa Fritekickstarter, just in case it really runs on a mainline kernel. The typical issue with SBCs is that they use a forked kernel abortion that is only maintainable by their own team, so that when they move to new hardware, their users will have to eventually switch as well. Using a mainline kernel would fix that. Also, it'd make it really easy to create task-oriented "distros" for specific use cases, say based onALFS.)Quote from: Crazy_Pete on November 02, 2018, 04:04:48 amYup. It's not that the tool needs to be open just because; it's that if we can properly interface to the tool, we can make the best use out of it, which increases the value. Siglent and Saelig apparently know this.In Linux, OpenGL support is easy, and especially for drawing the waveforms (not just one per screen update, but hundreds), there's a lot of low-level work that can make that really nice. I mean, stuff like FFT iseasyusing known-good libraries likeFFTW; the logic analyzer/protocol decoder support only needs a good data interface with large enough buffers (maybe pulse/space length oriented data format?) to make it really easy for devs to add new protocol support, and so on. It is thecoreof the application suite, the low-level stuff, that has to be right, or the suite is crap. (As I specialize in parallel and distributed molecular dynamics simulator development, I know how to create programs that keep the data flowing, extracting as much out of the CPU cores available as possible. The trick with GUI programs is that you really need to design the application to be multithreaded from the ground up, so that each thread/CPU core can keep working hard and data flows all the time.Thenyou get a nice, slick, smooth, robust application. The GUI toolkits, however, often require a specific threading model, so it all gets pretty complex spaghetti real quick; you need to design it properly from the get go to keep it from becoming an unmaintainable crashy pile of crap.)Quote from: Crazy_Pete on November 02, 2018, 04:04:48 amWhen I was younger, I tried the "I don't make a fuss about myself or my skills" approach. It was how I was raised. It did not work at all. I just almost killed myself by trying to bore through hard skulls by concentrated effort alone.Now, I know I nowadays probably sound like a self-centered asshole, but I'm not that, actually: based on what I've already done, I believe I do have the development skills to back up my claims. What I do not have, because of still suffering from the post-burnout and recurrent depression, is the ability to handle stress at all, or people who should know better. (Idiots are easy. It's the ones who know better, but prefer to lie or not admit to their mistakes or errors, that grind my guts. I like this forum a lot, because those seem to be very rare here.)

author: rstofer
author_rank: Super Contributor
timestamp: November 02, 2018, 06:17:54 pm
content: Quote from: Nominal Animal on November 02, 2018, 04:54:02 pmDigilent has given us an SDK (I haven't used it) and documentation along with sample programs. Why should they have to release their source? I don't have source for Windows 10 and I use it every day. Same with Waveforms, it works every time I use the AD2.Less than 2% of desktops use Linux - I wonder why a company would even bother to support it. More than 27 years later and, still, nobody cares.

author: Nominal Animal
author_rank: Super Contributor
timestamp: November 02, 2018, 09:32:52 pm
content: Quote from: rstofer on November 02, 2018, 06:17:54 pmThat are written in style which does not exactly inspire confidence; and the programs are crashy.Quote from: rstofer on November 02, 2018, 06:17:54 pmWho asked for any sources?I don't evenwantto see their sources. What I'd like to know, is the specifications for the communications protocols, so I can write my own.ThoseI'm willing to release.Quote from: rstofer on November 02, 2018, 06:17:54 pmUntil it crashes, you mean.Quote from: rstofer on November 02, 2018, 06:17:54 pmExcept that when you do high performance computation, it is the only OS used. All top 500 supercomputers are Linux. All computing clusters doing heavy work run Linux. Who the heck even cares about desktops? Not proper developers, at least. They usepropertools, not some toy operating system a big company has convinced a lot of people to use.You know what they say: a billion flies cannot be wrong.

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 03, 2018, 01:24:17 am
content: >Digilent has given us an SDK (I haven't used it) and documentation along with sample programs.An SDK that is also closed source and is clearly poorly written. Furthermore when the one line shell script crashed that calls the program, the developer immediately blamed open source libraries. ("That's Handled in the QT libs" <--- his exact words) There is an open source JAVA sdk and when i asked the developer about my doing something similar in C++ he just clammed up. Which means these people are not supporting open source>Why should they have to release their source?The truth is, as a matter of ethics, nobody shouldHAVEto do anything!I pointed out if they would release their sources, i would fix their program. The real question is why WOULDN'T they release their source? Why do hardware gurus think that software is intrinsically valuable? Hardware engineers are brain surgeons, Software engineers are cleaning ladies. We are essential to the functioning of the surgery, but we are no where near as valuable as a brain surgeon.Although honestly i don't expect them to release their sources. What i actually did ask was for some basic support as to where we should start open sourcing the SDK in C++/C. (And i was clear to them that all i needed was their approval and permission, to which they wouldn't respond.)Again it is really an issue of the brain surgeon not trusting the cleaning lady to do her job. (And i beat this dead horse repeatedly in this forum because i think this forumis the place to find OPEN MINDED hardware geniuses.)The truth is all anybody expected from them was a bit of support as to where we could begin creating a properly written open source SDK and they saw that as a total threat to their business model. Alright, i bought the Siglent instead based on the total cooperation i received from aTeamof people from Siglent and Saelig.>Less than 2% of desktops use Linux - I wonder why a company would even bother to support itVery little "real" computing is done in Windows. A large number of webservers are running Centos. I actually made a career out of refusing to support Windows. (I had talked to enough other consultants and done enough with Microsoft to realise their stuff was junk.) I had a reputation for 100% success in an industry known for 100% failure. The reason i avoided these failures was because i refused to work with any Microsoft Tools and actually wrote that into my contracts. As an analogy, most artwork is kindergarten children fingerpainting. I don't know why companies bother to sell paint and canvas to art schools.Thanks to AllCrazy Pete