#avr | Logs for 2016-03-22

Back
[01:04:09] <noko> How to read fuse bits state of XMEGA from application?
[09:02:48] <phinxy> Any idea what freq. a crystal labelled as "D250E2T" could have?
[09:17:44] <twnqx> LeoNerd: have some datasheet quotes...
[09:17:56] <twnqx> (found in a texas instruments datasheet) "Pins 6-May" (should be "Pins 6-5")
[09:18:15] <twnqx> "This is I/O bi-direction. Now it is used as clock output for EEPROM or Serial Flash memory"
[09:18:34] <twnqx> (taiwanese, SPI CLK pin)
[09:23:42] <LeoNerd> Mmmm
[09:28:49] <Tekkkz_> 4
[10:05:25] <phinxy> GND, VCC, D0, D1, RES, DC, CS. i cant figure out what d0 and d1 are on this SPI display
[10:05:39] <LeoNerd> What sort of display?
[10:05:43] <phinxy> sdd1306
[10:05:46] <LeoNerd> Is it possible those are letters - DI and DO?
[10:05:54] <LeoNerd> Data In and Data Out - if it's an SPI chain?
[10:06:04] <LeoNerd> as would be suggested by CS and... I'm guessing DC is "data clock"?
[10:06:08] <LeoNerd> Ah the 1306
[10:06:12] <LeoNerd> Yah I expect that's in and out
[10:06:13] <phinxy> D0 could be DO but D1 is a 1 for sure
[10:06:24] <LeoNerd> It's probably intended to be an I though
[10:06:29] <LeoNerd> maybe someone typoed it somewhere along the line
[10:06:46] <phinxy> ahh so DC is the clock. a website here says its data/command selection pin
[10:07:07] <LeoNerd> Well it oculd be.. but then where's the clock?
[10:07:14] <LeoNerd> RES is likely reset
[10:07:33] <phinxy> and that goes to..
[10:07:54] <LeoNerd> Also I'd suggest reading the ssd1306 datasheet on its various interface modes
[10:08:05] <phinxy> i have worked on another ssd display
[10:08:10] <phinxy> i know its datasheet in and out
[10:08:15] <phinxy> there are some cool hardware features
[10:08:29] <LeoNerd> Ahhhh
[10:08:33] <LeoNerd> In 4-wire SPI mode,
[10:08:34] <LeoNerd> D0 acts as SCLK, D1 acts as SDIN."
[10:08:37] <phinxy> But i used I2C on that one
[10:08:42] <LeoNerd> ^-- so those really /are/ D{zero} and D{one}
[10:08:53] <LeoNerd> D0 is the clock, D1 is the MOSI.. there is no MISO
[10:09:32] <LeoNerd> (section 8.1.3, page 17)
[10:10:59] <LeoNerd> I have annoyingly little luck with these SSD1306 chips
[10:11:15] <LeoNerd> The first one I bought had a nice interface, but there was some massive hardware fault in it causing huge corruption on the DRAM
[10:11:58] <LeoNerd> The second one is "I²C"-alike... quoting intentional. It omits the output bridge resistor on the D2 line, meaning it can't pull the SDA line low to ACK bits
[10:12:00] <LeoNerd> So you have to write it blind
[10:12:20] <LeoNerd> There's relatively few I²C interfaces that make it easy to blind-write to a slave ignoring its total apparant lack of ACK
[10:51:30] <Jartza> evening
[11:06:13] <twnqx> :(
[11:06:30] <twnqx> i just realized the LED controllers i wanted to play with during easter only have 4bit pwm :/
[11:13:28] <cehteh> 4 bit is not that bad, if they implement some tricks for logarithmic intensity. when you do that with 8 bit on avr you wont get much more than 16 levels too (unless you add some clever dithering)
[11:14:11] <LeoNerd> LED PWMing tends to be a bit odd anyway... I find anything higher than about 25% duty cycle starts to just look "Fully on" anyway
[11:14:46] <cehteh> yes thats this logarithmic lightness perception thing of the human eye
[11:15:22] <cehteh> you cant go lineary from 0 to 255 and expect that you see linear brightness increase
[11:17:19] <cehteh> i usually do a simple (x*x)/255 adaption, thats simple and close enough to the human perception (there are more advanced formulas to match it better) ... but that gives about 16steps only too
[11:25:11] <phinxy> When using "hardware SPI" with u8glib does Command/Data selection (a0) need to be any specific pin=?
[11:26:53] <eszett> hi
[11:29:35] <eszett> can someone help me getting my atmega into bootloader mode?
[11:30:04] <twnqx> still? :P
[11:30:16] <twnqx> are you sure you didn't accidentally erase your bootloader? :>
[11:30:19] <phinxy> does anyone know how u8glibs "PN()" macro works?
[11:30:31] <eszett> twnqx:. hi! yes still.. i didnt erased anythings, thats for sure
[11:30:31] <phinxy> im not sure if they expect pins to begin at 0 or 1
[11:30:49] <eszett> twnqx: do you know by chance an easy way to check if there is a bootloader in memory?
[11:31:25] <twnqx> the only thing i can tell you is that it's likely not there any more if you used ISP programming with avrdude or similar
[11:31:34] <twnqx> because that starts with a chip erase
[11:31:44] <eszett> argh!?
[11:32:07] <LeoNerd> So just write one back onto it again
[11:32:18] <eszett> I typed all the avrdude commands manually into the console, so how on earth did it erase anything?
[11:33:02] <eszett> hmm you mean when i flashed the memory?
[11:33:14] <LeoNerd> Because -U flash: ... by default does FCE
[11:33:19] <eszett> argh!
[11:33:34] <eszett> ok, i download the DFU bootloader hex binary from atmel website
[11:34:03] <eszett> but im not entirely sure how to flash it with that entry adress
[11:34:18] <eszett> the manual says Entry point: 0x3800
[11:39:49] <twnqx> i admit i never did that
[11:40:09] <twnqx> on my only megaU i always used the USB bootloader for flashing
[11:40:19] <eszett> I see..
[11:41:13] <twnqx> but from what quick googling tells me
[11:41:19] <twnqx> you just write it like any other .hex file
[11:41:33] <twnqx> nothing special needed, because the offset information is contained in the file
[11:41:43] <eszett> its contained in the file??? ahh!
[11:41:45] <eszett> very good
[11:42:01] <eszett> alright let's flash it
[11:43:18] <eszett> avrdude -c USBasp -p m32u4 -U flash:w:ATMega32U4-usbdevice_dfu-1_0_0.hex
[11:43:47] <twnqx> notice the output saying something about erasing?
[11:43:49] <LeoNerd> Looks good
[11:44:07] <eszett> now it erased the main program, and did successfuly write the bootloader!
[11:44:30] <eszett> dont know why it has to erase the whole chip (with main program) for this, but anyway. no problem
[11:44:31] <twnqx> very good. next time, write the main program using the bootloader. that will retain both.
[11:44:39] <eszett> yes
[11:45:45] <eszett> hm, When i plug the usb cable in, my OS doesnt detect the atmega
[11:46:11] <LeoNerd> To activate the bootloader you still need to put it into boot mode
[11:46:23] <LeoNerd> Again - my breakout board has a "boot" button on it. I have to press that or it does nothing.
[11:47:10] <eszett> Leo: yes, AFAIK HWB has to be connected to GND (it is!) while i press the reset button
[11:47:27] <eszett> still nothing..
[11:47:37] <twnqx> it willl only be there for a few seconds after reset
[11:48:01] <twnqx> at least that's how it is on my arduino with stock DFU bootloader
[11:48:41] <LeoNerd> I don't know how the stock DFU one works.. I have Adafruit's fancier one
[11:48:50] <eszett> hm ok
[11:48:59] * eszett working on it
[11:51:24] <eszett> in the extended fuse, there is a bit called HWBE (Hardware Boot Enable) and it is enabled here, as by default. So this should be fine.
[11:54:37] <twnqx> mind, fuse bits are inverted
[11:54:39] <twnqx> 0 = active
[11:56:15] <LeoNerd> Yah; that always makes me stop and think really carefully
[11:56:21] <LeoNerd> I've been bitten by that loads of times now
[11:56:54] <LeoNerd> Usually on tiny chips though, so I can just use my HVSP burner to pop them back again ;)
[11:57:20] <eszett> twnqx: yes I've learned about thaat inversion yesterday ;-)
[11:57:32] <WormFood> What do you guys feel is the "smallest" AVR that can handle doing USB?
[11:57:48] <LeoNerd> Personally? Probably 32U4
[11:57:50] <twnqx> megau2 :P
[11:58:03] <eszett> WormFood: not sure
[11:58:04] <LeoNerd> Oh, or 16U2 I suppose since that's "smaller"
[11:58:08] <learath> WormFood: are you trying to get on hackaday, or are you trying to actually make something work?
[11:58:08] <WormFood> I need like 8 pins
[11:58:10] <twnqx> but if you talk that software usb stuff, there's some 8pin that's used
[11:58:20] <LeoNerd> I wouldn't go near that myself
[11:58:22] <WormFood> learath, I'm trying to design something, using minimal costs.
[11:58:26] <twnqx> google the tinyi2c
[11:58:27] <LeoNerd> Hardware PHY is useful
[11:58:36] <learath> then use something from china
[11:58:37] <WormFood> An actual product, not something for show
[11:58:46] <twnqx> http://www.harbaum.org/till/i2c_tiny_usb/index.shtml
[11:58:47] <twnqx> that
[11:58:50] <eszett> WormFood: minimal costs has also something to do with finding good prices/sources ;-)
[11:58:56] <WormFood> of course
[11:59:03] <twnqx> but it's software usb, so... risky
[12:01:56] <WormFood> thanks for that link twnqx. that looks like it can do what I want.
[12:02:18] <WormFood> actually, I want the USB aspect of it, to be able to program itself, over usb.
[12:02:38] <twnqx> i just posted it because of the tiny45 (8pin)
[12:02:53] <twnqx> it uses obdev's software usb (open source), now available for many chips & clock rates
[12:02:59] <WormFood> The AVR used in that is the ATtiny45, which I can get for about $0.65 according to Atmel's website.
[12:03:47] <learath> twnqx that's pretty cool
[12:03:54] <twnqx> http://www.mouser.fi/ProductDetail/NXP-Freescale/MKL03Z8VFG4/?NXP-Freescale%2fMKL03Z8VFG4%2f&NXP-Freescale%2fMKL03Z8VFG4%2f&qs=sGAEpiMZZMtqO%252bWUGLBzeFTiWLnX7Jk2WnTIq7zzrFc%3d if only those had USB :(
[12:05:06] <twnqx> learath: it has varying degrees of success. i admit it worked for my tests on... can't remember what chip i used :S
[12:05:09] <twnqx> probably a mega8
[12:09:08] <eszett> twnqx: as far as i understand it, you say, writing flash with -U command does always erase the whole flash beforehand, including bootloader, right?
[12:10:16] <LeoNerd> I believe I said that already
[12:10:29] <LeoNerd> If you're using straight ISP, yes
[12:10:32] <eszett> you said that Leo, right
[12:10:38] <eszett> Leo: Is it possible to write main programm and bootloader at the same time into memory
[12:10:49] <LeoNerd> The usual way to do that on a 32U4 would be to put the bootloader on, and then use *it* to update the main firmware
[12:10:50] <eszett> as if main programm and bootloader are on single file?
[12:10:51] <LeoNerd> So it remains
[12:10:53] <LeoNerd> E.g. in avr109 mode
[12:10:59] <LeoNerd> That's how I do mine
[12:11:07] <eszett> Leo: maybe, but the bootloader doesnt work, it stays silent here
[12:11:11] <LeoNerd> Then fix that
[12:11:18] <LeoNerd> Once the BL works, then you can use it as above
[12:12:06] <eszett> hmm. After i flashed the BL, i read the whole flash memory to a file, and inspected it with my text editor. it seems the BL is really there.
[12:12:49] <eszett> But how do i get the BL to work??
[12:13:36] <LeoNerd> I'm not sure. I don't knwo what you've done or what you've not done
[12:13:39] <LeoNerd> I don't know what hardware you have
[12:13:42] <LeoNerd> I don't know how it's connected
[12:13:48] <LeoNerd> I can tell you "line up all the pieces and it will work"
[12:13:55] <LeoNerd> You'll have to tell us what pieces you have
[12:14:14] <eszett> The hardware shouldnt be the problem, since the circuit is working, as far as i see it when i upload code, LED blinks etc.
[12:14:20] <eszett> i can tell you everything
[12:15:02] <eszett> one moment i prepare some background info.. can take a while
[12:15:41] <cehteh> some bootloaders can be configured differently to enter bootloader mode, like some io must be jumpered or some data is expected on uart/usb/whatever, or at startup it just waits some $timeout for $something
[12:15:55] <LeoNerd> Yah
[12:16:07] <LeoNerd> I don't know the stock DFU one.. I only know the Adafruit variant on it
[12:16:31] <cehteh> also with F_CPU may not match the real thing
[12:16:31] <LeoNerd> The one that PWMs an LED for about 8 seconds while it waits
[12:16:31] <LeoNerd> So you know it's doing its thing
[12:16:31] <cehteh> (clkdiv/8)
[12:17:12] * cehteh just thinking about adding a F_OSC to his code .. grr :D
[12:29:50] <eszett> Leo: i prepared some info here http://i.imgur.com/JdFjA94.png
[12:30:33] <LeoNerd> Oh joy a picture
[12:30:39] <eszett> eye candy ;-)
[12:30:48] <LeoNerd> I really can't see any detail in that
[12:30:55] <LeoNerd> It's a silly fuzzy outoffocus mess of colours and plastic
[12:31:02] <eszett> ye
[12:31:05] <LeoNerd> To coin a phrase: Schematics Or GTFO
[12:31:26] <eszett> alright
[12:48:42] <twnqx> that PCB looks homemade
[13:42:10] <julius> eszett, uh..thats kinda haŕd to decrypt with flexible wires all over the place
[13:42:50] <julius> eszett, you can register on electronics stackexchange, create a forums postig there. they have a "basic" shematic editor and than get help there and post the link here
[13:43:15] <LeoNerd> Or if all else fails, piece of paper and a scanner/cameraphone/.. whatever
[13:43:24] <LeoNerd> Sometimes I find that actually quicker than using the software for it
[13:43:25] <julius> that would be good too
[13:43:47] <cehteh> fritzing :D
[13:44:02] <julius> so, now whos gonne get me that glass of water thats 2m away?
[13:44:46] <cehteh> build a robot for that
[13:45:20] <julius> actually, a robotic arm that can be controlled from the sofa....theres a market for that in the us
[13:46:03] <cehteh> i have a small table (actually stool) besides my sofa for my teapot .. considering to add wheels to the feet and make it self driving :D
[13:46:15] <cehteh> merkanum drive or so
[13:46:45] <julius> sure. if your apartment is big enough
[13:47:01] <julius> how about a arm hanging from the ceiling, in the middle of the room
[13:47:25] <cehteh> on rails like the robot in "Moon" ?
[13:47:26] <julius> a pain in the ass to install, but complete reach over the room
[13:47:42] <julius> that would be handy too
[13:48:14] <lorenzo> hm, how does one generally use 7 segment displays connected to a http://www.ti.com.cn/cn/lit/ds/symlink/tlc5927.pdf ?
[13:48:25] <lorenzo> here's the schematic http://www.embeddedadventures.com/datasheets/DSP-7S04_hw_v2.pdf
[13:49:03] <cehteh> i made our dinning room lamp on a big arm with counterweights
[13:49:09] <cehteh> so it can be moved at any place in the room
[13:49:39] <cehteh> 2x 2m arms
[13:49:49] <cehteh> big bricks as counterweights
[13:50:07] <julius> i want a picture of that
[13:50:26] <cehteh> mom
[13:58:07] <cehteh> wtf .. mobile network down :D
[13:58:49] <cehteh> switched my wlan to 5.8ghz recently but my mobile doesnt support that, have to configure a 2.4ghz AP
[14:25:35] <cehteh> julius: https://pbs.twimg.com/media/CeLJRpZXIAAE_Kp.jpg:large
[14:39:02] <julius> looks good, nicely done
[14:50:28] <cehteh> not fully satisfied with the result
[14:54:51] <julius> one never is
[14:55:02] <julius> "es gibt immer was zu tun" - hornbach
[14:55:25] <julius> kinda a nice slogan in lulling the customer into compliance
[14:56:34] <cehteh> http://public.pipapo.org/kitchen/kitchen.html .. ive self-build our kitchen :D
[14:56:39] <inkjetunito> cehteh: hey, is the lightning arm system your own development?
[14:57:01] <cehteh> development? .. heh
[14:57:51] <inkjetunito> cehteh: well, i like its flexibility
[14:58:19] <cehteh> it got bit too bulky and heavy, mainly because i used wood i had leftover
[14:58:34] <cehteh> on another try i would use aluminium
[14:58:52] <cehteh> and maybe add some motors, remote control
[14:59:36] <cehteh> then one could store positions and tell the arm where to move
[14:59:38] <julius> looks impressive
[14:59:50] <julius> i love the selfmade guide rail for the saw
[15:00:33] <julius> whats the "dark" material in the middle?
[15:00:35] <cehteh> the ones one can buy are so much overpriced
[15:00:51] <inkjetunito> cehteh: indeed
[15:00:55] <cehteh> aluminium U
[15:01:12] <cehteh> you can enlage the pics
[15:02:10] <julius> uh i see, the saw hangs in the rail and the blade to the right of it
[15:02:12] <julius> nice
[15:02:32] <julius> i wonder if ours at home has the same rail possibilities
[15:02:40] <julius> cant remember how it looks from below
[15:02:56] <cehteh> http://www.amazon.de/Bosch-Zubehör-2602317031-Führungsschiene-FSN/dp/B000VC5U5C
[15:03:31] <cehteh> most saws have some attachment
[15:03:49] <cehteh> just original parts are ripoff .. and too short
[15:04:08] <julius> yes a 100 bucks is a ripoff
[15:04:36] <cehteh> my rail is 2 parts which can be connected one short 1.3m and one long one 60cm or so
[15:04:53] <cehteh> total for 2m
[15:14:53] <Valen> my dad makes these http://687.com.au/
[15:15:02] <Valen> mitre fences
[15:15:09] <Valen> people seem to like them ;->
[15:18:17] <cehteh> yes nice
[15:36:55] <julius> you definitively need a more consumer friendly url
[15:38:12] <WormFood> http://www.atmel.com/device/attiny104.html heh
[15:43:47] <Valen> got that one because its short ;->
[15:44:11] <Valen> needed to fit it into a tiny PCB, the mitre fences were just something we stuck up there lol
[15:44:18] <WormFood> 666.com.au is short, and is easier to remember
[15:44:33] <Valen> heh, has some connotations though
[15:44:45] <WormFood> "999" upside down
[15:44:52] <Valen> and its taken
[15:44:59] <WormFood> both of 'em?
[15:45:03] <Valen> yup
[15:45:17] <Valen> 999 is even an actual website
[15:45:28] <WormFood> I could give you a subdomain, in jesusfuckinchrist.com :D
[15:45:34] <Valen> rofl
[15:45:39] <WormFood> too long?
[15:45:54] <Valen> useful, but for other tasks perhaps lol
[15:46:23] <WormFood> I have an alternate page for easter, which I should automate the display of.
[15:46:50] <Valen> no g?
[15:46:58] <WormFood> I let that domain expire once, and nobody picked it up, so I got it again'
[15:47:06] <WormFood> yeah. As in "Jesus Fuckin' Christ"
[15:47:12] <WormFood> no "g"
[15:48:03] <WormFood> I should set up an IRC bouncer, and use that as my reverse name lookup :D
[15:49:14] <julius> WormFood, you own that? nice one
[15:49:25] <WormFood> I do
[15:49:34] <WormFood> I also own fuckyourcomputer.com
[15:49:46] <julius> if my sect ever hits the big numbers im gonna call you
[15:49:52] <Valen> ok now that one could be usefull
[15:50:13] <WormFood> not .com, I mean fuckyourcomputer.net
[15:50:14] <julius> could be worth money if you get linked a lot
[15:51:09] <WormFood> That keyboard on fuckyourcomputer.net was not photoshopped/gimped. I have multiple keyboards, and a key cap puller :D
[15:52:32] <WormFood> that fuckyourcomputer fit with a matching username on some website.
[15:53:02] <WormFood> and, if you want to guarantee you'll get laid....then fuck your computer.
[15:53:44] <WormFood> I want to do something cool with those domains
[15:53:52] <WormFood> but, just don't have any drive to do it.
[15:54:23] <WormFood> http://www.storebound.com/storebound/pancakebot-1 <-- did you guys see this? I thought it was clever. Of course, runs on an AVR ;)
[15:55:24] <Valen> all new in the field of useless inventions lol
[15:55:26] <Valen> cool though
[15:55:55] <Valen> when kids ask why petrol is $25 a litre though and they need to swim to school lol
[15:59:08] <Jartza> lol
[15:59:15] <Jartza> I just got my first 3d printer
[15:59:21] <Jartza> or the kit. haven't assembled it yet.
[15:59:27] <Jartza> no pancakes though
[16:00:37] <WormFood> I have a 3D printer, that prints politicians...it's called "myanus"
[16:01:48] <WormFood> I'm looking over atmel's site, trying to find an AVR that fits the price range for a project I'm working on, and I'm rather surprised at the difference in cost, between some of these almost identical AVRs.
[16:04:14] <Jartza> yea
[16:04:32] <Jartza> I find funny for example that attiny88 is so cheap
[16:04:36] <Jartza> compared to for example attiny85
[16:04:52] <Jartza> then megas are hugely expensive, but xmegas are cheap
[16:05:01] <Jartza> it's almost like
[16:05:14] <Jartza> ...they want to kill the mega with pricing?
[16:05:46] <|DM|> I have a bit of an odd question
[16:06:13] <|DM|> Could I make the overflow of one timers interupt toggle the external input of another timer?
[16:06:48] <LeoNerd> Not easily
[16:06:58] <LeoNerd> You can't really cascade periphs on AVR very nicely. It annoys me
[16:07:03] <WormFood> what do you mean, by "external input of another timer"? You mean, like a clock source?
[16:07:19] <|DM|> yes, the T0 pin for timer0 for example
[16:07:29] <Jartza> why?
[16:07:34] <|DM|> to get a 16 bit timer
[16:07:57] <LeoNerd> PIC24s have a huge great crossbar matrix switch between all the periphs and the actual IO pins.. so you can route any periph to any IO, or even "hidden" connections between periphs directly
[16:08:01] <LeoNerd> But nothing like that on AVR
[16:08:01] <WormFood> You'd probably need to physically add a wire, and program a pin to output to the 2nd timer.
[16:08:28] <LeoNerd> Yah. You could physically connect the OCR1A pin to T0, say... and link them that way
[16:08:42] <LeoNerd> But now that eats up two physical IO pins
[16:08:49] <|DM|> Cant you read pins that are in output mode ?
[16:08:52] <WormFood> Or, do something like that in software
[16:08:59] <|DM|> Or was it that you can write to pins that are in input mode. I dont remember
[16:09:06] <WormFood> both
[16:09:16] <LeoNerd> "input mode" and "output mode" aren't things
[16:09:20] <Jartza> yes :)
[16:09:38] <Valen> is there some reason not to do it in software?
[16:09:39] <WormFood> You know what he means LeoNerd
[16:09:40] <LeoNerd> IO pins can always be read. They have a pushpull output driver that can be enabled or disabled. They have an optional weak pullup
[16:09:43] <Jartza> DDR, PORT and PIN registers can be read and written.
[16:09:45] <Valen> or use a 16 bit timer?
[16:09:48] <|DM|> I mean data direction in/out
[16:09:52] <WormFood> It's software, and not hardware
[16:10:06] <LeoNerd> The DDR(s) are badly named
[16:10:14] <LeoNerd> They should be called "totem driver enable"
[16:10:24] <|DM|> wut
[16:10:36] <WormFood> or, TDE for short
[16:11:26] <LeoNerd> Mm.. yes. TDEB, TDEC, TDED, ... could work
[16:11:33] <LeoNerd> Or ODE, for Output Drive Enable
[16:11:58] <LeoNerd> Ode To A Small Lump Of Putty I Found In My Armpit One Summer's Afternoon
[16:12:03] <LeoNerd> .. Green Putty
[16:12:13] <WormFood> I asked my girlfriend if she wanted to hear my new rape joke. She said "no", but I told her anyways.
[16:15:55] <Valen> lol
[16:16:17] <Valen> I mean thats bad and you should feel bad
[16:16:29] <liwakura> god i already did worse
[16:16:46] <liwakura> im gonna stand in the corner now
[16:38:35] <Jartza> LeoNerd: oh... ARM-pit?
[16:39:00] <liwakura> Jartza: tbh i felt some kind of offended by this joke
[16:39:04] <LeoNerd> Jartza: Douglas Adams
[16:39:05] <liwakura> i like ARM actuall
[16:39:08] <liwakura> *actually
[16:39:25] <LeoNerd> It's a piece of Vogon poetry from HHGTTG
[16:39:26] <Jartza> liwakura: sorry, it just came out from my cortex straight to my fingers :P
[16:39:40] <Jartza> (next you tell me you like cortex too)
[16:39:56] <Jartza> don't worry. I like ARM and Cortex :)
[16:40:12] <Jartza> 80% of embedded stuff I do revolves around ARM-stuff
[16:40:29] <Jartza> mostly work-related.
[16:41:05] <Jartza> I still like avr though, they are the easiest MCUs for easy stuff
[16:41:26] <LeoNerd> Yah
[16:43:18] <cehteh> avr is not in danger as long people still use 8051 :D
[16:43:28] <LeoNerd> Hahah
[16:45:05] <WormFood> I don't understand your reference to the 8051
[16:45:20] <WormFood> I looked into the 8051...what a fucked up MCU
[16:45:31] <WormFood> Why the fuck would anyone use that?
[16:45:55] <cehteh> thats what i meant
[16:46:30] <cehteh> as long people can stand that crap there are no worries that anyone would feel uncomfortable with avrs
[16:46:42] <WormFood> I gotcha now
[16:47:29] <Jartza> seems chinese use 8051 a lot still
[16:47:52] <WormFood> Why...fuckin' WHY is the ATtiny13 over $1 apiece?
[16:47:58] <cehteh> its everywhere
[16:48:15] <cehteh> SD cards use it a lot and all kinds of other hardware
[16:48:33] <cehteh> WormFood: i guess low demand
[16:48:39] <WormFood> But why are people using it for new designs?
[16:48:44] <cehteh> found that out too, some biggier avr's are cheaper
[16:49:17] <WormFood> The ATmega88, that Jartza mentioned, is about 50-60 cents
[16:49:39] <Jartza> attiny88
[16:49:42] <cehteh> human resources .. 8051 is like the cobol for µC in the 90's .. everyone knows it, no one wanted to switch
[16:50:06] <Jartza> atmega88 is much more expensive :)
[16:50:39] <cehteh> i have some tiny13 around, but will never restock them, better check what tiny25 or 45 costs
[16:50:47] <cehteh> sometimes cheaper
[16:51:08] <Jartza> t25 and t45 are more expensive than t85 :)
[16:51:14] <Jartza> and t85 is more expensive than t88
[16:51:36] <Jartza> t88 is very nice chip if you can live with low memory
[16:51:43] <Jartza> or well. 512 bytes isn't that low
[16:51:48] <Jartza> you can do a lot with it
[16:51:56] <Jartza> like 32x16 characters on VGA screen
[16:52:00] <Jartza> :P
[16:52:56] <Jartza> I was thinking one day that maybe I should buy few attiny85s in MLF package
[16:53:50] <cehteh> ah the tiny88 was the biggiest tiny :D
[16:54:21] <Jartza> nope
[16:54:25] <Jartza> attiny1634 is bigger
[16:54:39] <cehteh> expensive on amazon at least
[16:55:59] <Jartza> http://fi.farnell.com/atmel/attiny88-mu/mcu-8bit-attiny-12mhz-qfn-32/dp/1748549
[16:56:08] <Jartza> 0,547 € in singles
[17:04:35] <|DM|> what happens if I write 0b0000000011111111 (basically a word where the high byte is empty) to an 8 bit register in avr-C ?
[17:04:47] <|DM|> Will it just drop the top byte, or will I trigger some overflow ?
[17:06:35] <Jartza> probably your compiler will tell you, if you use -Wall -Wextra
[17:06:38] <Jartza> "warning: large integer implicitly truncated to unsigned type"
[17:06:43] <Jartza> or something like that
[17:07:16] <Jartza> oh
[17:07:28] <Jartza> you said 0b0000000011111111
[17:07:37] <Jartza> the compiler will first turn that into 255
[17:07:45] <Jartza> so it's perfectly fine
[17:08:10] <|DM|> I should have specified that the word is volatile
[17:08:13] <|DM|> I am bad at this.
[17:08:13] <Jartza> those zeroes in binary notation mean nothing :)
[17:08:41] <Jartza> so you're placing value from 16-bit variable to 8-bit register?
[17:09:06] <|DM|> from a 10 bit variable, right shifting it twice to become 8 bits, then putting it into an 8bit register
[17:10:03] <Jartza> the compiler will cast it
[17:10:11] <Jartza> if you want to be sure, you can cast it manually
[17:10:21] <|DM|> I see. Thank you
[17:10:36] <Jartza> being volatile doesn't affect anything here
[17:11:48] <|DM|> If it was just 0x00ff the compiler would just turn it into a assembly in statement
[17:12:03] <|DM|> in r18(or whatever),0xFF
[17:12:18] <|DM|> (which is what you said first, because I didnt make it clear that it was a variable not a static)
[17:12:41] <Jartza> yea
[17:13:21] <Jartza> volatile uint16_t foobar = 666 >> 2; DDRB = (uint8_t)foobar;
[17:13:46] <Jartza> even safer and better would be:
[17:13:55] <Jartza> DDRB = (uint8_t)foobar & 0xFF;
[17:14:12] <Jartza> DDRB being just an example of 8-bit register, of course
[17:14:19] <Jartza> and foobar being your 16 bit variable
[17:14:31] <|DM|> Why would the bitmask add safety if it gets cast to 8 bits anyways?
[17:15:02] <Jartza> because of unknown compiler bugs and strangeness of avr-libc :)
[17:15:16] <Jartza> sometimes it seems some registers behave strangely
[17:15:34] <Jartza> and you might end up actually writing 16-bit value to two registers.
[17:15:47] <|DM|> yeah, its why I asked here in the first place :)
[17:15:52] <Jartza> I hope those bugs are long gone, but I've seen that before
[17:16:06] <Jartza> hence I just said, "for safety" :)
[17:16:22] <|DM|> ...and why my makefile has a make for assembly & hexfile dissassembly
[17:16:27] <|DM|> Ah, I see. Thank you :)
[17:18:18] <Jartza> the cast _should_ be enough, but there are some 16-bit register access defines all around avr-libc and they might sometimes tickle compiler bugs.
[17:18:55] <|DM|> Ill check the assembly before I wrrite it to the chip then
[17:19:04] <Jartza> yeah
[17:19:24] <Jartza> that's why I always have also "disasm"-target in my makefile :)
[17:19:59] <|DM|> :D
[17:20:23] <Jartza> I can either say "make disasm" or "make dump" :)
[17:20:41] <liwakura> "make shit" :D
[17:20:45] <Jartza> yep
[17:21:07] <LeoNerd> Yah. disasm is useful
[17:21:11] <cehteh> anyone of you knows a trick how to switch on a sizeof() at compiletime?
[17:21:15] <LeoNerd> AVR programs are usually sufficiently small that such a thing is feasable
[17:21:22] <Jartza> "make dump" is very useful if you need to play with flash sections or linker scripts
[17:21:23] <cehteh> #if sizeof(x) ... wont do
[17:21:33] <Jartza> briefly to see if data is where it's supposed to
[17:21:47] <cehteh> i have some ugly hack now, just wondering if there is something i overseen
[17:22:43] <cehteh> http://paste.debian.net/418238/
[17:23:16] <cehteh> mind the shift <<blah-1)<<1 because to silence a compiler warning :D
[17:23:35] <Jartza> make dump: https://bpaste.net/show/0af0b0a99427
[17:23:43] <Jartza> just an example part from Tagsu :)
[22:07:23] <eszett> hi
[22:08:14] <eszett> Leonerd
[22:08:31] <eszett> (Leonhard?)
[22:14:20] <eszett> hmm
[23:01:13] <Casper> eszett: first time visit? or you want to talk again to someone specifically?
[23:22:51] <eszett> Casper well im new to AVR and new to this channel yes
[23:24:30] <Casper> ok, here, if you have question, just ask it, someone will eventually answer if you provided enought detail and did basic search (avr not responding? is there power? ... you'ld be surprised how much time we waste for such simple thing)
[23:25:26] <eszett> Casper: im sitting here since a few days, troubleshooting my simple Atmega32U4 (as breakout board) on a breadboard. The problem is, that i can't get into bootloader mode, and i dont know why
[23:25:56] <Casper> is there a bootloader flashed to the avr?
[23:26:07] <Casper> they usually come without any bootloader from factory
[23:26:35] <eszett> The datasheet says it comes with a BL out of the box (the ATMEGA32U$
[23:26:50] <eszett> at least the "Atmega32U4-AU" version
[23:27:30] <eszett> anyway, i downloaded the hex binary of the BL from the Atmel website and wrote it on the Atmega with avrdude, which did succeed
[23:27:41] <eszett> The bootloader seems to be there now
[23:27:47] <Casper> do you know what is the procedure to get into said bootloader? Usually there is a button to press before you power or within a few seconds of being powered
[23:28:55] <eszett> Im not sure, how many methods there are to enter bootloader mode. One is to have the pin HWB and RST connected to GND. but that doesnt work here..
[23:29:43] <Casper> do you have a crystal?
[23:30:00] <eszett> yes, a external 16Mhz with 22nF caps
[23:30:08] <eszett> just as it should be
[23:31:03] <eszett> I wrote a simple "LED blink" code, and that works, so this is fine
[23:31:26] <Casper> have you checked the fuses?
[23:31:48] <eszett> yes..
[23:31:51] <Casper> and if you flashed the bootloader then your blinker code, then you removed the bootloader
[23:32:02] <eszett> probably :-(
[23:32:22] <eszett> so i wrote the bootloader to the chip again, from the binary i got from the Atmel website
[23:32:38] <Casper> is the binary for the right avr?
[23:32:49] <Casper> and is it flashing it to the bootloader area?
[23:32:56] <eszett> yep ATMega32U4-usbdevice_dfu-1_0_0.hex
[23:33:09] <eszett> yes it flashed it to the bootloader area
[23:33:16] <Casper> and is the bootloader fuses set right? Like reset vector to bootloader and bootloader size...
[23:33:55] <eszett> uhm..
[23:33:58] <eszett> not sure
[23:34:58] <eszett> wait i have to check the fuses again
[23:35:16] <Casper> and be sure that VBUS is connected
[23:37:46] <eszett> VBUS is connected to Voltage yes
[23:38:08] <eszett> how can i check or set "reset vector to bootloader" and "bootloader size"?
[23:38:21] <Casper> it's some fuses
[23:38:41] <eszett> I use this http://www.engbedded.com/fusecalc/
[23:38:59] <eszett> Ah... interesting
[23:39:17] <Casper> also, be sure that you do not divide the clock by 8 :D
[23:40:04] <eszett> i disabled this damn clock divider already :-)
[23:40:13] <eszett> oh, quote "If you have a boot loader then BOOTSZ has to be used in conjunction with BOOTRST. BOOTRST tells the ATmega chip the memory address where the boot loader starts."
[23:40:24] <eszett> didnt know that
[23:40:45] <Casper> basically you have different bootloader size
[23:41:06] <Casper> the bootloader sit at the top of the flash
[23:41:33] <Casper> if your bootloader is small, then the start address will be higher up in flash
[23:41:38] <eszett> how can i figure how much size the DFU bootloader has?
[23:42:09] <Casper> ex: 32k flash, 1k bootloader? the bootloader start at 31k
[23:42:14] <Casper> the documentation should say it
[23:42:23] <eszett> alright let me look..
[23:51:02] <eszett> its "2 KWord"
[23:51:14] <eszett> that is 4 kilo bytes right?
[23:52:33] <eszett> That means according to datasheet i have to activate both BOOTSZ1 and BOOTSZ2
[23:53:15] <Casper> yes a word is 16 bits
[23:53:31] <eszett> both are activated by default, doh!
[23:53:48] <eszett> alright, now i can proceed to thhe next fuse bit which is.. BOOTRST
[23:54:37] <eszett> argh, BOOTRST may be the culprit, since it isnt activated by default! i have to change it
[23:58:58] <eszett> I have a question about ".. when the chip is reset": when disconnect voltage from the Atmega, is this a "reset" too?
[23:59:33] <Casper> power on reset ?
[23:59:38] <eszett> yes..
[23:59:53] <Casper> it does issue a reset at power on