DSP pin changes floor of ATtiny pulse. Help understanding

Go To Last Post
26 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does anyone know what might be going on here? An ATTiny85 is outputting a square wave like the following from 0V to 3V3:

 

When it's connected to an input pin of a DSP (FV-1) the floor of the signal goes from 0V to about 700mV. The top of the signal doesn't rise though (i.e. the whole wave isn't being shifted).

 

They're running off separate power supplies, but with a shared ground.

 

 

 

Here's a simplified version of the circuit:

Or the complete one is attached for reference.

Attachment(s): 

This topic has a solution.
Last Edited: Sun. Apr 10, 2022 - 06:39 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No 0.1uf capacitor on VCC pin?

“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

Document says:

the inputs are internally biased to a VDD/2 potential

 

Edit: should be audio input only

Last Edited: Sun. Apr 10, 2022 - 05:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What is shown if the oscilloscope probe is connected directly to ground? Or, to ground at different places in the system? Is the oscilloscope ground connected to the digital system ground? Where have you connected the probe ground lead? Is your local power line frequency 60Hz, by any chance?

 

Five simple questions!

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Sun. Apr 10, 2022 - 04:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Heisen wrote:

No 0.1uf capacitor on VCC pin?

This is just a breadboard circuit, but to be sure, I added it just now and it doesn't make a difference.

 

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

grohote wrote:

Document says:

the inputs are internally biased to a VDD/2 potential

It's referring to the audio input, not the pot inputs. C3 in the full schematic is the coupling cap that's needed.

Last Edited: Sun. Apr 10, 2022 - 04:24 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:

What is shown if the oscilloscope probe is connected directly to ground? Or, to ground at different places in the system? Is the oscilloscope ground connected to the digital system ground? Where have you connected the probe ground lead? Is your local power line frequency 60Hz, by any chance?

 

Thanks Jim.  I spot checked a few places and as far as I can tell, my ground rails on the breadboard with the attiny have continuity with all the ground spots in the DSP circuit. i.e. all grounds seem to be shared, but I can keep looking if you think this may be the culprit.

 

The scope's probe ground is plugged into the attiny's breadboard ground rail and shows continuity with the other ground spots.

 

Not sure about line frequency, but I'm in the US so 60Hz seems reasonable.

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

ka7ehk wrote:

What is shown if the oscilloscope probe is connected directly to ground? Or, to ground at different places in the system? 

 

I tried a handful of spots and they all show about -10mV.

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


Of course it is rising, you have 10K series there, WHY?  Make it 1K or get rid of it.

 

How do you expect to pull the FV pin down completely when you have a series resistor to prevent it?

Why are you feeding the AVR into an analog pot signal pin, anyhow?

 

Whoever drew this is giving you bad pointers, avoid drawing 4-way connections, it will easily bite you.  draw 3-way connections.

Here one connection is almost hidden...if you had a tech wire this up they might miss it & you will spend hours chasig such things down.  

 

 

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

Last Edited: Sun. Apr 10, 2022 - 04:57 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

Of course it is rising, you have 10K series there, WHY?  Make it 1K or get rid of it.

 

How do you expect to pull the FV pin down completely when you have a series resistor to prevent it?

 

I tried both 1k and 0k (direct from attiny pin to fv1 pin) and it shows the same behavior.  Can you talk a bit more about you mean?

The resistor was put their (admittedly naively) just as a safety measure to limit current draw.

 

avrcandies wrote:
Why are you feeding the AVR into an analog pot signal pin, anyhow?

It's a tap tempo implementation.  The AVR handles all the user input for timing, then feeds a pulse into the DSP.

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

Why are you feeding the AVR into an analog pot signal pin, anyhow?

 

If you look at the Figure 1 - Typical application for the FV-1 chip it shows the Pot pins being driven by 50K potentiometers, (Pots), to give them an ANALOG input voltage.

 

The Tiny outputs a square wave, as you have shown, i.e., High or Low, not an analog signal that ranges from 0 V to V+ volts.

 

If you want the micro to control the analog pot signals, you have several options.

 

You can use the digital output and a PWM signal, (see the uC data sheet for timers/counters and PWM signal generation).

You would then feed the PWM signal into a LPF to convert the PWM data stream to an analog voltage.

A good LPF is needed so that there is no ripple in the output.

 

One could also use a micro that has a DAC module, to output an analog voltage.

The Xmegas have this, as do some of the new AVR DB chips, (IIRC).

I haven't used the new XTinies to know their modules...

bottom line, pick a micro with an analog voltage output module.

 

You could also use an external DAC chip, connected to the micro with an SPI or I2C or other bus.

 

BTW, most decent LPF's would use an op-amp to also provide a minimal load on the PWM circuit, and to provide a good drive signal to the FV-1 chip.

That said, for a quick test you could add a cap to the series resistor to make a very poor LPF, and feed it with a PWM signal from the Tiny.

Better, however, would be to simply remove the micro and add a pot for your initial testing.

 

JC

 

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

DocJC wrote:
If you want the micro to control the analog pot signals, you have several options.

 

This is by design. I understand it's unconventional but it's necessary.

 

I've used PWM to control the FV-1 before, e.g. to allow the uC to read a pot, store presets, then feed the presets to the DSP.

But PWM isn't accurate enough to do precise tempos. It's a giant can of worms that several have tried to do without acceptable results.

This is the reliable way to do it.

 

Edit: and to be clear: This concept works just fine. My DSP code can and does read the pulse and use it with great accuracy.

My problem, the one I'd like to understand and solve, is that the bottom of the square wave is getting pulled up.(though I can always work around it in DSP code, but ideally would prefer to understand what I did wrong here)

Last Edited: Sun. Apr 10, 2022 - 05:08 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The input resistance of the potentiometer control inputs is on the order of 10 megohms

 

The 10K for protection should be ok.  Make sure you are hooked to the correct FV pin.  Also make sure nothing else is wired to the pin...something is tugging on it.

Make sure the AVR has power & solid gnd

Make sure all FV pins have pwr and gnd (gnd shared with AVR).

 

Does the AVR pin go to gnd when you have this issue with the 10K?  If so, the issue is current drawn on the FV side.  Assuming gnds are tied, that's all there is to it (you need to find what is drawing the current).

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:

The input resistance of the potentiometer control inputs is on the order of 10 megohms

 

The 10K for protection should be ok.  Make sure you are hooked to the correct FV pin. Also make sure nothing else is wired to the pin...something is tugging on it.

 

That last one... I'm going to triple check it. I hacked at the audio circuit to disconnect a pot and replace it with the wire from the AVR, but you make me wonder if I made a mistake there and the pot is somehow interacting.

 

"something is tugging on it" - I'm going to keep this at top of mind and give it another once over. This makes the most sense to me and makes me think my schematic isn't matching the real world.

 

avrcandies wrote:

Make sure the AVR has power & solid gnd

Make sure all FV pins have pwr and gnd (gnd shared with AVR).

Will double check, thanks. But I think it's all good.

 

Quote:

Does the AVR pin go to gnd when you have this issue with the 10K?  If so, the issue is current drawn on the FV side.  Assuming gnds are tied, that's all there is to it (you need to find what is drawing the current).

I may not be understanding what you're suggesting, but... When the AVR output is connected to the DSP input, the wave never falls fully to GND. Its floor is 700mV whether it's a direct connection (0ohm) or 100k resistor.  Edit: It DOES go all the way to GND (as intended) when completely disconnected.

 

I'll also triple check the grounds are tied, but I've spot checked a handful of places

Last Edited: Sun. Apr 10, 2022 - 05:19 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Let try 1k instead of 10k, as suggested. At the end, you will tell us the reason of all this, please.

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

grohote wrote:

Let try 1k instead of 10k, as suggested. At the end, you will tell us the reason of all this, please.

I noted earlier, but I did. It's the same behavior whether the resistor is 0ohm, 1k, 10k, or 100k.

 

The floor is 700mV if it's connected through any of those resistance values, 0V if disconnected.

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

Does the AVR pin go to gnd when you have this issue with the 10K? If so, the issue is current drawn on the FV side.

I may not be understanding what you're suggesting,

Do you see the same wave on both sides of the resistor...does the avr pin go to gnd while you have this issue

 

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

Last Edited: Sun. Apr 10, 2022 - 05:30 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
Do you see the same wave on both sides of the resistor...does the avr pin go to gnd while you have this issue

Yeah, it's the same wave on both sides of the resistor.

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

markas wrote:
It's the same behavior whether the resistor is 0ohm, 1k, 10k, or 100k.

 

Do measure Pot pin voltage without anything connected.

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

 

Yeah, it's the same wave on both sides of the resistor.

Ok, then you are saying something is wrong with the AVR, its pin is driving 10K (basically no load), but the AVR pin only drops to 0.7V.    With 10K, you might expect a very slight rise above gnd.

Even if driving 5ma (3.3/0.005= 660 ohms load), AVR pin would only rise about 0.18V      (0.7V takes about 20ma load (35 ohms) )   These voltages are due to the finite AVR pin drive capacity.

 

At this point this has nothing to do with the FV....you are saying if you hook a 10 K to 3.3V and to the AVR pin, it won't pull the pin to gnd with a 10k load?   Either a damaged AVR, one or more gnd pins not connected, or lacking a solid gnd.  Try measuring with a meter.  Make sure you aren't supplying gnd via the scope probe...that would be very bad situation 

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

Last Edited: Sun. Apr 10, 2022 - 05:44 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
At this point this has nothing to do with the FV....you are saying if you hook a 10 K to 3.3V and to the AVR pin, it won't pull the pin to gnd with a 10k load?

 

Are you suggesting the following should read as a square wave? As opposed to the 10k pull-up forcing it high? 

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

Are you suggesting the following should read as a square wave? As opposed to the 10k pull-up forcing it high? 

This has already been asked several times...do you see the SAME wave on BOTH sides of the resistor ?

 

if you are saying if you hook a 10 K to 3.3V and to the AVR pin, it won't pull the pin to gnd with a 10k load?   Either a damaged AVR, one or more gnd pins not connected, or lacking a solid gnd. 

 

Your previous reply

Yeah, it's the same wave on both sides of the resistor.

So at the AVR pin it is only going to 0.7V, then it is a failure of the AVR as mentioned, since with 10K AVR pin should be able to go all the way to gnd.   It will have nothing to do with the FV side at all.

Disconnect the FV completely, and just wire a 10K pullup to the AVR pin & start investigating.   Until the AVR pin can drive 10k, you will go nowhere.

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

Last Edited: Sun. Apr 10, 2022 - 06:15 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In code make sure the PB3 pin is set to output. 

 

DDRB |= (1 << PB3);

“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

Quote:

This has already been asked several times...do you see the SAME wave on BOTH sides of the resistor ?

Yes and I answered. I think the disconnect and source of (what I believe to be) your frustration is that you're seeing those two as equivalence and I'm just now wrapping my head around it. Which is why I sketched up and posted that last avr-only standalone example to confirm that assumption.

 

avrcandies wrote:
Until the AVR pin can drive 10k, you will go nowhere.

 

I tried 2 different attiny85's, and a nano board... none of them could drive 10k. I figured you and I must be living in alternate universes.  So I was trying to narrow down where the disconnect was....

 

then...

 

Heisen wrote:

In code make sure the PB3 pin is set to output. 

 

DDRB |= (1 << PB3);

 

Oh my! crying This was the longest, most roundabout way to discover such a boneheaded mistake. This was the problem.

 

But the silver lining is now none of us will forget that failing to set a pin as an output is the surest way to get this behavior.

 

Thank you both so much! I appreciate you taking the time to look this over and walk me through it.

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

markas in #1 wrote:

Or the complete one is attached for reference.

Attachment(s): 

Image icon tap-tempo.png

That schematic from PedalPCB https://www.pedalpcb.com/product/fv1dev/ is for their FV-1 Development PCB.

 

Where did you get the instructions to connect an ATtiny85, as a square wave generator, to the FV-1 POT2 input?

Last Edited: Sun. Apr 10, 2022 - 07:11 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Oh my! crying This was the longest, most roundabout way to discover such a boneheaded mistake. This was the problem.

With same 0.7 signal on both sides of the resistor, it pointed to the AVR as the trouble. So with it set as an input with the AVR pullup turned on (that would give you the high, since the 10 Meg is an extremely light load).  When you set it "low"
you turned off the pullup, so things just floated around, but the scope probe would mostly pull it down, that may be why it looked rough, compared to the high.  The probe pulldown falling should be slower & obvious, except that you had such an extremely slow time base (50ms), that this clue was paved over!  I bet if you use a fast timebase , with the condition), the rise (50K pullup) and fall (1 meg probe) edges will look a lot different.

 

 

 

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

Last Edited: Sun. Apr 10, 2022 - 07:12 PM