ATTINY1616 - Performing equivalent PIC CLC logic using the CCL

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

Hi All,

I'm looking at replacing PIC functionality with the aforementioned chip which is a much better match for my needs. I have one potential show stopper, however.

OUT1: I have a combined AND operation based on a PWM signal and two comparators. I've set this up using LUT0. Easy.

OUT2: I then have a third comparator which needs to latch. In PIC land I used to define a CLC as an SR, or I could use a CWG with auto-restart disabled. But in LUT1 this doesn't seem possible?

Finally, if OUT2=1 then OUT1 must be 0. This condition might be reset by an external condition or I can do it in hardware.

The issue then is that the Attiny's CCL after LUT0 and LUT1. The closest I seem able to get is using a JK, which would work if OUT2 went to the reset and not the K pin, which causes it to goggle instead of holding state 0.

Any ideas or am I out of luck?

Cheers,

Andrew

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

Ah, anything stopping me from putting the output of LUT1 back into the EVSYS, setting it as Event1 and then latching that way?

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

Welcome to AVRFreaks!

 

The sequential logic features, Flip-Flops or Latches of LUT[1:0] always use the outputs of both LUT0 and LUT1.  You have to be creative with your logic tables to accomplish what you want.

 

Have you tried swapping the LUT0 and LUT1 functions in your OP?  Use LUT1 and either PA7 or PC1 as an output for "I have a combined AND operation based on a PWM signal and two comparators.", then use both LUT outputs for the input to the RS Latch with that output going to either PA4 or PB4.

 

If the project is not proprietary, zip it up and PM it to me and I will see if I can figure out an alternative for you.]

 

BTW, what PIC chip were you using?

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

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

Yes, you can latch the CCL by using an Event for feedback.

 

Are you using TCD for the PWM signal? It supports suppressing the output using the event system. You can feed the comparators and latch event into a CCL to generate a sutdown event.

 

 

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

Hi,

That's exactly what I'm now doing. I found the TCD had auto-shutdown after posting  - so used it.

The CCL + Events are more flexible than it initially looked.

 

Cheers,

Andrew

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

Ok here's the problem. I can't see a solution.

 

LUT0 is being used for something else. There is only one free async event remaining. The two sync events are available but if it's like the PIC these won't run in sleep, which is a negative. The aim is to use the ATTINY or PIC as glue, zero software other than for init.

Getting back to the issue at hand, the upper/middle comparator input is external (I can move it internal if needbe as I have one comparator free). The bottom right comparator is internal.

The SR gate requires a feedback latch using the event system as discussed above. This is unset via a zerocross (mppttPWM).

So I count 4 variables, CMP1, CMP2, mpptPWM, Event0

And the LUT's only have 3 inputs, therein lies the problem.

Attachment(s): 

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

snoopy33 wrote:
Ok here's the problem. I can't see a solution.

Use an ATmega4809 instead as it has LUT2 and LUT3 available, basically two CCLs.  The other solution is to become more creative with your logic tables. 

 

For Microchip: The Microchip parametric search only indicates CCL counts of 0 and 1 for AVR-8 devices, however it does not indicate how many LUTs the CCL provides!  Since the LUTs are paired in a CCL, shouldn't it be that the CCL count for devices with more than two LUTs indicate a CCL count corresponding to half the number of LUT pairs? 

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

Last Edited: Mon. Apr 20, 2020 - 09:57 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Something like that, I assumed all AVR's only came with LUT0/1 due to the parametric search.

I can't use Atmega4809 as I need many of the peripherials offered by the 1616 (3x cmps, 2x dac, 1x hw monostable, tmrD with auto shutdown).

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

Saw your Final Implementation thread.

 

Another alternative, the new AVR-DA series https://www.microchip.com/wwwpro... has all of your peripheral requirements covered, and up to 6 LUTs.  Thanks gchapman!

 

Good luck.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

Last Edited: Tue. Apr 21, 2020 - 01:11 AM