#avr Logs

Mar 23 2021

#avr Calendar

02:20 AM jancoow: Rue_mohr the attiny 414 automatically pulls the line low if it recognises the address
02:27 AM jancoow: In the interrupt you should send the ACK
09:23 AM rue_mohr: oh
09:25 AM LeoNerd: Ah; I²C on the new Tiny 1-series? It's fun
01:31 PM jancoow: LeoNerd tiny 1?
01:32 PM jancoow: oh ye its called tinyAVR I see
01:32 PM LeoNerd: The ATtiny 1-series. 412, 814, 1616, 3217, etc..
01:38 PM jancoow: Ah ye
01:38 PM jancoow: I got the tiny414
01:38 PM jancoow: Made this board like 2 years ago but finally time to implement TWI
01:38 PM LeoNerd: Indeed, a 1-series. It's a nice chip
01:39 PM LeoNerd: TWI is a bit fun on those chips, took me a while to get all the details working
01:39 PM jancoow: I fucked up the pinout tho; didn't check the alternative pins correctly so have to run some wires lol
01:39 PM LeoNerd: Oh the datasheet is incomplete
01:39 PM jancoow: Ah ye, I tried the example code which simply fails..
01:39 PM LeoNerd: The pinout table in the datasheet for that chip is just outright missing half the options
01:39 PM jancoow: LeoNerd ye I read on some forum that the datasheet was incomplete, is it still?
01:39 PM jancoow: wut?!
01:39 PM jancoow: kidding??
01:39 PM LeoNerd: "still"? They haven't released a new version
01:40 PM jancoow: damn, 01/2017
01:40 PM jancoow: wtf
01:40 PM jancoow: so, is there more to the multiplexer ?
01:40 PM LeoNerd: Yes
01:41 PM LeoNerd: One mo, I have a google doc I wrote it out in
01:41 PM jancoow: dang, you are my hero! :D
01:41 PM LeoNerd: https://docs.google.com/spreadsheets/d/1WteSwBYFPF6iJPfpVZuk9wL6XvEzrVQaZ98MY6U6z6U/edit?usp=drive_web&ouid=114433557481806433076
01:41 PM jancoow: I would be so happy if I can select teh correct pins
01:41 PM jancoow: Would be great if I can have sda/scl on pin 11/12
01:41 PM LeoNerd: I haven't mapped out TCB0 yet because in practice I still haven't worked out how to make it output PWM at all, on any chip
01:42 PM jancoow: oh, I wrote my own pwm with a timer
01:43 PM jancoow: oh huh, this is not that much more information right
01:45 PM jancoow: what do you mean with pwm actually
01:46 PM LeoNerd: PWM output from TCB0
01:46 PM LeoNerd: I haven't made that work on -any- of the 1-series chips
01:47 PM jancoow: oh that's WO
01:48 PM LeoNerd: Yeah
01:49 PM jancoow: Yeah I'm making a 9 channel led PWM dimmer
01:49 PM LeoNerd: It's not hugely important... TCA is clearly the PWM timer of choice... or TCD if you have one
01:49 PM LeoNerd: TCB is mostly for input capture
01:49 PM jancoow: But I just did it with the timer itself in code
01:49 PM LeoNerd: If you need that many PWM channels maybe you wanted one of those dedicated chips for it?
01:49 PM jancoow: yes, now you are talking to smart
01:49 PM jancoow: ;p
01:49 PM LeoNerd: But I recommend not the TLC5940. Horrible chip to drive
01:50 PM LeoNerd: I made the mistake of using one of those in my stage controller box. Looks good on a quick glance of the data sheet, but in practice it has a bunch of terrible properties while actually driving it. It takes a lot of babysitting
01:50 PM jancoow: but tldr; I made a PCB for some other application (230v triac dimmer) with the attiny414 as well. Then I was like a pwm dimmer would be great too; so I quickly drawed that board and ordered with the other PCB
01:51 PM jancoow: so ye, in the end, this was stupid and could better go for a I2c PWM chip
01:51 PM jancoow: LeoNerd oh :/
01:51 PM LeoNerd: Yeah some of the self-contained I²C driven ones are nice
01:51 PM jancoow: I have to say that the attiny414 works great tho. The advantages is that I can do fading on the chip itself, which lacks on those i2c pwm drivers
01:51 PM jancoow: so I can set fade speed
01:51 PM jancoow: per channel
01:52 PM LeoNerd: The problem with the 5940 is that you have to give it its main clock signal, _and_ you have to reset it proeprly at the end of its 1024 tick cycle
01:52 PM LeoNerd: If you don't do the reset properly it will just sit there, not retriggering
01:52 PM LeoNerd: So you have to get your timing just right to refresh it all the time
01:52 PM LeoNerd: The self-contained I²C ones are lovely.. they'll totally run themselves
01:52 PM jancoow: oh, it's a shift register?
01:54 PM LeoNerd: Not quite
01:55 PM LeoNerd: The 5940, you program in the channel values, then tell it to "start", and it sets all its outputs. then you give it 1024 ticks, and on each tick it might clear the outputs again based on the channel values. at the end of those 1024 ticks it will just remain static and sit there...
01:55 PM LeoNerd: You have to then reset it to start a new 1024-tick process all over again
01:56 PM LeoNerd: The advantage of that scheme is that -you- are in control of when to write new data as compared the cycle restart, so you can avoid any output glitches. Plus if you wanted to run fewer than 10 bit cycle you just write smaller numbers and reset after maybe 256 ticks or whatever
01:56 PM LeoNerd: The downside is that exact timing is required
01:56 PM LeoNerd: Which became too much for my single ATmega328 which was also driving WS2812s and listening for DMX512 data, all at once
01:58 PM jancoow: damn
01:58 PM jancoow: ye those dmx interupts are a no go then
01:59 PM LeoNerd: I've solved it mostly now by doing DMX offload on its own chip
01:59 PM jancoow: I mean the i2c interupts are the same problem now on this board
01:59 PM LeoNerd: https://www.tindie.com/products/leonerd/rs-485-isolated-attiny841-board/ -- which is what I made this for :)
01:59 PM jancoow: but they are at that high speed that I hopefully don't see it :P
01:59 PM jancoow: hehe nice
01:59 PM LeoNerd: I keep meaning to make a WS2812 offload chip someday too
01:59 PM jancoow: looks cool
01:59 PM jancoow: ws2812 are slow
01:59 PM jancoow: upgrade! :P
02:00 PM LeoNerd: They're slow, but they're cheap
02:00 PM LeoNerd: Slowness doesn't matter in static props
02:00 PM jancoow: ye
02:00 PM jancoow: ye
02:00 PM LeoNerd: Cheapness matters when I want to fill a stage with them :)
02:00 PM jancoow: well..
02:00 PM jancoow: sucks if it goes down in production
02:01 PM LeoNerd: Eh, they're pretty reliable
02:01 PM LeoNerd: If anything breaks, chances are it's a physical connector or somesuch
02:01 PM jancoow: depends where you buy the strips haha
02:01 PM jancoow: ye
02:01 PM jancoow: exactly
02:01 PM LeoNerd: 2812 also has only one data line, so it's easier on the connector
02:02 PM jancoow: 2813 has a backup line
02:02 PM LeoNerd: Though if you're making big chains of them you absolutely have to apply multiple PSUs in multiple places
02:02 PM jancoow: oh heck ye
02:02 PM LeoNerd: Otherwise, voltage droop down to the far end of the chain means you lose power in the blue channel, and it really shifts your colours
02:02 PM jancoow: those cheap 5 meter strips from china drops al ot of volt
02:02 PM jancoow: ye
02:02 PM jancoow: white becomes yellow :P
02:02 PM LeoNerd: You can actually -see- it on a 10m strip
02:02 PM jancoow: I saw it on a 5 meter strip
02:03 PM LeoNerd: Ideally what I do is run the thing at 12V (or even 24V) with lots of those cheap 5V buck switching converters scattered about
02:03 PM jancoow: yep
02:03 PM jancoow: lot less amps
02:03 PM LeoNerd: That way, even a volt or two of droop on the 24V line really doesn't matter to the converters
02:04 PM LeoNerd: Well that too
02:04 PM LeoNerd: Plus it's easier to get beefy 12V power supplies for stage use, than 5V
02:04 PM jancoow: https://es.jancokock.me/120f5/
02:04 PM jancoow: Meh, 5v is quite common
02:04 PM LeoNerd: Ooooh that yellow
02:05 PM jancoow: yes, this was full bridgness
02:05 PM jancoow: 5 meter
02:05 PM LeoNerd: On the plus side you could use it as a lovely colour-temperature calibration gradient ;)
02:05 PM jancoow: It was back in NZ. I bought the shit of banggoods, didnt had ANY stuff there, so went to a local repair shop and asked if I could solder some wires there
02:05 PM jancoow: :P
02:05 PM jancoow: so ye, couldn't really fix this easily XD
02:06 PM LeoNerd: For that strip, I'd just stick 5V into each end.. the drop in the middle is already not too bad, and would be halved again by doing that
02:06 PM LeoNerd: would be fine
02:06 PM jancoow: yes well I didn't had any wire haha
02:06 PM jancoow: not long enough
02:06 PM jancoow: ahh wel; good times
02:06 PM jancoow: was good disco lights so
02:07 PM jancoow: who carded
02:07 PM LeoNerd: :)
02:07 PM LeoNerd: I used mine to simulate a ripply water effect
02:07 PM jancoow: hey, quick question, so you worked with I2C on the tiny?
02:08 PM LeoNerd: The "water" was supposed to be a pool, just below audience eyeline.. so all you could see was the ripples in the aqua-blue reflections coming off onto the back wall
02:08 PM LeoNerd: Which I did by a long strip set to 100% cyan, and some code to simulate random "particles" of black shooting across from either side. It looked really quite good for how simple it was
02:09 PM LeoNerd: Yes I've done I²C on tiny-1. In fact I'm doing so riiight now
02:17 PM LeoNerd: ... was there going to be a followup question?
02:17 PM jancoow: wow nice, you got any vids of that effect?
02:18 PM jancoow: sounds cool
02:18 PM jancoow: the posibilities are endless; I really liked to do lightning with theatre and stuff back at highschool
02:18 PM LeoNerd: annoyingly no.. it was quite a while ago now. I may have some still photos though
02:18 PM jancoow: didnt had pixel mapping stuff back then haha
02:18 PM LeoNerd: Yeah stage effects can be really fun
02:18 PM jancoow: we where just creative with simple led lights (was very cool back then! :P), some moving heads later on
02:18 PM jancoow: or just normal PAR spots
02:18 PM LeoNerd: Given even the closest audience row is probably a good 3 to 5 metres away from anything, that actually covers quite a lot. There's a lot you can get away with that when you see it up close you wouldn't
02:19 PM jancoow: with a cheap USB to DMX dongle which was so cool because we could create simple light shows with crappy software,,, wuut! :P
02:19 PM LeoNerd: Oh everyone has movers these days
02:19 PM LeoNerd: Worth it just to avoid going up the ladder to refocus stuff
02:19 PM jancoow: don't forget the scanners
02:19 PM jancoow: and there annoying fans
02:21 PM jancoow: LeoNerd lol, now I look back at the pictures.. :P
02:22 PM jancoow: https://live.staticflickr.com/3854/14321419986_4ae009ef21_k.jpg you see that strap there? That was peeeeeeerfectly safee! :P
02:22 PM jancoow: looks so sketchy now I look at it, but fun back then
02:23 PM LeoNerd: Ohdeargod
02:23 PM LeoNerd: runawaaaaaay!
02:24 PM jancoow: XD
02:31 PM jancoow: LeoNerd oh anyhow; ye about the question
02:31 PM jancoow: It would be great to have sda/scl on pin 11/12 but that doesn't seem possible right
02:31 PM jancoow: or are there also hidden things in the multiplexer?
02:34 PM LeoNerd: Er.. tiny412 does not have pins 11/12. It's an 8pin chip
02:34 PM LeoNerd: Ohwait you were talking about the 414
02:34 PM jancoow: oh ye sorry got the 414!
02:34 PM jancoow: thats a bit larger
02:34 PM LeoNerd: Right. [that's basically the 814]
02:35 PM LeoNerd: As far as I know, the PORTMAP chapter of the datasheet for that is complete
02:35 PM LeoNerd: PORTMUX even
02:35 PM jancoow: ah ye
02:36 PM jancoow: okay then no luck for me
02:36 PM LeoNerd: Yeah, so that's the alternate IO pins for the TWI0
02:36 PM LeoNerd: By default they're on 8/9 = PB1/PB0, but you can swap them to being on 11/12 = PA1/PA2
02:37 PM jancoow: ye, I swapped them to pa1/pa2 for now. Made a mistake tho
02:37 PM jancoow: have to run some wires
02:39 PM LeoNerd: I'm still waiting to see if they'll make an AVR with the PIC24's arbitrary IO crossbar matrix in it
02:39 PM exp: jancoow: was this the source of your i²c issues?
02:39 PM LeoNerd: On PIC24s the peripherals don't have a fixed mapping.. you can route any peripheral IO to any phyiscal pin.. more or less
02:40 PM jancoow: exp, no, not at all! It was pure code :0
02:41 PM jancoow: LeoNerd yes they are pretty cool aren't they. We use those atsaml at work and even those can't map every peripheral to every pin. But those pics are way more flexible
02:41 PM LeoNerd: The fun bits are where you map multiple peripheral inputs from the same physical pin.. or some ins and an out.. to do some sort of connection between them
02:42 PM jancoow: dang :D
02:42 PM LeoNerd: Some AVR chips have started going that way, with the PORTMAP, but that mostly just lets you move a peripheral to the same numbered pins on a different port
02:42 PM jancoow: yes
02:42 PM jancoow: you have those pads
02:42 PM LeoNerd: Also usually the timers are a bit more flexible... e.g. TCB doesn't have dedicated input pins
02:42 PM LeoNerd: Use the event system for it
02:42 PM jancoow: but even then you can't set the clock on all the 4 pins for example
02:49 PM jancoow: LeoNerd if you maybe have some time, are you willing to look at a small code snippet of the I2C interrupt handeling?
02:49 PM LeoNerd: Syre
02:49 PM LeoNerd: +Sure
02:49 PM LeoNerd: I can multiplex it between my own code
02:49 PM LeoNerd: (because UPDI s sloooow to write)
02:49 PM LeoNerd: Ohyeah, how are you writing UPDI to your chip?
02:53 PM jancoow: okay; so I just wrote the stuff to set the led PWM and fade values (not tested). But I generated the code from the atmel website for this chip.. However, when I tested it with an ESP8266 as master and scan all addresses, it didn't send an ACK back when it reached his address. So I added this behavior myself, which I'm still not sure if it's
02:53 PM jancoow: totally right
02:53 PM jancoow: https://es.jancokock.me/52ebc/
02:53 PM jancoow: err woops
02:54 PM jancoow: this is the interrupt handling: https://es.jancokock.me/cd633/
02:54 PM LeoNerd: Oooh TWI slave
02:54 PM LeoNerd: I haven't done that yet. Only TWI master
02:54 PM LeoNerd: I implemented an I²C slave on the tiny4313 with the USI module.. that was /not/ fun
02:55 PM LeoNerd: But yah so far I haven't used the 1-series TWI as a slave
02:55 PM jancoow: ah, bummer :)
02:55 PM jancoow: lets test this write code then
02:56 PM jancoow: oh and about UPDI
02:56 PM jancoow: I'm using a usb to serial cable with a 3.3v level converter and a 4.7k resistor between RX/TX, and then one wire is going to the reset
02:56 PM jancoow: and I'm using a py-updi thingy from github which works :D
02:56 PM LeoNerd: Ahyes.. the USB-UART scheme :) Which is what all my products do
02:57 PM jancoow: would be better to burn a bootloader and program it over UART I guess
02:57 PM LeoNerd: Yeah.. headsup: you might want to use a 1k resistor, or a diode one day.. if you plan on talking to the new AVR DA chips. I found the 4k7 resistor version doesn't work properly there
02:57 PM LeoNerd: Nah..
02:57 PM jancoow: but I can steal the atmel ICE from work now so :P
02:57 PM LeoNerd: UPDI over UART is fine
02:58 PM jancoow: oh wait; you are right. I'm using a 1k resistor
02:58 PM jancoow: I used a 4.7k one with the raspberry pi; but that didn't work with my USB to TTY
02:58 PM LeoNerd: Mhmm. It's not quite right depending on the voltage levels involved
02:59 PM jancoow: well the atmel ICE works too, and it even can do debugging
02:59 PM jancoow: When I made this board btw; I routed out all SPI pins for hte programmer, then after I got it I figured out I could not program it like a regular attiny
03:00 PM jancoow: almost bought the expensive atmel ice until I figured out you could make a cheap updi programmer yourself
03:00 PM LeoNerd: Yah..
03:00 PM LeoNerd: I make/sell them.. the simple UART versions
03:00 PM jancoow: really?!
03:00 PM jancoow: where
03:00 PM LeoNerd: https://www.tindie.com/products/leonerd/avr-updi-programmer-with-12v/ -- is currently my most popular product
03:01 PM jancoow: wtf is tindie
03:02 PM LeoNerd: A marketplace.. Think a bit like etsy, but for electronics
03:02 PM jancoow: lol, what is etsy
03:02 PM jancoow: but okay nice never heard of it
03:02 PM jancoow: so you bake them yourself at home or something?
03:02 PM LeoNerd: Yah
03:02 PM LeoNerd: Well, hotair
03:02 PM jancoow: that's super cool man
03:02 PM jancoow: is it worth the $$
03:03 PM LeoNerd: I think so
03:05 PM jancoow: Bummer its murrica only
03:06 PM LeoNerd: Not at all. I'm in UK.. I post stuff all over the world
03:06 PM LeoNerd: I suppose particular sellers might not... depends on the seller
03:07 PM jancoow: oh rlly
03:07 PM jancoow: so I might be able to sell stuff too
03:08 PM jancoow: doubt if people are interested in it
03:19 PM jancoow: ugh, neither does the STOP itnerupt not trigger..
03:27 PM jancoow: okay this is not good :P https://es.jancokock.me/f5716/
03:57 PM jancoow: LeoNerd maybe im crazy but, are those chips so low power? Because even if I don't connect the VCC it is powerd from the datalines or something XD
03:57 PM jancoow: pretty weird..
04:12 PM LeoNerd: That's the ESD diodes back-powering it
04:50 PM jancoow: lol
04:50 PM jancoow: wtf
04:57 PM exp: yeah that's normal enough to see, i've got to investigate how i've got 5v leaking into my 12v net on a particular board
04:57 PM exp: and it's almost certainly going to be a 12v device with diodes
05:08 PM jancoow: ah damn
05:08 PM jancoow: sucks
05:19 PM exp: it's an odd one, only happens when powered through a specific header only used for programming
05:47 PM jancoow: Ugh I made the most stupid mistake
05:47 PM jancoow: Enough for today
06:26 PM specing_ is now known as specing
07:25 PM vgtw_ is now known as vgtw
08:49 PM specing_ is now known as specing
10:00 PM rue_mohr: I did an IR remote that power via the diodes
10:00 PM rue_mohr: depending on which pin is high, it sends one of the codes