AD9833

Post and discuss new components that you have created.
chipfryer27
Valued Contributor
Posts: 1146
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 284 times
Been thanked: 412 times

Re: AD9833

Post by chipfryer27 »

Hi

Taking an interest in the potential two of these modules may achieve I bought a couple from a well known online store, with them arriving today.

Soldered one up to the supplied pins (which negates warranty no doubt) and I was set to play.

Documentation says it can be powered from 2.5 - 5.5v so I connected it up to my BL0080 with breakouts attached using "breadboard" style jumpers and a further power jumper to 5v.

Tried a chart of my own, which ran through to the end without crashing and connected a Tektronix to the analogue outputs. I was hoping for 400Hz but just got noise. Checking connections I discovered the little PCB was quite hot so immediately disconnected everything. Nothing obvious so connected things back up a step at a time. Nothing warm to speak of.

Compiled again with just noise as the end result.

Set BL0080 for 3v3 and moved power jumper lead to 3v3. Compiled again with nothing achieved.

Tried Martin's chart (chip changed to suit) but no difference.

I don't know if I've somehow destroyed the module inadvertently, maybe it doesn't like 5v after all, but it certainly isn't playing nice. Occasionally during tests (changes to chart) the module would get quite warm but after cycling power it cooled and stayed like that (until the next time).

I don't have much in the way of test kit here but next step will be to connect an analyser to the jumpers to see what is being sent. If that looks good then I may risk the other module.....

Regards

mnfisher
Valued Contributor
Posts: 953
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 507 times

Re: AD9833

Post by mnfisher »

Just tested on hardware - and with a couple of tweaks - seems to work.
So I set CS polarity to Active low and changed Clock polarity to idle high (both in cal_spi properties)
I also changed the first line of the calculation in SetFrequency to

Code: Select all

.fword = .frequency * (pow (2,28) / ref)
which may or may not be necessary?

Then I get a square, sine and tringle wave - oddly the amplitude of the square wave is ~5v and for sine and triangular wave it is less than 1v (655mV peak to peak) . The frequency is measured as 640Hz (as set) :-)


LabNation_Screenshot2.png
LabNation_Screenshot2.png (204.23 KiB) Viewed 2886 times
LabNation_Screenshot3.png
LabNation_Screenshot3.png (213.96 KiB) Viewed 2886 times
LabNation_Screenshot5.png
LabNation_Screenshot5.png (214.58 KiB) Viewed 2886 times

Martin

mnfisher
Valued Contributor
Posts: 953
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 507 times

Re: AD9833

Post by mnfisher »

Just seen Iain's comment - yes I think I got the same two from the same well known purveyor of all things...

I've connected to an Arduino (Uno) and am running it at 5V. All cool running - my usual trick is to reverse Gnd and VCC which can make things a little toasty.

Tested at several speeds (now have a square wave at 5MHz)

Martin

chipfryer27
Valued Contributor
Posts: 1146
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 284 times
Been thanked: 412 times

Re: AD9833

Post by chipfryer27 »

Hi

That's great you have it running :)

I tried the usual play with the settings but couldn't get it to do anything.

I''ll have another go when I've got some test kit around.

Regards

Edit...
Just had another go with Martin's chart with his documented tweaks.... Nothing but noise

mnfisher
Valued Contributor
Posts: 953
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 507 times

Re: AD9833

Post by mnfisher »

Is that the one you 'cooked'?

This is the working code - just in case I changed anything else - my memory isn't what it used to be.

So this is the working code. Just in case...
AD833Test.fcfx
(17.86 KiB) Downloaded 124 times
Martin

chipfryer27
Valued Contributor
Posts: 1146
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 284 times
Been thanked: 412 times

Re: AD9833

Post by chipfryer27 »

Hi

Connected up an analyser to the pins on the breakout board (continuity checked to chip, ~27 Ohms).

Modified Martin's chart for a PIC 16F1939 (coz it was in the BL0080) and put an endless loop straight after he generates the first Square Wave to call a halt to proceedings.

AD833Test_1.fcfx
(18.73 KiB) Downloaded 123 times

Not good.....

Whilst I could see activity on CS and Clock, nothing on the data pins, they remain Low.

1939_SPI_ch1.png
1939_SPI_ch1.png (133.47 KiB) Viewed 2862 times

1939_SPI_ch1_zoom.png
1939_SPI_ch1_zoom.png (148.24 KiB) Viewed 2862 times

I tried using a Software channel (same pins) but no difference.

I then tried a PIC16F877A but that wouldn't do anything not even under mLoader. As that was probably the original chip shipped with my very first programmer from twenty years or so ago, the chip owed me nothing. Using a new 877A (bought in a "Maplin" like store in Australia about 15 yrs ago) it accepted the chart but still no activity on the data pins.

Strange that two chips would display similar issues I swapped pins. This meant I had to use a Software channel, and I put MOSI on C1. This then gave me activity on the Pin. I knew I like Australians...:)

877A Software MOSI-C1.png
877A Software MOSI-C1.png (135.17 KiB) Viewed 2862 times
877A Software MOSI-C1_Zoom.png
877A Software MOSI-C1_Zoom.png (159.69 KiB) Viewed 2862 times


Connecting the module back to the board and running the code, after a bit of faffing with connections I obtained Martin's square wave @ 640Hz.

20230611_103801.jpg
20230611_103801.jpg (136.67 KiB) Viewed 2861 times


I have plenty of jumpers obtained from the likes of Farnel which are of good quality but over time these have got intermixed with the stuff that ships with many a cheap module (cheap for a reason) so it's always good to check connectivity.

Next test will be to see if I can do anything with C5... :)

Regards

Edit....
Yep, same module as before, the one that got very hot. Working fine now though.......:)

chipfryer27
Valued Contributor
Posts: 1146
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 284 times
Been thanked: 412 times

Re: AD9833

Post by chipfryer27 »

Hi

Yesterday when I had issues I checked my connections from chip pin on BL0080 thru ZIF socket, thru BL0119 to a breakout module. All good with a resistance of around 27 Ohms.

Clearly there is an issue with Port C5 so I made a flash test for the port. Not good at all.....

Port_C_Flash.png
Port_C_Flash.png (102.62 KiB) Viewed 2853 times

Problem traced to the breakout module. This has a row of SIL headers conneted to a Male 9-pin D-Type. Pin 5 had a very intermittent connection that was resolved by a tab of an iron. I'm guessing the pressure of me pressing a test lead against it made the connection, giving me continuity, but when released..... well I didn't fancy going to church this morning anyway as it's raining.....

Downloaded Martin's chart (modified for 1939) with all pins as normal (Ch1) and got my square wave. I then modified to run without halt and give each waveform ten seconds before moving on.

Initially the square was stable with a pk-pk of 5.1V but the sawtooth and sine, being only around 632mV pk-pk were quite unstable. This was due to the scope having the trigger set too high. Once resolved each waveform is stable. Well for a module that only costs a few pounds each it's very stable :)

I need to employ an apprentice as I need to ged rid of the cheapo jumpers. Actually it is a 50/50 chance between dodgy jumpers and dodgy cheapo header pins.....:)

Regards

Vatel20
Posts: 19
Joined: Wed Dec 16, 2020 10:07 am

Re: AD9833

Post by Vatel20 »

ΟΚ!! it worked .thank you all

WingNut
Posts: 254
Joined: Tue Jul 13, 2021 1:53 pm
Has thanked: 33 times
Been thanked: 23 times

Re: AD9833

Post by WingNut »

chipfryer27 wrote:
Sun Jun 11, 2023 12:40 pm


I need to employ an apprentice as I need to ged rid of the cheapo jumpers. Actually it is a 50/50 chance between dodgy jumpers and dodgy cheapo header pins.....:)

Amen to that!

chipfryer27
Valued Contributor
Posts: 1146
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 284 times
Been thanked: 412 times

Re: AD9833

Post by chipfryer27 »

Hi
ΟΚ!! it worked .thank you all
Thanks should be aimed at Martin as he shared code to demonstrate functionality. With the issues I had, I used Martin's "known good" to continue testing with, just to eliminate further issues that may have been in my code. Unlikely though as everything I write works first time............. :lol:
Amen to that!
Much like last call at the bar, we know we shouldn't but we still do.... :) Cheap for a reason.... I can't really tell if it is the headers or jumpers but they are a constant source of trouble now my jumpers are mixed. We all know we should throw accompanying free jumpers in the bin, but..... Maybe I'll build a tester that allows MM/FF/MF jumpers to be confirmed before use, but that will only take care of 50%. I either don't use the accompanying headers or I get out my calipers first...

Thanks to Vatel20 for putting me on to the modules. I had been mulling over creating a "binaural beats" machine to emulate one I had 20+ years ago. Yes I know you now get "apps" to do such but none that allow full creativity. These modules fit the bill nicely.

Martin, after viewing your code and then figuring out how you did things, my crayons may soon be felt tips.. :)

Regards

Post Reply