#avr | Logs for 2016-09-16

Back
[00:37:23] <Casper> has anyone here used an avr as usb host?
[00:37:48] <inflex> mmm... is it even possible?
[00:42:09] <Casper> not sure
[00:42:20] <Casper> all I want to do is a charger
[00:42:44] <Casper> those sony ps3 controller require a host to authorise the 500mA, else it do not charge at all...
[00:43:05] <Casper> and of course, the ps3 turn off the port when it sleep
[00:43:27] <Casper> and the pc is not close enought, so a bit of an annoyance
[00:43:38] <Casper> ... I think I found the solution
[00:43:43] * Casper goes test
[00:45:12] <Casper> did find a solution! I have a WDTV there, it does authorise it! now, just need an active hub
[01:02:18] <Casper> yay!
[01:02:21] <Casper> it worked!
[02:34:38] <inflex> nice :)
[02:34:55] <inflex> I'm now sitting here trying to conjure a new hotair controller board. I have the chassis at least (and airpump)
[02:35:16] <inflex> Thinking that in order to prevent lighting nightmares I should use bang-bang controlling for the heater
[02:35:38] <inflex> (ie, half-wave switching only)
[02:37:03] <felixphew> sorry for the noob question, but:
[02:37:24] <felixphew> is there an easier way to talk to i2c than trying to implement everything yourself?
[02:37:43] <felixphew> I can't seem to find a halfway point between arduino and raw AVR C
[02:38:05] <Snert> get any adafruit module that speaks i2c.
[02:38:11] <Snert> and heist the code.
[02:38:17] <felixphew> nice
[02:38:21] <felixphew> I could actually do that
[02:38:34] <felixphew> because I have the adafruit part for the chip I'm trying to talk to
[02:38:34] <Snert> an i2c temperature sensor of some sort.
[02:38:38] <felixphew> (DS3231)
[02:39:13] <inflex> I've got some i2c stuff here, all just software bit-bang
[02:39:15] <inflex> but it works
[02:39:25] <inflex> I use it to talk to my i2c 8x2 LCD
[02:40:01] <felixphew> just out of curiosity, why would you bit-bang if your chip actually does i2c
[02:40:07] <felixphew> or twi or whatever Atmel calls it
[02:40:54] <inflex> easier to shift it up/down the atmel range of chips.
[02:41:06] <inflex> ie, from T13 -> mega88
[02:41:36] <inflex> also lets me put i2c devices on non-twi pins
[02:42:14] <felixphew> fair enough
[02:42:26] <felixphew> and I'm guessing performance is irrelevant with i2c
[02:43:48] <felixphew> thanks!
[02:45:18] <inflex> http://dxp.me/i2csw.c
[02:45:19] <inflex> http://dxp.me/i2csw.h
[02:46:17] <felixphew> that's a lot of nops
[02:46:27] <inflex> Just watch out with the i2c addresses, some of them use or don't use the 9th bit I think
[02:46:31] <felixphew> couldn't you just use <util/delay.h> ?
[02:46:47] <inflex> you could, but I guess they're just trying to keep the dependencies to a minimum
[02:47:10] <inflex> http://www.procyonengineering.com/embedded/avr/avrlib/ <=- fairly sure I got it out of this lib
[02:47:38] <felixphew> that looks like exactly the kind of thing I'm after
[02:51:44] <inflex> np
[03:18:53] <_ami_> twnqx: calling generic_handle_irq() explicitly on GPIO does the job which i wanted. :)
[03:19:09] <twnqx> ah, cool
[03:20:31] <_ami_> although i read somewhere that irq takes too much cpu resources and mem
[03:21:04] <_ami_> 31: 0 0 0 0 0 0 3 0 platform-gpio-device 0 platform-gpio-device
[03:21:25] <_ami_> all cpu cores are looking for this irq. i think i should limit it for 1 cpu core only.
[03:21:31] <twnqx> nah
[03:21:37] <twnqx> all is good
[03:22:11] <_ami_> okay.
[03:22:25] <twnqx> https://bpaste.net/show/e2aa07c1d63d for me, apparently only one handles them anyway
[03:23:05] <_ami_> ah, can't open, blocked at office ntwork :/
[03:23:58] <twnqx> https://gist.github.com/chrschmidt/358625041501b048865adb1395643d58 maybe?
[03:24:35] <_ami_> true
[03:24:39] <_ami_> in most of the cases.
[06:04:17] <inflex> anyone created a 240V speed controller that uses voltage amplitude adjustment, rather than just triac type cut?
[06:18:15] <Tom_itx> sounds like alot of the cnc axis controllers
[06:18:29] <Tom_itx> +- 10v control
[06:23:09] <inflex> Basically this is for an air pump that's running off 240V. Right now it's using a normal triac-diac cut controller
[06:23:27] <inflex> so when it's on partial phase the thing shudders quite bad and the lights aren't a fan of it
[06:25:14] <inflex> air pump is just a normal diaphragm type unit that oscillates at 50~60Hz with the AC
[06:25:55] <inflex> http://electronics-diy.com/1000w-ac-motor-speed-controller.php <=- this basically is what they're using right now.
[10:50:51] <Emil> Hey, if anyone has any recommendations regarding the actual content of the guide at https://emil.fi/avr please tell me!
[10:56:49] <twnqx> emil: wouldn't that rather be a swedish name than finnish?
[10:57:44] <Emil> twnqx: kind of, yes
[10:58:04] <Emil> The finnished (heh) name from Emil would be Eemil or Eemeli but Emil is perfectly fine
[10:58:06] <polishprogrammer> Emil, cool, it looks like a kernel changelog
[10:58:08] <Emil> in Finland also
[10:58:18] <twnqx> first line has programmin instead of programming :P
[10:58:36] <Emil> Thanks!
[10:59:06] <Emil> Fixed
[10:59:09] <polishprogrammer> its hard to distinguish between the code and the content
[10:59:41] <twnqx> the code is weird
[10:59:56] <polishprogrammer> also, setting fusebytes might be a bit problematic for a beginner, maybe ad some explanations what are they?
[11:00:00] <twnqx> DDRB changes two bits to output, but only one is later used
[11:00:14] <Emil> twnqx: nah, both are used
[11:00:21] <polishprogrammer> why is led cathode connected to PB0?
[11:00:24] <polishprogrammer> not gnd?
[11:00:42] <twnqx> where?
[11:00:46] <Emil> To demonstrate current sinking
[11:00:53] <polishprogrammer> oh, ok
[11:01:05] <twnqx> PORTB^=0b000000010; toggles only one bit
[11:01:15] <Emil> twnqx: indeed, which is just fine
[11:01:24] <twnqx> also, that is 9 bits :S
[11:01:45] <Emil> Fixed
[11:02:05] <Emil> Thankfully that would not have made a difference :D
[11:02:07] <polishprogrammer> its a cool crash course, but it lacks some stuff that makes other parts hard to get for the reader, i suppose the target audience is a beginner or straight out of arduino, right?
[11:02:11] <twnqx> still don't see where the lowest bit is toggled
[11:02:13] <twnqx> ah ok
[11:02:16] <twnqx> the schematic tells it
[11:02:20] <twnqx> my bad
[11:02:46] <twnqx> maybe explain automation with makefiles at that point?
[11:02:50] <twnqx> or at least mention it
[11:03:02] <twnqx> else, nice and easy example
[11:03:10] <polishprogrammer> ^ yes
[11:03:58] <Emil> Makefiles are a whole new level of things to understand and they are already pretty well explained elsewhere :D But yeah, I could demonstrate a simple makefile, too
[11:04:27] <twnqx> just link to it then
[11:04:27] <Emil> I agree that it is pretty hard to read but a fix is coming for that
[11:05:18] <polishprogrammer> i mean, i get the whole idea that you first build the circuit, etc. but there are some things that need to be mentioned for a beginner to understand the whole thing
[11:05:24] <skz81> Emil, doesn't it lacks a part on how to connect the PC to AVR (before we can use AVRdude) ?
[11:05:34] <polishprogrammer> ^ that for ex.
[11:05:36] <skz81> I guess you started to mention it on the schematic
[11:05:37] <Emil> skz81: usbasp is a usbdevice
[11:06:20] <Emil> Hmm, well, as it is a beginners guide I could add a note about plugging the device in
[11:06:50] <polishprogrammer> also, just in case, make a note that avrdude invocation should be sudo if there are libusb permission errors
[11:06:59] <Emil> true
[11:07:06] <skz81> Emil, yes, that's exactly what I meant ;°)
[11:07:33] <polishprogrammer> and prefix the stuff that needs to be input into the terminal with '$'
[11:07:49] <polishprogrammer> and maybe a linebreak before and after
[11:08:03] <polishprogrammer> because it's hard to read
[11:08:28] <skz81> Hum, you can often avoid sudoing by creating a dedicated group, let the device be owned by that group, and add yourself (and any other users) to this group
[11:08:43] <Emil> skz81: We know
[11:08:48] <Emil> but it is hard for a beginner
[11:08:53] <Emil> polishprogrammer: better now?
[11:08:57] <polishprogrammer> apart from that, great tutorial. It's an order of magnitude better than what I used to learn on
[11:09:05] <Emil> HMm
[11:09:09] <Emil> I should add intendation
[11:09:15] <polishprogrammer> that was fast
[11:09:18] <polishprogrammer> baetter
[11:09:41] <Emil> polishprogrammer: thanks! It is not better than what I had two years ago but I aim to please :3
[11:10:32] <skz81> Emil, okay, up to you. That's not a guide about UNIX permission, after all
[11:11:46] <Emil> Should be more readable now
[11:12:13] <polishprogrammer> yeah
[11:12:55] <Emil> polishprogrammer: the target audience is a beginner level, yeah
[11:13:06] <Emil> what parts do you feel like I should explain?
[11:13:11] <polishprogrammer> i think that the code, asciiart and shell command should be <pre> and the text should be <p>. I used to make everything in <pre> but that looked like a text file
[11:13:14] <Emil> That are hard to get for the reader?
[11:13:23] <Emil> polishprogrammer: it is a text file :D
[11:13:45] <polishprogrammer> my single-file sites were always Black <pre> + gray divs
[11:14:07] <Emil> twnqx: added a note about using makefiles instead
[11:17:27] <polishprogrammer> i think you should put something between step 4 and 5 that explains the reole of a programmer and fuses, not too much about the latter. Also something about the IO lines, why are they organised in ports and what are DDRB and PORTB. And say that Vcc should be in range of <lowest for ATmega328> and 5V
[11:17:52] <polishprogrammer> oh sorry the DDR and PORT asre explained
[11:17:58] <polishprogrammer> *are
[11:18:58] <polishprogrammer> my first programmer was a parallell cable with some resistors :P
[11:19:13] <Emil> It is powered from the usbasp so voltage levels are safe but true, could mention it
[11:19:41] <polishprogrammer> oh, ok
[11:20:14] <polishprogrammer> shouldn't the other gnd (22) be also connected? im not sure
[11:21:02] <Emil> They are internally connected so not necessary
[11:21:23] <Emil> if one is using good amounts of current then yes, they should be connected for even power distribution
[11:21:39] <polishprogrammer> i didn't know that
[11:21:40] <Emil> This is like an mvp
[11:21:55] <Emil> polishprogrammer: that's for the atmega and attiny series, though
[11:22:13] <Emil> they might not be properly connected in ARM chips or xmegas
[11:22:19] <Emil> but even still they probably are
[11:22:57] <Emil> I added a note about different programmers
[11:23:30] <DKordic> IMHO even a mention of usbasp is a huge mistake.
[11:23:42] <Emil> Why?
[11:23:47] <Emil> What should we use instead?
[11:23:53] <DKordic> Because it is bitbanged USB!
[11:24:04] * Emil shudders
[11:24:05] <learath> bitbanged usb is the best usb! :)
[11:24:21] <polishprogrammer> i think uspasp is the best programmer for the beginer, ready and cheap.
[11:24:27] <polishprogrammer> You can get a dragon later,
[11:24:47] <polishprogrammer> but as i said my first was a parport cable with resistors
[11:25:04] <Emil> DKordic: Anycase, the point is to be a mvp that gets you started software and hardware side
[11:25:14] <Emil> To break the first barrier
[11:25:31] <Emil> Then you can bang your head about peripherals and interrupts later ;)
[11:26:26] <Lambda_Aurigae> there are different quality usbasp programmers out there too.
[11:27:06] <Lambda_Aurigae> and, why no resistor on the PB0 LEDN connection?
[11:27:16] <Emil> Lambda_Aurigae: look closer
[11:27:30] <Lambda_Aurigae> oh, you are feeding from pb0 to pb1?
[11:27:37] <polishprogrammer> BUT, the reason i used a parport cable instead of usbasp, is that the asp i bought had outdated firmware and didn't want to talk with avrdude
[11:27:54] <Lambda_Aurigae> might want to make that a bit more obvious..
[11:28:11] <Emil> Lambda_Aurigae: the schematic isn't obvious?
[11:28:31] <Emil> polishprogrammer: fortunately that's history nowdays
[11:28:37] <Lambda_Aurigae> polishprogrammer, also, some usb ports won't talk with some of the v-usb hardware implementations.
[11:28:43] <Lambda_Aurigae> Emil, not at first glance, no.
[11:30:09] <Lambda_Aurigae> I have a computer here with 8 USB ports...one of the v-usb implementations with the chip running at 3.3V works on 6 of them but not the other 2...the v-usb implementation that uses zener diodes on the D+ and D- lines and runs the chip at 5V will work on the other 2 and 2 of the first set but not the other 4....it's really screwy.
[11:30:10] <Emil> Lambda_Aurigae: how would you improve the schematic?
[11:30:27] <polishprogrammer> Lambda_Aurigae, i have a dragon now so that's not a problem ;)
[11:30:30] <Emil> Well, that's quite annoying
[11:30:56] <polishprogrammer> Emil, i'd put the led between the PB1 and PB2 or draw it on the schemati
[11:30:57] <polishprogrammer> c
[11:30:59] <Lambda_Aurigae> Emil, I would connect the LEDN and LEDP points with something in there for the LED itself...like -->|-- and the points noted.
[11:31:23] <Emil> Hm
[11:31:24] <Emil> sure
[11:32:40] <Lambda_Aurigae> v-usb kinda bends some of the usb spec to get it to work..to the point of kinda breaking a couple of bits even.
[11:33:04] <Lambda_Aurigae> it's a nifty toy but not something I would want to rely on for a commercial process, specially something plugging into different computers.
[11:33:11] <polishprogrammer> yeah
[11:33:24] <polishprogrammer> there are avrs or chips with hardware usb
[11:33:31] <Lambda_Aurigae> that's why I use pic16f1454 chips as usb interface chips these days.
[11:33:51] <Lambda_Aurigae> gives a level of complexity for beginners though.
[11:34:10] <polishprogrammer> well, i'm an amateur and i barely started a AVR-busPirate i2c link ;D
[11:34:12] <Lambda_Aurigae> my first stk200 parallel port programmer from 2001 still works...and is still the one I use most these days.
[11:34:43] <polishprogrammer> wow
[11:34:50] <Lambda_Aurigae> well,,,my first one I soldered together...based on a 74ls244 chip...first ever was 4 wires from the parallel port to the chip.
[11:35:01] <polishprogrammer> you're doing this professionally i guess
[11:35:05] <Lambda_Aurigae> nope
[11:35:09] <Lambda_Aurigae> it's a hobby
[11:35:13] <polishprogrammer> wow^2
[11:35:19] <Lambda_Aurigae> I'm a computer/copier tech professionally.
[11:35:26] <Lambda_Aurigae> Xerox Systems Analyst
[11:35:37] <polishprogrammer> cool
[11:36:14] <polishprogrammer> i'm thinkig about a career in tech, maybe not as a coder
[11:36:26] <Lambda_Aurigae> I would have loved to be a programmer/developer
[11:36:34] <Lambda_Aurigae> but no university degree.
[11:36:42] <polishprogrammer> or maybe electronic engineering because there are so many programmers nowadays
[11:36:47] <Lambda_Aurigae> so, I'm stuck in the drudgery of dealing with customers day in and day out.
[11:37:07] <Lambda_Aurigae> most "programmers" are script kiddies who haven't a clue,,,in my experience.
[11:37:22] <polishprogrammer> :/ i still have time to think about it, i have to finish high school
[11:37:25] <Lambda_Aurigae> if it's not php or ruby or javascript, it's not a real programming language.
[11:37:47] <polishprogrammer> i feel like there are lots of theese people
[11:37:50] <Lambda_Aurigae> I got my start programming on the 6502 processor on the vic-20 and apple-2 computers.
[11:37:59] <Lambda_Aurigae> basic then assembly.
[11:38:19] <polishprogrammer> but webdev is only a branch of programming, or maybe 'programming'
[11:38:43] <Lambda_Aurigae> then pascal on the apple-2 then fortran on x86 systems then C, Ada, C++, JAVA, Perl, PHP, etc.
[11:38:45] <polishprogrammer> i never touched assembly. i learned java first, then C and python
[11:39:10] <Lambda_Aurigae> assembly rocks for doing exactly what you want to do and learning how the hardware really works.
[11:39:40] <polishprogrammer> i guess that's right
[11:39:47] <Lambda_Aurigae> programming in high level languages, specially on commodity OS based systems, abstracts you so much from the hardware that you end up with things like windows.
[11:40:08] <polishprogrammer> xD
[11:40:10] <Lambda_Aurigae> microsoft windows,,,been totally rewritten at least twice according to microsoft...
[11:40:23] <Lambda_Aurigae> however, there is a bug that has existed since windows 3.1 that still exists in windows 10
[11:40:29] <Lambda_Aurigae> and it's THE SAME CODE!
[11:40:39] <Lambda_Aurigae> or, at least, part of it is.
[11:40:59] <polishprogrammer> i heard that parts of NTFS or FAT code are older than me
[11:41:23] <Lambda_Aurigae> the ability to execute, as administrator, malicious code sent to the computer as part of a print driver update.
[11:41:29] <polishprogrammer> yes, NTFS is 23 years old
[11:41:33] <Lambda_Aurigae> yup.
[11:41:39] <Lambda_Aurigae> original FAT is much much older.
[11:41:40] <Emil> Lambda_Aurigae: How about now?
[11:41:59] <polishprogrammer> Emil, nice
[11:42:18] <Lambda_Aurigae> that works but I would change -|<|- to -|<-
[11:42:26] <Lambda_Aurigae> but, that's just me.
[11:42:56] <Lambda_Aurigae> and move it up a little in the \/ area so they "connect"
[11:43:07] <Lambda_Aurigae> again, just my nose picking.
[11:43:57] <Emil> Hmm
[11:44:01] <Emil> Lemme see
[11:44:23] <Lambda_Aurigae> I would almost go with square lines rather than the diagonals.
[11:44:49] <polishprogrammer> wow, this tutorial is VT100 compatible, i'm now reading it via curl and less
[11:45:12] <polishprogrammer> it's really "no GUI"
[11:45:15] <polishprogrammer> ;)
[11:45:19] <Lambda_Aurigae> polishprogrammer, only way to go.
[11:45:31] <Lambda_Aurigae> it would even display on my c-64 web browser.
[11:45:43] <polishprogrammer> Lambda_Aurigae, i settled with XFCE on xubuntu
[11:46:24] <Emil> polishprogrammer: ; )
[11:46:31] <Lambda_Aurigae> I run kubuntu with xfce on this machine and pure debian with xfce on my new laptop.
[11:46:37] <Emil> polishprogrammer: exactly my aim
[11:47:03] <Lambda_Aurigae> wonder if I still have the AVR dev CD anywhere?
[11:47:14] <polishprogrammer> AVR dev CD?
[11:47:22] <Lambda_Aurigae> years back, in like 2006 or so, I put together a bootable linux live cd
[11:47:31] <polishprogrammer> cool :v
[11:47:35] <Lambda_Aurigae> had everything needed to boot to the CD and do AVR development.
[11:47:42] <Lambda_Aurigae> with or without gui...boot option.
[11:47:55] <Lambda_Aurigae> it would even boot and run on an old 386 with 2MB of ram.
[11:48:16] <Emil> That's pretty solid
[11:48:30] <Lambda_Aurigae> it was super stripped down too so it fit on a 150MB mini CD
[11:48:30] <Emil> polishprogrammer: but haha, how did you even figure to try it out with curl and less :D
[11:48:56] <polishprogrammer> I once ran SliTaz on an old thinkpad with no disk and 24MB of ram, ssh'd to my PC and ran irssi
[11:49:16] <polishprogrammer> Emil, you told me it's a text file ;)
[11:50:28] <Lambda_Aurigae> the avr dev CD was an old slack distro that I was able to rip everything out of except what I absolutely needed...it had a minimal gui, web browser, pdf viewer, avr toolchain, and a selection of PDF documents.
[11:50:40] <Lambda_Aurigae> I should recreate that for a more modern system.
[11:50:43] <Emil> polishprogrammer: I did :D
[11:50:49] <polishprogrammer> i ned to go. It's a great tutorial Emil, i bookmarked it. See you Lambda_Aurigae
[11:51:00] <polishprogrammer> and all other of you guys
[11:51:04] <Emil> polishprogrammer: haha, thanks! Glad you liked it
[11:51:06] <Emil> See ya : )
[11:51:10] <Lambda_Aurigae> have fun.
[11:51:17] <Lambda_Aurigae> I need to get on the road back to the campground.
[11:51:23] <Lambda_Aurigae> only came home to get some things we forgotted.
[11:51:26] <Lambda_Aurigae> and being lazy.
[11:51:48] <Lambda_Aurigae> so, all reservoirs, or something like that!
[11:52:35] <Emil> See ya!
[23:17:55] <inflex> fecking damnit... wtf am I supposed to find a 500K pot on the weekend... gorramnit
[23:18:13] * inflex wonders if he can modify this phase-adjustable triac-diac circuit
[23:18:37] <inflex> Worried I'm going to blow myself up probably
[23:28:44] <sabor> 500k is similar enough to an isolator to now be worried about anything ;)
[23:43:47] <inflex> What I was rather meaning is that I don't have any 500K's at the moment, only 10K pots... so I'm just going to have to wait
[23:47:34] <sabor> aah
[23:47:59] <sabor> hmm, 10 is too low for a dimmer circuit
[23:48:11] <sabor> 10k i mena
[23:53:48] <inflex> Agreed
[23:53:59] <inflex> Am thinking I might just buy a whole dimmer circuit and wire the pump up with that
[23:54:09] <inflex> It's frightening how bad this controller board is
[23:54:29] <sabor> since you'r ein #avr you ought to connect that 10k pot to and analog input of an avr and control the triac with a PWM output ;)
[23:55:25] <inflex> I was thinking of spinning a whole new board.
[23:55:27] <sabor> yeah, i've seen a few similar circuits too
[23:55:43] <inflex> What's interesting is that they even have a little air buffer attached to the pump
[23:55:50] <inflex> (about 75mL capacity)
[23:56:44] <inflex> One thing I never liked about this setup was that unless you're on 50 or 100%, the partial phase just made it sound terrible
[23:56:49] <sabor> hmm, 75mL is almost nothing, so i guess the pump is also pretty small?
[23:57:04] <inflex> it's for a hot air rework station
[23:57:14] <sabor> aah, ok :)
[23:57:28] <inflex> Probably being used just to smooth out the diaphragm pulses
[23:57:47] <sabor> i'm since a long time thinking about replacing our cheap fan dimmers with self-made sinus dimmers...
[23:58:00] <inflex> I'd have preferred if there was some amplitude/voltage regulation to control the output, rather than the phase control
[23:58:15] <sabor> yeah
[23:58:45] <inflex> So, on an exotic idea, was thinking of driving it from a DC->AC converter
[23:59:46] <sabor> yeah, why not