Project “Synthavr” – A Self-contained Retro Music Studio.

Go To Last Post
111 posts / 0 new

Pages

Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 3

 

Project “Synthavr” – A Self-contained Retro Music Studio.

 

Pronounced : Synth-a-ver

 

This project will be a "self-contained" multi-track synthesizer and music composing system made from 8 Bit AVRs and 1980's era semiconductors.

Self-contained means that all music will be composed on the system, including the mathematically produced synthesized instruments made by using the WaveLab application that will be part of the Operating System.

 

I am undertaking this massive project for two reasons...

 

1) I really want a complete self-contained retro-style music studio that combines the power of the Fairlight CMI with the unique sounds of earlier analog synths. So why not just use Renoise or Presonus? Simple... see reason number two.

 

2) I want to challenge myself to build the entire system using only 8 Bit AVR Microcontrollers and 80's era components such as 74 series gates and basic SRAM. The system will be prototyped on a breadboard and then later hand wired, so all parts must be through hole format.

 

Expanding on the above, here are the rules I have set for this project...

 

- Only 8 Bit AVRs in DIP packages may be used.

- All other ICs will be basic 80's era gates, opamps and SRAM.

- Self-contained means no connection to modern equipment.

- The OS will run from an AVR and bitbang the VGA display.

- No samples will be used, all sounds are computed by the OS.

- 8+1 channels of sound, each with multiple instruments and FX.

- Multiple analog FX per channel that are controlled by DACs.

- The final project to be hand wired on massive perf boards.

 

To expand on the first few rules, parts (thru hole) that are allowed will be; standard SRAM, 7400 series logic, common op amps, DAC technology that was available in the 80's, and the usual common semiconductors.

 

Equal effort will be put into the final hardware, which should look as good (and retro) as it sounds. An enclosure with a glass front will reveal the massive hand wired board and the user interface will have the feel of 1970's modular synths.

 

 

[CHANNELS]

- 8 Identical fully independent sound channels

- Each channel can play one instrument but define multiples

- Atmega324 for each channel with common Command Bus

- 512K Scratch RAM for wave file instrument creation

- 12 Bit DAC output / up to 100KHz sample rate

- Real-time DSP effects done in AVR code

- Internal FX : volume, distortion, echo, etc

- External FX : Buchla style low pass with resonance

 

 

[OPERATING SYSTEM]

- 640x480 Dual Buffer VGA Video system bitbanged by AVR

- 80x60 text with 640x480 bitmaps in 64 colors

- User interface will be buttons and analog knobs

- OS runs WaveLab and Composer apps directly from AVR

- Common Command Bus between OS and all independent channels

 

 

[OS.WAVELAB]

- Graphical display of instrument wave files being created

- Multiple layers of mathematical operations on wave files

- Final instruments are stored as operations not samples

- Seamless wave looping and unlimited point envelopes

- Live preview of samples and unlimited undo changes

 

 

[OS.COMPOSER]

- 8 standard tracker like channels and one solo channel

- Each track maintains its own song memory in SRAM

- Edit or live compose any track while others playback

- Standard track input using keyboard or editor

- Tracker functions will be similar to Amiga OctaMED

 

 

[OTHER FX]

- Unique solo instrument with Theramin like analog qualities

- Solo instrument is recorded via multiple ADC inputs

- Global & Patchable mechanical spring reverb unit

- SPO256 Speech Synthesizer with VCO for pitch control

- Metronome for recording live tracks

 

 

Now that I have carved up a set of rules and a list of features, the prototyping shall begin on a set of massive breadboards.

Looking forward to discussion this project with fellow Freaks!

 

Photos, Videos and Source Code to come.

 

Cheers!

Radical Brad

No Fate But What We Make!

Last Edited: Sat. Jan 1, 2022 - 09:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

They said it couldn't be done...so now, do it

 

With all of this stuff, power "layout" will be critical & worth an investment of time to get it perfected.

Wondering if the BB gndplane should be used, so that gnd is uniform everywhere (as opposed to  gnd variation, on the little strips).  Maybe tie the gnd strips to the metal plate. You don't want gnd here to differ from gnd way over there.

Perhaps have an analog gnd vs a digital gnd for lower noise floor.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
You don't want gnd here to differ from gnd way over there.
Though ground will differ; can steer return currents (AVR are significant impulse loads)

 

Reason for Ground Splits | Signal Consulting, Inc. and Dr. Howard Johnson

[third to last paragraph]

 At 8 bits, ... You might arrange the layout so that the input signal goes straight to the audio amplifier and stays away from the processor, and arrange the power connections so that all the DC current feeding the CPU doesn't plow straight through the analog area.

...

Power Supply, Power Routing, and Decoupling Capacitors | AVR040: EMC Design Considerations

[third paragraph]

The current pulses on the power supply lines can be several hundred mA if all eight I/O lines of an I/O port changes value at the same time. If the I/O lines are not loaded, the pulse will only be a few ns.

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I did notice some ground bounce and other issues when I made my massive breadboard Vulcan-74 project. The switching noise was sometimes visible on the screen as faint variations in brightness. I did manage to tame this by running much larger power rails to "sections" of the board, and will do the same here. On the hand wired version, I intend to lay down copper rails across the perf board between all sections and channels. I will be using straightened 15 amp copper house wiring with the shielding stripped. In this project, keeping the DAC voltage stable will be important.

 

Here is one of my VGA projects, running at 30MHz across the entire breadboard. Everything was 74 logic, except for the Xmega256 on the small board.

The synchronous switching of 12 chained 74HC245s all at once did create a lot of spikes.

Careful grounding was required to avoid seeing patterns on the 400x300 VGA screen.

 

 

I will learn from my past mistakes and get ahead of this problem.

 

Brad

No Fate But What We Make!

Last Edited: Sun. Jan 2, 2022 - 05:50 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AtomicZombie wrote:
On the hand wired version, I intend to lay down copper rails across the perf board between all sections and channels.
Manufactured bus bar is pictured in Brian's #1 at Anyone Recognise This? | AVR Freaks

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, something similar and robust just like that. What I did was to cut a length of 15 amp house wire, slice the outer shield, and then laterally slice the black and white shielding to expose the bare 14 gauge copper wire. It was easy to straighten by rolling it on a flat surface. The copper worked well as it was easy to solder the smaller wiring to or even the leg of an IC placed through the perf board. I will show photos of this when I get to that point on this project.

 

I always like to go for the DIY option when possible!

 

Brad

 

gchapman wrote:

AtomicZombie wrote:
On the hand wired version, I intend to lay down copper rails across the perf board between all sections and channels.
Manufactured bus bar is pictured in Brian's #1 at Anyone Recognise This? | AVR Freaks

 

No Fate But What We Make!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

Starting from the beginning, here are some photos of how I made my twin MOABs (Mother Of All Breadboards).

Since there is nothing more annoying than running out of proto space, I decided to go big with my breadboard.

I made two boards that each have 24 standard solderless breadboards connected together.

These are quality boards from Twin Industries, and hell yes there is a HUGE difference!

 

 

To make the board easier to move, I opted for dual boards with 24 breadboards each and they will be fastened to 1/4" thick aluminum plates

I also made aluminum rear plates so I could attach various connectors like power, video, and other common ports I often use.

 

 

Here is one of the MOABs sitting next to what I used to think was a big breadboard made on a baking sheet.

The circuit on my old board is an NTSC video game system using only AVRs and 74 logic, very similar to what I am doing once again.

Funny, that was 12 years ago! Here is a video of it doing some basic graphics...

 

https://www.youtube.com/watch?v=MQO-aXIFvFs

 

The Video Generator in this project will be light years ahead of my old experiments from "back in the day"!

 

 

I do a LOT of breadboard work, often complex designs running over 20 MHz, and they always work despite what the experts think about breadboard "limitations".

Besides minding your propagation delays and ground loops, breadboard quality and neat wiring are the other factors for success.

Don't go jamming thick stranded wires in your breadboards dude (and dudettes), use thin gauge solid copper wires cut to the required lengths!

Where do you get so much of this magic wire?? Just slice up some CAT-5 wire.

 

 

Yes, this cheap and easily available wire not only works perfectly in a breadboard, it is easy to form and has a decent number of colors.

Since CAT-6 is now the standard, you can get CAT-5 by the foot for next to nothing. Ask an IT nerd friend for the cables they replace on cabling jobs.

 

 

Red, Green, Blue, Brown and White... a perfect number of colors for organizing your breadboard into VCC, GND and signal pairs.

I often cut up a lot of similar length wires at once, especially short Green and Red for power rails.

A slightly dull jackknife is all I have ever used to remove the shield - just give a twist along your thumb and pull the 1/4" of shield away from the copper.

For my MOABs, I needed many hundred short Green and Red wires to join the power rails of all 48 breadboards together.

 

 

My breadboading space now contains 40,000 tie points! Whadda ya think? Largest breadboard in the World? Should I call Guinness again? (don't ask)!

I also added decoupling caps to help combat switching noise, something that can show up on the screen when creating high speed video projects.

But wait, the breadboard is essentially a massive capacitor, so isn't' this a waste of time? Seems not as it did make a difference in several high speed (30MHz+) projects.

 

Ok, that's it for now. I now have a massive amount of prototyping space and an almost endless supply of old-school 74 logic components to drop on.

I will leave this entry with an eye candy shot of a one of my shelves full of 80's era ICs and semiconductors that all hope to become something amazing.

 

 

Coming next will be the scrawlings of a mad man, also known as my hand drawn schematics and ideas.

Yeah, I am also going to do all of the schematics by hand using a pen and paper as that just feels like the right way to fly here.

 

Talk to you Freaks again soon, and.... Happy New Year!!!
Hard to believe that I have been a proud member of this great forum for 15 years now. Where does the time go?

Cheers!

Brad

 

 

No Fate But What We Make!

Last Edited: Sun. Jan 2, 2022 - 05:54 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AtomicZombie wrote:

These are quality boards from Twin Industries, and hell yes there is a HUGE difference!

How much does a single one cost?

 

I have been told that a good quality budget breadboard is Busboard Prototype Systems BB830

and on the premium side the absolute best is Jameco Valuepro WBU-202-R

 

Have you tried these in the past?

“Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?” - Brian W. Kernighan
“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” - Antoine de Saint-Exupery

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I paid about $10 CAD for my boards. Here is a link...

 

https://www.digikey.ca/en/products/detail/twin-industries/TW-E40-1020/643111

 

Before those, I tried the cheapo China made boards and constantly had points that were glitchy.

I would imagine any board made in a factory with actual quality control and properly paid labor would work well.

 

Brad

 

Heisen wrote:

AtomicZombie wrote:

These are quality boards from Twin Industries, and hell yes there is a HUGE difference!

How much does a single one cost?

 

I have been told that a good quality budget breadboard is Busboard Prototype Systems BB830

and on the premium side the absolute best is Jameco Valuepro WBU-202-R

 

Have you tried these in the past?

No Fate But What We Make!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Your projects, (HW & SW), and your physical construction of them, are impressive as can be!

 

Thank you for posting the images.

 

I'm looking forward to following your progress as this project takes shape!

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AtomicZombie wrote:
I did notice some ground bounce and other issues when I made my massive breadboard Vulcan-74 project.
Ground bounce isn't a digital issue for other than clock signals iff the ground bounce's absolute magnitude is low enough (current injection)

AtomicZombie wrote:
The switching noise was sometimes visible on the screen as faint variations in brightness.
Video DAC may have a stated PSRR though PSRR data may be minimal; LC LPF on DAC's VDD (ferrite bead) (RC if low current)

A clocked DAC should be better.

AtomicZombie wrote:
In this project, keeping the DAC voltage stable will be important.
(may you consider a pardon for a pedantic) "low" noise though power supply stability supersedes noise.

Sometimes one asks 'What's the DAC's PSRR?' and the answer is "IDK" (the lack of PSRR data is a hint that there's no power supply rejectionwink

AtomicZombie wrote:
Here is one of my VGA projects, running at 30MHz across the entire breadboard.
Impressive clock frequency

 

edit :

P.S.

AtomicZombie wrote:
The synchronous switching of 12 chained 74HC245s all at once did create a lot of spikes.
fyi, AUC has reduced spikes though only in SMT.

 


Wire-Wrap | Signal Consulting and Dr. Howard Johnson

[third paragraph from the bottom]

There are several solutions to the clock problem.

[slew rate limiting (AVRxt), LPF, series termination, coax]

I/O Pins | AVR® DA Family

[bottom]

I/O Slew Rate

approximately 3 ns, 20 ns, 40ns

Wire Wrapping vs. Soldering: How and When to Use Wire Wrapping (Jameco)

 

Designing With TI Ultra-Low-Voltage CMOS (AUC) Octals and Widebus Devices (Texas Instruments)

[page 3]

2.1 Novel Output Structure

...
The second branch, the transmission line branch (TLB), which contains a series resistor, provides optimized impedance matching into the transmission line to help minimize ringing and to optimize signal integrity.

...

SN74AUC245 data sheet, product information and support | TI.com

"Dare to be naïve." - Buckminster Fuller

Last Edited: Sun. Jan 2, 2022 - 04:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AtomicZombie wrote:
Ask an IT nerd friend for the cables they replace on cabling jobs.
Likewise for fiber optic cables (remnants or partial spools, handy for inter-plate and between enclosures, limit the area and impedance of the digital return currents on the non-digital plate)

fyi, can rent fiber optic splicers (context is the startup small in SMB/SME)

AtomicZombie wrote:
Whadda ya think?
Impressive inductance reduction given what you start with (not protoboard)

AtomicZombie wrote:
... and an almost endless supply of old-school 74 logic components to drop on.
If (when?) those go EOL there's the EOL distributors.

AtomicZombie wrote:
Where does the time go?
Matters not for time is both meaningful and meaningless.

May you and all have good health!

 


FiberSplicer

due to

Splicer Rentals (Tyrosys)

 

Rochester Electronics (en-US) : Homepage

About - Ewing Components Inc.

 

edit :

https://upload.wikimedia.org/wikipedia/commons/transcoded/c/c0/De-Gesundheit.ogg/De-Gesundheit.ogg.mp3

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Sun. Jan 2, 2022 - 06:51 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Ok, I am starting to laydown some ICs, mainly as a test for the type of DAC I want to use for each channel.

In my Vulcan-74 system, I just threw together a simple 8 bit R2R DAC using some hand matched 1% tolerance resistors.

Being just a game system, I figured this this was good enough, but the resulting sound was actually much better than expected.

 

The DAC was pumped by an Atmega324 at rates up to 78KHz with help from a few 74HC590 counters.

Being only 8 bits with no filtering, it wasn't all that bad!

 

Here is the breadboard version, the DAC and sound system living on the second MOAB to the right...

 

 

Here is a video I made when I did the first sound test. The speaker amp is fed right off the R2R DAC here...

 

https://www.youtube.com/watch?v=fuJz3ERi8Kg

 

For this project, I want to get the best sound possible, but need to keep with era appropriate tech, and only through-hole parts.

Obviously, an R2R DAC beyond 8 bits is not possible, and most consider 7 bits to be the best possible even with careful matching of resistors.

 

So far, here are the options I am considering as DACs for all of the standard 8 channels....

 

1) Hand matched 8 Bit resistor ladder R2R DAC

This is easy to do and will sound decent, but will have some noise and low fidelity after running through the required filtering, even with the high sample rates I can achieve with the AVR.

 

2) Old school 8 Bit DAC0800 IC

I do have a bunch of these, but my tests with the R2R DAC seemed to sound better! These also require strange split power supplies and serious op amp circuits to get decent sound out.

 

3) Direct PWM from the AVR on each channel.

Easy to do, and can run up to 30MHz / 2/ 1024 for 15 KHz sample rates at 10 bit. Might be some aliasing noise though but probably deserves a prototype test anyhow.

 

4) Serial DAC like the MCP4822.

I also have a bunch of these, and they are DIP parts that contain a precision 12 bit R2R DAC inside, so close enough to era appropriate technology for me. I will be testing these for sure.

 

So I will probably breadboard a simple test that hammers out a programmed wave file from a 512K SRAM into both the AVR PWM and then the MCP4822.

This is essentially what a single channel will do - program a very complex waveform to the 512K working RAM and then spew it out to a DAC at the required frequency.

For this test, I will just send basic waveforms to see if I can actually hear the difference between the 12 Bit DAC and the 10 Bit AVR PWM.

I would imagine that the aliasing of the PWM will be the killer though. Having to reduce the PWM to only 8 Bit won't cut it for this project.

 

I know there are many inexpensive 16 Bit serial DACs available, but these sway too far off the era-specific path for me.

The MCP4822 is close enough to what was inside the old Fairlight CMI to pass, and these are also available in DIP format.

I will not break my rules and use surface mounted parts in this project.

 

Will post results as soon as the breadboard is singing!

 

Brad

 

 

 

 

 

No Fate But What We Make!

Last Edited: Sun. Jan 2, 2022 - 08:33 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A similar era device to the cmi was the Linn LM1 drum machine. It used sampled drum sounds stored in EPROMs, one sound per chip. The waveform was stored as 8 bits but it was stored as a mu-law waveform giving an effective 12-bit quality in 8-bits. The DACs were, IIRC, an AMD part. I think I even have some upstairs, alongside a set of Linndrum EPROMs. 

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AtomicZombie wrote:
Easy to do, and can run up to 30MHz / 2/ 1024 for 15 KHz sample rates at 10 bit. Might be some aliasing noise though ...
fyi, PWM-input 10-bit DAC at 25 KHz without an aliasing issue but ... SMT.

AtomicZombie wrote:
I would imagine that the aliasing of the PWM will be the killer though.
CMOS is great for switched capacitor filters, some are steep (AAF), in DIP, though didn't evaluate for noise (CMOS noise has significantly decreased)

 

edit :

P.S.

AtomicZombie wrote:
... and only through-hole parts.
AVR Dx DAC

 


LTC2644 (Rev. B) (Analog Devices)

[page 1, middle of right column]

... eliminating voltage ripple and replacing slow analog filters and buffer amplifiers.

 

Low-Pass Filters | Analog Devices

 

DAC | AVR® DA Family

I/O Multiplexing | AVR® DA Family

DAC - Digital-to-Analog Converter | Migration from the megaAVR® to AVR® Dx Microcontroller Families

AVR64DD32/28 Preliminary Data Sheet (DAC on page 511, release in '22?)

 

edit : the sell sheet for LTC2644 PWM-input DAC

PWM to DC in One Cycle (Analog Devices)

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Thu. Jan 6, 2022 - 03:56 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have you tried the AVR-DB DAC yet?

I have a tray of AVR128DB-28 here that I have not done much with due to the crippled port arrangement.

 

I never gave it any consideration figuring it would not be any better than the DAC on all of the XMega series.

The XMega DAC wasn't even close to good enough for audio, well not for decent audio.

Even my 8 Bit R2R with standard 10% precision resistors blew it away by a long shot. 

 

If it is improved fabric, I will certainly give it a whirl.

 

Brad

 

gchapman wrote:

 


LTC2644 (Rev. B) (Analog Devices)

[page 1, middle of right column]

... eliminating voltage ripple and replacing slow analog filters and buffer amplifiers.

 

Low-Pass Filters | Analog Devices

 

DAC | AVR® DA Family

I/O Multiplexing | AVR® DA Family

DAC - Digital-to-Analog Converter | Migration from the megaAVR® to AVR® Dx Microcontroller Families

AVR64DD32/28 Preliminary Data Sheet (DAC on page 511, release in '22?)

 

No Fate But What We Make!

Last Edited: Sun. Jan 2, 2022 - 10:53 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


AtomicZombie wrote:
Have you tried the AVR-DB DAC yet?
No

AtomicZombie wrote:
The XMega DAC wasn't even close to good enough for audio, well not for decent audio.
XMEGA A1U DAC clock noise erratum isn't present in other XMEGA.

AtomicZombie wrote:
If it is improved fabric, ...
Different fabric, different design, and on wafers that can be reasonably acquired (wafer fab process, two less bits for DAC)

AVR DB's DAC noise data is zero data (same with AVR DA) whereas other CMOS DAC noise data is present.

 


ATxmega128A1U, ATxmega64A1U Data Sheet

[page 216]

17. DAC clock noise

The system clock is visible as clock noise on the output of the DAC. Peak to peak noise is in the range 0.7mV - 1.6mV at 2MHz and 0.05mV to 0.1mV at 32MHz. If external clock is used as system clock, the noise is up to three times higher.

Problem fix/Workaround

Add external low-pass filter to remove the noise.

Silicon Issue Summary | ATxmega128/64/32/16A4U Silicon Errata and Data Sheet Clarification

 

XMEGA Lead Time, Dec'20 | AVR Freaks

ATxmega16A4U ATxmega32A4U ATxmega64A4U ATxmega128A4U Device Datasheet

[page 323]

Figure 37-303. DAC noise vs. temperature

VCC = 3.0V, VREF = 2.4V

MCP4801/4811/4821 Data Sheet (middle of page 4, noise density is 1 microV/Hz^0.5 at 10 KHz [CMOS] which is AVR DB op amp's estimated noise density)

Audiophiles may prefer bipolar DAC over CMOS DAC though CMOS's noise is improving (wafer fab process, FET design)

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The "easy" solution these days is I2S and then an external I2S DAC (often including an amp too) but sadly I fear you don't see I2S from Atmel until you trade up to Cortex. I don't think any AVR has I2S. 

 

At least some of the Xmega do have a DAC though I don't think any exceed 12 bit. But maybe that's enough resolution? 44.1 would be good but I guess 22.05 is acceptable? 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
I don't think any AVR has I2S. 
Likewise MSP430 though there's an app report to connect I2S via SPI plus a bit of logic; maybe AVRxt's CCL and EVSYS could be the glue logic.

clawson wrote:
But maybe that's [12-bits] enough resolution?
Likely yes unless one is an audiophile.

clawson wrote:
44.1 would be good but I guess 22.05 is acceptable? 
Yes though the AAF must be steep (high order)

 


Interfacing an I2S Device to an MSP430 Device - slaa449a.pdf (Texas Instruments)

Wired Communication | Microchip Technology (16-bit MCUs)

[mid-page]

Inter-IC Sound (I2S™)

 

Bit-depth | Videos/Digital Show and Tell - XiphWiki

[last sentence of next to last paragraph]

That's right; your old mix tapes were only about 6 bits deep if you were lucky!

 

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

These also require strange split power supplies and serious op amp circuits to get decent sound out.

???

 

OK, I'm not an audio person...

 

But you have totally lost me.

An R2R ladder REQUIRES an op-amp driver on its output to isolate the load's input impedance from the R2R ladder's impedance, and totally screwing up its linearity.

 

One then, typically, would incorporate a LPF into the op-amp buffer to eliminate the high frequency switching noise from the DAC, otherwise is will certainly alias down and introduce distortion.

 

So roll your own R2R or use an old school DAC with its internal R2R (or other technique), and you still need the op-amp buffer and LPF no matter what approach you take.

 

There are plenty of on-line unipolar LPF op-amp designs and calculators on the web, and the good news is that once you design one, and test it on a breadboard, you just build 7 more just like it!

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


For "old" school here is a 1984 handbook, listing dacs avail at that time

 

http://www.bitsavers.org/compone...

 

 

The AD7541A is still avail today in DIP (as old stock)   & is single supply (didn't check the others)

Its brother is avail from Digikey for $11

https://www.digikey.com/en/produ...

 

here's some ultimate classic parts https://www.ebay.com/itm/3719125...

 

Ebay has a bunch of regular (non-gold) dip DACs as well

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AtomicZombie wrote:
Have you tried the AVR-DB DAC yet?
My DSO unfortunately has an 8-bit ADC.

An Analog Discovery 2 may be a fit for measuring AVR Dx DAC noise though couldn't locate its noise data.

 

Setup for Use Case #2 | GitHub - microchip-pic-avr-examples/avr128da48-using-10-bit-dac: Using 10-bit DAC for Generating Analog Signals on AVR-DA

Generating Sine Wave Signal Using 10-Bit DAC

...

Analog Discovery 2 - Digilent Reference

[1/4 page]

Resolution

14-bit

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

gchapman wrote:

AtomicZombie wrote:
Have you tried the AVR-DB DAC yet?
My DSO unfortunately has an 8-bit ADC.

 

If it helps I can do audio measurements with a 24-bit unit (the QA401 on the right).

 

 

@AtomicZombie are you going for fixed or variable rate sampling?

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

Last Edited: Mon. Jan 3, 2022 - 08:19 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

aproposwink

 

Veritas ex machina | Videos/Digital Show and Tell - XiphWiki

2 July 2013

[in last few paragraphs]

For digital conversion, we use a boring, consumer-grade, eMagic USB1 audio device. It's more than ten years old at this point, and it's getting obsolete.

...

Just because we can measure an improvement doesn't mean we can hear it, and even these old consumer boxes were already at the edge of ideal transparency.

The eMagic connects to my ThinkPad, which displays a digital waveform and spectrum for comparison, then the ThinkPad sends the digital signal right back out to the eMagic for re-conversion to analog and observation on the output scopes.

Emagic hardware | Emagic - Wikipedia

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for all of these great posts, full of information.

 

I am doing some testing today, and will be putting the AVR-DB into the ring with it's DAC as well.

Even though it will be a royal pain to twiddle that 8th bit in from the SRAM, the fact is that these little dudes easily overclock to 40MHz with a lot more headroom.

The Atmegas (latest Microchip releases) will easily do 30MHz, even the 1284, which back in the Atmel days had an issue with even 25MHz.

 

Not sure what they have done differently, but damn do these new ones really crank!

I have also noticed that the ones that can double their clock speeds have the bright white branding.

 

Perhaps I can do just fine without overclocking, but somehow it's more fun to continue to break rules.

30MHz on a 16 square foot breadboard with 20" long wires, 8 Bit tech doing things normally left for an FPGA, and screaming clock rates at their bleeding edge.

 

Ok, I have a circuit half done, and it will be a competition between the following...

 

1) ATMega 324P overclocked to 30MHz, pushing out  a 10 Bit sample to its PWM.

 

2) AVR DB128 overclocked to 30-40MHz pushing a sample out to its 10 bit DAC.

 

I don't expect the 324 to be able to achieve the performance I want for sample rates, not after multiple layers of programmatically assigned effects are applied to the sample data. In previous work with PWM, I have found that 32KHz sample rates are about the minimum. The DB can probably do it, and I have yet to really determine the overclocking edge. When overclocking, I usually push 2MHz increments until some of the internal functions stop working, and then back off by about 4 MHz. Tiny85 can always do 32MHz, sometimes 40MHz, and all XMegas can easily do 64MHz, sometimes even 80Mhz. Will be interesting to see what DB can crank out.

 

As a final option, I may consider keeping the 324 to do the shoveling of data to and from the working RAM (as well as effects processing) and then hurl the final data to the DB so it can simply act as a DAC, running at the absolute highest possible clock rate. This options is still less expensive than most dedicated DACs. 

 

Will report back when I have some data (or smoke) to show.

 

Brad

 

 

No Fate But What We Make!

Last Edited: Mon. Jan 3, 2022 - 05:43 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


AtomicZombie wrote:
Not sure what they have done differently, but damn do these new ones really crank!
Microchip Tempe (Arizona) now wafer fab AVRe+ in addition to Microchip Colorado Springs (Colorado); Microchip Gresham (Oregon) may join.

AtomicZombie wrote:
Perhaps I can do just fine without overclocking, but somehow it's more fun to continue to break rules.
Bulging envelopewink

AtomicZombie wrote:
I don't expect the 324 to be able to achieve the performance I want for sample rates, 
mega324 PDIP "may" have a follow-on in mega4809 PDIP.

AtomicZombie wrote:
... and then hurl the final data to the DB so it can simply act as a DAC, 
AVR DB SPI may be an alternative but no DMA for either MCU (working RAM, DAC)

Can enhance SRAM to add a dual-port feature; dual-port SRAM is EOL'ing due to FPGA.

Reason : RCA CDP1802 has DMA

 


Tempe Fab 2, Gresham Fab 4 | AVR Freaks

GBNG-06LXXH156 | Product Change Notification | Microchip (mega4809 wafer fab)

 

Push Performance and Power Beyond the Data Sheet White Paper (Texas Instruments)

EETimes - Go beyond the datasheet - Part 1: Dependencies and guardbands

EETimes - Go beyond the datasheet, Part 2: Understand the considerations

 

ATmega164A; ATmega164PA; ATmega324A, ATmega324PA, ATmega644A, ATmega644PA, ATmega1284, ATmega1284P

[page 11]

Figure 1-1. Pinout

40-Pin PDIP | ATmega4808/4809 Data Sheet

 

Through Hole CPLD - Complex Programmable Logic Devices – Mouser

Search results for: dual Through Hole SRAM – Mouser

CDP1802A, CDP1802AC, CDP1802BC CMOS 8-Bit Microprocessors (Intersil was acquired by Renesas)

CDP1802ACD3 Renesas / Intersil | Mouser

Introduction | GitHub - brouhaha/cosmac: RCA COSMAC CDP1802 functional equivalent CPU core in VHDL

[last sentences]

A PIXIE graphics core equivalent to the CPD1861 is also provided. The PIXIE core uses a dual-port frame buffer to allow NTSC-rate video output independent of the CPU core clock rate

IIRC, the relatively inexpensive Zilog Z80 boards had dual-port DRAM between MPU and video.

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am still doing some hardware tests on various DAC options, the results being tested by looking at the waveforms on a scope and then listening on headphones. It will take some time to setup the test rig, but so far I do have an AVR324 sending out some basic sin / saw / tri /sqr waves to an 8 bit R2R  DAC just to verify coding.

 

What was surprising is how clean the sinewave looks on the scope, even at 8 bits. Surprising because not long ago I was doing some testing on the 12 Bit 4822 serial DAC and do remember there being a significant amount of noise in the 12 bit computed sinewave I sent to it, enough to easily see on the scope.

 

I may put my 1% R2R 8 Bit DAC back into the test ring. The advantage would be much higher sample rates due to only having to read 1 byte at a time from the SRAM.

Since all of my "samples" are going to be computed by the AVR and written to the SRAM, 8 Bits may be enough.

 

I know from previous testing (converted 16 Bit Wave audio) that an 8 Bit R2R was not good enough for decent sounding sample playback, even after careful manipulation in Audacity to trim as much noise and aliasing out as possible. But in this case I am directly writing the 8 Bit Data, so perhaps it will be clean enough at 30+ KHz playback rate.

 

This is going to be interesting.

I won't post again until I have photos and video of the DAC testing to show.

 

Brad

No Fate But What We Make!

Last Edited: Wed. Jan 5, 2022 - 03:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AtomicZombie wrote:

What was surprising is how clean the sinewave looks on the scope, even at 8 bits.

 

What's the vertical resolution of your 'scope?

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


What's the vertical amplifier's frontend noise?

Reasons : "tape hiss", PC sound "card" may have less noise

 

T3DSO1000 / T3DSO1000A Data Sheet

[page 8]

Noise

ST-DEV ≤ 0.5 division (< 1 mV/div)

ST-DEV ≤ 0.2 division (< 2 mV/div)

ST-DEV ≤ 0.1 division (≥ 2 mV/div)

Bit-depth | Videos/Digital Show and Tell - XiphWiki

...

Intuitively, that means that we can measure tape hiss and thus the noise floor of magnetic audio tape in bits instead of decibels, in order to put things in a digital perspective.

...

 


Teledyne LeCroy - T3DSO1000/1000A Series Oscilloscopes

 

edit : misnomer

 

edit2 : FAN3852 noise is about 6 microVrms over our audio range.

FAN3852 - Microphone Pre-Amplifier with Digital Output (onsemi)

[page 3, middle]

Table 5. DEVICE SPECIFIC ELECTRICAL CHARACTERISTICS

[SNR, eN]

[page 7, top]

Figure 7. Mono Microphone Application Circuit

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Wed. Jan 5, 2022 - 04:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You may be interested in... 

 

https://youtu.be/njMQmmgvpbg 

 

I have been considering whether RP2040 could be good for a synth design as $3 buys you a board that has dual core 133MHz ARM which is plenty of headroom for audio processing. 

 

That video confirms beyond any doubt that it's a great platform for synthesized audio! 

 

The chip does not natively have I2S but it has these peripheral sub processors called PIOs (which sounds innocuous but is a real wolf in sheep's clothing). They can, apparently, be easily programmed to create I2S. This really intriguing video explains what PIOs actually are with their little 9 opcode processors and 32 step instruction memory.. 

 

https://youtu.be/yYnQYF_Xa8g

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AtomicZombie wrote:

What was surprising is how clean the sinewave looks on the scope, even at 8 bits. Surprising because not long ago I was doing some testing on the 12 Bit 4822 serial DAC and do remember there being a significant amount of noise in the 12 bit computed sinewave I sent to it, enough to easily see on the scope.

The "other" 8 bit of a (e.g.) CD are there for loudness dynamic, with constant amplitude 8 bit is plenty.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

I have been considering whether RP2040 could be good for a synth design as $3 buys you a board that has dual core 133MHz ARM which is plenty of headroom for audio processing. 

 

In comparison to what was under the hood of a typical 80s synth a dual-core ARM is many many times more powerful.

 

Take the classic Fairlight CMI Series 2 for example. The main processing was a pair of 6809s running in antiphase so they both talked down a common buss. The sound came from 8 channel cards as analogue signals which were essentially a set of programmable counters reading out of 16k x 8 of RAM. The graphics display was bitmapped RAM with a bit of hardware assist to ease vector drawing.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

Last Edited: Wed. Jan 5, 2022 - 04:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's an older 250 MHz Agilent DS03202A, and I could not find that info when I looked it up.

 

When I looked at the Sine Wave, I zoomed in quite far to capture the edge, and the 12 Bit 4822 DAC seemed to produce a waveform that had as much or even more distortion than the R2R DAC hung right off the AVR port. Even dropping the 4 LSB to issue an 8 Bit signal, I don't think it was much better than my 1% resistor ladder.

 

The Sine wave saw being produced by a 12 bit value in a lookup table in a tight assembly routine that was cycle counted for an equalized loop.

 

On the scope, I viewed a 10KHz Sine Wave, and for my "real world" test, I produced a 440Hz Sine Wave that ramped from zero volume to full volume over 4 seconds so I could listen for any noise in the silence using headphones.

 

Both actually sounded the same to me.

When I did the same tests using music samples I converted in Audacity, noise was much higher in the low end of the volume range as expected.

 

This is why I am wondering if I even need more than 8 bits since I am only computing samples in code for this project.

Each channel will also have quite a bit of post processing done to the audio, going through DAC controlled filters such as the Buchla-style low pass with resonance and various others.

 

Looking ahead, I would say that the audio from the DAC will have to travel through at least 6 or more op-amps before it reaches the amp stage, so maybe in this case a faster sample rate is better than worrying about those extra 2 or 4 bits.

 

So much to consider, but I will continue to do what I have always done on my projects...

 

Breaboard the damn thing and test it in the real world.

In the end, it is all about the sound produced.

 

The real power in this project will be the Operating System running on the main AVR, specifically the application I call WaveLab, which will be computing the waveforms that are stored in each channels 512K SRAM. Since none of the math has to happen in real-time, I should be able to move the earth with the diversity of sounds possible here.

 

I have been considering using a scripting language similar to basic that will run on the OS so I can define sounds in a mathematical / code method.

A lot can be done with simple commands such as...

 

 For ctr = 0 To 524287
      a = Int(b - (Math.Sin((ctr) / 333) * b))
      b = Int(63 - (Math.Sin((ctr) / 5555) * 63))
      c = Int(127 - (Math.Sin((ctr) / 55) * 127))
      d = (a * c) / 256
      f = Int(127 - (Math.Sin((ctr) / 6) * 127))
      WAV(ctr) = (f * d) / 256
Next

 

Originally, I though of just doing a visual UI that allowed mixing of waveforms, but there is only so much that can be done with FM Synthesis, and to me all of the synths of that era had a similar sound. I want this system to be way out of the box and be able to produce anything from 70's style analog right up to thick spacey string sounds. Percussion, FX, and even speech!

 

Ok, enough dreaming for now, I have wires to connect before I get too far down the rabbit hole.

 

Later,

Brad

 

Brian Fairchild wrote:

AtomicZombie wrote:

What was surprising is how clean the sinewave looks on the scope, even at 8 bits.

 

What's the vertical resolution of your 'scope?

No Fate But What We Make!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:
In comparison to what was under the hood of a typical 80s synth a dual-core ARM is many many times more powerful.
yup, that's why I like the 600MHz Teensy 4 so much for synth design (that and the fact that the drag and drop synth designer makes it about 5 minutes work to create one!) but the only downside of Teensy 4.0 or Teensy 4.1 I now use is that it's a £25 board with a £15 audio interface on top so it's great for a one off but if you wanted to consider something commercial the BOM is far too high whereas a £3 board is a completely different kettle of fish though you drop to 133+133MHz. In volume you'd just buy the relatively simple to lay out chip on its own for an even lower cost. 

 

I know this is a Microchip site and we should promote their solutions but unless I'm missing it I'm not seeing anything even remotely comparable in Microchip's portfolio. 

 

(there's a pretty strong reason why, up to now, many, many digital synthesis Eurorack modules have a Teensy 4 hanging out back, the RP2040 could well change things though) 

Last Edited: Wed. Jan 5, 2022 - 05:02 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AtomicZombie wrote:

Looking ahead, I would say that the audio from the DAC will have to travel through at least 6 or more op-amps before it reaches the amp stage, so maybe in this case a faster sample rate is better than worrying about those extra 2 or 4 bits.

 

Since you're gong old school, and if you can find any, keep the output from the DAC at full amplitude and deal with amplitude changes in the analogue domain. Chips like the CA3080 or LM13600/13700 can still be found. Or use a DAC with an external reference as a multiplying DAC.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AtomicZombie wrote:
I have been considering using a scripting language similar to basic that will run on the OS so I can define sounds in a mathematical / code method.
WaveLab and a C interpreter should fit in a mega1284.

Python 3 would fill a mega1284 though there would be a porting effort; PIC24 may be easier.

 

README · master · Zik Saleeba / picoc · GitLab

micropython-avr8/README.md at master · slavaza/micropython-avr8 · GitHub

https://github.com/micropython/micropython/blob/master/ports/pic16bit/Makefile#L13

PIC24FJ256GA702 | Microchip Technology

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I may put my 1% R2R 8 Bit DAC back into the test ring.

Here is a bad idea:

Since you control what is being generated AND the DAC distribution, you could warp samples, so that of the 256 codes, more of them are used at the lower voltages....so with weak levels where things are more sensitive (such as hearing and background noise) , you get finer steps & with louder sounds you get bigger steps, but it is less noticeable....your own compander.

That would be a lot of work, but you seem to enjoy it!

(fig 1)

https://www.analog.com/media/en/...

 

8 bits "turns into 17 bits", well sorta

https://www.analog.com/media/en/...

https://www.digikey.com/en/produ...

 

High-Purity Sine Wave Generation Using Nonlinear DAC with Pre-distortion Based on Low-Cost Accurate DAC....  This chapter presents a novel method that is capable of generating a high-purity sine wave using a low-cost nonlinear DAC. The purity of generated sine wave is significantly better than the original DAC output. In addition, with the aid of the low-cost DAC-ADC co-testing method, both DAC and ADC linearity information are accurately obtained with only 1 hit per code.   https://link.springer.com/chapte...

 

You could also "tack on" an opamp circuit to a standard linear dac, but that would not be nearly as much fun!

https://www.electronics-tutorial...

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Wed. Jan 5, 2022 - 06:11 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AtomicZombie wrote:
This is why I am wondering if I even need more than 8 bits since I am only computing samples in code for this project.
frown

The closer to studio tape the better (dynamic range and low noise)

A 2008 XMEGA AVR moves data nearly as fast as a 1985 i386.

16-bits is more than enough ... 8-bits is arguable.

AtomicZombie wrote:
In the end, it is all about the sound produced.
yes

 


https://github.com/microchip-pic-avr-examples/avr128db48-low-bom-mic-interface-using-opamp#low-bom-microphone-interface-using-the-analog-signal-conditioning-opamp-peripheral

The estimated SNR is 100 which is good enough for inexpensive microphones for most use cases.

Replacing AVR DB's bulk CMOS op amps (very noisy) with zero-drift CMOS op amps (very reasonable noise) increases the SNR s.t. that AFE is a match to the AVR DB's ADC.

TC7652 | Microchip Technology

Conversely, SMT :

NCS333: Low Power, Zero-Drift Operational Amplifier with 10 µV Offset (onsemi)

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks again for all of these great responses, it offers a lot to think about as I move towards a final design.

I am on the road for work a lot, sitting in a hotel along the cold shores of Lake Superior right now catching up on this thread.

 

As I study the pros and cons of various DAC technologies, a somewhat "out there" thought came to mind....

 

Knowing that 6 Bits is about the best one can expect from a 1% resistor R2R DAC due to linearity going out of spec, what if I simply accepted this fact and made a 12 bit DAC but let the AVR sort it all out in a self calibrating lookup table?

 

Crazy?

It would work like this...

 

A 12 Bit R2R made of 1% resistors, passed to the op-amp and then right back to the 12 bit ADC on the AVR-DB. I would reserve 4K of the 16K internal SRAM for a fast 12 bit lookup table that would store all of the corrected values after they have been read and processed back into a completely linear format.

 

This self-tuning operation would only have to happen once on power-up, and only take a few milliseconds. Now the lookup table would correct any linearity issues between the MSB and few lower bits that may be out of spec. The overhead cost of this (in cycles) would be better than the overhead required to control a 12 BIT SPI DAC, so sample rate could be high.

 

Of course, this idea seems so good that it must have been considered decades ago and not implemented for some reason I am overlooking.

 

So far, I am swaying towards the MCP4822 DAC, since it is an 8 pin DIP, and I have a dozen of them in my parts box.

I intend to do all of my wave processing in 32 bits inside the AVR, so pushing out 12 bits gives plenty of headroom for the math.

 

I have also decided that I will add PS2 mouse support to the OS so that I can easily draw and edit waveforms on the screen.

The PS2 hardware is age appropriate, and I even have a box full of ancient ball mice, some dating back to the 80's for use on the C-64!

 

Brad

 

No Fate But What We Make!

Last Edited: Thu. Jan 6, 2022 - 02:58 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AtomicZombie wrote:

A 12 Bit R2R made of 1% resistors, passed to the op-amp and then right back to the 12 bit ADC on the AVR-DB. I would reserve 4K of the 16K internal SRAM for a fast 12 bit lookup table that would store all of the corrected values after they have been read and processed back into a completely linear format.

 

Wouldn't the ADC need to have a greater number of bits than the DAC for this to work?

 

[E2A]

I can't get my head around how this scheme would work with missing codes. Especially larger steps caused by MSB changes. I need to draw it out.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

Last Edited: Thu. Jan 6, 2022 - 03:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Increased precision by ADC's accumulator though oversample-and-decimate is preferred.

AVR® Dx - Additional Features | ADC | Migration from the megaAVR® to AVR® Dx Microcontroller Families

 

edit :

https://github.com/microchip-pic-avr-examples/attiny1627-training-12-bit-adc#assignments

  • Assignment 3: ADC Resolution from 12-bit to 17-bit

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Thu. Jan 6, 2022 - 03:31 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The way I see it working is that the sampling ADC and the outputting DAC would have the identical number of bits.

Oversampling on the DB (gchaman) would be ideal for this.

 

The end result is that the AVR would now know which values were nonlinear (noise).

The lookup table would simply order all of the samples from lowest to highest.

Some values might even be the same, and that's ok, as long as lower values are not higher as that creates what we know as audio noise.

 

The idea came to me when I was looking at some old VGA Generator code that allowed me to define the order of 256 colors.

So if 10% of the DAC values are out of order due to resistor precision defects, no prob.... just adjust the lookup table and send them out correctly.

 

This idea still seems too good to be true.

Brad

 

Brian Fairchild wrote:

 

Wouldn't the ADC need to have a greater number of bits than the DAC for this to work?

 

 

[E2A]

I can't get my head around how this scheme would work with missing codes. Especially larger steps caused by MSB changes. I need to draw it out.

No Fate But What We Make!

Last Edited: Thu. Jan 6, 2022 - 04:49 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The lookup table would simply order all of the sampled from lowest to highest.

Yes you could do that---you will likely end up with gaps & bunching---so the 4096 values would not be evenly distributed.  So it might work, but you will get fewer effective bits.  how many?....hmm

You'll need low ppm  drift resistors to maintain ordering....1/4096 is 244 ppm. and you need to maintina over some temperature range.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I had another day on the road to think about DAC options and have decided to put a rock over the rabbit hole and go with the MCP4822 option.

 

An ATmega32p in each channel will take care of commands from the main CPU, hurl data to the SPI DAC and do some basic effects.

I already have these components here, and the 12 bit DAC will certainly be good quality, and fits my project rules.

 

Most of this hardware is now on the breadboard and I will post some results when I have a chance.

 

Brad

 

No Fate But What We Make!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AtomicZombie wrote:
When I looked at the Sine Wave, I zoomed in quite far to capture the edge, and the 12 Bit 4822 DAC seemed to produce a waveform that had as much or even more distortion than the R2R DAC hung right off the AVR port.
low THD and/or low PSRR?

MCP4802/4812/4822 Data Sheet (PSRR = -60 dB at 10 Hz)

LTC8043 - Serial 12-Bit Multiplying DAC (PSRR = -120 dB, THD = -108 dB at 1 KHz)

due to

The Art of Electronics 3rd Edition | by Horowitz and Hill

Download a sample chapter

[page 22, bottom of right column]

13.3. Multiplying DACs. 894

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a nice clean 12 Bit Sine Wave coming out of the 4822 DAC now.

Just as a sanity check, I sent a computed 8 Bit Sine Wave to a carefully matched R2R DAC as a comparison.

So even with the bit of noise on the LSBs, the 12 Bit sound is far better, especially at lower volume levels.

 

So that concludes DAC testing, and I am happy with the results.

 

In my never ending insane fetish for cycle counting, I ran up against something odd when optimizing my SPI routine...

 

// SEND SPI DATA
out SPDR0,r24
TXW:
in r0,SPSR0
sbrs r0,SPIF0
rjmp TXW

This is the usual method, and it certainly works fine, but I should be able to shave a few cycles by using NOPs instead of the polling like this...

 

// SEND SPI DATA
out SPDR0,r24
nop
nop
nop
nop
nop
nop
nop
nop

By inserting the exact number of NOPs required as the SPI sends out bits, I will always exit at the same time.

The polling routine could have up to 3 extra cycles of overhead because of the way it has to jump.

 

What is odd is that I can't make this work, no matter how many NOPs I add.

I even tried a few hundred NOPs in a loop, knowing damn well that was way more than needed.

But no matter what, the SPI will not send that way.

 

Am I missing something obvious?

I even tried doing a dummy read to SPSR0 in case internally that triggered something, but that still does not work.

 

I am going to keep moving forward, but this should work and will probably count for some lost sleep!

 

I will post some videos and sound captures of the DAC playing a bell sound once I have some basic code to generate the sound.

 

Brad

 

No Fate But What We Make!

Last Edited: Mon. Jan 10, 2022 - 10:08 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AtomicZombie wrote:
Am I missing something obvious?
slave select?

Master Mode | ATmega328PB

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, the SPI is setup in master mode, double speed.

 

// SET SPI TO MAXIMUM SPEED
SPCR0 = (1<<SPE0)|(1<<MSTR0);
SPSR0 = (1<<SPI2X0);

 

Everything works fine, I just want to ditch the polling and shave 3 cycles.

I am getting 1.12KHz output of a 256 step Sine Wave, which is certainly decent (287 KHz sample rate), but I think I can do a small bit better.

No real reason, since I intend to drop to about 40KHz sample rate, but I am obsessed with optimization in assembly.

 

Brad

 

 

gchapman wrote:

AtomicZombie wrote:
Am I missing something obvious?
slave select?

Master Mode | ATmega328PB

 

No Fate But What We Make!

Pages