Elektor_Mag_-_January-February_2021

([email protected]) #1

26 January & February 2021 http://www.elektormagazine.com


the waveform or frequency. Of course, you’ll
need to change the software to support such
functions. Microcontroller pins PB2, PC0
and PC1 can be used without any problem,
whereas PB4 and PB5 are dedicated pins for
In System Programming (ISP) and care must
be taken that additional connected compo-
nents don’t interfere with this programming
interface.

LED1 was added to indicate that the proces-
sor is busy calculating the audio sample data,
but since this is finished in only a quarter of a
second PB3 can also be used for additional
features. In that case, R1 can be connected
to the power supply as power-on indicator.

If and when you add functionality to this I2S
signal generator, if you have any other remarks
or suggestions regarding this project, don’t
forget to share it with us and other readers
on the Elektor Labs page [3]!
200253-01

described earlier in this article needs about
10%. So there is some space left in program
memory to extend the code and add extra
features. Note that the free demo version of
BASCOM-AVR can not be used to compile the
software due to its program memory limita-
tions, you’ll need to buy a registered version
if you want to change the program.

The software download for this project [2]
contains the HEX-file for the original firmware,
so this project can be built without a licensed
BASCOM-AVR version, just an AVR-ISP
programming interface and programming
software like Atmel AVR Studio or AVRDUDE
will get your ATmega128 up and running.

...or hardware
There are still some I/O pins of the micro-
controller unused that can be implemented
to control additional features, like changing

be added after every byte. It takes three clock
cycles for the Do-Loop to restart, which is
perfect to produce one full period of 192
samples of a 1 kHz sine wave. So the only
thing the main loop of the program has to do
is to output the bytes of the array to port D.


Building the hardware
We have designed the PCB shown in Figure  3
for this project, the layout and the Gerber
files are available for download. Alternatively,
you can use a piece of Veroboard, as our
designer did in the first prototyping phase
(see Figure  4 ).
If you are unable to find a supplier for the
74AC4040, it is possible to cut the connection
between pin 13 and 14 of IC4. By connect-
ing pin13 to ground with a jumper wire a
74 HC 4040 can be used, but timing is far from
optimal and could pose a problem with the
DAC being tested. This correction works with
our RPi DAC though. The wires from K2 of
the generator to the DAC should be kept as
short as possible.


The supply voltage of this circuit must
match the voltage of the DAC under test. At
VCC = 3.3 V, the current consumption is just
over 20 mA.


Changing software...
The program uses 77% of flash memory
space. Just calculating the sine wave as


Questions or Comments?
Do you have questions or comments
about his article? Email the author at
[email protected].

Contributors
Idea, Design, Text: Ton Giesberts
Schematic and illustrations:
Ton Giesberts, Patrick Wielders
Editor: Luc Lemmens
Layout: Giel Dols

related products


> RPi High End Audio DAC - Bare PCB (160198-1)
http://www.elektor.com/rpi-high-end-audio-dac-pcb-160198

> Raspberry Pi High End Audio DAC – Module (160198-91)
http://www.elektor.com/raspberry-pi-high-end-audio-dac-module-160198-91

Figure 4: The prototype of the generator on Veroboard.

Free download pdf