#avr | Logs for 2015-08-13

Back
[00:11:48] <z3t0> Hi, I recently purchase 2 atmega328ps (http://www.dx.com/p/aaron-1-atmega328-pu-atmel-microcontroller-chip-for-uno-r3-uno-328-2pcs-267118) and only just realized they are direct replacements for the UNOs chip, so that means its set to use an external oscillator... I need to set it to use the internal one but dont know how. I am using OS X any help appreciated
[00:15:55] <darklor> do you have atmel studio?
[00:16:15] <z3t0> I dont believe there is an atmel studio for os x....
[00:16:24] <darklor> do you have avrdude?
[00:16:42] <z3t0> ye
[00:16:44] <z3t0> yes*
[00:16:47] <darklor> the internal osc is enabled by programming fuse bits
[00:16:56] <z3t0> I also found something called AVRFuses an application for fuse programming
[00:17:08] <darklor> be very careful as you can easily "brick" your chips by doing this wrong
[00:17:20] <z3t0> yea i figured as much.. but have no idea how to do so.
[00:17:22] <z3t0> hmm
[00:17:31] <darklor> one sec
[00:17:41] <z3t0> I am trying to figure out what the Bit Clock should be, it is one of the options i have to enter for AVRFuses
[00:17:42] <z3t0> thanks
[00:17:58] <z3t0> btw the chip is ATmega 328P PU
[00:18:28] <z3t0> and it is clocked at 16MHz external, which i need to change to internal (which is why i need to do fuse programming). I dont have any external oscillators
[00:18:38] <z3t0> or more accurately i do have the oscillator but not the capcacitors
[00:18:50] <Xark> z3t0: Have you checked out http://www.engbedded.com/fusecalc/ ?
[00:19:04] <darklor> are you using crystal or ceramic osc
[00:19:12] <z3t0> I am not using any yet
[00:19:18] <z3t0> Xark: thanks will take a look
[00:19:53] <z3t0> I recently purchased the chips and have not been able to program them yet, they came as UNO replacements so they are set to external 16, but i do not have those which is why i want to set it to use internal 8HMz
[00:20:31] <darklor> are you using a programmer?
[00:20:32] <Xark> z3t0: You may need an external xtal to change the fuses...
[00:21:14] <z3t0> darklor: arduino as isp
[00:21:24] <darklor> okay, where did you buy the chips
[00:21:37] <z3t0> Xark: xtal is a crystal right? I have the crystal but not the caps
[00:21:40] <z3t0> darklor: http://www.dx.com/p/aaron-1-atmega328-pu-atmel-microcontroller-chip-for-uno-r3-uno-328-2pcs-267118
[00:21:46] <darklor> yes xtal is crystal
[00:21:55] <darklor> does it have 2 or 3 leads
[00:21:56] <z3t0> darklor: would it work without the caps?
[00:22:02] <darklor> if it has 3 leads
[00:22:03] <Xark> z3t0: Well, you nay need a working oscillator (i.e., with caps). :)
[00:22:05] <z3t0> darklor: 2 I can give you a link
[00:22:13] <darklor> i dont need a link
[00:22:20] <z3t0> I see... would there be any other way?
[00:22:50] <darklor> when I buy the 328p chips they are set up to use the internal 8Mhz internal osc
[00:23:09] <darklor> and i program them using arduinio as isp, or equiv
[00:23:11] <z3t0> yes unfortunately i did not look too closely and it was my first time buying them
[00:23:20] <darklor> what site did you get them from
[00:23:33] <z3t0> darklor: http://www.dx.com/p/aaron-1-atmega328-pu-atmel-microcontroller-chip-for-uno-r3-uno-328-2pcs-267118
[00:23:58] <darklor> ah, so they probably have some super funky settings
[00:24:08] <z3t0> yeah
[00:24:08] <darklor> i have never had good luck with the asian import chips
[00:24:18] <darklor> are you in the US
[00:24:28] <darklor> if so, i get them from DigiKey and Mouser
[00:24:34] <darklor> cheap and fast shipping
[00:25:01] <z3t0> I just found some things that may be capacitors... any idea how i can measure their capacitance using a multimeter
[00:25:22] <darklor> only some multimeters have uF setting
[00:25:35] <darklor> it will say uF or F on the meter somewhere if it can
[00:25:37] <z3t0> oh ok
[00:25:45] <Xark> z3t0: Some DMMs have that, however tiny ~20pF caps like for xtal are probably too small...
[00:25:47] <z3t0> i dont think mine has it then, its a basic one
[00:25:48] <darklor> what do the capacitor things look like
[00:26:06] <z3t0> black cylinder with two legs and HDX written on the side
[00:26:20] <z3t0> also if i shake it i can here things moving about inside
[00:26:35] <z3t0> hmm
[00:26:35] <darklor> the caps you need will look like small pankakes with 2 wires coming out
[00:26:41] <z3t0> I have a crazy idea
[00:26:44] <z3t0> gimme a sec
[00:26:46] <darklor> about 2mm diameter, .5mm thick
[00:26:47] <darklor> okay
[00:27:05] <Xark> z3t0: You want much smaller ones, like https://www.adafruit.com/products/2215 (often blue)
[00:27:05] <darklor> the cap you have is electrolytic, you need ceramic, or metal film wtc
[00:27:33] <darklor> exactly
[00:27:52] <darklor> you can usually find them in old VCR's and similar electronics
[00:28:08] <darklor> when I first got started with electronics, thats how i got most of my passive parts
[00:28:58] <z3t0> ok so i found an old board i designed for a custom arduino but it never worked out
[00:29:09] <darklor> have you tried hooking your chips up without the xtal and just trying to program the fuse bits to use internal xtal
[00:29:13] <z3t0> however i did solder on the right caps and can stick an stall in there
[00:29:30] <z3t0> darklor: yes it gives me invalid device signature
[00:29:37] <z3t0> oh wiat
[00:29:39] <z3t0> my bad
[00:30:00] <z3t0> I have not tried programming the fuse bits without the xtal as i dont know how to actually program the fusebits
[00:30:22] <darklor> go to that fuse calculator website you pasted and use the defaults
[00:30:56] <darklor> if you gimme a sec, i can get some for you to try that should be safe
[00:31:15] <z3t0> darklor: ok il paste what i get in here just to check with you
[00:31:32] <z3t0> this is what i get
[00:31:33] <z3t0> -U lfuse:w:0x62:m -U hfuse:w:0x99:m -U efuse:w:0xff:m
[00:32:49] <darklor> one sec while i check those
[00:32:56] <z3t0> ok
[00:33:15] <z3t0> do you know Bit Clock is? and what would be the default for the mega 328p?
[00:34:28] <darklor> that term appears to be specific to that program
[00:35:00] <z3t0> ok
[00:35:29] <darklor> i would use hfuse of 98 instead of 99 to enable reset vector so serial programming will work
[00:35:41] <z3t0> ok
[00:36:06] <darklor> if you have a uart usb dongle
[00:36:17] <darklor> if not then 99 is fine
[00:36:24] <z3t0> unfortunately i think i will have to use a crystal... i can't talk to the chip due to avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xff
[00:36:43] <z3t0> i do have a rs232 to usb
[00:37:21] <z3t0> what would happen if i tried without the caps?
[00:37:42] <darklor> try lfuse of E2, whick will not use clockdiv
[00:37:53] <darklor> caps, no caps, same effect
[00:37:57] <darklor> its just hex
[00:37:57] <z3t0> E2?
[00:38:00] <darklor> yep
[00:38:11] <z3t0> sorry but i dont really know what that is..
[00:38:23] <darklor> what is the that to which you refer
[00:38:58] <darklor> clockdiv, e2, hex?
[00:39:06] <z3t0> e2
[00:39:24] <darklor> the value to set the lfuse to
[00:40:22] <darklor> it will use the same settings you were using before, just not devide the internal 8Mhz clock by 4
[00:40:33] <darklor> which may be causing the sync issue
[00:40:48] <z3t0> but how do i set it to e2?
[00:40:58] <z3t0> I dont really know anything about fuse programming
[00:41:08] <darklor> don't worry
[00:41:32] <darklor> so you are using that graphical fuse programming program right?
[00:41:36] <z3t0> yes
[00:41:42] <z3t0> i can use avrdude if you want
[00:41:45] <z3t0> i dont mind either way
[00:41:58] <darklor> do you know how to use it?
[00:42:11] <z3t0> its basically just choosing the options
[00:42:26] <z3t0> its very similar to the calculator you linked
[00:42:32] <darklor> okay, so use avrdude
[00:42:36] <z3t0> ok
[00:42:47] <z3t0> so umm
[00:43:05] <darklor> what
[00:43:08] <z3t0> one sec
[00:43:30] <darklor> for the fuses portion of the args use: -U lfuse:w:0xe2:m -U hfuse:w:0x98:m -U efuse:w:0xff:m
[00:44:05] <z3t0> it doesn't work because i get invalid sigature
[00:44:13] <darklor> hmm
[00:44:40] <darklor> what is the exact avrdude string you are using
[00:44:57] <z3t0> avrdude -c avrisp -p m328p -P /dev/tty.usbmodem1d111 -U lfuse:w:0xe2:m -U hfuse:w:0x8 9:m -U efuse:w:0xff:m -F (2) rafikhan1:~*
[00:45:09] <z3t0> ignore the (2) ..
[00:45:09] <Xark> z3t0: What is the "bad" signature it gets (in the error)?
[00:45:14] <z3t0> 0x000
[00:45:22] <Xark> Yeah, so not really talking.
[00:45:28] <z3t0> yup
[00:45:46] <darklor> how sure are you that the connection between programmer and chip are correct
[00:46:00] <darklor> it can be easy to flip MISO and MOSI
[00:46:09] <z3t0> i have checked several times, the only way it might not work is that the avr legs dont reach into the breadboard
[00:46:20] <darklor> that is a possibility
[00:46:23] <z3t0> lemme check another time just in case
[00:46:37] <darklor> afk for a few min
[00:46:42] <z3t0> ok
[00:50:19] <darklor> i am getting some parts together, to see if i can replicate your problem
[00:51:59] <darklor> well crap, i dont know where my loose 328's went
[00:52:14] <darklor> well, i wish i could have been of more help
[00:53:02] <darklor> i gotta go for now, but i should be on again tomorrow, i will look for my chips and see if i can duplicate your situation and provide you with a tutorial of some kind.
[00:53:14] <z3t0> no problem
[00:53:18] <z3t0> thanks for all the help
[00:53:40] <z3t0> i am starting to think the arduino (ISP) may be the problem
[00:53:47] <darklor> no problem, it was fun, and hopefully, I will be able to get you up and running
[00:53:59] <darklor> actually, i found that it is usually the solution
[00:54:26] <darklor> arduino as isp is EXACTLY the same as many commercial programmers out there
[00:55:12] <darklor> so i am going to bed, but if you are still stuck, check back here tomorrow
[00:55:16] <darklor> bye
[11:38:06] <z3t0> Hi, I trying to change the fuse bit of my atmega 328p but i t an error saying safemode: fuse changed was ff and now is 7
[11:38:20] <z3t0> The arguments i am using is: -U lfuse:w:0x62:m -U hfuse:w:0xd9:m -U efuse:w:0xff:m
[12:09:45] <Jartza> hola
[12:09:56] <fobboyandy> sup jartza
[12:10:05] <Jartza> vga with attiny85
[12:10:06] <Jartza> that's up :)
[12:10:07] <fobboyandy> saw the monitor thing you did yesterday
[12:10:10] <fobboyandy> pretty cool
[12:10:24] <fobboyandy> oh that was ran on an attiny85?
[12:10:26] <Jartza> yeah, going to make it support ansi codes (at least subset)
[12:10:33] <Jartza> yeah, attiny85
[12:10:54] <Jartza> after the ansi works like I want it to, then I'll hook up 3 attinys
[12:10:55] <fobboyandy> is what your doing going to be made public?
[12:10:58] <Jartza> and make it color
[12:11:01] <Jartza> yes it is
[12:11:03] <fobboyandy> cause i kinda wanna see it
[12:11:06] <Jartza> I'll write a blog post about it
[12:11:10] <fobboyandy> sweet
[12:11:13] <Jartza> with source code in github etc
[12:11:37] <fobboyandy> do you already have a blog with previous projects?
[12:11:43] <Jartza> although it's now completely assembler
[12:11:54] <Jartza> but maybe that might teach something still
[12:12:08] <Jartza> fobboyandy: http://labs.rakettitiede.com/language/en/
[12:12:28] <Jartza> that's actually our company blog, but I write those english embedded posts :)
[12:12:55] <fobboyandy> lol how do you pronounce the title
[12:13:25] <Jartza> just say rocket science :D
[12:13:33] <Jartza> rakettitiede is rocket science in finnish
[12:14:18] <Jartza> the audio-data-transfer might be of some interest :)
[12:14:34] <fobboyandy> am reading that right now
[12:14:52] <fobboyandy> for how long have you been doing avr?
[12:16:44] <Jartza> umm... I guess my first avr-stuff was made around 8 years ago
[12:17:01] <fobboyandy> oh my lord
[12:17:06] <Jartza> but not very actively
[12:17:17] <Jartza> over 8 years of embedded total, mostly at work
[12:17:40] <fobboyandy> i started about last week. when will i be as good as everyone else?
[12:17:42] <Jartza> arm, embedded linux, avr, 8051, whatnot
[12:17:50] <fobboyandy> how long does it usually take to start understanding things?
[12:17:59] <Jartza> fobboyandy: never, as there is no such thing as "everyone else" :D
[12:18:07] <Jartza> I might be good at some stuff and suck at some
[12:18:17] <Jartza> the same applies to everyone. nobody's perfect
[12:18:29] <fobboyandy> amen
[12:18:33] <Jartza> to understand things, I suggest you take the "cruel" approach
[12:18:43] <fobboyandy> which is? fail and learn from it?
[12:18:45] <Jartza> even if you have arduino and all the i2c and spi controllers and stuff
[12:18:50] <Jartza> make something with bitbanging
[12:18:55] <Jartza> try to bitbang spi, or i2c
[12:19:21] <Jartza> that is a good learning
[12:19:31] <fobboyandy> are there college courses that can teach me this?
[12:19:39] <Jartza> once you understand those buses, that's a small victory already
[12:19:57] <fobboyandy> how do you learn these things? who taught you?
[12:20:06] <z3t0> Hi, I am having a bit of a problem with an atmega328p
[12:20:23] <Jartza> fobboyandy: I'm "self-taught"
[12:20:27] <z3t0> I am trying to use _delay_ms in a blink test but it won't use the right timing
[12:20:30] <Jartza> so, reading, trying, experimenting.
[12:20:37] <Jartza> failing is an important part of success
[12:21:07] <Jartza> you try - you fail - you try again - you fail again... repeat that so many times it makes you cry and suddenly you find out that you understood something and succeed :)
[12:21:28] <z3t0> instead of a one second delay, i get a 8 second delay
[12:21:31] <Jartza> z3t0: have you defined F_CPU?
[12:21:35] <z3t0> yes
[12:21:42] <z3t0> as 8000000
[12:21:49] <Jartza> hmm. and using internal oscillator?
[12:21:52] <z3t0> yes
[12:21:57] <Jartza> I bet you have clk/8 fuse burned then
[12:22:04] <Jartza> that divides the internal clock by 8. making it 1MHz
[12:22:05] <z3t0> yes i do
[12:22:08] <z3t0> oh
[12:22:19] <Jartza> 8MHz / 8 = 1MHz :)
[12:22:23] <z3t0> that makes sense... i did not really understand what that meant at the time, thanks will try that
[12:22:38] <Jartza> no prob
[12:22:46] <Jartza> fobboyandy: oh, and irc proves to be very helpful
[12:22:49] <fobboyandy> thanks jartza, looks like i have a long way ahead of me
[12:22:50] <Jartza> always ask questions
[12:23:02] <Jartza> getting some sort of logic analyzer is very helpful
[12:23:21] <z3t0> hmm
[12:23:21] <Jartza> I personally recommend saleae ones, but they might be a tad expensive for hobbyists
[12:23:46] <fobboyandy> oh we have logic analyzers here at my school
[12:23:47] <z3t0> just another quick question, i seem to get this a lot. when trying to program efuse i get 0x07 != 0xff
[12:23:51] <fobboyandy> just don't know what it's for yet
[12:23:55] <fobboyandy> LOL
[12:24:07] <Jartza> fobboyandy: well, for example to see if your i2c works as expected :)
[12:24:27] <z3t0> dw i fixed it, i simply program the fuses one by one and i wokrs
[12:24:27] <Jartza> z3t0: did you use fuse calculator?
[12:24:29] <z3t0> works*
[12:24:41] <z3t0> Jartza: yes, not sure why i can't program them all at once
[12:24:53] <Jartza> http://avrcalc.pl/
[12:25:08] <Jartza> z3t0: when internal osc is set to 1MHz, try lowering the speed of programming
[12:25:19] <Jartza> like adding -B 8 to avrdude command
[12:25:37] <z3t0> oh ok
[12:25:37] <z3t0> thanks
[12:25:55] <Jartza> at least it seems to help with my programmer and attiny85, which comes from factory as 1MHz
[12:26:02] <z3t0> makes sense
[12:26:10] <fobboyandy> what kind of programmer do you use jartza?
[12:26:34] <Jartza> for avr, I have avr isp mk2 clone
[12:26:39] <Jartza> olimex one
[12:26:39] <fobboyandy> i was having quite a dilemma when it came to choosing my first programmer
[12:27:01] <Jartza> https://www.olimex.com/Products/AVR/Programmers/AVR-ISP-MK2/open-source-hardware
[12:27:04] <fobboyandy> are clones compatible with the official atmel softwares?
[12:27:37] <Jartza> at least that olimex works fine with avr studio
[12:27:46] <Jartza> although I use OSX and command-line-tools
[12:27:52] <Jartza> I'm a bit oldschool :)
[12:28:08] <fobboyandy> i ended up getting a pocket avr programmer from sparkfun
[12:28:16] <fobboyandy> what's the difference between them all
[12:28:19] <Jartza> other cheap programmers can work with atmel studio using avrdude and configuring them as external tools
[12:29:02] <fobboyandy> ok so what's the difference between an avrisp and the cheaper ones?
[12:29:07] <Jartza> oh, that seems to be usbtiny clone
[12:29:20] <Jartza> well, they work a bit differently
[12:29:35] <Jartza> "major" ones are avrisp and usbtiny and usbasp clones
[12:29:56] <Jartza> I think avrisp is the "closest" clone of atmels own
[12:30:07] <Jartza> but all of them work just fine with avrdude
[12:30:12] <fobboyandy> how are they different?
[12:30:13] <Jartza> so I wouldn't worry that much
[12:30:30] <Jartza> different firmware in programmer and it listens to different kind of protocol
[12:30:37] <fobboyandy> other than the ones that can debug, don't the programmers all flash firmware and get same resule?
[12:30:39] <fobboyandy> result*
[12:30:40] <Jartza> but they all program the avr the same way
[12:30:55] <fobboyandy> kk
[12:30:57] <Jartza> yes, all can program and burn fuses, no worries there
[12:31:14] <fobboyandy> lol
[12:31:18] <Jartza> even those $2 cheap chinese usbasp-clones on ebay seem to work after firmware update
[12:32:02] <fobboyandy> so even some of the really cheap ones can work with avr studio if they have the same protocol as some of the atmel ones
[12:32:36] <Jartza> and with avrdude, even the weirder ones work
[12:32:54] <Jartza> avrdude has excellent support for programmers
[12:33:32] <fobboyandy> RikusW told me that development boards like STK500 have debugging features
[12:34:03] <fobboyandy> i still don't see how microcontrollers can have bugs yet
[12:34:23] <fobboyandy> don't bugs come from the code itself? and to debug means looking at the code?
[12:34:47] <fobboyandy> instead of trying to debug it outside of the code?
[12:44:49] <z3t0> does anyone know what pin timer1 is one for the atmega328p?
[12:46:17] <z3t0> is it pin 15?
[12:46:57] <antto> may be a dumb question but.. doesn't it say in the datasheet?
[12:47:09] <z3t0> yes, just wanted to make sure
[12:47:26] <antto> u can never be fully sure ;P~
[12:47:40] <z3t0> i know but i mean, incase i misunderstood the data sheet
[12:48:05] <antto> what things does it say for pin 15?
[12:48:31] <z3t0> OC1A
[12:48:49] <antto> Output Compare 1 A i guess
[12:48:56] <z3t0> ok
[12:49:07] <z3t0> i think thats the one
[12:49:29] <antto> is there also OC1B?
[12:49:37] <z3t0> yes thats 16
[12:49:40] <antto> and how about C and D?
[12:49:51] <z3t0> 02CA is 17
[12:49:57] <z3t0> no D
[12:50:02] <antto> right
[12:50:08] <antto> and timer1 is 16bit i guess
[12:50:12] <z3t0> yes
[12:50:36] <antto> i'm guessing it can work as 2 8bit PWMs or something
[12:50:45] <antto> and then that's what A and B are for
[12:50:45] <z3t0> not sure about that
[12:50:50] <z3t0> probably
[12:51:34] <antto> you probably can chose or enable the compare output individually on OC1A and OC1B via the timer1 configuration bitz
[12:52:06] <z3t0> I am trying to figure out how i can disable the interrupt on timer 1
[12:52:40] <z3t0> (TIMSK &= ~_BV(OCIE1A) should work?
[12:53:22] <antto> man.. xmega looks easier nao ;]
[12:53:40] <z3t0> how so?
[12:54:35] <antto> u got stuff like TC_BLABLA_bm
[12:54:40] <antto> in avr/io.h
[12:54:45] <z3t0> ok
[12:55:01] <z3t0> i am quite new to avr programming so i probably wouldn't understand
[12:56:22] <antto> you got a whole structure in the header for each timer
[12:56:38] <antto> this structure has the timer control registers as member variables
[12:57:57] <antto> you also have the different configurations for the timer declared as enums..
[13:00:21] <antto> toomuchinformation.gif
[13:27:29] <z3t0> does anyone know if the avr delay has any limits? I know that the arduino delay does have limits
[13:28:15] <Tom_itx> it does
[13:28:19] <Tom_itx> i don't remember what it is
[13:28:25] <z3t0> oh
[13:28:34] <z3t0> is there any way to code around it?
[13:28:45] <Tom_itx> put it in a loop
[13:29:21] <z3t0> ok thanks
[13:29:38] <Tom_itx> http://tom-itx.no-ip.biz:81/~webpage/avr/tiny10/t10blink.asm
[13:29:47] <Tom_itx> that's basically a double loop
[13:30:05] <z3t0> cool thank you
[13:40:57] <Jartza> whoa
[13:41:10] <Jartza> a hawk-eye-colleague of mine just spotted a bug from my vga code
[13:41:18] <Jartza> instead of add + adc I had add + add
[13:41:34] <Jartza> luckily it didn't cause trouble now, but it could've been nasty to debug .)
[13:42:07] <Jartza> especially because I added to Z-register and used ijmp after that
[13:52:13] <z3t0> hi, i dont know why but i seem to be getting an undefined reference to (function name)
[13:53:39] <z3t0> if anyone would be interested to check here is the gist. It's a small file and probably a simple mistake
[13:53:40] <z3t0> thanks
[13:53:43] <z3t0> #join c
[13:59:57] <Jartza> here is the gist? where? :)
[14:00:35] <Tom_itx> It's a small file
[14:00:38] <Tom_itx> too small to see
[14:02:30] <Jartza> I see
[14:02:38] <Jartza> well the problem is, it's missing a byte... or two
[14:08:27] <z3t0> dw i fixed it
[14:09:03] <z3t0> does anyone know what TIMSK does in Arduino? and how i can use it in avr?
[14:09:30] <Jartza> I don't know about arduino, but datasheet should have definition what TIMSK does
[14:10:07] <Jartza> on attiny it enables or disables timer/counter compare interrupts etc.
[14:11:25] <z3t0> ok thanks
[14:11:31] <z3t0> i figured it out i think
[14:12:46] <z3t0> hmm i have a new problem
[14:13:14] <z3t0> I need to use _delay_ms but it expects a compile integer time constant
[14:13:38] <Jartza> yes
[14:13:54] <Jartza> so you can't use variable there
[14:14:27] <Jartza> but you can use for example for(uint8_t i=0; i<10; i++) _delay_ms(1);
[14:14:53] <Jartza> or make that a function
[14:15:31] <z3t0> oh i see
[14:15:32] <z3t0> thanks
[14:18:54] <Jartza> or if you don't need a millisecond accuracy, use _delay_ms(10) etc.
[14:26:49] <z3t0> do you know how i can use an atmega328p from the arduino side?
[14:26:51] <z3t0> IDE*
[14:26:55] <z3t0> I need to burn the bootloader
[14:33:34] <Jartza> I don't use arduino myself
[14:33:35] <Jartza> :(
[14:47:21] <Martin90> bss36504, are you there ?
[14:47:34] <bss36504> Martin90: howdy
[14:48:19] <Martin90> Hello ;)
[14:49:02] <Martin90> bad news ... do you remeber our last talk and my locked uC ?
[14:49:34] <bss36504> I believe so. You put it in low frequency oscillation mode by mistake, right?
[14:50:09] <Martin90> yex, I plug that low crystal oscilator 32.768kHz and still ca't flash...
[14:50:12] <Martin90> yes*
[14:50:46] <Martin90> AVRDUDE output: "I plug that low crystal oscilator 32.768kHz"
[14:50:48] <Martin90> sorry
[14:51:01] <Martin90> "avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc..."
[14:51:17] <Martin90> ^ this is the avrdude output ;)
[14:52:51] <Martin90> I remove exteral caps (22 pF) and now new error message: "avrdude: error: programm enable: target doesn't answer. 1
[14:52:51] <Martin90> avrdude: initialization failed, rc=-1"
[14:53:45] <bss36504> Huh, are you trying to program it via usb or something? I dont know much about avr dude. If you are trying to use a USB DFU or something, he 32.768khz crystal probably isnt able to be used to make the clock required for USB.
[14:54:02] <bss36504> But if youre using an external programmer, I assume you have anther issue.
[14:54:05] <Martin90> yes via USV
[14:54:07] <Martin90> USB*
[14:54:55] <bss36504> Oh, you may need an external programmer now. I didnt realize you were programming the device via a USB bootloader.
[14:55:32] <Martin90> I use USBasp and avrdude
[14:55:44] <Martin90> what you mean by external programmer ?
[15:01:22] <Martin90> you were mistaken pal ;) FORTUNATELY !
[15:04:37] <Martin90> I ulocked it ;)
[15:16:18] <Martin90> thank you for help !
[17:30:11] <Martin90> is "USART_RXC_vect" valid for atmega16a ?
[17:38:32] <bss36504> Martin90: What did you have to do to un-brick it?
[17:39:28] <Martin90> bss36504, simply turn my programmer to "slow" mode ;)
[17:39:32] <Martin90> no big deal :)
[17:39:33] <bss36504> haha
[17:39:38] <bss36504> yes that would do it.
[17:39:45] <bss36504> wait what programmer are you using?
[17:39:55] <Martin90> USBasp
[17:40:26] <Martin90> anyway, there is quite interesting question
[17:40:47] <bss36504> Oh, I thought you were directly trying to USB into the part, which I realize now make zero sense. It's been a long day. But yes, turing down the programming frequency to less than 1/4 the clock of the chip is important
[17:40:54] <Martin90> the settings I have now says " high grequency cristal 1 < ... Mhz
[17:41:26] <Martin90> so it means I can use any quartz fro m1 Mhz to 16 Mhz right ?
[17:42:04] <bss36504> I beleive so yes
[17:42:29] <Martin90> so how programmer (device) "know" at what freq programm ?
[17:42:50] <Martin90> its quite wide range of frequencies
[17:43:47] <bss36504> The programmer doesnt know what frequency it should program at, it's relying on you to correctly set that value to less than 1/4 the frequency of the target MCU.
[17:45:14] <Martin90> 1/4 the frequency of the target MCU why ?
[17:45:34] <Martin90> I mean what uC freq has to do with programmer freq of programming
[17:47:20] <bss36504> well the mcu has to do something with the data it's receiving, and that takes clock cycles. I presume that the way the programming module in the AVR works, in needs at least 4 clocks to do "something" with each bit it gets from the programming line
[17:47:34] <bss36504> short answer: It just has to be that way, Atmel said so.
[17:48:08] <Martin90> yeah short answer is nice but I would like to know ;)
[17:48:25] <Martin90> Since this actually lock my uC
[17:48:48] <Martin90> or maybe
[17:49:22] <Martin90> programmer sends some test data to figure aut what the freq is or detects it in other way, and then sends it at right speed ?
[17:49:53] <bss36504> Well no, thats not why your uC was locked. It became locked because you put it in a mode that needed a clock source you werent providing. Then, after you got it clocking again, you were attempting to program at a speed that was too high.
[17:50:14] <bss36504> In answer to the why, i think only Atmel really knows the reason
[17:50:16] <Lambda_Aurigae> the programming is done through the spi hardware which, if you try to run it too fast, won't work right due to its max speed is determined by the speed the processor is running.
[17:50:56] <bss36504> The why basically just is "Because they said so". Which I realize is sort of a lame answer, but it's valid in this situation.
[17:51:12] <bss36504> The SPI simply cannot operate at faster than 1/4 the CPU clock speed.
[17:51:34] <Martin90> Lambda_Aurigae, but now if I understand corretly I set my uC for frequencies form 1 - 16 Mhz its quite wide range don't you agree ?
[17:51:57] <bss36504> No, thats just the frequency of crystals that the oscillator circuit can lock onto.
[17:52:11] <bss36504> It has nothing to do with the final, implemented cpu speed
[17:52:34] <bss36504> the cpu speed will just be whatever your crystal is rated for, provided it is between 1Mhz and 16Mhz
[17:52:57] <Martin90> right
[17:53:27] <Martin90> so the question still ramains - when programmer starts flashing how does it know at what freq work ?
[17:53:33] <Martin90> 1 or 16 mhz ?
[17:53:37] <Martin90> 8 or 4 ?
[17:53:41] <Lambda_Aurigae> there are different fuse settings for different speed crystals too...to make things work better.
[17:53:51] <Lambda_Aurigae> the programmer doesn't know the speed of the processor.
[17:53:54] <Lambda_Aurigae> it doesn't care.
[17:53:57] <bss36504> The programmer just runs at whatever speed you tell it to
[17:54:01] <rue_school> it flashes at the clock rate, divided by the hardware divider, divided by the software
[17:54:03] <Lambda_Aurigae> but it can only run up to 1/4 of the processor speed.
[17:54:03] <rue_school> whatever that is
[17:54:14] <Lambda_Aurigae> if you try to go faster it won't work.
[17:54:20] <Martin90> so first read fuses settings and then flash it accordingly ?
[17:54:46] <Lambda_Aurigae> with fuses, always read once, check thrice, then write.
[17:55:55] <Martin90> Hmm where did you get this -> " it can only run up to 1/4 of the processor speed." why 1/4 of crystal ?
[17:56:33] <bss36504> Because thats what the Atmel Studio programming dialog instructs me to do, and above that it doesnt work :)
[17:56:33] <Martin90> few post ealier somebody said something like programmer doesn'r care...
[17:57:03] <bss36504> The programmer doesnt care, but the uC will care if it cant read the information being fed to it and then respond.
[17:57:11] <Martin90> bss36504, you figured it out perfect ;)
[17:57:30] <bss36504> Likely it's documented somewhere too
[17:57:59] <bss36504> I do know that in SPI "doublespeed" mode, you're at 1/2 clock, and normal max SPI is 1/4 clock, so I imagine it's related to that
[17:58:20] <Martin90> alright ;)
[17:58:28] <bss36504> Perhaps in programming mode, doublespeed isnt supported. Or perhaps in slave mode, doublespeed isnt supported
[17:59:13] <Lambda_Aurigae> programming won't run in doublespeed mode.
[17:59:23] <bss36504> Lambda_Aurigae: Right, exactly my point :)
[17:59:44] <Lambda_Aurigae> if you want to be independent of the clock speed, use HVSP or HVPP
[17:59:57] <Lambda_Aurigae> or use PICs
[18:01:42] <Martin90> in terms of interrupts; does USART interupts have to be set before ?
[18:01:55] <Martin90> I set global interrupts flasg and sei of course
[18:02:12] <Martin90> but USART inter.. doesn't fire
[18:02:12] <bss36504> Pretty sure there are module specific interrupt enable bits for the USART
[18:02:48] <Martin90> It looks like but I can't see any
[18:04:18] <Lambda_Aurigae> there are bits to turn on and off all of the interrupts.
[18:04:20] <Lambda_Aurigae> it's in there.
[18:04:29] <bss36504> Page 165: UCSRB: Bit 7, RXCIE: RX Complete Interrup Enable
[18:05:05] <Martin90> yes I see, thank you guys ;)
[18:05:39] <Martin90> I should probably take a break ;)
[21:18:03] <MarkX> hi, i am about to follow the command here >> http://electronics.stackexchange.com/questions/161361/burn-micronucleus-bootloader-to-use-attiny85-via-usb-avrdude << with this setup >> http://2.bp.blogspot.com/-3RpB2COVHjI/TkBXUdm-i1I/AAAAAAAAACU/THx73jgf1bY/s1600/fritzing.png
[21:18:05] <MarkX> does the uno need any specific sketch running on it?
[21:20:18] <Lambda_Aurigae> might want to ask in an arduino channel.
[21:20:37] <MarkX> yep did, but that channel looks dead :(
[21:20:51] <Lambda_Aurigae> and most of us here don't do arduino.
[21:21:02] <MarkX> ah my mistake
[21:21:16] <LeoNerd> "duplo" as I sometimes call it
[21:21:25] <Lambda_Aurigae> ardweenie
[21:21:43] <MarkX> hahaha
[21:22:27] <Lambda_Aurigae> I think arduino causes brain damage.
[21:22:48] <MarkX> jeez such hatred
[21:22:50] <LeoNerd> Eh, not sure. It's like Duplo.
[21:23:14] * Jordan_U likes Duplo blocks.
[21:23:16] <LeoNerd> It's OK to give to absolute beginners to teach the basic idea that you can stick things on other things and make bigger things, but once people have that concept and basic hand-eye coördination, they should move on to something nicer
[21:23:53] <bss36504> Like welding steel I-Beams
[21:24:26] <LeoNerd> Jet fuel can't weld steel I-beams
[21:24:36] * bss36504 groans
[21:24:39] <MarkX> so dang
[21:24:41] <MarkX> dank*
[21:24:59] <bss36504> Arduinos cant melt plastic duplos
[21:25:02] <bss36504> wait a second....
[22:16:19] <Valen> bss36504: bet they can
[22:16:25] <Valen> if you perhaps set them on fire
[22:17:50] <Valen> LeoNerd: https://www.youtube.com/watch?v=J-_cLM6XuAU running off kerro which is jet fuel, I reckons that'll get er done
[22:45:08] <grey> An Atmega328p should be able to do 9600 baud usart with the internal oscillator, right?
[22:46:08] <Valen> at some level of accuracy i presume so
[22:53:24] <grey> hrm, I'm trying to print "Hello world!!" through a CP2102 uart->usb module, and I'm getting "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒" in my terminal :\
[22:55:52] <bss36504> grey: sounds like your terminal is just getting garbage.
[22:56:02] <bss36504> do you have a scope?
[22:56:21] <bss36504> I apologize in advance for any errors, I've been at work for almost 15 hours
[22:56:45] <grey> Ah I do have a scope, but it's too late to hook that up tonight
[22:57:50] <grey> if it's just garbage, that's fine, wasn't sure if that could indicate baud/clock problems, or what
[22:58:22] <bss36504> Well, it may. It seems as though something is wiggling on the data lines, just not what you want.
[22:59:01] <bss36504> Assuming you went through the registers correctly, the 328 should be more than capable of 9600 using the internal osc. Theres a table about it in the datasheet
[22:59:11] <bss36504> like max baud rates for certain clocks
[22:59:25] <bss36504> also the ol' formula for the baud rate register
[23:03:49] <Valen> my first test with anything like that is to do a loopback test
[23:04:02] <Valen> make sure all your serial port crap is working before worrying about the micro
[23:04:24] <grey> can you just jumper the txd and rxd pins on the cp2102 breakout? o_o
[23:04:49] <bss36504> What, to echo what you type? sure
[23:30:23] <grey> bss36504: that worked like a dream, so I at least ruled out a faulty usb/usart module, thanks!
[23:30:38] <grey> tomorrow I'll bust out the scope and see what the lines coming out of the AVR look like
[23:31:11] <bss36504> grey: Are you fortunate enough to have a serial decoder in your scope?
[23:31:30] <grey> no, but if the signals aren't total garbage I have a seperate bus probe that should do that
[23:31:41] <bss36504> perfect
[23:31:55] <bss36504> at least you should see them wiggling if the module is set up properly