#avr Logs

Dec 30 2017

#avr Calendar

02:32 AM NicoHood: I want to detect if my AVR is powered from an external PSU or the USB bus. Can't I just put the PSU output (5v) to a digital pin and read it? Or should I put some resistor in between or so? (The board supports external power from VIN 5v.)
02:51 AM nuxil: NicoHood, you want a resistor to ground ofcource.
02:56 AM nuxil: NicoHood, https://gyazo.com/f65ccb69d9a124356a8fb0ef9c2ae30b :) my awesome drawing skills :p
03:02 AM nuxil: actually.. you should use a zener. it will clamp the voltage to nV. so if you get some spike voltage from the pcu. the zener will deal with it.
03:13 AM nuxil: So i was at the supermarket the otherday and bought som nice looking apples they had pre made into 2kg bags. i get home and toss them into the fridge.
03:13 AM nuxil: and today i wanted a apple. open the bag and take one out.
03:14 AM nuxil: it looked real delicious. real shiny and good.. to shiny. so i susspect something is up.
03:15 AM nuxil: https://gyazo.com/7a7d3eeb7de124fe54691c58798fde86 i google this code and see its genetic manipulatetd.
03:15 AM nuxil: ok. nothing new there.
03:15 AM nuxil: so take it and rens it in some medium hot water.
03:16 AM nuxil: result
03:16 AM nuxil: https://gyazo.com/99cea5422fa22a36e566476d40bc7a52
03:17 AM nuxil: so.. the conclusion im not eating apples anymore :p
03:49 AM _ami_: https://github.com/ve3wwg/avr/blob/c075f7f86a7815bc3e3534c2aee859df85c9885d/attiny13/slavei2c/slavei2c.S -> wow!
03:50 AM _ami_: i2c slave on attiny13a, incredible.,
03:50 AM _ami_: By seeing this code, i want to brush up asm :)
03:50 AM * _ami_ forgot asm oavr
04:45 AM polprog: nuxil: wow, that apple sucks
05:12 AM polprog: _ami_: that looks cool
05:12 AM polprog: might be faster than C
05:12 AM polprog: if you have a good block schematic then you can code stuff either in asm, C, or whatever
05:39 AM rue_shop3: is that whats-his-names i2c library?
05:39 AM rue_shop3: the really awesome one?
05:40 AM rue_shop3: some of the only code I have ever looked at and thought, "nope, thats good, nothing to change"
06:31 AM Emil: NicoHood: the power sources need to be separated
06:31 AM Emil: NicoHood: either with diodes
06:31 AM Emil: or some other way
06:31 AM Emil: diodes are super easy and simple
06:32 AM Emil: once you have that, just put a resistor to ground on both v rails
06:32 AM Emil: and then look at the v rails with either a digital pin or adc
07:00 AM Emil: nuxil: dat apple:D
07:28 AM _ami_: polprog: rue_shop3: the i2c slave on t13a is pretty cool. imagine how many i2c enabled sensors you can make.
07:29 AM _ami_: i once tried to make bit bang i2c slave on t13 using C, but could not. i tried for few hrs and then gave up.
07:31 AM _ami_: may be i should try it again. may be in C. my understanding about i2c/avr is much better than old days! :)
07:31 AM _ami_: much better now*
07:33 AM nuxil: polprog, Emil yeah it looks "Real Delicious" right ? :p
07:39 AM _ami_: i think i am in love with atiny13a again. :P
07:51 AM _ami_: also i did not have LA then. now i have so i should try again. may be in C first and then move to asm as understanding progress.
07:51 AM _ami_: progresses*
07:51 AM _ami_: luckily i have i2c slave code for reference.
07:56 AM LeoNerd: Does the 13A have a real I²C slave peripheral then?
07:58 AM Emil: LA?
07:58 AM Emil: Hmm
07:58 AM Emil: I'm thinking about making a rotary encoder module
07:59 AM Emil: some avr that can do spi/uart and the rotary encoder on a pcb
07:59 AM LeoNerd: It might be handy, yes. Rotary encoders are just sufficiently annoying with the 4-phase signalling
08:03 AM Emil: Perhaps vcc, gnd, interrupt (possibly multiplexed with some other pin), data out, data in, clock
08:04 AM LeoNerd: 'tiny13 would be good for I²C-attached rotary, (A, B, SW, SDA, SCL) except no interrupt. You'd need 6 pins for that, perhaps HVSP it?
08:04 AM _ami_: LeoNerd: t13a does not have i2c
08:04 AM _ami_: it does not have USI either.
08:05 AM LeoNerd: Yah.. I thought not
08:05 AM LeoNerd: It's pretty minimal really
08:05 AM _ami_: indeed.
08:05 AM _ami_: and only one timer.
08:05 AM LeoNerd: I've done soft UART receiver on them before
08:05 AM LeoNerd: I use one as a remote UART-attached PWM controller, just a single channel
08:05 AM _ami_: yes, i use softuart on t13 for debugging sometimes.
08:06 AM LeoNerd: Offhand I can't quite recall why I even did that as opposed to just PWM'ing down the control line.. hrmm
08:08 AM Emil: :DD
08:08 AM Emil: LeoNerd: heh
08:11 AM _ami_: Emil: Logic analyzer.
08:34 AM Emil: ah
12:05 PM rue_bed: did you write i2c pwm for t13?
12:05 PM rue_bed: ??
12:13 PM rue_bed: and.... encoders, area easy, just pin interrupts and a state machine
12:26 PM Emil: "easy"
12:27 PM rue_bed: hu?
12:27 PM rue_bed: itis
12:27 PM Emil: sure pal
12:27 PM Emil: sure
12:27 PM rue_bed: want to see the code for the state mcahine?
12:27 PM rue_bed: I 'm sure its posted
12:28 PM Emil: also handling it as a state machine is imho silly
12:28 PM rue_bed: its the fastest way
12:29 PM rue_bed: http://ruemohr.org/%7Eircjunk/avr/mega32/encoder-servo1/main.c
12:29 PM rue_bed: updaatepos()
12:29 PM rue_bed: 3 lines of code to do the update
12:30 PM Emil: rue_bed: naw, fastest is dealing one of the inputs as clock and the other as data
12:30 PM rue_bed: maybe you should look at that code
12:31 PM rue_bed: it does quadrature decoding
12:31 PM rue_bed: two interrupts and a tiny state machine
12:32 PM rue_bed: why do I understand state machines so much better than anyone anywhere?
12:32 PM * rue_bed snorts, rolls over and goes back to sleep
12:33 PM Emil: iamverysmart
02:12 PM nuxil: hey Jartza.
02:12 PM nuxil: https://i.gyazo.com/440690017de42d1d1df892d692912e37.jpg
02:12 PM nuxil: :D
02:12 PM Casper: nuxil: new kind of "hello world"? :D
02:13 PM Ameisen: My collection now is: two atmega2560s, a few Cortex M0s, a Cortex M4, a Cortex M7, a Cortex A20, and an ESP32
02:13 PM Ameisen: :|
02:13 PM Ameisen: I suspect the M7 and the ESP32 are roughly equivalent
02:13 PM nuxil: Casper, im giving Jartza a thanks for the display i bought from him ;p
02:13 PM Ameisen: though the ESP32 has dual cores
02:13 PM Ameisen: so, it may have an edge
02:17 PM Emil: nuxil: nice
02:17 PM Emil: Ameisen: what's your toolchain/development environment?
02:18 PM Ameisen: emil - VC++ and GCC
02:18 PM Ameisen: and a set of ruby scripts I wrote
02:18 PM Ameisen: I'm fancy.
02:21 PM Emil: Ameisen: where do you get the libs/defines for those cortex thingies?
02:23 PM Ameisen: Not entirely sure.
02:23 PM Ameisen: I know that ST will have some of them
02:23 PM Ameisen: they have SDKs for 'em
02:23 PM Ameisen: ARM development depends a lot on which ARM chip
02:24 PM Emil: I know
02:24 PM Emil: my point is
02:24 PM Ameisen: ST is pretty well known, so they have SDKs available
02:24 PM Emil: with avr I can just apt-get install avr-libc :D
02:24 PM Ameisen: be weird if I had aptitude on windows.
02:24 PM Ameisen: :P
02:24 PM Emil: and I pretty much know how to use stlink and gcc and binutils
02:24 PM Ameisen: Though avr-gcc is available on Windows anyways, and I'm still active in trying to get llvm-clang up to speed for avr
02:25 PM Ameisen: I've tinkered a bit with stlink. Seems nice.
02:25 PM Emil: I'm still looking for a way to write https//emil.fi/avr but for arm
02:25 PM Ameisen: more convenient than the many many ways to interface with AVR stuff
02:25 PM Ameisen: I haven't figured out how to baremetal the A20 yet
02:25 PM Ameisen: not sure what the GPIO latency on it is either
02:26 PM Ameisen: It's incredibly fast and has a ton of memory, but it's an application board
02:26 PM Ameisen: if the GPIO latency is low enough, it'd be perfect for some stuff
02:26 PM Ameisen: I'd love to cache entire movement profiles in memory
02:27 PM Ameisen: I was able to build a very simple ARM A20 bootloader in about 15 minutes, but I haven't figured out how to setup the image so the allwinner bootloader recognizes it.
02:29 PM Emil: nice
02:30 PM Ameisen: I just hope GPIO times are low
02:30 PM Ameisen: 1 GiB of memory is a lot.
03:28 PM Jartza: whooops
03:28 PM Jartza: irc was in backscroll, didn't notice there was activity :)
03:29 PM polprog: hey
03:30 PM polprog: i pressed ^H
03:30 PM polprog: ^G in irssi, then pressed enter, my nick sent an empty line and my term flashed
11:52 PM day__ is now known as day