#avr | Logs for 2014-01-31

Back
[00:42:26] <rue_bed> I forgot to interrogate people for code samples under threat of being kicked from channel, could someone remind me tommorow evening?
[00:44:08] <WormFood> what is "evening"
[00:44:24] <WormFood> I think my evening will be a very different time from yoru evening
[00:52:43] <tzanger> how was CNY?
[01:09:07] <WormFood> nothing special tzanger
[01:09:45] <WormFood> so many fireworks, my whole house smelled like gunpowder
[02:51:56] <mesger> anyone know a good and cheap overseas pcb manufacturing service ?
[02:52:15] <jacekowski> by overseas you mean chinese?
[02:52:33] <mesger> ah true from my end overseas is chinese yes
[02:52:43] <mesger> but any will do
[02:52:51] <mesger> as long as they are cheap :)
[02:52:59] <jacekowski> spirit circuits have shop in china
[02:53:01] <jacekowski> and UK
[02:56:33] <Valen> hackvana
[02:56:41] <Valen> join #hackvana
[02:57:15] <Valen> he does pcbs and is quite helpfull
[03:42:54] <hackvana> Valen: Thanks buddy :-)
[05:11:56] <guanche> hi
[05:12:54] <guanche> guys, I want to fire the timer0 at 20 Khz with 32 steps of resolution, this is from an atmega clocked at 20 mhz, and for motor control
[05:13:12] <guanche> so this gives me 20 * 32 = 640 Khz
[05:14:12] <guanche> but if I solve the equation on the datasheet for compare-match, and providing I use a prescaler of 8, shouldn't I end up with 2.5 Mhz with an OCR value of 0?
[05:14:43] <guanche> this is because 20 Mhz / 8 = 2.5 Mhz
[05:18:34] <Thrashbarg> assuming you're referring to the timer itself and not a toggling output, sure
[05:18:59] <Thrashbarg> if you want that timer to output a square wave on a pin, you need to divide that frequency by two again
[05:20:08] <guanche> uhm, I'm made a mess with this
[05:20:38] <guanche> what I'm trying to do is to modulate the duty cycle, thus
[05:21:43] <guanche> I turn it on at the begining of these 32 timer cycles, and when as many interrupts has gone by (according to the desired duty cycle where 0 is none, 32 is 100%), I turn the pin off
[05:22:12] <Thrashbarg> 8 or 16-bit timer?
[05:22:23] <Thrashbarg> Timer0 suggests 8-bit
[05:22:24] <guanche> timer0, which is 8 bit
[05:23:41] <Thrashbarg> you'd want the PWM mode obviously, but if you want 32 steps you could always left-shift the 5-bit number three times
[05:24:21] <guanche> I'm doing sofware pwm, as usual, simply using the timer
[05:24:38] <guanche> because target chipset might not have a pwm
[05:30:56] <Thrashbarg> hm ok I'd like to help but I've been awake for way too long already
[05:31:20] <guanche> np, thanks
[05:31:26] <guanche> I'll keep struggling with this
[05:31:45] <Thrashbarg> I'm sure there's someone else here who's got more of a clue than I do at the moment anyway lol
[05:32:25] <guanche> hehe, I might solve by my own on the way
[05:32:28] <guanche> but thanks again
[07:36:38] <Malinus> is IRQ another thing SS is called in SPI, because of no name conventions?
[07:37:37] <Tom_itx> SS is slave select
[07:38:32] <Tom_itx> used to select your active slave device, you can have other IO pins for slave but that one needs to be initialized as OUTPUT for SPI to work
[07:40:11] <Tom_itx> #define SPI_STC_vect _VECTOR(17) /* SPI Serial Transfer Complete */
[07:40:23] <Tom_itx> is the interrupt
[07:40:27] <Tom_itx> at least on that device
[07:43:12] <Tom_itx> iirc, spi: MISO, MOSI, SCK, SS are the pins used
[07:48:52] <Malinus> Tom_itx, yeah, but there is no name convention, so sometimes they call the same things differently. Very confusing.
[08:47:44] <Casper> Malinus: SS can also be called Chip Enable, or sometime just Enable
[08:50:31] <specing> Slave Select is better
[08:50:48] <specing> because j/k, slaves
[08:50:56] <mesger> is there any good gerber file app for osx ?
[09:22:29] <Casper> specing: well, slave select, in the spi context, is indeed better
[09:23:22] <Casper> due to the master/slave presence, so the master select the slave.... but the slave will have CE or E, since it make more sense
[09:23:27] <Casper> which I find funny
[09:24:26] <PoppaVic> and remember, in LA, Master/Slave is deprecated.
[09:40:05] <Duality> https://code.google.com/p/avrmate/
[09:44:16] <rue_house> way to combine it all
[09:46:58] <Duality> actually was looking for avr python bindings
[09:50:28] <rue_house> a fuse/avrdude command line genorator is a nice union
[09:51:25] <rue_house> a makefile builder-runner and its set :)
[10:25:58] <Roter> i have a question. I was looking to buying this programmer: http://www.pololu.com/product/1300 . In the manual, it says this: The programmer is powered by the 5V USB power bus, and it is intended for programming AVRs that are running at close to 5 V (note that the programmer does not deliver power to the target device). So does this mean, i wont be able to power the microcontroller, when i connect it to the programmer and then to the computer? Or is it something
[10:25:58] <Roter> difrent?
[10:29:54] <amee2k> "intended for devices running at close to 5V" means it won't be able to program targets running at e.g. 3.3V
[10:30:53] <amee2k> the chip type is edited out on the product pictures, but it looks like a generic PL2303/FT232 USB interface with custom USB ID
[10:31:59] <amee2k> so it'll just put out straight 5V TTL signals, and AVR inputs typically are not "5V tollerant" if the chip is running at a lower voltage
[10:32:41] <amee2k> "won't be able to power the microcontroller" means you only get ground and signal pins, but on 5V output from the USB port.
[10:33:23] <amee2k> which makes sense, because if it provided power to the target system, potentially the entire target device would be running off the programmer's USB port
[10:33:46] <amee2k> and the target might take damage from improper power rail sequencing if it randomly has the 5V rail pulled high
[10:35:56] <amee2k> typically you'd connect the programmer to a running computer, then put the ISP cable on the target device, power up the target device with its own power source, and then start the programming procedure with whatever software you use for that
[10:39:38] <Roter> hmm, im quite new to this, but would something bad would happen if i just connected the microcontroller to the programmer and the programmer to the pc and then just use it? I wouldnt realy want to use a seperate power source.
[10:40:38] <amee2k> the ISP output on the programmer shouldn't be putting out any noticable amount of power
[10:42:19] <amee2k> typically, the target device won't take damage if you try to program a powered-off MCU, but obviously it won't work either
[10:43:29] <amee2k> i'd expect the programming adapter doesn't take immediate damage either, without seeing a schematic of that programmer board, or for that matter knowing what chip they used, it is impossible to say for sure
[10:44:42] <amee2k> from the pinout, it *looks* like you can get 5V USB power off the single-row header on the side, but you'll be limiteed to 500mA (and strictly speaking probably 100mA unless that chip registers as high power device with the USB host)
[10:45:54] <Roter> soory, but its still a bit hard to understand. "typically, the target device won't take damage if you try to program a powered-off MCU, but obviously it won't work either". Why wouldnt it work?
[10:46:10] <amee2k> because the target MCU isn't actually running
[10:46:43] <Roter> So if i connected the programmer to the mcu, would it power it?
[10:46:56] <amee2k> no. thats exactly the point
[10:47:34] <amee2k> it *might* work accidentially because the data signals go through the ESD protection diodes on the target chip and pull the rails high enough for it to work. but thats putting a lot of strain on the pin drivers of the programmer and probably doesn't work reliably either
[10:48:53] <amee2k> on one of the pictures is a pad labelled "5V VBUS", you can take 5V off that pin (but make sure to not short it by accident. i don't see any protection circuitry on the board, so you'd be shorting out the USB port)
[10:49:37] <amee2k> but probably a better idea to find a wall wart that says 5V and use that for experimenting
[10:50:16] <Roter> hmm, is this model difrent, or are most programmers like this?
[10:50:21] <amee2k> but the ISP connector should only have ground and data pins on it
[10:51:20] <amee2k> actually, thats the typical arrangement
[10:51:58] <amee2k> the reason there is a "Vdd" pin on the header is only there so the programming adapter an distinguish between 5V and 3.3V targets (or possibly other voltages)
[10:52:22] <amee2k> (which this one doesn't do. it always assumes 5V)
[10:52:41] <Roter> I see then, i was thinking of buying this programmer, because i could have gone to a shop and bought it, but now im thinking of just ordering one.
[10:52:56] <Roter> So do you have something like this, maybe better, or a bit lower price?
[10:53:55] <amee2k> 20$ for a purpose-made USB programmer, and from a western reseller, isn't /that/ bad
[10:54:36] <amee2k> you can probably go lower if you buy a generic FT232 adapter directly from china... a lot of AVR software should support (ab)using that for ISP
[10:55:06] <Roter> Well if there is no big difrence then its okay
[10:55:06] <amee2k> but hard to tell whats on these chinese boards when they arrive... minor anti-yay for generic product pictures :>
[10:55:27] <Roter> i just wanted too hear opinions, because im only startin
[10:55:37] <Roter> and i wanted to try programming microcontrollers
[10:56:06] <amee2k> we had an order with adapters that had a nice FT232 chip on the pictures, and when they arrived they had "epoxy blobs" with chinese PL2303 clones that don't even work with the official drivers
[10:57:00] <Roter> If i get this one, what else should i get for me to start programming it? It comes with an usb cabel, and the cable that goes from the programmer to the mcu
[10:57:38] <amee2k> yeah, the generic 6-pin cables. you'll probably want some MCU to actually program with it though :)
[11:00:08] <Roter> :D yeah, but i believe i also need some cables?
[11:00:19] <Roter> that connect from the 6-pin to the microcontroller
[11:00:22] <Roter> and maybe some leds
[11:00:52] <amee2k> depends. if you get a board like that "baby orangutan" board that they have, the 6-pin cable would suffice
[11:03:07] <amee2k> personally, i cut up a spare one of the 6-pin cables and soldered header pins to one end so i can plug it into these solderless experimentation boards
[11:07:53] <Roter> Will look into that, but i might do that later
[11:07:57] <Roter> when i have more experience
[11:08:22] <Roter> So i will need somesort of cables right?
[11:10:43] <amee2k> as i said, depends on what you want to use as target :)
[11:11:34] <amee2k> if the target board has a 6-pin header like that, then the included ISP cable will suffice
[11:13:13] <Roter> well i was thinking of just using a breadboard for testing and then getting a clean normal board, when i want to make something
[11:16:48] <Roter> would that be a good idea?
[11:19:32] <amee2k> sounds like a plan :)
[11:19:53] <amee2k> i just got a similar ISP programmer like that, and some atmega88s when i started
[11:21:05] <Roter> what is the cable called ?
[11:21:10] <Roter> i cant find the name
[11:21:37] <Roter> like a simble cable, but i can use it on the breadboard
[11:23:21] <amee2k> i don't think it has a specific name... 6-pin ISP cable, ribbon cable, IDC cable
[11:23:36] <amee2k> http://www.pololu.com/product/972 << this was in the related products list on the left :)
[11:24:32] <amee2k> imma run off soon btw... need to do homework and run an errand
[11:24:35] <Roter> no no, i mean a simple cable, that i could use to connect a pin from the mcu to a led or something
[11:24:39] <Roter> ok
[11:24:53] <Roter> thats my last question
[11:25:01] <amee2k> oh, okay... they make jumper cable kits for use on solderless boards
[11:25:16] <Roter> Also thank you for actualy anwsering them
[11:25:24] <amee2k> but any solid wire that is about the right size will do
[11:25:32] <Roter> allright thank you!
[11:26:07] <amee2k> i got a roll of single-stranded wire that works great at the hardware store here as "doorbell wire" (intended for wiring up doorbell buttons)
[11:27:06] <myself> ideally, you want 22AWG, since 24 is too small and flexible and it tends to fold up when you poke it into the breadboard
[11:27:21] <myself> solid 22, with cheap insulation like PVC, which is easy to strip
[11:27:42] <myself> https://www.sparkfun.com/products/11367
[11:27:50] <amee2k> http://www.ebay.com/itm/251178082666 << an advantage of wires like that is that they're male-to-female
[11:28:14] <amee2k> i.e. you can put the female end on something that already has pins, and then run the connections to wherever you need it on the solderless board
[11:28:24] <myself> yup, I have about a hundred of those
[11:29:04] <myself> and about 500 of http://www.ebay.com/itm/170943265214
[11:29:32] <amee2k> e.g. you could go from the ISP adapter's 6-pin header directly to the appropriate MCU pins
[11:32:27] <amee2k> hehe, yup, these are the male-male variant
[11:32:45] <amee2k> but i don#t like the ones with round heads... from my exp, they're *just* a tiny bit wider than 0.1"
[11:33:03] <amee2k> so if you line up more than 3-4 in a row on a breadboard, it tends to get cramped
[11:33:12] <amee2k> the ones with square posts line up more nicely
[11:35:23] <amee2k> and the female-female variant can also come in handy
[11:36:16] <amee2k> i made a little adapter board with stripeboard that has a ZIF socket and 3 rows of header pins on each side. this way i can run wires from the ZIF board to a cheapo eval board with a mega64A (which has a male header for IDC cables too)
[11:41:21] <Roter> soory, but that i dont know most of those words :D
[11:59:05] <myself> amee2k: I agree, the round ones have slightly too wide a head to stack next to each other, and the pins are often covered with adhesive and so make a flaky connection until you clean 'em.
[12:03:09] <myself> you might be amused at my solution for protyping with double-row headers. Everyone has a few of these or something similar sitting around: http://dangerousprototypes.com/2011/11/08/dipthedil/
[12:03:46] <myself> I sliced up the middle of a breadboard to move the sides closer together: http://www.flickr.com/photos/myself248/11377373075/
[12:06:59] <Roter> that is quite interesting
[12:08:40] <myself> The next few photos show various steps of the process.
[12:08:46] <amee2k> hehe, nice
[12:09:13] <myself> I've asked sparkfun to look into having some manufactured that way
[12:09:14] <amee2k> i made an adapter board that fits over the center divider
[12:09:29] <myself> yeah, I have a bunch of those adapters but I hate them :P
[12:09:42] <amee2k> but i rarely use it... i tend to prefer point to point wiring with jumper wires
[12:10:14] <myself> at some point, 20cm of wire starts looking an awful lot like an antenna, and 5cm of breadboard is just 'better enough' to sidestep the problem ;)
[12:10:57] <amee2k> hehe >_>
[13:46:51] <Lambda_Aurigae> IDE cables for the win.
[13:47:04] <Lambda_Aurigae> or floppy cables.
[13:47:17] <Lambda_Aurigae> then you can stick wires into the holes at the other end and jump to breadboard.
[14:00:44] <Roter> wait wait
[14:00:53] <Roter> you can use ide cables?
[14:01:09] <Roter> like remove one line of cable, and remove the ends, and then just use it?
[14:10:01] <Lambda_Aurigae> who removes?
[14:10:25] <Lambda_Aurigae> stick dual row thingies into the end of the cable then stick wires into the other end to jumper to a breadboard.
[14:10:54] <Lambda_Aurigae> just remember that on many IDE cables there is one hole plugged up and not usable.
[14:25:33] <theBear> without reaching for the floor, isn't it only ANCIENT ones with a blocked hole ?
[14:30:26] <Roter> i still dont realy understand how you can use them.
[14:31:04] <Roter> I thought maybe you could split one of the lines of the cable, and use that line, as a jumper cable
[14:47:08] <Roter> so does anybody know, where i can find jumper cables
[14:47:16] <Roter> there are non in shops nearby
[14:47:58] <Roter> i have a lot of difrent wires, including IDE, so looking for a way to maybe use them
[14:48:04] <l9> ld computer
[14:48:08] <l9> old computers
[14:48:55] <l9> or if you can find old used blasting wires they are perfect on a breadboard
[14:57:46] <Roter> by old computers, what do you mean?
[15:00:30] <l9> IDE cable amongst other...
[15:01:13] <Roter> yeah, but how would i use the ide cable?
[15:01:22] <Roter> soory, dont realy understand
[15:01:28] <l9> you have a soldering irion right?
[15:01:34] <Roter> yeah
[15:02:41] <l9> is it me or am i trying too explin too you howto make a wire too use on breadboards?
[15:04:31] <Roter> well, i just wanted to know if i could maybe use a single wire from the IDE, but i was just asking to be sure and not waste it
[15:04:43] <Roter> so yes. how do into wire
[15:06:17] <l9> well unmantle the core and solder the first 1cm of the wire it will keep it from splitting up
[15:06:51] <l9> be carefull not too over solder the tip then it wont fit into the board.
[15:07:49] <l9> http://www.ebay.co.uk/itm/40pcs-Dupont-Male-to-Male-Jumper-Wire-Ribbon-Cable-Pi-Pic-Breadboard-Arduino-/281200991665?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item4178e29db1 or you could buy a ribbon like that
[15:07:51] <Roter> oh!
[15:08:05] <Roter> i just dont realy want to order stuff and then wait for it
[15:08:46] <l9> so how are you getting your new shinny atmels then?
[15:09:21] <l9> it took me over half a year too complete my first project, and that was a simple mood light for my kid
[15:09:48] <l9> pation and waiting is part of it i guess
[15:10:09] <Roter> :D yeah i guess
[15:10:29] <Roter> i just want to try it out. maybe i wont even like it, so i dont want to overspend
[15:11:19] <l9> Roter: do you like beeing stuck and having too really work hard too find a solution?
[15:11:41] <Roter> well, i know programming, so i guess i do
[15:11:53] <Roter> i just want to be able to show my work outside of my computer
[15:14:12] <l9> then you will love avrs
[15:14:30] <l9> but takes time and pations and it is a whole new ball game
[15:16:03] <Roter> Yeah, atleast i know C++, so i believe it wont be hard for me to use C
[15:16:32] <Roter> you are quite a cool guy, helped me quite alot, so what kind of projects have you done?
[15:16:40] <Roter> maybe i would be able to try some
[15:16:56] <l9> haha a mood light
[15:17:39] <l9> i have been busy having a life, kinda ruins all programming
[15:18:01] <Roter> :D
[15:18:26] <Roter> yeah, i have plenty of time to be on the computer, so i try to make the best of it
[15:18:52] <l9> but i have been spending time on raspberry pi lately and i have been looking into a complete setup for controlling light/temp/ph for my aqarium
[15:19:24] <l9> and i am setting up a new web store for electronic parts
[15:22:12] <Roter> cool
[15:22:27] <Roter> well, im leaving, i like to sleep.
[15:22:28] <Roter> bye
[18:17:20] <balrog-k2n> hi, i'd like my code to work when an SPI slave chip is connected to SPI, or when it's not connected, I'm using the standard SPI transfer code (write to SPDR, wait for SPIF to be set, read from SPDR)
[18:17:36] <balrog-k2n> it hangs if there's no SPI slave, why could that be?
[18:53:56] <twnqx> balrog-k2n: actually.. can't
[18:54:12] <twnqx> spi will just read garbage when no slave is connected
[18:54:51] <balrog-k2n> twnqx: that's what I was thinking, but apparently SPIF never gets set when the pins are not connected
[18:57:19] <twnqx> to put it carefully
[18:57:29] <twnqx> my code works, whether there's a slave or not...
[19:01:26] * balrog-k2n usually hits the strangest issues
[19:01:45] <twnqx> tell me about it, it took me days to even get serial working :/
[19:01:56] <twnqx> but then all of my code is from scratch
[19:04:33] <Malinus> twnqx, but there are perfect examples in the datasheet of how to use the peripherals.
[19:04:47] <Malinus> twnqx, just if you weren't aware.
[19:05:08] <twnqx> that doesn't help you if those perfect examples lose data
[19:07:10] <balrog-k2n> twnqx: well, today my host code to talk to the avr through serial works under strace but not without it, *that's* a fun bug
[19:07:21] <twnqx> :)
[19:07:50] <twnqx> i had something like that before too... years ago
[19:08:03] <balrog-k2n> anyway i added a timeout to the wait for SPIF and things are better
[23:46:39] <Roklobsta> does anyone have libraries of avr parts for kicad?
[23:48:25] <Roklobsta> no one says anything while i quietly faceplam.
[23:53:20] <Roklobsta> hem the 16U's are in the default library