Any clever way to mimic an output enable for an AVR output?

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

I have an AVR128DB48 outputting a signal on a pin, and depending on the state, the signal might be coming from one of two different timer/counters, or from a CCL. There's also an externally-controlled output enable signal, and when this goes high, my pin should be switched to Hi-Z. I can do this with a pin change interrupt for /OE, but then there's a delay of about 1 microsecond, or possibly worse if /OE changes while servicing another interrupt.

 

I'm brainstorming for ways I might use an AVR peripheral with hardware output enable support, to get immediate response to /OE without needing an external buffer. Something with events and an Op Amp maybe? SPI in slave mode with the /SS slave select signal?

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

I think that you have two, maybe more, problems.

 

1. Since GPIO has no unitary "enable" control. the only real way is to switch the pin from output to input. But, once you do that, you are still left with a pull-up that might or might not be on. So, regardless of the source of the action, you are left with a two operation sequence to either enable or disable. That will leave a couple of instruction cycles where the output state COULD be something other than you want.

 

2. CCL is about the only place where you can mix internal and external signals. It sounds like you are already using CCL. But, with the large number of signals involved (CCL and two timers) you may have used up your CCL resources. 

 

In your shoes, I think that I would look for only of those single gate things that has a tristate output and an enable pin. It would be nice not to use something external. But, if this function is "must do". it may be the only workable solution.

 

Jim

 

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

 

 

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

You may be right. I looked further at the Op Amp, and I think it might actually work, but may be more hassle than it's worth.

 

  1. Configure an Op Amp as a voltage follower / unity gain buffer
  2. Externally connect my digital output pin to the OPn analog positive input pin
  3. The Op Amp's output pin can be enabled or disabled by the level of an event, using the DRIVEn event input.
  4. Use the event system to connect /OE to DRIVEn
  5. Profit

 

This could work, but I'm not sure how the Op Amp output behaves when used as a digital output - what's its drive strength and slew rate, is it going to display weird analog effects, under/overshoot, or other issues I'm not thinking of. It feels too much like replacing one problem with another.

 

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

outputting a signal on a pin, and depending on the state, the signal might be coming from one of two different timer/counters, or from a CCL

Why?  That sounds like bad planning to require such a mess. Maybe revisit what you are trying to do & come up with something less chaotic.  Can you rearrange your signals/modes?

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

bigmessowires wrote:
I can do this with a pin change interrupt for /OE ...
PORT can generate an event; hopefully there's enough CCL reserve to handle that event.

bigmessowires wrote:
... , but then there's a delay of about 1 microsecond, ...
VPORT?

bigmessowires wrote:
... without needing an external buffer.
If CCL's resources are inadequate then attach an sPLD (greater flexibility and reserve than a buffer)

 


Event Users | AVR® DB Family

 

Virtual Ports | AVR® DB Family

 

GreenPAK | Dialog

 

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