#avr Logs

Dec 12 2017

#avr Calendar

05:20 AM polprog: you know what they say
05:23 AM polprog: your mom's so old she's in debian stable repository
06:22 AM Emil: polprog: daaamn
06:26 AM cehteh: i am old, i am using debian oldstable
07:15 AM polprog: did they alaredy push the georgian calendar patch?
12:50 PM Ameisen: so... right now, I think...
12:50 PM Ameisen: since it uses the arduino sdk still (hard to rip out)
12:50 PM Ameisen: it has two ISRs by default - one for the timer, one for USB
12:50 PM Ameisen: maybe one for serial, as well?
12:50 PM Ameisen: then the firmware itself has I think 2 ISRs - one for steppers, one for thermal control
01:34 PM rue_mohr: where is abcminiuser!
01:52 PM Ameisen: Interesting - if you use static singletons on AVR, it is generally 2 cycles slower. Instead of using the the singleton's address directly in loads/stores, it instead loads the address into Z, and then performs Z-offset loads/stores.
04:16 PM fooman2011: Hello. I have a problem with my code: https://pastebin.com/tGHiK3jf I don't understand why the led on pin PB2 is blinking only one time when the function blinkfunc is called. COuld you please help me ? Note that if I remove the line: PORTB |= _BV(PB4); then there is no problem and the led on PB2 is blinking 2 times.
04:21 PM cehteh: did you compile with -Wall -Wextra
04:21 PM cehteh: did you set F_CPU?
04:21 PM cehteh: and the code looks stupid :D
04:21 PM fooman2011: yeah it's just a test
04:21 PM fooman2011: to reproduce my problem
04:21 PM fooman2011: I'm using arduino IDE
04:22 PM fooman2011: i d'ont knowa the flag used
04:22 PM fooman2011: the F_CPU should be set correcly
04:22 PM fooman2011: as I said, ithout the line PORTB |= _BV(PB4); I don't have any problem
04:33 PM fooman2011: well another info: if I add PORTB &= ~_BV(PB4); after the line _delay_us(2000000); then the code is OK.
04:34 PM fooman2011: It is like I can't have the 2 pins set to high at same time
04:35 PM rue_mohr: tell more, show the whole code
04:35 PM rue_mohr: sounds like you have a simple error
04:35 PM rue_mohr: id also like to RANT BOUT NOBODY EVER MAKING PROPER SET AND CLEAR BIT MACROS
04:36 PM rue_mohr: #define SetBit(BIT, PORT) (PORT |= (1<<BIT))
04:36 PM rue_mohr: #define ClearBit(BIT, PORT) (PORT &= ~(1<<BIT))
04:36 PM -!- #avr mode set to +o by ChanServ
04:37 PM Casper: o.O
04:37 PM rue_mohr changed topic of #avr to: 8 bit avr controllers -- #define SetBit(BIT, PORT) (PORT |= (1< 04:38 PM Casper: who pissed off rue_mohr ???
04:38 PM rue_mohr: #define SetBit(BIT, PORT) (PORT |= (1<<BIT))
04:38 PM rue_mohr: #define ClearBit(BIT, PORT) (PORT &= ~(1<<BIT))
04:38 PM rue_mohr: #define ClearBit(BIT, PORT) (PORT &= ~(1<<BIT))
04:38 PM rue_mohr: #define ClearBit(BIT, PORT) (PORT &= ~(1<<BIT))
04:38 PM rue_mohr: #define ClearBit(BIT, PORT) (PORT &= ~(1<<BIT))
04:38 PM rue_mohr: #define ClearBit(BIT, PORT) (PORT &= ~(1<<BIT))
04:38 PM rue_mohr: #define ClearBit(BIT, PORT) (PORT &= ~(1<<BIT))
04:38 PM rue_mohr: #define ClearBit(BIT, PORT) (PORT &= ~(1<<BIT))
04:38 PM rue_mohr: #define SetBit(BIT, PORT) (PORT |= (1<<BIT))
04:38 PM rue_mohr: #define SetBit(BIT, PORT) (PORT |= (1<<BIT))
04:38 PM rue_mohr: #define SetBit(BIT, PORT) (PORT |= (1<<BIT))
04:38 PM rue_mohr: #define SetBit(BIT, PORT) (PORT |= (1<<BIT))
04:38 PM rue_mohr: #define SetBit(BIT, PORT) (PORT |= (1<<BIT))
04:38 PM rue_mohr: #define SetBit(BIT, PORT) (PORT |= (1<<BIT))
04:38 PM rue_mohr: #define SetBit(BIT, PORT) (PORT |= (1<<BIT))
04:38 PM rue_mohr: #define SetBit(BIT, PORT) (PORT |= (1<<BIT))
04:38 PM rue_mohr: can anyone miss it NOW!?!?!?!
04:40 PM fooman2011: ?
04:41 PM thardin: doot
04:42 PM thardin: rue_mohr: that's actually not quite enough
04:42 PM thardin: you probably want to do #define SetBit(BIT, PORT) do { PORT |= (1<<BIT); } while(0)
04:43 PM thardin: then there's the problem of PORT being volatile so that doesn't generate a sbi instruction (which we've discussed earlier in her)
04:48 PM fooman2011: I have replace _BV style code by your macro setBit and ClearBit
04:48 PM fooman2011: it change nothing I still have the strange behaviour
04:48 PM rue_mohr: I can make a bot to paste it every hour on the hour int eh channel
04:49 PM rue_mohr: and ya know, the way I use that macro has worked for like 8 years,
04:49 PM rue_mohr: and I'v never had a problem
04:49 PM rue_mohr: granted I always use it the same way
04:49 PM rue_mohr: maybe other people cant do that
04:49 PM rue_mohr: maybe their not capable of it
04:50 PM rue_mohr: but the continious stream of unreadable code makes me balistic
04:50 PM fooman2011: calm down man
04:50 PM rue_mohr: fooman2011, anyhow, you have some code you want looked at or what?
04:50 PM fooman2011: yeah I have past it on past bin
04:50 PM fooman2011: I'll show you the new version using the macros
04:51 PM rue_mohr: whateer, the pastebin url is important
04:51 PM rue_mohr: dont want to search all of pastebin for code htat might be yours
04:53 PM fooman2011: I had given the link
04:53 PM fooman2011: here is the new version: https://pastebin.com/9vNhijZz
04:53 PM fooman2011: I'm using ATTiny2313A with an external crystal
04:55 PM fooman2011: Note that If I remove the PB4 setBit or if I clear the PB4 after the 2sec delay,then the led on PB2 is blinking correctly
04:55 PM rue_mohr: ok, and whats the problem its giving you again?
04:55 PM fooman2011: else the led on PB2 is blinking only 1 time per blinkfunc call
04:55 PM fooman2011: sorry on pastebin I replace the name of the function
04:55 PM fooman2011: blinkfunc is setimage
04:56 PM fooman2011: corrected here: https://pastebin.com/m6sT6N7N
04:56 PM rue_mohr: 2000000 <-- you know how many bits that number takes to hold?
04:56 PM rue_mohr: hint: 16 bits goes up to 65535
04:56 PM fooman2011: 21
04:57 PM rue_mohr: pretty sure the delay_us takes a 16 bit argument
04:57 PM fooman2011: Ok I try to change this
04:57 PM rue_mohr: how about change the resolutio of the fn
04:57 PM rue_mohr: maybe delay_ms
04:57 PM rue_mohr: or delay_s?
04:58 PM * rue_mohr reads delay.h
04:58 PM fooman2011: yeah I'll test using delay_ms
04:59 PM rue_mohr: odd, dosn't look like there is a second resolution one.
04:59 PM fooman2011: same problem
05:00 PM fooman2011: using delay_ms
05:00 PM rue_mohr: so, describe the sequence as its doing it?
05:00 PM fooman2011: as I saied, if I don't setbit PB4 or if I clearbit PB4 after the 2sec delay then I don't have problem
05:00 PM fooman2011: It's like I can't have PB2 and PB4 HIGH at same time
05:01 PM rue_mohr: or its a reset pin
05:01 PM rue_mohr: ATTiny2313A
05:01 PM fooman2011: nothing on datasheet is here: file:///Z:/Development/Epaper/Datasheets/ATTINY2313A-PU.pdf
05:01 PM fooman2011: the reset pin is PA2
05:02 PM rue_mohr: A2 is the reset pin
05:02 PM learath: that's a great url
05:02 PM rue_mohr: k
05:02 PM learath: :P
05:02 PM fooman2011: oops sorry
05:02 PM fooman2011: :p
05:02 PM learath: :)
05:02 PM fooman2011: http://www.atmel.com/images/doc8246.pdf
05:03 PM rue_mohr: can you repost source now?
05:03 PM rue_mohr: as you have it
05:04 PM fooman2011: ok
05:06 PM rue_mohr: remeber to tell us the url
05:07 PM fooman2011: https://pastebin.com/dwPkpYcn
05:08 PM rue_mohr: ... would you like to try my delay routine?
05:09 PM fooman2011: you think that it comes from the delay routine ?
05:09 PM rue_mohr: so your saying the pulse that should happen when PB4 is high, dosn't work?
05:09 PM fooman2011: yes
05:09 PM rue_mohr: do you have leds hooked upto it or a scope./
05:09 PM rue_mohr: ?
05:09 PM rue_mohr: or logic analizer
05:10 PM fooman2011: don't have scope
05:10 PM fooman2011: ampmeter voltmeter
05:10 PM fooman2011: that's all I have
05:10 PM rue_mohr: ok
05:10 PM rue_mohr: please do this
05:10 PM rue_mohr: no that dosn't make sense
05:10 PM rue_mohr: yea have him do it
05:10 PM rue_mohr: really on a 2313?
05:10 PM fooman2011: 2313A
05:10 PM fooman2011: with an external crystal
05:11 PM fooman2011: do you want to see the fuses ?
05:11 PM rue_mohr: no
05:11 PM fooman2011: ok
05:11 PM rue_mohr: do you have a cat with black hair and a mushroom
05:11 PM rue_mohr: NOT THAT SOLUTION
05:11 PM rue_mohr: ok ok
05:11 PM rue_mohr: do you have 2pcs of 1k resistor?
05:12 PM rue_mohr: and you fogot about the beeswax candle
05:12 PM rue_mohr: ah, so I did...
05:13 PM fooman2011: I don't have resistor here :/
05:13 PM rue_mohr: hmm
05:13 PM rue_mohr: anything from 470 ohms to 200k ohms?
05:14 PM fooman2011: I have 10K
05:14 PM rue_mohr: good enough
05:14 PM rue_mohr: put a resistor from +5V to pb2
05:14 PM rue_mohr: put a resistor from +5V to pb4
05:14 PM rue_mohr: then check your code again
05:14 PM rue_mohr: this is partly a sanity check
05:14 PM fooman2011: I remove the led on pb2 ?
05:15 PM rue_mohr: uh, you have a resistor on the led, right?
05:15 PM fooman2011: yes
05:15 PM rue_mohr: k, do you have an led on both?
05:15 PM fooman2011: not on PB4
05:15 PM rue_mohr: do you have an led you can put on pb4?
05:18 PM rue_mohr: you just dont want me opening interdimentional portals to solve microcontroller problems...
05:18 PM rue_mohr: you have to use the power responsibly
05:19 PM rue_mohr: its where the problems originate from tho ya know...
05:19 PM fooman2011: Ok found the problem
05:19 PM fooman2011: it was jst a bad connexion on my board...
05:19 PM rue_mohr: short on breadboard?
05:19 PM fooman2011: :D
05:20 PM rue_mohr: yaya!
05:20 PM fooman2011: Anyway thanks very much for your help
05:20 PM rue_mohr: see any we didn't have to summon a portal to do it!
05:20 PM rue_mohr: spoilsport
05:35 PM theBear: told y'all breadboards suck teh short and hairies ! but would you listen ?!?!? it's like the schoolbus crash all over again ! <sad slow head shake>or maybe electricity isjust a bit grumpy you can't spell connectionyet
11:11 PM day__ is now known as daey