#avr | Logs for 2015-03-14

Back
[07:48:45] <Lambda_Aurigae> happy PI day!
[12:11:09] <shiinko> Hey
[12:11:42] <shiinko> I have a weird problem with my circuit, I'm using ATTiny 2313 with LEDs and a button
[12:11:53] <shiinko> of I power it using USBasp it works as expected
[12:12:05] <shiinko> but if I connect it to a battery (and 5V regulator)
[12:12:13] <shiinko> the button stops working
[12:13:04] <shiinko> There isn't full 5V on the AVR (about 4V) but it should work according to specs, I think. I have it programmed to run at 1MHz
[12:14:50] <shiinko> Another thing I can't figure out is that it works with 9V battery (it still has about 8V and it drops when everything is powered), but it doesn't work with a fully charged LiPo
[15:08:22] <gmarsh> stupid quick question: other than avrdude, are there any programming tools for windows for AVR's, that'll work with an ISP MKII?
[15:09:03] <gmarsh> and atmel studio obviously?
[15:13:04] <DKordic``> shiinko: Can You provide schematic?
[15:15:50] <shiinko> DKordic``: I don't have one, it was my first project so I didn't plan much in advance
[15:17:12] <shiinko> But what I have is a button that is not working for unknown reason. I made a test program and after the first button press, it seems "stuck"
[15:17:25] <shiinko> The program was supposed to turn the LED on while button was held down
[15:17:45] <shiinko> But when using it with this battery the LED stayed on after button release
[15:26:05] <DKordic``> shiinko: More information would help. Give me link to code (hastebin.com) with desscription of the problem and PCB in comment at the begining.
[15:27:35] <shiinko> DKordic``: Okay, I'll send the link when it's done
[15:27:47] <DKordic``> shiinko: Do You have a __capacitor__ between VCC and GND?!
[15:28:34] <shiinko> DKordic``: I didn't have any at hand when I was building it but I have them now. So no, right now there aren't any
[15:29:08] <DKordic``> Plastic and electrolite, the bigger the better, in paralllel between VCC and GND __after__ voltage regulator.
[15:29:36] <DKordic``> I bet that is the difference.
[15:30:05] <shiinko> I ordered a lot of different values off eBay, what value should I aim for?
[15:30:54] <DKordic``> Put the biggest You have __both__ plastic (or similar) and electrolitic in __parallel__.
[15:32:10] <shiinko> both of them between GND and regulator output?. I have electrolytic and ceramic capacitors at hand
[15:32:49] <DKordic``> Yes. Great.
[15:34:22] <DKordic``> Are You using solderless breadboard?
[15:34:38] <shiinko> Most of the schematics online show one capacitor between input and GND and second one between GND and output
[15:35:00] <shiinko> Also I have up to 2200uF capacitors here, I guess that's too much though ? ;)
[15:37:08] <DKordic``> I don't see how could it be too much. Put another one on input of regulator if You can.
[15:42:38] <shiinko> DKordic``: I don't feel like soldering right now but I think it's helping
[15:43:56] <shiinko> Oh, and to answer a previous question, didn't see it. I have it soldered on a PCB with holes, so connected using wires
[15:44:15] <shiinko> Not the best looking thing but it work, as soon as I solder on some capacitors
[15:44:19] <shiinko> works*
[15:45:18] <DKordic``> Cap on input is more important for this http://en.wikipedia.org/wiki/Rectifier#Full-wave_rectification circuit than batery.
[15:46:37] <DKordic``> shiinko: Buy a solderless breadboard. Or go to hacker space nearest to You. They most likely have a pile of them.
[15:47:42] <shiinko> I have them but I haven't really tested it out before soldering it on the board
[16:50:54] <Lambda_Aurigae> shiinko, also, what is the battery voltage you are feeding the regulator and what is the regulator?
[16:55:38] <mark4> lol. either im missing something or atmel messed up with this documentation. "This bit is protected by the configuration change protected mechanism. Refer to Configuration Change Protection on page 13 for details. go to page 13 and it explains what config change protection is
[16:55:52] <mark4> it then says "Refert to the individual registers for how to enable changes" lol
[16:56:32] <mark4> both sections refer to each other saying "they tell you how to do it over there" lol
[16:57:07] <Lambda_Aurigae> what bit?
[16:57:46] <mark4> this was the IVSEL bit. i guess i just missread the page 13 stuff, it doesnt say "refer to the register containing the bit you want to change for how to do it"
[16:58:00] <mark4> it says refer to the CCP register... the avrs im used to didnt have this reg
[16:58:23] <mark4> the CCR register has two values you write to it. one to enable spm, the other to enable bit changes of protected bits
[16:58:31] <Lambda_Aurigae> yup.
[16:59:29] <mark4> so i do out ccp, 0xNN or do i need to st to ccp+0x20 ?
[16:59:38] <mark4> its not telling me the address of that register
[16:59:43] <mark4> im sure its in there somewher
[17:01:53] <Lambda_Aurigae> the address is in the datasheet for that chip.
[17:01:59] <Lambda_Aurigae> there should be a register list somewhere.
[17:02:30] <mark4> i wish they wouldnt do that, scatter all the related info both throught one document and throught multiple documents
[17:02:47] <mark4> why they dont just make ONE document with all the info grouped together....
[17:02:53] <mark4> but nobody does that
[17:02:57] <Lambda_Aurigae> it's there.
[17:02:59] <Lambda_Aurigae> what chip?
[17:03:17] <mark4> its the atxmega256a3bu
[17:03:21] <mark4> im in the "Complete" doc
[17:03:43] <mark4> so im sure this info is in here somehwere, but its NOT shown on the page where they talk about any specific register
[17:04:11] <mark4> the foo register has bits 0 thru 7 and this is the purpose of the foo register. thers no "the foo register is at address 0xnnnn"
[17:04:24] <Lambda_Aurigae> yes..xmega...the red headed stepchild of the avr world.
[17:04:27] <mark4> they have a picture of the register and bits. it would be simple to put the register addres next to that
[17:04:32] <mark4> heh
[17:05:21] <Lambda_Aurigae> if it were regular atmega or attiny then it's all in one datasheet.
[17:06:03] <mark4> well ya. the atmega suffers the scatterbrained documentation to a degree but not as bad as this and NEITHER of these is as bad as ANY texas instruments documentation
[17:06:29] <Lambda_Aurigae> and I'm running back and forth to the kitchen...cooking crescent rolls in the waffle iron.
[17:07:09] <mark4> they have a doc for GPIO for this one chip i was working on. you go there and RTFM how to use this peripheral and.... buried deep inside a small sentence in a totally different document is info on ONE BIT of some control register that unless you set it you cannot use that peripheral
[17:07:24] <mark4> no mention of this bit anywhere in the documentation on that peripheral
[17:07:27] <mark4> that cost me a job
[17:07:41] <mark4> you can do that? lol
[17:07:42] <mark4> !
[17:08:02] <mark4> a doc for a peripheral i mean not gpio
[17:10:03] <Lambda_Aurigae> ok...looks like, in the document that is not the complete, they are all in there.
[17:10:11] <Lambda_Aurigae> peripheral module address map gives you the base address
[17:10:28] <Lambda_Aurigae> then in the sections it gives you an offset from the base address to the left of the register description.
[17:10:44] <Lambda_Aurigae> pulling the complete to see if it is similar.
[17:10:52] <mark4> offset != address lol.
[17:11:12] <mark4> they probably are. one of those docs is a work in progress, its not finished
[17:11:13] <Lambda_Aurigae> you look at the peripheral module address map to get the base address for the peripheral you are working with.
[17:11:18] <Lambda_Aurigae> then add the offset to that.
[17:11:40] <mark4> ya and that map should be in the same doc lol... just sayin. but again, hardly any chip maker does that
[17:11:46] <Lambda_Aurigae> same thing in the complete document.
[17:11:52] <Lambda_Aurigae> section 34 has the base addresses.
[17:11:54] <Lambda_Aurigae> it is!
[17:12:06] <Lambda_Aurigae> both documents have the same address map in the same location..section 34.
[17:12:36] <mark4> so CCP has a +0x04 next to its picture... thats its offset?
[17:12:48] <mark4> its where i would expect to usually see an address
[17:13:04] <Lambda_Aurigae> the complete document isn't really complete..use the atxmega au manual.
[17:13:18] <Lambda_Aurigae> that is the offset, yes.
[17:13:28] <mark4> ok and yea im in that manual now
[17:13:47] <mark4> i discarded the two documents you just went to
[17:13:49] <Lambda_Aurigae> I don't even use xmega..this is the second time I've looked at xmega manuals...figured it out in under 5 minutes.
[17:14:00] <mark4> they dont have any real info in them, just marketing bullshit
[17:14:25] <mark4> i didnt need you to go research, you basically answered my question in your first sentence
[17:16:00] <Lambda_Aurigae> hehe..I needed to research it for my own verification.
[17:16:19] <mark4> :)
[17:16:20] <Lambda_Aurigae> I did have a little help early on in my electronics hobby world though.
[17:16:37] <Lambda_Aurigae> when I was 12 I had a Xerox engineer teach me how to read and understand datasheets.
[17:16:41] <mark4> actually this isnt 100% just a hobby. my avr code is hobby right now
[17:16:47] <mark4> but im planning on using this at work.
[17:16:48] <Lambda_Aurigae> for me it's hobby.
[17:16:57] <Lambda_Aurigae> I fix copiers for a living.
[17:17:06] <Lambda_Aurigae> electronics has been a hobby of mine since I was 8.
[17:17:12] <Lambda_Aurigae> 39 years ago.
[17:17:28] <mark4> its been my job for a long time but when im new to a device family i still sometimes need help :)
[17:17:41] <mark4> your slightly younger than me :)
[17:18:27] <Lambda_Aurigae> I've had some real impressive mentors along the way.
[17:20:08] <Lambda_Aurigae> a guy who worked for Xerox PARC, a guy who was a lead engineer at Los Alamos, a guy who was a lead engineer for Sandia National Labs, and Robert Metcalfe(inventor of ethernet whoalso worked at Xerox PARC)
[17:20:56] <Lambda_Aurigae> although, Robert Metcalfe I only worked with for a month when I was in my 30s.
[17:22:42] * Xark remembers his InfoWorld column...
[17:22:47] <Lambda_Aurigae> me too.
[17:23:09] <Lambda_Aurigae> My boss of the time knew him personally and we were doing some bleeding edge software development for network management.
[17:23:28] <Lambda_Aurigae> and, him being the nominal father of modern networking, they brought him in to consult on the project.
[17:23:53] <mark4> you were doing sw dev then professionally?
[17:24:17] <Fleck> anyone know a lib for ENC28J60?
[17:24:49] <Lambda_Aurigae> mark4, I was the IT department of the company...and, yes, I was doing some software dev along with the professionals.
[17:24:56] <Lambda_Aurigae> Fleck, depends on what you want to do with it....
[17:25:18] <Fleck> listen on multiple ports and send/receive data? :D
[17:25:20] <Lambda_Aurigae> the tuxgraphics stack rocks.
[17:25:24] <mark4> real IT guys have to do some sort of devel
[17:25:30] <Lambda_Aurigae> yeah.
[17:25:39] <Lambda_Aurigae> I wrote a lot of parsing scripts for the developers.
[17:25:42] <mark4> ugh is that a microchip device?
[17:25:57] <Lambda_Aurigae> they tried doing them in perl..I did them in C, they were faster, and they worked where the ones in PERL didn't
[17:25:57] <Fleck> yes
[17:26:01] <Lambda_Aurigae> mark4, yes..and it rocks.
[17:26:10] <Lambda_Aurigae> ethernet to spi device.
[17:26:29] <Lambda_Aurigae> add a couple of caps, a magjack, and a 25 mhz crystal and you have ethernet connectivity.
[17:26:29] <mark4> alot of microchip "Devices" are freeking awesome. i just dont like their PIC devices at all.
[17:26:42] <mark4> pic32 isnt a pic device. its a MIPS device
[17:26:45] <Lambda_Aurigae> mark4, I don't like most PIC devices...the pic32 devices rock though.
[17:26:56] <mark4> pic32 is mips
[17:26:57] <Lambda_Aurigae> it's a mips device with pic peripherals.
[17:26:59] <mark4> not pic :P
[17:27:07] <Lambda_Aurigae> yes, I know.
[17:27:19] <mark4> their peripherals are always rock solid, its there uC cores that are brain dead
[17:27:30] <Lambda_Aurigae> and the peripherals attached to it are awesome...but way complicated sometimes..
[17:27:36] <Lambda_Aurigae> and, talk about horrid documentation!
[17:27:41] <mark4> heh
[17:27:55] <Lambda_Aurigae> I'm working with some pic32mx270f256b chips right now.
[17:28:24] <Lambda_Aurigae> 28pin dip package, 50MHz, 256K flash, 64K sram, MIPS core, usb otg/host/device.
[17:28:45] <Lambda_Aurigae> AND, it can execute code from sram if properly configurated.
[17:29:40] <Lambda_Aurigae> thinking I might build an ethernet tap with one.
[17:29:57] <Lambda_Aurigae> one pic32, two enc28j60, and some bits-n-pieces.
[17:30:12] <Lambda_Aurigae> hook up usb to the PC I want to capture to and put the device inline.
[17:30:41] <Lambda_Aurigae> http://tuxgraphics.org/electronics/200606/article06061.shtml
[17:30:46] <Lambda_Aurigae> for fleck
[17:31:10] <Lambda_Aurigae> I've used that to build ethernet mini-server and mini-client using atmega chips.
[17:37:16] <Lambda_Aurigae> http://www.procyonengineering.com/embedded/avr/avrlib/
[17:37:25] <Lambda_Aurigae> also has an enc28j60 library and network stack.
[17:37:38] <Lambda_Aurigae> it is much older and not so well developed and can be a pain to use sometimes.
[17:37:52] <Lambda_Aurigae> Pascal Stang is a good guy though and has helped me out in the past with his stuff.
[17:42:15] <mark4> so atxmega256 ""A"" 3bu <-- the A makes this an A version of the xmega right?
[17:42:29] <mark4> beause each one has a different manual, i assumed it did
[17:42:50] <Lambda_Aurigae> umm...sure.
[17:42:55] <Lambda_Aurigae> guess so.
[17:43:01] <mark4> heh thas what i thunked
[17:43:31] <Lambda_Aurigae> would have to dig through the website to see but I would bet that is correct.
[17:43:45] <Lambda_Aurigae> oh man...supper here is uber-yummers!
[17:44:10] <Lambda_Aurigae> put a corned beef brisket in the crock pot this morning..with some potatoes and half a cup of chopped garlic.
[17:44:25] <Lambda_Aurigae> meat and potatoes are just falling apart...and soooo garlicky!
[17:44:35] <Lambda_Aurigae> good thing the wife is gone for the weekend.
[17:45:08] <mark4> kind of like a potroast but different :)
[17:45:14] <Lambda_Aurigae> much different.
[17:45:18] <mark4> i would put peas and carrots in that
[17:45:24] <mark4> moar peas!
[17:45:36] <Lambda_Aurigae> corned beef is a cut of meat that is cured in sugar and salt and seasoning.
[17:45:40] <Lambda_Aurigae> it's "corned"
[17:45:55] <Lambda_Aurigae> an irish dish I guess.
[17:45:57] <mark4> yes i know what corned beaf is, there aint no corn in it! lol
[17:46:02] <Lambda_Aurigae> nope.
[17:46:04] <mark4> argentina makes alot :P
[17:46:33] <Lambda_Aurigae> it's not usually available around here except for right around st. patricks day.
[17:46:59] <mark4> where is "here" ?
[17:47:24] <Lambda_Aurigae> Iowa, USA, Earth, Sol System, Milky Way Galaxy.
[17:47:29] <Lambda_Aurigae> not sure which universe though.
[17:48:10] <mark4> heh when a cop asks me where im going i usually look up into the sky for caseopea so i can find where the andromida spiral is. i point towards it and say "that way"
[17:48:42] <mark4> our galazy and andromida are heading towards each other and will collide in about 3 billion years
[17:48:51] <Lambda_Aurigae> yup.
[17:48:57] <Lambda_Aurigae> I try to avoid having cops ask me where I'm going.
[17:49:35] <mark4> i wont give a cop anything. no drivers license, no proof of insurance, only my name. thats it.
[17:49:59] <Lambda_Aurigae> here, if they ask for your license and registration and insurance proof, you give it to them or they can arrest you.
[17:50:16] <mark4> and then you sue them for violating your right to silence. basically
[17:50:35] <Lambda_Aurigae> if you can afford to sue them.
[17:50:36] <mark4> and you dont need no bar corporation idiot to help you do it. in fact your worse off if you do
[17:50:54] <mark4> if you cant afford to sue them then your action is 100% totally free. its called indegent status
[17:51:05] <mark4> i would currently qualify
[17:51:09] <Lambda_Aurigae> hehe.
[17:51:15] <Lambda_Aurigae> this is argentina, yes?
[17:51:19] <mark4> no
[17:51:27] <mark4> thats just where they make alot of corned beef :)\
[17:51:33] <mark4> im in texas. but this applies to every state
[17:51:39] <Lambda_Aurigae> hmm.
[17:51:48] <Lambda_Aurigae> don't think I would want to test it.
[17:51:54] <mark4> you have no legal requirement for a drivers license or insurance or a title
[17:52:01] <mark4> well yes. it would be a PITA for sure lol
[17:52:30] <mark4> no requirement for places. inspection stickers, none of that. unless u are using the road for commercial purposes.
[17:52:35] <mark4> truck dricer, taxi driver.
[17:52:44] <mark4> but... im not recommending trying this either lol
[17:53:30] <mark4> this xmega has interrupts AND events
[17:53:36] <mark4> going to have to rtfm wtf an event is lol
[19:10:36] <mark4> hmm has anyone implemented a hardware divide using the avr's fractional multiply?
[19:15:26] <specing> fractional multiply?
[19:15:31] <specing> XMEGA stuff?
[19:15:33] <mark4> yes
[19:50:49] <DKordic`> Even mega8 has fmul{,s,su}. AFAIK it is just a lsl after mul*. Rd*(2**(-7)) * Rr*(2**(-7)) = (Rd*Rr)*(2**(-14)). fmul should result in R*(2**(-15)) so R = 2*(Rd*Rr) or lsl (Rd*Rr).
[21:22:44] <mark4> wth lol ONE cycle to write SRAM, two to read it! that seems bass ackwards
[21:24:45] <specing> why?
[21:24:57] <specing> it makes perfect sense
[21:25:14] <specing> your cpu cannot execute while it is waiting for data
[21:25:31] <specing> but written data can be put into a flush buffer that is flushed later
[21:27:08] <mark4> i dont think ive ever seen a cpu where writes were faster than reads
[21:31:24] <specing> mark4: then you've never seen a CPU?
[21:32:14] <specing> they are faster or equal on all CPUs
[21:32:26] <specing> they are equal on 8bit avrs
[23:42:19] <markm_> ok so im looking at a disassembly of the example code that comes with my a3bu explained board and its doing an out to port 0x3b but this is listed as reserved in the documentation
[23:42:49] <markm_> out $3b, r20 ; wtf?
[23:42:59] <markm_> its not a disassembly of data. its code
[23:43:22] <markm_> r20 has 0 here
[23:49:37] <Casper> what is 0x3b?
[23:49:51] <Casper> and on what µC?
[23:51:27] <markm_> its for the atxmega256a3bu
[23:51:36] <markm_> i sucked the code off with my avr dragon and am disassembling it
[23:51:48] <markm_> its doing an out to port address 3b
[23:52:35] <markm_> it looks like its enabling LPM but the CTRLA register is at offset 0x0b
[23:52:52] <markm_> there is no register at $3b, that port address is reserved
[23:53:07] <markm_> so obviously im not understanding this disassembly
[23:53:21] <markm_> or the disassembler is just totally wrong
[23:53:28] <markm_> BF0b is the opcode. duh
[23:53:39] <markm_> why is it adding 0x30 to that in the disassembly?
[23:54:27] <markm_> BF0B should be disassembled as "out $0b, r16" no?
[23:54:55] <markm_> 1011 1AAr rrrr aaaa
[23:56:28] <markm_> no the disassembly is right. the upper two AA bits are set so its 11 1101 or 3b
[23:57:00] <markm_> and the register is 1 0000 which is r16
[23:58:12] <markm_> unless xmega opcodes are encoded differently lol