DDS Frequency Generator With ESP32 - Part 2

by AZDelivery in Circuits > Arduino

40 Views, 0 Favorites, 0 Comments

DDS Frequency Generator With ESP32 - Part 2

AT-Tiny2313 am Arduino-Programmer (1).JPG

In the previous episode we examined the DDS capabilities (direct digital synthesis) of the ESP32. In the hunt for faster solutions for our DDS generator, we have to look for a micro controller who eight bit wide port offers and with one external clock signal can be supplied. Either the giants of Microchip, formerly atmel at Mega 16 and at Mega 32 or, because we do not want to shoot on sparrows, the dwarf, an at Tiny 2313. I chose the little one because port B provides the required eight output lines and because it can be supplied with an exact, external quartz oscillator up to 20MHz instead of only 16 MHz as with AT MEGA16/32. You can find out in today's episode which tools are required to write and program an AT Tiny 2313 and how to work with them


Micropython on the ESP32 and ESP8266

today

The ESP32 gets quick reinforcement

So what's up today?

· Procurement and installation of Atmel studio 7.0

· Procurement and installation of the Arduino IDE

· AZ-Arduino Nano Set up V3 as the programmer of Atmel chips

· Procurement and establishment of the programmer software

· Create and burn assembler test program for the AT Tiny 2313

Our ESP32 can rest today while we take care of his fast DDS helper. What is needed in hardware for this?


In the course of project development, we need two Breadboards that are put together on the long sides over two stream rails so that the controller, the quartzoscillator, the resistances and the Arduino Nano Have space.

The first part of the structure to burn the flash content of the AT Tiny 2313 is very simple, as Figure 1 shows.


illustration 1: Circuit for burning the flash content at the Attiny2313

Before we go to work, we need a few more software modules.

Supplies

The Software

For flashes and the programming of the AT Tiny 2313:

Atmel studio 7.0

Avrdude (contained in the Arduino IDE)

Arduino IDE

Signal display:

Saleae Logic 2

The AT Tiny 2313 programs for the project:

tinytest.asm First test program

How does the program get the AT Tiny 2313?

What Thonny is for the development of micropython programs is Atmel-Studio 7.0 for writing assembler (or C ++-) programs for ATMEL building blocks. With the help of Thonny, we send data and firmware directly via the USB line to the controller.

For Atmel chips, we need a so-called programmer to burn programs, which implements the data from the USB bus into Atmel-compliant signals. An AVR MK II (price around € 20) is ideal because this component can be addressed directly from the Atmel studio 7.0 and thus significantly simplifies the programming process.


illustration 2: AVR-MK II Programmer of Atmel

But it is also cheaper if you only want to program an Atmel controller in between and accept a little more circumstances. It also works with an Arduino clone. This can be a microcontroller Board AZ-ATMEGA328, an AZ microcontroller Board LGT8F328P or an AZ-Nano V3-. Because an Arduino derivative is usually dusted somewhere in a corner, I chose the latter variant. In this post an AZ plays Nano V3 the programmer role. So the Nano We learn to play programmmer, we need the first Arduino IDE.

Get and install Arduino IDE

Download the installation file and save it in any directory.


illustration 3: Download the installation file

In the next window you have the choice - download with or without a donation.


illustration 4: You have the choice

You must agree to the data protection regulations, you do not need to specify an email address.


illustration 5: Agree to the data protection regulations

Navigate now to the target directory and OK.


illustration 6: Save the file

Now switch to the target directory in the Explorer and start the installation file.


illustration 7: Run installation

The license requirements must be accepted, then select the user group.


illustration 8: Accept license agreements

To release the Arduino IDE for all users, you must have admin rights.


illustration 9: User selection

It is best to confirm the specification of the target directory for installation.


illustration 10: Confirm directory selection

After the installation is over, let the IDE start.


illustration 11: Complete installation

Now a few more steps are running automatically. We have the drivers for USB access installed.


illustration 12: Install the driver for USB access

Now the right time is to connect the Arduino board to the PC so that the virtual COM interface is recognized in the next but above.

The IDE offers other components for furnishing, we allow the update and have everything installed, then we no longer need to take care of it later.


illustration 13: Start window after installation

The IDE now shows the available COM ports, we choose the right one and also peck our board from the list.


illustration 14: Port and board selection

Port and controller board can also be subsequently Tool-Menu can be set up.


illustration 15: Board selection via the menu

The Nano V3 becomes an ISP

The AZ-Nano To transform V3 into an ISP (in System Programmer) is not a feat. The required sketch is supplied in the IDE (Integrated Development Environment = Integrated Development Environment). We get it over the menu Files - Examples - 11 Arduinoisp - ArduinoSp In the editor.


illustration 16: Sketch ArduinoSp Load

Finally we have the sketch compiled and send the result for Nano V3.


illustration 17: Compiling sketch and uploading

Unfortunately, we cannot use the Arduino IDE directly to burn our own assembler programs in the AT Tiny 2313. But the IDE provides a hint for another solution. If you scroll up in the output window, you will find the line with the command through which the translated hex file of the sketch on the AT Mega 328 on the Nano-Board was sent. Since this transmission runs via the USB connection, we can also use the AVRDUDE tool, which is called here, also for our purposes. More on that later.


illustration 18: Call from Avrdude

We come back to this line when we will send the first assembler test program to the AT Tiny 2313. But first we have to write and assemble this program and another free tool helps us.

Atmel Studio 7.0- Development Environment for Atmel Chips

Atmel studio 7.0 is a network of editor, assembler, debugger, simulator and disassembler. Let's take a look at how to write an assembler program with the program, test, translate and to the controller.

First load them Installation file Down and save them in a directory of your choice. Navigate to the download directory and start the installation.

We have to agree to the license agreements so that the installation begins.


illustration 19: Agree to the license agreements

We only need the 8-bit family on controllers.


illustration 20: Select the controller family

We can also need the examples if necessary.


illustration 21: Installation with installation

We acknowledge the system check with Next if all points have a green hook.


illustration 22: System check result

After the successful installation, we also start for the first assembler session.


illustration 23: Installation ended

On the homepage we will join a new project - New Project.


illustration 24: Surface after the first start

We give a name for the assembler project - tinytest. A directory of the same name is created to store the project files.


illustration 25: Create a new project

Now we just have to select the controller type - at Tiny 2313 (A) - then the editor window opens. There we copy the program text from the file tinytest.asm, after we deleted the text presented. In our project, the file main.asm.

The First Assembler Program

What is assembler?

Assembler is a machine -close language. By using Assembler is a machine -close language. By the interpreter. That makes micropython programs slowly.

Similar to a C program, there is no way to explore commands interactively, as is the case in Micropython in Repl. But at least ATMEL-Studio 7.0 with its debugger offers the opportunity to gradually go through the program and to look at the content of the registers and memory areas as well as IO operations and to check for correct execution of the operations.

A list of command mnemonics can be found in Data sheet of the AT Tiny 2313 on pages 257 and 258. Don't be afraid, we will only use a small part of it in our programs.

The timing test

Notice: AVR assembler code is not case sensitive, so it is not differentiated between upper and lower case.

As with our ESP32, we want to check how fast the little one is when it comes to querying and issuing DDS data. We are guided By the program dds_generator_irq.py. Again we let two pins switch on and off and look with the Logic Analyzer how the timing works.

We copy the text of the program that we are now discussing from the file tinytest.asm In the editor window of ATMEL-Studio 7.0, if that hasn't already happened. This becomes the file main.asm In our project. The name main.asm Automatic ATMEL-Studio 7.0.

Constants are with .Equ fixed. We show the clock frequency of our quartzoscillator of 20MHz the identifier clock to.

.Equ tact = 20000000 ; 20 MHz is the system clock

At Tiny 2313 there are special memory cells on which operations can be carried out, the registers. At Tiny 2313 there are 32 of them. So you perform the task of a CPU. Register can also receive alias names. Here the register R16 to R18 are renamed. To name registers .def used.

.def speed = r16 ; Renamen some registers

.def Temp2 = r17

.def Temp3 = r18

Register can only absorb 8-bit values. We need four of them to process 32-bit values.

.def DDSP0 = r20 ; DDS phase

.def DDSP1 = r21 ;

.def DDSP2 = r22 ;

.def DDSP3 = r30 ;

.def DDSD0 = r24 ; DDS phase increment

.def ddsd1 = r25 ;

.def ddsd2 = r26 ;

.def ddsd3 = r27

In contrast to the ESP32, we do not have individual GPIOs in the AT Tiny 2313, but ports with six (port d) and eight bits (port b) width. This allows us to be the simultaneous edition of eight bits, which is essential for the self -constructed DAC. The AT Tiny 2313 has no built -in DAC.

We set the pins to measure the timing Portd.4 and Portd.6 a. The port is also a register, which is not capable of any arithmetic or logical operations. Each port includes a data directional register that determines which PIN is as an input (GDR-bit = 0) or output (GDR-bit = 1). IO registers have their own address area, which ranges from 0x00 to 0x3f. In addition to the one-output registers, there are other registers in the address area, which, for example, control the function of the timers, interfaces etc.

.Equ Looppin = 4

.Equ Timerpin = 6

.Equ MPPORT = port; portd = 0x12

.Equ mddr = GDRD ; GDRD = 0x11

The frequency of the sampling frequency for our DDS application results from the measurements that we will carry out later. Isrvalue is a comparative value for the hardware timer By which the IRQ folk frequency is determined. If the timer reaches this value, it is reset and begins to count system clates again. A system clock corresponds to a period of 50Ns at 20MHz. With 40 system cycles we get 2µS IRQ sequence time.

; Maximum sampl frequency: 20,000 hz / 24 = 833333 Hz

; Selected frequency of sampling: 500 kHz

; Top value for Timer1:

;

.Equ isrvalue = 20,000 / 500000; = 40

The DDSD value is calculated in the same way as in previous contribution. Due to the restriction of Atmel studio 7.0 to 32 bends, you have to make a pull-up during the calculation. We divide 2 first31 Due to the frequency of the frequency in KHz and then multiply By 2. In later production mode, this calculation of the ESP32 does and only sends the little one the finished DDSD value.

; DDS offset for 1kHz output signal

; DDSD / 2^32 = 1000/500000 or

; ddsd = 1kHz/500kHz*(2^32) = 8589934

.Equ ddsd = Exp2 (31) / 500 * 2;

We had put the curvet data on the ESP32 in the form of lists. There are no lists in assembler. Instead, we place the DDSS data as Bytes (We had put the curvet data on the ESP32 in the form of lists. There are no lists in assembler. Instead, we place the DDSS data as Bytes) We had put the curvet data on the ESP32 in the form of lists. There are no lists in assembler. Instead, we place the DDSS data as Bytes of We had put the curvet data on the ESP32 in the form of lists. There are no lists in assembler. Instead, we place the DDSS data as Bytes position 0x0400.

; ***********************************************************

; * Curvet data

; ***********************************************************

.cseg

.org 0x0200

Sine:

.db 128, 131, 134, 140, 144, 147, 150

.db 153, 156, 159, 162, 165, 168, 171, 174

.db 177, 180, 182, 185, 188, 191, 194, 196

.db 199, 201, 204, 206, 209, 211, 214, 216

.db 218, 220, 222, 226, 228, 230, 232

.DB 234, 236, 237, 240, 242, 243, 244

.db 246, 247, 248, 250, 251, 251, 252

.db 253, 253, 254, 254, 255, 255, 255

.db 255, 255, 255, 254, 254, 253, 253

.db 252, 252, 251, 249, 248, 247, 246

.DB 245, 244, 242, 241, 240, 238, 236, 235

.DB 233, 231, 229, 225, 223, 221, 219

.DB 217, 215, 212, 208, 205, 203, 200

.db 197, 195, 192, 189, 187, 184, 181, 178

.db 175, 172, 169, 167, 164, 160, 157, 154

.db 151, 148, 145, 142, 139, 136, 133, 130

.db 126, 123, 120, 117, 114, 111, 108, 105

.db 102, 99, 96, 92, 89, 87, 84, 81

.db 78, 75, 72, 69, 67, 64, 61, 59

.db 56, 53, 51, 48, 46, 44, 41, 39

.db 37, 35, 33, 31, 29, 27, 25, 23

.db 21, 20, 18, 16, 15, 14, 12, 11

.db 10, 9, 8, 7, 6, 5, 4, 4

.db 3, 3, 2, 2, 1, 1, 1, 1

.db 1, 1, 1, 2, 2, 2, 3, 3

.db 4, 5, 5, 6, 7, 8, 9, 10

.db 12, 13, 14, 16, 17, 19, 20, 22

.db 24, 26, 28, 30, 32, 34, 36, 38

.db 40, 42, 45, 47, 50, 52, 55, 57

.db 60, 62, 65, 68, 71, 74, 76, 79

.db 82, 85, 88, 91, 94, 97, 100, 103

.db 106, 109, 112, 116, 119, 122, 125, 128

In the program memory area, the Words on the addresses 0x0000 to 0x0012 are reserved for the interruptvectors. The program execution jumps to the program addresses stored here when one of the 13 interrupt sources becomes active. We put the program pointer on the address 0x0000: .org 0x0000. There is a jump (RJMP) to the start label of the program. At the address 0x0005 there is a jump to ISR (Interrupt service routine), which takes care of the overflow of the timer 1.

*************************************************************

; * IRQ vectors

**************************************************************

.org 0x0000 ; Program start

RJMP start ; Reset vector

.org 0x0005 ; Timer1 Overflow Pointer

RJMP T1ovl

The program can begin behind all IRQ vectors.

.org 0x0013 ; Behind all IRQ vectors

*************************************************************

; * Main program preparations

*************************************************************

When starting the program, the stack pointer must first be initialized. The stack is part of the RAM storage and is required, for example, to save the return address when calling a subroutine routine. The stack is at the end of the RAM area and is filled from top to bottom. We invite the LSB to the RAM-end address (Immediate) to the R16 register. And shovel the value into the LSB of the stack pointer (stack pointer low), that is the 0x3d tab in the IO area.

Start:

LDI TEMP1, low (ramend) ; Set stack pointer

Out SPL, speed

We put the phase hand DDSP At the beginning and prove the increment DDSD before loading the registers directly with the values. We break down the previously calculated DDSD value into the four Bytes. This is clearer here than in Micropython.

LDI DDSP0.0 ; Phase register on 0

LDI DDSP1.0

LDI DDSP2,0

LDI DDSP3,0

LDI DDSD0, Low (DDSD) ; Define phase increment

LDI DDSD1, High (DDSD)

LDI DDSD2, Byte3 (DDSD)

LDI DDSD3, Byte4 (DDSD)

In the GDR Register we set the bits 4 and 6. This makes the cables of the port (SBI = Set bit in IO), the condition of which we set to 0 (CBI = Clear bit in IO).

SBI MdDR, Loppin ; Head of Looppin on exit

CBI MPort, Loppin ; Pin low

SBI MdDR, Timerpin ; Head of Looppin on exit

CBI MPort, Timerpin ; Pin low

At Port B, we put all lines out of output.

LDI R16, 0B11111111 ; Portb on exit

Out GDRB, R16

The timer is said to overcrowded after 40 system clocks, they are reached when it has counted up to 39. The timer works with 16-bit values, so we have to determine the MSB and LSB separately and assign the two Bytes of the ICR register. The AT Tiny 2313 manual stipulates that the MSB must be output in front of the LSB.

LDI R17, High (Isrvalue-1) ; Comparative value for timer 1

LDI R16, Low (Isrvalue-1) ; Modus 14

Out ICR1H, R17

Out ICR1L, R16

Bit 7 in the register Timsk (0x39) switches on the timer 1-overflow-IRQ.

LDI R16, 0B10000000 ; Timer 1 Overflow Enable

Out Timsk, R16

We use mode 14 of the timer 1. To explain the more precise background would go too far here. For those interested, I recommend pages 97 ff and Table 12-5 on page 113 of the Manual.

LDI R16, 0B00011001 ; Set mode 14

Out tccr1b, r16

LDI R16, 0B00000010

Out tccr1a, R16

The 16-bit width of Z-Register is made up of the R30 registers (zl) and R31 (ZH) Together and serves as a pointer in the program memory in his special task, where data stored there with the command LPM (Load Program Memory). The Byte block (Load Program Memory). The Byte address 0x0400. With the MSB 0x04 we feed ZH. zl is later set By the ISR. After that, we generally allow interrupts. The command be Set the i-flag in the status register Sreg (= 0x3f).

LDI ZH, 0x02

be

; *************************************************************

; * Main program

*************************************************************

The main loop only has the task that loop Portd.4 to switch on and off, as with the ESP32. RJMP leads a relatively jump to the label loop out of. Labels are ongoing addresses, stand at the beginning of the line and are completed with one ":".

Loop:

SBI MPort, Loppin ; to

CBI MPort, Loppin ; out of

RJMP Loop

*************************************************************

; * IRQ service routines

*************************************************************

The ISR of the Timer-IRQs also has the same task as for the ESP32 in the last episode. The timer, Portd.6, is set, LPM Get a value from the Sinus table over the pointer of the Z register. Without further operands, the value goes to the R0 register, from where it is output on port B.

T1ovl:

SBI MPort, Timerpin ; IRQ signal

LPM ; Get signal level to R0

Out Portb, R0 ; outdate

Add DDSP0, DDSD0 ; Increase phase angle

ADC DDSP1, DDSD1

ADC DDSP2, DDSD2

ADC DDSP3, DDSD3

CBI MPort, Timerpin ; IRQ signal

reti

DDSP must now be increased By DDSD. The two LSBs are simply added (add). This can result in a transmission bit that must be taken into account in the three next additions (ADC = Add with Carry). In addition, the first summary and the sum value is initially in the first operator. Then we put the bit 6 in port d to 0 and return from the IRQ. DDSP3 is that Alias For register r30 = zl.

With the button F7 Starts ATMEL-Studio 7.0 the assembly process and shows the result in the output window. We are now looking for the line with the start of the program and click on the first line afterwards. The red dot indicates that we set a breakpoint at this point.


illustration 26: Set an interruption point

Now we start with F5 A debug session. The simulator starts the program and stops at the Breakpoint. With the button Processor status Let us switch on the advertisement of the registers. With the button F11 we can hike through the program and in the processor Status window. With Ctrl+Shift+F5 Let's switch off the debug mode.

Burning of the AT Tiny 2313

Now only the transfer of the program to the AT Tiny 2313 is missing. With the MK II, we could now simply transfer the program out of the Atmel studio 7.0. Around the Nano To be able to use V3 as a programmer, we need another program that the AVRISP im Nano V3 can control with the correct signals and that is avrdude.exe.

The call to burn the Nano V3 from the Arduino IDE, is, with alleviation, horrendous long. But it also goes shorter and, above all, directly from the directory, in which Atmel studio 7.0 takes off the translated assembler file. We change there after we have opened a window of the prompt.


illustration 27: Here is the assembled file in Intel-Hex format

Our file is called tinytest.hex And is in the Intel Hex format. Since 1975, the Intel Hex format has been used to use data to be transferred to Files in such a way that they can be transferred to memory building blocks secured. A data record (a line, see below) consists of the start -Byte (And is in the Intel Hex format. Since 1975, the Intel Hex format has been used to use data to be transferred to Files in such a way that they can be transferred to memory building blocks secured. A data record (a line, see below) consists of the start -Byte counter And is in the Intel Hex format. Since 1975, the Intel Hex format has been used to use data to be transferred to Files in such a way that they can be transferred to memory building blocks secured. A data record (a line, see below) consists of the start -Byte (And is in the Intel Hex format. Since 1975, the Intel Hex format has been used to use data to be transferred to Files in such a way that they can be transferred to memory building blocks secured. A data record (a line, see below) consists of the start -Byte is And is in the Intel Hex format. Since 1975, the Intel Hex format has been used to use data to be transferred to Files in such a way that they can be transferred to memory building blocks secured. A data record (a line, see below) consists of the start -Byte two Hexadecimal digits in the ASCII format. You can find more details in this Wikipedia article read. The file content of our tinytest.hex Can be with the free hex editor HXD regard. The first line of text is marked in Figure 27:

: 02 0000 02 00 00 46 43 0D 0A

This is followed By the This is followed By address 0x0400.


illustration 28: The first Bytes from the tinytest.hex file

So I'm going to the directory now F: \ ___ atmel \ tinytest \ tinytest \ debugwhere my file is located.


illustration 29: Entry request and change to the target directory

The AT Tiny 2313 should now be with the Nano V3 and be wired to the quartzoscillator. In addition, we connect the Logic Analyzer to record the level of portd. 4 (Mainloop pulse on channel 1) and portd.


illustration 30: IRQ-timing with the Logic Analyzer capture


illustration 31: Signal sampling with the Logic Analyzer

Before we walk to "burn" the program, a story can still be clarified that often causes uncomfortable and abdominal grim, or can even lead to the controller. This is the handling of the Fuses. In addition to the program RAM and EEPROM memory, ATMEL controllers have a memory area of ​​four Bytes that set the starting behavior and other parameters of the chip, mentioned Fuses. The term Fuse is not to be understood in the sense of the German word, rather as a switch that can be closed or open. Two of them lfuse and Hfuse Are of interest to us, for the time being, you should keep your hands off the others. The individual bits in the Fuse-Bytes have the following meaning.


illustration 32: Fuse-bit values ​​and their meaning

The Fuse low Byte must therefore be changed if the AT Tiny 2313 is Fabrikneu. This is due to the fact that the manufacturer's RC oscillator with 8MHz is set at the factory and the clock frequency is reduced to 1MHz. In this state, the AT Tiny 2313 could therefore be operated entirely without external clock sources.

However, we provide the controller with an external, much more precise clock source (CCKSEL3: 0 = 0B0000) and want to achieve the highest possible clock speed. So we do not share By 8. This makes our value from LFUSE to 0xe0.

First of all, we ask the Fuse values.

Avrdude -v -pt2313 -cavrisp -pcom6 -b19200

AVRDUDE: AVR Device Initialized and Ready to Accept Instructions

Reading | ############################################ 100% 0.05s

AVRDUDE: Device Signature = 0x1e910a

Avrdude: Safemode: Lfuse Reads AS 62

AVRDUDE: Safemode: Hfuse Reads as DF

Avrdude: Safemode: Efuse Reads as FF

Avrdude: Safemode: Lfuse Reads AS 62

AVRDUDE: Safemode: Hfuse Reads as DF

Avrdude: Safemode: Efuse Reads as FF

Avrdude: Safemode: Fuses OK

The Lfuse Let's change to 0xe0 now.

Avrdude -V -PT2313 -cavrisp -pcom6 -b19200 -puse: w: 0xe0: m

Reading | ############################################ 100% 0.06s

AVRDUDE: Device Signature = 0x1e910a

Avrdude: Safemode: Lfuse Reads AS 62

AVRDUDE: Safemode: Hfuse Reads as DF

Avrdude: Safemode: Efuse Reads as FF

AVRDUDE: Reading Input File "0xe0"

Avrdude: Writing Lfuse (1 Bytes):

Writing | ############################################ 100% 0.02s

Avrdude: 1 Bytes of Lfuse Written

Avrdude: Verifying Lfuse Memory Against 0xe0:

AVRDUDE: Load Data Lfuse Data from Input File 0xe0:

AVRDUDE: Input File 0xe0 Contains 1 Bytes

AVRDUDE: Reading on-chip Lfuse Data:

Reading | ############################################ 100% 0.01s

Avrdude: verifying ...

Avrdude: 1 Bytes of Lfuse Verified

AVRDUDE: Safemode: Lfuse Reads AS E0

AVRDUDE: Safemode: Hfuse Reads as DF

Avrdude: Safemode: Efuse Reads as FF

Avrdude: Safemode: Fuses OK

We have successfully changed the clock source. The heart of our at Tiny 2313 is now ticking with 20MHz. If we burned the LFUSE Bit CKOut, we could connect the Logic Analyz Channel 3 and record the clock to Display it on the screen. How would the Lfuse Byte be for it? - Sure: 0b10100000 = 0xA0.

Now we finally want to send our program for the AT Tiny 2313.

AVRDUDE -V -PT2313 -cavrisp -pcom6 -b19200 -Uflash: w: "tinytest.hex": i

Writing | ############################################ 100% 1.02s

Avrdude: 1280 Bytes of flash Written

Avrdude: Verifying Flash Memory Against Tinytest.hex:

AVRDUDE: Load Data Flash Data from Input File Tinytest.hex:

AVRDUDE: Input file tinytest.hex contains 1280 Bytes

Avrdude: Reading on-chip flash data:

Reading | ############################################ 100% 1.38s

Avrdude: verifying ...

Avrdude: 1280 Bytes of Flash Verified

AVRDUDE: Safemode: Lfuse Reads AS E0

AVRDUDE: Safemode: Hfuse Reads as DF

Avrdude: Safemode: Efuse Reads as FF

Avrdude: Safemode: Fuses OK

The AT Tiny 2313 is already working with the new program. Let's take a look at the signals to Portd.4 and Portd.6. Hopefully the Logic Analyzer is already hanging on the USB bus. Then we start the Logic2 application. As soon as the connection to the Logic Analyzer stands, we press the button twice in a row R. It starts and stops the recording. With the scroll wheel of the mouse we zoom in the curves.


illustration 33: Determination of the timing with the Logic Analyzer

The measurement confirms the calculations that we have set up in the program meeting. With these values ​​we are on the safe side, our DDS waveform generator.

The next task we have to solve is to convert the sinus values ​​on port B into voltage values. Unfortunately, the AT Tiny 2313 has no built -in DAC. But there is also a solution for this. In the next episode you read how it looks and how it goes on.