#avr | Logs for 2012-08-11

Back
[00:02:22] <Casper> alignment is a big issue
[00:05:03] <learningc> also precision
[00:31:09] <CapnKernel> why try even?
[00:31:31] <CapnKernel> single sided is quick and good fun
[00:33:02] <buhman> I'm attempting to think of a good way to go about talking to a LCD screen
[00:33:21] <buhman> of course I could just use ugly things like _ms_delay() but I'd really rather not
[00:33:35] <learningc> Because I wanted a quick prototype.
[00:33:45] <CapnKernel> :-)
[00:33:57] <CapnKernel> Breadboard
[00:34:01] <CapnKernel> Or single sided with jumpers
[00:34:20] <learningc> Not for few high speed chips :)
[00:34:47] <learningc> And not for 100-pin packages. :)
[00:35:30] <buhman> what I'm most worried about is the initalization sequence; clearly I need to use timer hardware for that, the rough idea I was thinking is to have an (initially) timer-interrupt-controlled ISR that would start the controller in the mode I want
[00:35:48] <buhman> but somehow I need to keep track of my state between each call to the ISR
[00:35:49] <learningc> What kind of LCD?
[00:36:01] <buhman> learningc: the biggest one digikey has :P
[00:36:25] <buhman> http://www.digikey.com/product-detail/en/NHD-0440WH-ATMI-JT%23/NHD-0440WH-ATMI-JT%23-ND/1882564?cur=USD
[00:40:18] <buhman> I was thinking after the initialization sequence is done, I would have some kind of array of bytes to send to the LCD screen
[00:40:59] <buhman> rather than having the ISR timer-controlled at this point, it would be interrupt-controlled by the enable line of the LCD
[00:41:40] <buhman> not sure how stable that would be however
[00:42:11] <buhman> if I set a pin as an interrupt source, does that automagically mask out the bit from the appropriate DDR?
[00:42:26] <buhman> and inside the ISR, am I allowed to flip it back to 1?
[00:42:26] <learningc> Whatever the method you choose at the end, why not get it to work first using ordinary timer?
[00:42:57] <buhman> learningc: erm, that would be cool too
[00:43:31] <buhman> learningc: how do I 1) keep track of state between ISR calls 2) access some array constant from the ISR
[00:44:22] <learningc> Have you thought of using static variables?
[00:45:08] <buhman> erm you mean an extern?
[00:45:47] <buhman> I thought a ISR was a TU; so how do I "share" static variables between TU's?
[00:45:54] <buhman> (non-hackishly I would hope)
[00:46:36] <learningc> What do you mean by keeping track of state exactly?
[00:47:03] <buhman> quite simply: what' I've already accomplished up to now
[00:47:41] <buhman> for example, I was planning on operating in 4 bit mode; that takes two timer-clocks to do a single character, so in the second call the the ISR, I would have to somehow know I now need to send the second half of the byte
[00:48:08] <buhman> similarly: I also need to know which character I send last and/or want to send now
[00:48:24] <buhman> "keeping track of state"?
[00:49:37] <learningc> So either use a static or a global variable.
[00:50:28] <buhman> erm, isn't static variable linkage internal to a single translation unit?
[00:50:42] <buhman> or perhaps I'm not understanding what that means
[00:51:24] <buhman> I would presume I declare the static variable in the main function, which would mean it would be internal to that main function.
[00:52:36] <learningc> You can use a pointer to access it externally I believe.
[00:52:55] <buhman> so how do I pass the pointer to the ISR?
[00:53:00] <buhman> that's really *the* question
[00:53:17] <learningc> Global variable.
[00:53:41] <learningc> Global pointer I mean.
[00:54:38] <Kevin`> why not make it a global variable if you are gonna do that
[00:54:47] <buhman> :S
[00:55:11] <Kevin`> (remembering to use the volatile keyword because of isr random context)
[00:56:00] <buhman> global volatile T?
[00:57:02] <Kevin`> no need to specify 'global', just declare it in that context
[00:59:49] <learningc> i.e. outside of any functions.
[02:09:48] <buhman> :s my atmega doesn't seem to be behaving properly to begin with
[02:30:44] <R0b0t1> Anyone got anything on NLFSRs?
[02:45:59] <buhman> so erm, I hastily disconnected the m162 from my crazy breadboard, put it on a clean breadboard, used my 5V from the ATX PSU directly, hastily wired it for jtag programming with my dragon, put the led on PB0, and a 10k resistor, and ran the code
[02:46:03] <buhman> http://youtu.be/qME5pWHHWok
[02:46:06] <buhman> wtf is going on?
[02:46:40] <buhman> I'm using the internal RC oscillator, clkdiv8: my code: http://sprunge.us/IAVM (the exact same thing I uploaded during the video); that should yield *exactly* Hz yet it can't even do a single full period properly
[02:48:16] <buhman> http://sprunge.us/HfbV ; fuses
[06:10:53] <PlastyGrove> I recently read an article on development boards - never realised there are so many options to choose from
[06:11:39] <PlastyGrove> Funnily enough, some are very affordable - arduino isn't necessarily the best value for money in some cases
[06:39:58] <RikusW> I'd use AVR dip + breadboard + bootloader or programmer
[06:40:17] <RikusW> or simply one of my own mega32u2 boards
[07:07:16] <k-man> can someone point me to some sample code for setting up a PWM output on an attin85?
[07:10:35] <specing> datasheet register section? :D
[07:48:49] <specing> I think I found an error in the instruction set reference
[07:48:55] <specing> page 83
[07:49:08] <specing> Loads one byte indirect from the data space to a register. For parts with SRAM, the data space consists of the Register
[07:49:12] <specing> File, I/O memory and internal SRAM (and external SRAM if applicable). For parts without SRAM, the data space consists of
[07:49:14] <specing> the Register File only. The EEPROM has a separate address space.
[07:49:15] <specing> for LD
[07:49:48] <specing> AVR memory is 0x0 = register file; 0x20 = I/O mem, 0x60 = SRAM
[07:50:09] <specing> So if the part doesen't have SRAM, It doesen't have IO mem?
[07:50:24] <specing> What does it control then if it is a micro-controller?
[07:56:56] <OndraSter> specing, probably bug
[07:57:34] <OndraSter> also you are using usually IN/OUT for the IO regs
[08:17:41] <specing> OndraSter: yeah but I want to write a command that would read/write registers
[08:17:57] <specing> s/registers/memory/
[08:18:04] <OndraSter> well
[08:18:05] <specing> for that I need LD and ST
[08:18:21] <OndraSter> the only device that hasn't got SRAM I can think of top of my head is tiny15
[08:18:37] <specing> I know SRAM starts at 0x60 because that is what the init code uses
[09:01:21] <specing> The __flash qualifier will locate data in the .progmem.data section. Data will be read using the LPM instruction. Pointers to this address space are 16 bits wide.
[09:01:42] <specing> No more worrying where the data is! :)
[09:17:16] <specing> const __flash char str[] = "bla";
[09:17:16] <specing> static void puts_m (const __flash char *str) {
[09:17:16] <specing> while (*str) {
[09:17:16] <specing> usart_putchar (*str);
[09:17:16] <specing> 150: 84 df rcall .-248 ; 0x5a <usart_putchar>
[09:17:19] <specing> 152: fe 01 movw r30, r28
[09:17:21] <specing> 154: 21 96 adiw r28, 0x01 ; 1
[09:17:23] <specing> 156: 85 91 lpm r24, Z+
[09:17:26] <specing> 158: 81 11 cpse r24, r1
[09:17:29] <specing> 15a: fa cf rjmp .-12 ; 0x150 <main+0x4c>
[09:17:31] <specing> GCC...
[09:18:14] <specing> I am seriously unimpressed.
[09:18:24] <OndraSter> wait
[09:18:31] <OndraSter> why does it touch Y?
[09:18:34] <OndraSter> when it doesn't use it?
[09:18:43] <specing> I have no idea :(
[09:19:03] <specing> This is cutting edge gcc 4.8.0
[09:19:06] <OndraSter> lol
[09:19:16] <specing> I'll repeat the same with 4.5.3
[09:20:06] <specing> avr/main.c:79:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'char'
[09:20:09] <specing> avr/main.c:80:27: warning: type defaults to 'int' in declaration of '__flash'
[09:20:12] <specing> avr/main.c:80:35: error: expected ';', ',' or ')' before 'char'
[09:20:16] <specing> 4.5.3 flips out with __flash
[09:21:25] <specing> using __flash would certainly be less error-prone than using pgm_read_* macros all over the place
[09:21:42] <specing> If it generated smarter code..
[09:22:49] <specing> const char str[] PROGMEM = "bla";
[09:22:49] <specing> static void puts_m (const char *str) {
[09:22:49] <specing> while (*str) {
[09:22:49] <specing> usart_putchar (pgm_read_byte(str));
[09:22:49] <specing> 164: fe 01 movw r30, r28
[09:22:51] <specing> 166: 84 91 lpm r24, Z
[09:22:54] <specing> 168: 7a df rcall .-268 ; 0x5e <usart_putchar>
[09:22:56] <specing> str++;
[09:22:59] <specing> 16a: 21 96 adiw r28, 0x01 ; 1
[09:23:03] <specing> PROGMEM is similarly retarded (4.5.3)
[09:23:12] * specing switches back to 4.8
[09:24:18] <specing> Same.
[09:24:31] <specing> Though it generates 16 bytes less elsewhere
[09:24:38] <OndraSter> heh
[09:25:46] <specing> Go home GCC, you are drunk.
[09:25:59] <OndraSter> damnit, why my printer has got issues with separating lines?
[09:26:14] <OndraSter> even TQFP32 with mega168 has to be cut by knife to make there some bigger separation
[09:26:15] <OndraSter> than it is now
[09:26:16] <specing> Maybe its firmware was compiled using GCC
[09:26:19] <OndraSter> heh
[09:26:24] <OndraSter> most likely it was
[09:26:30] <OndraSter> there should be some ARM or something else inside of it
[09:26:37] <OndraSter> maybe not ARM... ARM is in my other printer
[09:41:01] <specing> I think I have an idea why it is so horrible
[09:41:06] <specing> The pointer is being passed in Y
[09:45:27] <specing> part of the ABI I think
[09:46:00] <specing> 14a: c6 e2 ldi r28, 0x26 ; 38
[09:46:01] <specing> 14c: d0 e0 ldi r29, 0x00 ; 0
[09:46:02] <specing> 14e: 01 c0 rjmp .+2 ; 0x152 <main+0x4e>
[09:46:10] <specing> Man it could have optimized it out... -.-
[10:13:11] <OndraSter> yeah well
[10:13:15] <OndraSter> this is gcc
[10:13:16] <OndraSter> ;D
[10:19:22] <specing> I have to figure out how to pass function/flash addresses to inline assembly...
[10:19:37] <specing> puts_f_loop: usart_putchar(temp);
[10:19:39] <specing> puts_f: asm volatile ("lpm %0, Z+ \n\t" : "=r" (temp) ); asm volatile ("cpse %0, __zero_reg__\n\t" : : "r" (temp)); asm volatile ("rjmp %0 \n\t" :: "I" (puts_f_loop));
[10:19:52] <specing> Eww irssi, what have you done...
[10:20:11] <specing> anyway avr/main.c:87:43: error: 'puts_f_loop' undeclared (first use in this function)
[10:20:20] <specing> avr/main.c:84:1: warning: label 'puts_f_loop' defined but not used [-Wunused-label]
[11:50:35] <specing> OndraSter: With the help of ##asm people, I have optimized the function ;)
[11:50:41] <OndraSter> :)
[11:50:42] <OndraSter> cg
[11:50:59] <OndraSter> printer from some business I got for free
[11:51:01] <OndraSter> business printer
[11:51:06] <OndraSter> Page Count 26999
[11:51:11] <OndraSter> it was made in 2003 or 4
[11:51:21] <OndraSter> over 1k pages from that are mine
[11:51:23] <OndraSter> that is NOT much
[11:51:30] <OndraSter> considering that the cartridge is made for 6k pages :)
[11:52:16] <specing> 6k page cartridge? How much does that cost?
[11:52:31] <OndraSter> refill? about 30€
[11:52:35] <OndraSter> refill incl. new drum
[11:58:22] <specing> http://codepad.org/eaKJDO4y
[11:58:25] <Casper> the sad part is that 2k or 6k is about the same price
[11:58:42] <specing> Much better ;)
[15:02:51] <Kre10s> Hey. So i wa able to make sense of the AT88SC2040 crypto-chip traffic... anyone know how the challenges are computed? I know it is via sha-256, but the datasheet does not mention how it is assembled... I am able to use the MTZ memory test zones, as well as read the config zones. how should i assemble the Verify Crypto challenge?
[15:13:18] <Kre10s> nobodies got a clue huh?
[18:38:33] <OndraSter> omg I posted something that was ment to go here on another chan
[18:38:34] <OndraSter> <OndraSter> sorry for my language
[18:38:34] <OndraSter> <OndraSter> but the only thing I can say is
[18:38:34] <OndraSter> <OndraSter> HOLY SHIT
[18:38:34] <OndraSter> <OndraSter> lightbulb just exploded
[18:38:34] <OndraSter> <OndraSter> luckily I wasn't sitting in my chair
[18:38:36] <OndraSter> <OndraSter> otherwise I'd be picking up parts of glass from my head
[18:38:38] <OndraSter> <OndraSter> the glass literally flew from the bottom
[18:38:40] <OndraSter> <OndraSter> this is NOT the first case
[18:38:42] <OndraSter> <OndraSter> this is the third case
[18:38:44] <OndraSter> <OndraSter> first time I was not in my chair as well
[18:38:46] <OndraSter> <OndraSter> second time I was, but luckily close to my computer and far away from the light
[18:38:50] <OndraSter> <OndraSter> also the first time it made huge crack in the glass on the cover of the light
[18:38:52] <OndraSter> <OndraSter> second time it completely cracked the glass and went to the ground
[18:38:54] <OndraSter> <OndraSter> I didn't bother getting a new glass cover for the light
[18:38:56] <OndraSter> <OndraSter> now it did again
[18:38:58] <OndraSter> <OndraSter> three times
[18:39:00] <OndraSter> <OndraSter> same thing
[18:39:02] <OndraSter> <OndraSter> any idea why?
[18:39:32] <OndraSter> also it tripped circuit breakers
[18:39:40] <Tom_itx> overvoltage
[18:39:47] <OndraSter> that is the only explanation
[18:39:48] <Tom_itx> bad wiring
[18:39:57] <Tom_itx> bad karma
[18:40:00] <OndraSter> I live like 100m from the local distribution unit
[18:40:10] <Tom_itx> put a meter on the outlet
[18:40:12] <OndraSter> also xmas lights die very quickly
[18:40:16] <OndraSter> about 240V last time I checked
[18:40:18] <OndraSter> still within spec
[18:40:23] <Tom_itx> spike
[18:40:28] <OndraSter> 230V +- 5 or 10%
[18:40:33] <OndraSter> Tom_itx, I turned it on
[18:40:35] <OndraSter> the light
[18:40:36] <OndraSter> this time
[18:40:49] <OndraSter> first time it was also during power up, second time when it was lighting for over an hour
[18:41:03] <Kevin`> OndraSter: get an automatic voltage regulator, or at least something that will do an automatic cutoff, of sufficient size
[18:41:04] <OndraSter> oh well, at least that the glass of the bulb didn't break and I picked up just that
[18:41:20] <OndraSter> Kevin`, it does *only* in my room this shit
[18:41:25] <OndraSter> okay, lightbulbs die
[18:41:26] <OndraSter> often
[18:41:28] <Kevin`> OndraSter: also put something over the light. you can get lights with an anti-shrapnel coating if that's not possible
[18:41:39] <OndraSter> but WHY did it completely took off?
[18:42:26] <OndraSter> I want to switch to LED lightning in my room for a while, but can't find "cheap" and "good" lightning for a reasonable price
[18:42:27] <Tom_itx> the element burnt so quickly as to spatter molten metal on the glass causing it to shatter
[18:42:36] <OndraSter> the glass did not shatter
[18:42:39] <OndraSter> the glass is intact
[18:42:41] <OndraSter> just as the bottom part
[18:42:46] <OndraSter> they separated
[18:44:37] <OndraSter> I have got here 100W LED
[18:44:41] <OndraSter> (100x1W inside small package)
[18:44:51] <OndraSter> but there is no easy way of cooling it without huge fan blowing on it :D
[18:44:55] <OndraSter> huge and noisy
[18:45:45] <OndraSter> I bought about 2? years ago LED bulb from DX, one died after about 3/4 of a year
[18:45:49] <OndraSter> I did not use the other one
[18:45:56] <OndraSter> they are 6W, shine about as 40W regular lightbulb
[18:46:00] <OndraSter> I am used to having 60W bulb though
[18:46:04] <OndraSter> WHICH ARE NOT BEING MADE ANYMORE IN THE EUROPE
[18:46:17] <OndraSter> fuckign european union and their fucking laws (sorry for those words, but I AM PISSED)
[18:46:35] <OndraSter> oh well, time to screw out the remaining part of the light..
[18:46:41] <OndraSter> bottom's pressed = power off
[18:47:02] <OndraSter> .. I'll rather kill the circuit breakers for lights for this floor
[18:47:03] <OndraSter> safety ftw
[18:50:25] <OndraSter> arrgh I screwed it in tightly
[18:50:32] <OndraSter> also the junk that was holding the glass is falling out
[18:50:33] <OndraSter> IN MY EYES
[18:50:35] <OndraSter> bloody thing
[18:58:51] <OndraSter> wow
[18:58:55] <OndraSter> 247V in the socket
[18:59:29] <OndraSter> +-10%
[18:59:40] <OndraSter> 230V... that is 253V
[18:59:46] <OndraSter> hmm not enough to complain
[19:12:02] <OndraSter> btw if anybody wants to see my 100W power LED
[19:12:03] <OndraSter> http://clip2net.com/page/m12051/18841069
[19:12:37] <CapnKernel> They're very common here.
[19:12:54] <OndraSter> yeah
[19:12:58] <OndraSter> I bought this off ebay
[19:14:36] <OndraSter> btw
[19:14:40] <OndraSter> these are the remainings
[19:14:40] <OndraSter> http://clip2net.com/s/2clsB
[19:14:48] <OndraSter> you can see completely intact glass
[19:14:58] <OndraSter> the holder is quite damaged, it took a lot ot screw it out
[19:22:40] <specing> AFAIK we can still buy 60W lights here
[19:23:13] <OndraSter> buy yes
[19:23:16] <OndraSter> but not make
[19:23:40] <specing> Well when they outlawed 100W ones I just switched to 2x60 ;P
[19:23:56] <specing> When 60W are no avail anymore I'll just go 4*30W
[19:24:03] <OndraSter> you are allowed to buy anything, they are not allowed to make new ones
[19:24:05] <OndraSter> heh
[19:24:07] <OndraSter> well
[19:24:22] <OndraSter> next year should be outlawed even 30W
[19:24:27] <OndraSter> or is it the year after that-...
[19:24:40] <specing> And when those arent available anymore, I'll abduct a politician and wire him to 230V
[19:24:52] <OndraSter> I will gladly help you with that
[19:24:56] <OndraSter> but may I add a suggestion?
[19:24:57] <OndraSter> small one
[19:25:03] <OndraSter> let's plug him between two phases...
[19:25:43] <OndraSter> I do wonder if our house is wired with aluminium or copper
[19:25:47] <OndraSter> it is about 20 years old
[19:25:59] <OndraSter> because my room is right at the circuit breakers
[19:26:08] <OndraSter> closest to the street's voltage
[19:26:11] <OndraSter> thus it gets the highest voltage
[19:26:28] <OndraSter> now if we are aluminium based the voltage drop could be high enough so stuff in the upper floor doesn't blow up
[19:26:48] <OndraSter> I shall measure voltage tomorrow
[19:26:51] <OndraSter> on the upper floor
[19:32:59] <ben1066> When did atmega328s get so expensive....
[19:34:23] <ben1066> They are £7 on farnell, the ones with arduino bootloader are £4
[19:39:03] <damjan> $3.50 at futurlec
[19:40:08] <ben1066> I just found the price hike odd
[19:40:24] <ben1066> They have 10,000s in stock
[19:59:00] <OndraSter> 2.4€/mouser
[19:59:09] <OndraSter> 100pcs at 1.37
[20:04:51] <ben1066> How strange...
[20:07:55] <OndraSter> aa the "cheapest" tiny with enough pins is attiny20... but I do wonder if I will fit whole NRF24L01+ management into 1kB so I have 1kB for the data acquiring itself :P
[20:08:49] <OndraSter> then there is tiny44a
[20:09:00] <OndraSter> or tiny40
[20:09:09] <OndraSter> with more pins
[20:09:32] <OndraSter> I know I won't fit 6 IO pins ;D
[20:27:23] <OndraSter> ALTHOUGH I could probably fit there
[20:27:28] <OndraSter> just for simple voltage measurement
[20:27:43] <OndraSter> SCK, MISO, MOSI, CSN and the voltage measured
[20:27:46] <OndraSter> that is 5 pins
[20:27:47] <OndraSter> NICE
[20:28:51] <Tom_itx> how do you chmod subdirectories all at once?
[20:29:48] <OndraSter> chmod -R
[20:29:49] <OndraSter> ?
[20:31:11] <Tom_itx> ok
[20:55:55] <Kre10s_> any of you have the AT32UC3C_EK ? I just got one, turned it on, and am seeing nothing... the docs say I should see a gui with some loopback stuff... I get only a white screen. any ideas?
[21:05:00] <Kre10s_> whats it take to get the avr32 toolchain on ubuntu ?
[22:00:44] <inflex> anyone made an ESR meter with an AVR and just clocking out at ~100kHz?
[23:02:35] <buhman> I have the following code http://sprunge.us/NCTC
[23:02:52] <buhman> for some reason when I go into IDLE sleep mode, the CTC ISR doesn't seem to fire correctly
[23:03:29] <buhman> it looks like about when I sei() the ISR has enough time to fire once, and then around the time sleep_cpu() happens, everything stops
[23:05:05] <buhman> am I not allowed to use timer1 in IDLE mode or something?
[23:08:50] <R0b0t1> buhman, most likely, I would refer to the datasheet. Or rather, what I think happens, is the clock stops being distributed. Thus disabling the timer.
[23:09:28] <buhman> erm, datasheet says in IDLE mode "CLKIO" is still enabled
[23:09:48] <buhman> just CLKCPU that is disabled
[23:09:53] <buhman> and CLKFLASH
[23:10:02] <buhman> but that's it
[23:10:04] <timemage> buhman, if the chip wakes up when the timer occurs an changes PB3, main() exits doesn't it? and then does who knows what with PB3.
[23:10:16] <buhman> O.O
[23:10:35] <timemage> buhman, what happens if you just add while(1); before return 0; ?
[23:11:33] <buhman> timemage: BOOM
[23:11:48] <buhman> oh, I was actually trying to avoid while(1); that was the whole point of the sleep mode
[23:12:00] <timemage> buhman, well, put the sleep in the while.
[23:12:02] <buhman> but it makes sense that the CTC wakes it up from sleep to do the ISR
[23:12:05] <buhman> timemage: that's what I did
[23:12:09] <timemage> buhman, good =)
[23:12:11] <buhman> and that seems acceptable
[23:12:20] <timemage> buhman, well, it kind of has to be.
[23:12:28] <buhman> erm can I do that in the ISR actually?
[23:12:44] <timemage> buhman, ehh, i don't know but i wouldn't.
[23:13:02] <buhman> probably dirtier that way, you're right
[23:13:48] <buhman> now.. to compare power usage in the sleep states :D
[23:14:17] <buhman> nice, 10mA less in IDLE