Skip to main content
Commonmark migration
Source Link

##Background

Background

I wanted to make a simple function generator with an ATmega328 and an R2R resistor network, similar to Jesper Hansen's Mini DDS (Direct Digital Synthesis).

To make the function generation firmware run fast enough, I believe I have to wire an entire PORT (all of its 8 output pins) on the ATmega328 to the R2R resistor network. This way I can write one full byte to the port with a single command, like so:

PORTD = B10101000; 

On the ATmega328, I think PORT D is the only port I can use like that. ATmega328 pinout and port distribution is below.

ATmega328 pinout

##The Problem

The Problem

The problem I'm facing is that I also want to use the ATmega328 serial port for programming the board, but the serial port is also on PORT D (pins PD0 and PD1), thus creating a conflict.

##Proposed Solution

Proposed Solution

After some research, I've decided that I could get away with the design below. The relevant part is circled in green.

My schematics combining UART and R2R network

With that circuit I think I'll be able to use the serial pins for programming the board and also, but not at the same time, drive the R2R network to produce a sine wave.

##Considerations

Considerations

The considerations I gathered so far, including contributions from comments, are the following:

  1. R17 is required to protect whatever is connected to the RX line (e.g. MAX232 IC) when ATmega pin 2 is changed to an output to drive the R2R network. That will prevent a large current from being sourced by the MAX232 IC when the pin is driven low.

  2. R17 value (1kΩ) will slow down RX line a bit (increase rise and fall times), but according to what I understood from this answer by Leon Heller - Resistors in series with Tx and Rx, it won't be enough to prevent serial communication (pending experiments to prove it).

  3. I won't be able to use both functions at the same time, but that's ok, as I plan to switch between functions in the firmware.

  4. RX and TX lines are linked to each other by a 50kΩ equivalent resistance, by R1, R2 and R3. That will create a 0.1mA current in and out of each pin, when they show different logic levels. I think that won't be a problem, but further experiments are required.

##Questions

Questions

My questions are:

  1. Will my circuit work? If not, why not?
  2. Will this circuit burn or stress my ATmega or whatever I connect to the serial connector?
  3. Is there a better way to do it using an ATmega328 and the R2R network?

I know there are a lot of ADC chips out there that would help me solve this problem easily and would make my miniDDS more precise, but I wanted to start out with these requirements.

##Background

I wanted to make a simple function generator with an ATmega328 and an R2R resistor network, similar to Jesper Hansen's Mini DDS (Direct Digital Synthesis).

To make the function generation firmware run fast enough, I believe I have to wire an entire PORT (all of its 8 output pins) on the ATmega328 to the R2R resistor network. This way I can write one full byte to the port with a single command, like so:

PORTD = B10101000; 

On the ATmega328, I think PORT D is the only port I can use like that. ATmega328 pinout and port distribution is below.

ATmega328 pinout

##The Problem

The problem I'm facing is that I also want to use the ATmega328 serial port for programming the board, but the serial port is also on PORT D (pins PD0 and PD1), thus creating a conflict.

##Proposed Solution

After some research, I've decided that I could get away with the design below. The relevant part is circled in green.

My schematics combining UART and R2R network

With that circuit I think I'll be able to use the serial pins for programming the board and also, but not at the same time, drive the R2R network to produce a sine wave.

##Considerations

The considerations I gathered so far, including contributions from comments, are the following:

  1. R17 is required to protect whatever is connected to the RX line (e.g. MAX232 IC) when ATmega pin 2 is changed to an output to drive the R2R network. That will prevent a large current from being sourced by the MAX232 IC when the pin is driven low.

  2. R17 value (1kΩ) will slow down RX line a bit (increase rise and fall times), but according to what I understood from this answer by Leon Heller - Resistors in series with Tx and Rx, it won't be enough to prevent serial communication (pending experiments to prove it).

  3. I won't be able to use both functions at the same time, but that's ok, as I plan to switch between functions in the firmware.

  4. RX and TX lines are linked to each other by a 50kΩ equivalent resistance, by R1, R2 and R3. That will create a 0.1mA current in and out of each pin, when they show different logic levels. I think that won't be a problem, but further experiments are required.

##Questions

My questions are:

  1. Will my circuit work? If not, why not?
  2. Will this circuit burn or stress my ATmega or whatever I connect to the serial connector?
  3. Is there a better way to do it using an ATmega328 and the R2R network?

I know there are a lot of ADC chips out there that would help me solve this problem easily and would make my miniDDS more precise, but I wanted to start out with these requirements.

Background

I wanted to make a simple function generator with an ATmega328 and an R2R resistor network, similar to Jesper Hansen's Mini DDS (Direct Digital Synthesis).

To make the function generation firmware run fast enough, I believe I have to wire an entire PORT (all of its 8 output pins) on the ATmega328 to the R2R resistor network. This way I can write one full byte to the port with a single command, like so:

PORTD = B10101000; 

On the ATmega328, I think PORT D is the only port I can use like that. ATmega328 pinout and port distribution is below.

ATmega328 pinout

The Problem

The problem I'm facing is that I also want to use the ATmega328 serial port for programming the board, but the serial port is also on PORT D (pins PD0 and PD1), thus creating a conflict.

Proposed Solution

After some research, I've decided that I could get away with the design below. The relevant part is circled in green.

My schematics combining UART and R2R network

With that circuit I think I'll be able to use the serial pins for programming the board and also, but not at the same time, drive the R2R network to produce a sine wave.

Considerations

The considerations I gathered so far, including contributions from comments, are the following:

  1. R17 is required to protect whatever is connected to the RX line (e.g. MAX232 IC) when ATmega pin 2 is changed to an output to drive the R2R network. That will prevent a large current from being sourced by the MAX232 IC when the pin is driven low.

  2. R17 value (1kΩ) will slow down RX line a bit (increase rise and fall times), but according to what I understood from this answer by Leon Heller - Resistors in series with Tx and Rx, it won't be enough to prevent serial communication (pending experiments to prove it).

  3. I won't be able to use both functions at the same time, but that's ok, as I plan to switch between functions in the firmware.

  4. RX and TX lines are linked to each other by a 50kΩ equivalent resistance, by R1, R2 and R3. That will create a 0.1mA current in and out of each pin, when they show different logic levels. I think that won't be a problem, but further experiments are required.

Questions

My questions are:

  1. Will my circuit work? If not, why not?
  2. Will this circuit burn or stress my ATmega or whatever I connect to the serial connector?
  3. Is there a better way to do it using an ATmega328 and the R2R network?

I know there are a lot of ADC chips out there that would help me solve this problem easily and would make my miniDDS more precise, but I wanted to start out with these requirements.

replaced http://electronics.stackexchange.com/ with https://electronics.stackexchange.com/
Source Link

##Background

I wanted to make a simple function generator with an ATmega328 and an R2R resistor network, similar to Jesper Hansen's Mini DDS (Direct Digital Synthesis).

To make the function generation firmware run fast enough, I believe I have to wire an entire PORT (all of its 8 output pins) on the ATmega328 to the R2R resistor network. This way I can write one full byte to the port with a single command, like so:

PORTD = B10101000; 

On the ATmega328, I think PORT D is the only port I can use like that. ATmega328 pinout and port distribution is below.

ATmega328 pinout

##The Problem

The problem I'm facing is that I also want to use the ATmega328 serial port for programming the board, but the serial port is also on PORT D (pins PD0 and PD1), thus creating a conflict.

##Proposed Solution

After some research, I've decided that I could get away with the design below. The relevant part is circled in green.

My schematics combining UART and R2R network

With that circuit I think I'll be able to use the serial pins for programming the board and also, but not at the same time, drive the R2R network to produce a sine wave.

##Considerations

The considerations I gathered so far, including contributions from comments, are the following:

  1. R17 is required to protect whatever is connected to the RX line (e.g. MAX232 IC) when ATmega pin 2 is changed to an output to drive the R2R network. That will prevent a large current from being sourced by the MAX232 IC when the pin is driven low.

  2. R17 value (1kΩ) will slow down RX line a bit (increase rise and fall times), but according to what I understood from this answer by Leon Heller - Resistors in series with Tx and Rxthis answer by Leon Heller - Resistors in series with Tx and Rx, it won't be enough to prevent serial communication (pending experiments to prove it).

  3. I won't be able to use both functions at the same time, but that's ok, as I plan to switch between functions in the firmware.

  4. RX and TX lines are linked to each other by a 50kΩ equivalent resistance, by R1, R2 and R3. That will create a 0.1mA current in and out of each pin, when they show different logic levels. I think that won't be a problem, but further experiments are required.

##Questions

My questions are:

  1. Will my circuit work? If not, why not?
  2. Will this circuit burn or stress my ATmega or whatever I connect to the serial connector?
  3. Is there a better way to do it using an ATmega328 and the R2R network?

I know there are a lot of ADC chips out there that would help me solve this problem easily and would make my miniDDS more precise, but I wanted to start out with these requirements.

##Background

I wanted to make a simple function generator with an ATmega328 and an R2R resistor network, similar to Jesper Hansen's Mini DDS (Direct Digital Synthesis).

To make the function generation firmware run fast enough, I believe I have to wire an entire PORT (all of its 8 output pins) on the ATmega328 to the R2R resistor network. This way I can write one full byte to the port with a single command, like so:

PORTD = B10101000; 

On the ATmega328, I think PORT D is the only port I can use like that. ATmega328 pinout and port distribution is below.

ATmega328 pinout

##The Problem

The problem I'm facing is that I also want to use the ATmega328 serial port for programming the board, but the serial port is also on PORT D (pins PD0 and PD1), thus creating a conflict.

##Proposed Solution

After some research, I've decided that I could get away with the design below. The relevant part is circled in green.

My schematics combining UART and R2R network

With that circuit I think I'll be able to use the serial pins for programming the board and also, but not at the same time, drive the R2R network to produce a sine wave.

##Considerations

The considerations I gathered so far, including contributions from comments, are the following:

  1. R17 is required to protect whatever is connected to the RX line (e.g. MAX232 IC) when ATmega pin 2 is changed to an output to drive the R2R network. That will prevent a large current from being sourced by the MAX232 IC when the pin is driven low.

  2. R17 value (1kΩ) will slow down RX line a bit (increase rise and fall times), but according to what I understood from this answer by Leon Heller - Resistors in series with Tx and Rx, it won't be enough to prevent serial communication (pending experiments to prove it).

  3. I won't be able to use both functions at the same time, but that's ok, as I plan to switch between functions in the firmware.

  4. RX and TX lines are linked to each other by a 50kΩ equivalent resistance, by R1, R2 and R3. That will create a 0.1mA current in and out of each pin, when they show different logic levels. I think that won't be a problem, but further experiments are required.

##Questions

My questions are:

  1. Will my circuit work? If not, why not?
  2. Will this circuit burn or stress my ATmega or whatever I connect to the serial connector?
  3. Is there a better way to do it using an ATmega328 and the R2R network?

I know there are a lot of ADC chips out there that would help me solve this problem easily and would make my miniDDS more precise, but I wanted to start out with these requirements.

##Background

I wanted to make a simple function generator with an ATmega328 and an R2R resistor network, similar to Jesper Hansen's Mini DDS (Direct Digital Synthesis).

To make the function generation firmware run fast enough, I believe I have to wire an entire PORT (all of its 8 output pins) on the ATmega328 to the R2R resistor network. This way I can write one full byte to the port with a single command, like so:

PORTD = B10101000; 

On the ATmega328, I think PORT D is the only port I can use like that. ATmega328 pinout and port distribution is below.

ATmega328 pinout

##The Problem

The problem I'm facing is that I also want to use the ATmega328 serial port for programming the board, but the serial port is also on PORT D (pins PD0 and PD1), thus creating a conflict.

##Proposed Solution

After some research, I've decided that I could get away with the design below. The relevant part is circled in green.

My schematics combining UART and R2R network

With that circuit I think I'll be able to use the serial pins for programming the board and also, but not at the same time, drive the R2R network to produce a sine wave.

##Considerations

The considerations I gathered so far, including contributions from comments, are the following:

  1. R17 is required to protect whatever is connected to the RX line (e.g. MAX232 IC) when ATmega pin 2 is changed to an output to drive the R2R network. That will prevent a large current from being sourced by the MAX232 IC when the pin is driven low.

  2. R17 value (1kΩ) will slow down RX line a bit (increase rise and fall times), but according to what I understood from this answer by Leon Heller - Resistors in series with Tx and Rx, it won't be enough to prevent serial communication (pending experiments to prove it).

  3. I won't be able to use both functions at the same time, but that's ok, as I plan to switch between functions in the firmware.

  4. RX and TX lines are linked to each other by a 50kΩ equivalent resistance, by R1, R2 and R3. That will create a 0.1mA current in and out of each pin, when they show different logic levels. I think that won't be a problem, but further experiments are required.

##Questions

My questions are:

  1. Will my circuit work? If not, why not?
  2. Will this circuit burn or stress my ATmega or whatever I connect to the serial connector?
  3. Is there a better way to do it using an ATmega328 and the R2R network?

I know there are a lot of ADC chips out there that would help me solve this problem easily and would make my miniDDS more precise, but I wanted to start out with these requirements.

Notice removed Improve details by Ricardo
Bounty Ended with Jon Watte's answer chosen by Ricardo
Tweeted twitter.com/#!/StackElectronix/status/464201943456690176
Notice added Improve details by Ricardo
Bounty Started worth 50 reputation by Ricardo
Improved questions.
Source Link
Ricardo
  • 6.2k
  • 20
  • 57
  • 90

##Background

I wanted to make a simple function generator with an ATmega328 and an R2R resistor network, similar to Jesper Hansen's Mini DDS (Direct Digital Synthesis).

To make the function generation firmware run fast enough, I believe I have to wire an entire PORT (all of its 8 output pins) on the ATmega328 to the R2R resistor network. This way I can write one full byte to the port with a single command, like so:

PORTD = B10101000; 

On the ATmega328, I think PORT D is the only port I can use like that. ATmega328 pinout and port distribution is below.

ATmega328 pinout

##The Problem

The problem I'm facing is that I also want to use the ATmega328 serial port for programming the board, but the serial port is also on PORT D (pins PD0 and PD1), thus creating a conflict.

##Proposed Solution

After some research, I've decided that I could get away with the design below. The relevant part is circled in green.

My schematics combining UART and R2R network

With that circuit I think I'll be able to use the serial pins for programming the board and also, but not at the same time, drive the R2R network to produce a sine wave.

##Considerations

The considerations I gathered so far, including contributions from comments, are the following:

  1. R17 is required to protect whatever is connected to the RX line (e.g. MAX232 IC) when ATmega pin 2 is changed to an output to drive the R2R network. That will prevent a large current from being sourced by the MAX232 IC when the pin is driven low.

  2. R17 value (1kΩ) will slow down RX line a bit (increase rise and fall times), but according to what I understood from this answer by Leon Heller - Resistors in series with Tx and Rx, it won't be enough to prevent serial communication (pending experiments to prove it).

  3. I won't be able to use both functions at the same time, but that's ok, as I plan to switch between functions in the firmware.

  4. RX and TX lines are linked to each other by a 50kΩ equivalent resistance, by R1, R2 and R3. That will create a 0.1mA current in and out of each pin, when they show different logic levels. I think that won't be a problem, but further experiments are required.

##Questions

My questions are:

  1. AreWill my assumptions and reasoning correctcircuit work? If not, why not?
  2. Will this circuit burn or stress my design workATmega or whatever I connect to the serial connector?
  3. Is there a better way to do it using an ATmega328 and the R2R network?

I know there are a lot of ADC chips out there that would help me solve this problem easily and would make my miniDDS more precise, but I wanted to start out with these requirements.

##Background

I wanted to make a simple function generator with an ATmega328 and an R2R resistor network, similar to Jesper Hansen's Mini DDS (Direct Digital Synthesis).

To make the function generation firmware run fast enough, I believe I have to wire an entire PORT (all of its 8 output pins) on the ATmega328 to the R2R resistor network. This way I can write one full byte to the port with a single command, like so:

PORTD = B10101000; 

On the ATmega328, I think PORT D is the only port I can use like that. ATmega328 pinout and port distribution is below.

ATmega328 pinout

##The Problem

The problem I'm facing is that I also want to use the ATmega328 serial port for programming the board, but the serial port is also on PORT D (pins PD0 and PD1), thus creating a conflict.

##Proposed Solution

After some research, I've decided that I could get away with the design below. The relevant part is circled in green.

My schematics combining UART and R2R network

With that circuit I think I'll be able to use the serial pins for programming the board and also, but not at the same time, drive the R2R network to produce a sine wave.

##Considerations

The considerations I gathered so far, including contributions from comments, are the following:

  1. R17 is required to protect whatever is connected to the RX line (e.g. MAX232 IC) when ATmega pin 2 is changed to an output to drive the R2R network. That will prevent a large current from being sourced by the MAX232 IC when the pin is driven low.

  2. R17 value (1kΩ) will slow down RX line a bit (increase rise and fall times), but according to what I understood from this answer by Leon Heller - Resistors in series with Tx and Rx, it won't be enough to prevent serial communication (pending experiments to prove it).

  3. I won't be able to use both functions at the same time, but that's ok, as I plan to switch between functions in the firmware.

  4. RX and TX lines are linked to each other by a 50kΩ equivalent resistance, by R1, R2 and R3. That will create a 0.1mA current in and out of each pin, when they show different logic levels. I think that won't be a problem, but further experiments are required.

##Questions

My questions are:

  1. Are my assumptions and reasoning correct?
  2. Will my design work?
  3. Is there a better way to do it using ATmega328 and the R2R network?

I know there are a lot of ADC chips out there that would help me solve this problem easily and would make my miniDDS more precise, but I wanted to start out with these requirements.

##Background

I wanted to make a simple function generator with an ATmega328 and an R2R resistor network, similar to Jesper Hansen's Mini DDS (Direct Digital Synthesis).

To make the function generation firmware run fast enough, I believe I have to wire an entire PORT (all of its 8 output pins) on the ATmega328 to the R2R resistor network. This way I can write one full byte to the port with a single command, like so:

PORTD = B10101000; 

On the ATmega328, I think PORT D is the only port I can use like that. ATmega328 pinout and port distribution is below.

ATmega328 pinout

##The Problem

The problem I'm facing is that I also want to use the ATmega328 serial port for programming the board, but the serial port is also on PORT D (pins PD0 and PD1), thus creating a conflict.

##Proposed Solution

After some research, I've decided that I could get away with the design below. The relevant part is circled in green.

My schematics combining UART and R2R network

With that circuit I think I'll be able to use the serial pins for programming the board and also, but not at the same time, drive the R2R network to produce a sine wave.

##Considerations

The considerations I gathered so far, including contributions from comments, are the following:

  1. R17 is required to protect whatever is connected to the RX line (e.g. MAX232 IC) when ATmega pin 2 is changed to an output to drive the R2R network. That will prevent a large current from being sourced by the MAX232 IC when the pin is driven low.

  2. R17 value (1kΩ) will slow down RX line a bit (increase rise and fall times), but according to what I understood from this answer by Leon Heller - Resistors in series with Tx and Rx, it won't be enough to prevent serial communication (pending experiments to prove it).

  3. I won't be able to use both functions at the same time, but that's ok, as I plan to switch between functions in the firmware.

  4. RX and TX lines are linked to each other by a 50kΩ equivalent resistance, by R1, R2 and R3. That will create a 0.1mA current in and out of each pin, when they show different logic levels. I think that won't be a problem, but further experiments are required.

##Questions

My questions are:

  1. Will my circuit work? If not, why not?
  2. Will this circuit burn or stress my ATmega or whatever I connect to the serial connector?
  3. Is there a better way to do it using an ATmega328 and the R2R network?

I know there are a lot of ADC chips out there that would help me solve this problem easily and would make my miniDDS more precise, but I wanted to start out with these requirements.

Clarified section on considerations about the design a bit.
Source Link
Ricardo
  • 6.2k
  • 20
  • 57
  • 90
Loading
added 7 characters in body
Source Link
Ricardo
  • 6.2k
  • 20
  • 57
  • 90
Loading
Tried to improve title a bit.
Link
Ricardo
  • 6.2k
  • 20
  • 57
  • 90
Loading
added 146 characters in body
Source Link
Ricardo
  • 6.2k
  • 20
  • 57
  • 90
Loading
Source Link
Ricardo
  • 6.2k
  • 20
  • 57
  • 90
Loading