Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDS Support for Arduino Zero (and its built-in DAC) #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jake-b
Copy link

@jake-b jake-b commented Aug 17, 2015

This is a very rough draft of DDS support for the Arduino Zero. I still have more work to do, but it is working pretty well. You can see the oscilloscope output from the code running on a Zero here:

A nice smooth wave (more or less) without any filtering, since it is a DAC rather than PWM.

There are some limiting factors to using HamShield (as best I can gather from public info):

  • The Arduino Zero is a 3.3v board and is not 5v compatible. For proper support of newer Arduino boards, HamShield would need to include level shifters and use the IOREF pin to set the voltage on the processor side to support both 3.3v and 5v main boards.
  • The HamShield expects the PWM audio out from the Arduino to be on D3. The Zero's fancy 10-bit DAC is on A0. (a selectable solder jumper maybe?)
  • I2C for modern Arduino boards (Leonardo+) is on the SDA/SCL pins near D13. You can bit-bang A4/A5 on the Zero if necessary, and I've tested it as working.

I'm going to try a "DigiX level shifter shield" between the HamShield and the Zero to deal with the 3.3v issue. The shield also lets you route the SDA/SCL lines to the A4/A5 location. I can probably cut/solder around the A0/D3 issue as well.

This is all out-of-scope for the Kickstarter, but I would love to see a "HamShield 2.0" that is more compatible with Leonardo, Due, and Zero.

I'll continue to work on this Zero DDS code to fix a few omissions and bugs.

@jake-b jake-b changed the title DSS Support for Arduino Zero (and its built-in DAC) DDS Support for Arduino Zero (and its built-in DAC) Aug 17, 2015
- Added a 10-bit sine table, probably wasteful considering its stored in 16-bit integers.
- Added "DDS_MAX_COMPARATOR" and "DDS_MAX_ACCUMULATOR" macros to hide some math and imrpove readability.
- Simplified calcFrequency and made it work for arbirary frequencies (with/without default refclk)
- Simplified getDutyCycle().  I think its more understandable now, and works for various combinations of accumulator size and lookup table size.

Tested on both an Arduino Zero and an Arduino UNO.  Seems to work, but YMMV.
@jake-b
Copy link
Author

jake-b commented Aug 17, 2015

I'm considering this "done" for now, until I get a real HamShield to play with. Even if you don't take these changes, there are a few good ideas (I think) that you may want to incorporate into your main branch.

@spaceneedle
Copy link
Contributor

Thanks! This is really cool! I will have Stephen and Nigel take a look at
this.

We can get any of the bugs sorted out once you get your HamShield.

On Mon, Aug 17, 2015 at 2:31 PM, jake-b [email protected] wrote:

I'm considering this "done" for now, until I get a real HamShield to play
with. Even if you don't take these changes, there are a few good ideas (I
think) that you may want to incorporate into your main branch.


Reply to this email directly or view it on GitHub
#15 (comment)
.

NOTE: this sample won't really work for the HamShield ont he Ardiuno Zero as it will
Besides the logic voltage issue, it will be playing its tones out of AO, rather
than D3 or D11.  Hook up your oscilloscope to A0 to see the waveform.
@spaceneedle
Copy link
Contributor

Hello Jake,
could you send me your contact information? [email protected]. I wanted to touch base with you on getting this working on the Zero. We had a few other folks who were interested!

@aperezbios
Copy link

@spaceneedle, what's the current plan for merging this commit to support the Zero? Have you or anyone else validated it still works with the shipping version of HamShield?

@nigelvh
Copy link
Contributor

nigelvh commented Feb 14, 2018

Has anyone had a chance to test this? I don't have access to a Zero board, so I'm unable to verify functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants