#avr Logs

Dec 08 2018

#avr Calendar

12:46 AM rue_mohr: jesseg, ok, I attached a property to all the children of my managemnt object called userdata
01:31 AM HighInBC: I with my parents gave me property
06:10 AM [1]MrMobius is now known as MrMobius
06:44 AM rue_bed: they did, like your hair colour
09:01 AM Igloo: I'm having problems programming an ATtiny85 with an Arduino. I have a heartbeat on pin 9, I upload (to ATtiny85 1MHz, Arduino as ISP), and pin 9 goes solidly on.
09:02 AM Igloo: This is the output I get: https://gist.github.com/ian-semmle/f20afd6e696bdbaf802130ea292ad3f6
09:02 AM Igloo: Does anyone know what I'm doing wrong please?
09:05 AM polprog: whats your avrudude invocation
09:05 AM polprog: the command
09:05 AM Igloo: I'm using the arduino IDE
09:05 AM polprog: oh
09:06 AM Igloo: Is there a way to see what commands it's running? I can't find one
09:06 AM polprog: so you have an attiny85 on a breadboard that is connected to an arduino board
09:06 AM polprog: ?
09:07 AM Igloo: Yes
09:07 AM polprog: okay, did you upload the proper programmer sketch to the arduino?
09:07 AM Igloo: Yes
09:07 AM Igloo: Well, I uploaded the Examples/ArduinoISP sketch
09:08 AM polprog: disconnect the tiny85 and try to program it through the arduino again to see if the programmer responds
09:08 AM polprog: im not sure what is the avrdude option to run as arduinoisp
09:11 AM Igloo: Hmm, I just uploaded blink to the Arduino, then the programmer again, and now it's broken differently
09:13 AM Igloo: It now just says "Binary sketch size: 782 bytes (of a 8,192 byte maximum)" and keeps heart beating
09:14 AM Igloo: It doesn't look like the program has been uploaded successfully, though
09:18 AM Igloo: Ah, I think the IDE was confused. I changed the programmer to something else and then back to ArduinoISP, and now it fails in the same way again
09:19 AM Igloo: I wonder if it's worth trying the newer IDE version
09:33 AM polprog: i think its worth trying to run avrdude directly
09:36 AM Igloo: I don't suppose you have a link that explains how to compile and upload with avrdude please?
09:37 AM polprog: emil.fi/avr ;)
09:37 AM Igloo: That's actually ultimately what I'd like to be able to do anyway, but when I looked I could only find people descriptions of how to do it with the IDE, so I thought I'd start with that
09:37 AM polprog: scroll down to point 5
09:38 AM polprog: you will have to adjust the abr-gcc [this is the compiler] invocation, use -mmcu=attiny85
09:38 AM polprog: then avrdude will have to be called with the right -c and -p option
09:38 AM polprog: s
09:39 AM polprog: you dont have to run the fuse setting command because its for mega328p anyway, youd have to read how to set tiny85's fuses right
09:40 AM polprog: i should upload a makefile to my site
09:40 AM Igloo: I think I'll need to do step 4 too, as I don't have the compiled code
09:41 AM polprog: yes
09:41 AM polprog: nho step 4 is writing the code
09:41 AM polprog: you compile with avr-gcc
09:41 AM polprog: what system are you on?
09:42 AM Igloo: I won't be able to compile the blink example from the IDE with avg-gcc, will I? All it does is defien loop and setup functions
09:42 AM Igloo: Linux
09:42 AM polprog: do you use arduino code in the blink example?
09:43 AM Igloo: All I have in the IDE is https://pastebin.com/i1AzQJE2
09:44 AM polprog: ok, so this is arduino code
09:44 AM polprog: its like C programming language but without the hard parts
09:44 AM polprog: and your attiny85 is just a chip inside a breadboard right?
09:44 AM Igloo: Yes
09:45 AM polprog: https://github.com/yuvadm/attiny85-blink
09:45 AM polprog: this will get you started pretty well
09:46 AM polprog: it uses bare metal C code with libc-avr
09:46 AM polprog: https://github.com/casebeer/attiny85-hello-world or this
09:47 AM Igloo: https://pastebin.com/7exjyUPk should blink pin 2, right?
09:49 AM polprog: you are setting bit 3, so thats PB3, so yes
09:49 AM polprog: usually we use PORT pin numbering, not physical pin numbering
09:53 AM Igloo: Hmm, is -c arduino what I want?
09:54 AM polprog: yes
09:54 AM polprog: -c sets the programmer type
09:56 AM Igloo: Well, that made the error LED come on. Which I guess is a kind of progress.
09:56 AM Igloo: Here's what I got: https://pastebin.com/86qX9BGq
09:57 AM polprog: hmm
09:57 AM polprog: check cabling
09:58 AM polprog: if its tight and all ok
09:58 AM polprog: and if it doesnt work, try to slow down the programming clock
09:58 AM Igloo: multimeter says all OK
09:59 AM Igloo: How do I slow down the programming clock?
10:00 AM polprog: its the -B option and then you give it the clock perion in microseconds, default is 1 and that is too fast sometimes
10:00 AM polprog: try -B 10, thats 10x slower
10:00 AM polprog: then -B 100 etc
10:00 AM polprog: and see if this was the issue
10:02 AM Igloo: No luck up to 1000
10:03 AM Igloo: I think I'll try rewriting the arduino with the latest IDE, in case that is buggy, and then a different chip, in case I screwed this one up
10:04 AM polprog: i guess you wanna learn the bare metal programming
10:04 AM polprog: the stuff thats happening under the arduino layer
10:05 AM Igloo: Yeah, my goal is to program the attiny85, nothing to do with arduino. It just looked like an arduino was the easiest way to program it
10:05 AM Igloo: I may have been wrong in that assessment :-)
10:05 AM polprog: haha
10:06 AM polprog: arduino is not bad but you get to see the limitations pretty quickly
10:06 AM polprog: for example as far as i know there is no way to turn on two or more pins at once wuing their HAL
10:06 AM polprog: hardware abstraction layer
10:06 AM polprog: using*
10:06 AM polprog: in C, its a single line if the pins are in the same port
10:13 AM Igloo: Hmm, that appeared to upload from the IDE, but the 85 isn't blinking
10:14 AM Igloo: avrdude still doesn't work, so I think I have a wrong flag there
10:14 AM Igloo: When I say it appeared to work from the IDE, I mean the transfer light flashed a bit
10:16 AM polprog: what program did you pload to the tiny85
10:16 AM polprog: upload*
10:16 AM polprog: whats with me typing today
10:17 AM Igloo: Aha, this IDE has verbosity options. It's using -pattiny85 and -b19200
10:17 AM Igloo: And also using a different version of avrdude
10:18 AM Igloo: With -b19200 avrdude also appears to work, but still no blinking :-(
10:23 AM Igloo: Ah, I might have it...
10:25 AM Igloo: Yes! I had an LED on the reset pin, and I think that was making it unhappy. Now I have some blinking LEDs :-)
10:26 AM Igloo: And better still, I can do it from either the IDE or the commandline!
10:26 AM Igloo: Many thanks for your help, polprog!
10:27 AM polprog: no problem
10:27 AM polprog: :D
10:27 AM polprog: even though the reset pin is an IO pin
10:27 AM polprog: it should only be used as IO as a last resort
10:27 AM polprog: imo
10:28 AM polprog: you can use it if oyu give out very short low pulses
10:28 AM Igloo: I had just put LEDs on all the pins so I could see what was going on
10:28 AM polprog: shorter than the reset pulse length
10:28 AM polprog: or just disable it completely but then you loose the ability to reset it easily, you have to turn it all off
10:29 AM polprog: do you have a pullup resistor on the reset pin?
10:29 AM Igloo: No, but I assumed there would be an internal one by default
10:30 AM polprog: there is one, but its weak
10:30 AM polprog: most people put an external one just in case
10:30 AM Igloo: Yeah, I will do when I have a real circuit
10:32 AM polprog: also #avrs is usually more active
01:17 PM cehteh: ok .. whats faster, one 64bit division or 2 32bit divisions?
01:17 PM * cehteh curses at math and timing
01:19 PM rue_mohr: Igloo, never use the reset pin
01:19 PM rue_mohr: leave it reset
01:19 PM cehteh: i happily use it, while leave it as reset
01:20 PM rue_mohr: cehteh, what you doing math with?
01:20 PM cehteh: stepper slopes
01:20 PM rue_mohr: interpolation or ramping?
01:20 PM cehteh: better :D
01:21 PM cehteh: ramping, smoothing, different accel/decel phases
01:21 PM rue_mohr: k
01:21 PM rue_mohr: your not familiar with brensham are ya?
01:22 PM cehteh: math hates me
01:22 PM rue_mohr: you dont need fancy division
01:22 PM cehteh: https://public.pipapo.org/stepper.png
01:22 PM cehteh: red is position vs time, blue is speed vs time
01:22 PM rue_mohr: trapazoidal vel prof, ok
01:23 PM rue_mohr: yes, I can tell
01:23 PM cehteh: its not trablahdioal
01:23 PM cehteh: the close you get to max_speed the less accel
01:26 PM cehteh: brensham line would be simple interpolation
01:27 PM cehteh: i am up to about 8kHz max signal speed now, would be nice when i get 10 or more ... actually i a bit over 5khz, but for 2 steppers
01:28 PM cehteh: so optimizing the math a bit
01:28 PM cehteh: one division should be enough *but* ideally not in 64 bit :)
01:30 PM rue_mohr: http://ruemohr.org/~ircjunk/images/haha-markx.svg
01:30 PM rue_mohr: thats the position output of my velocity profile code
01:31 PM cehteh: and how is the accel/speed profile
01:31 PM rue_mohr: I didn't put in the data
01:31 PM cehteh: because you can hardly see a difference trapezidioal vs smoothed accel
01:33 PM rue_mohr: http://paste.debian.net/1054947/
01:33 PM rue_mohr: its done the heavy way
01:33 PM cehteh: no way that works on a atmega at 10khz :D
01:34 PM rue_mohr: i wou;dnt expect it to
01:34 PM cehteh: well thats what i am after
01:36 PM rue_mohr: mhm
01:36 PM rue_mohr: I wonder
01:36 PM cehteh: with other work and 2 divisions i am at 8khz ... geting one div less should give it the necessary performance boost
01:36 PM rue_mohr: I wonder if I'd try to do that on an avr or use an stm32
01:37 PM cehteh: maybe xmega should solve it as well
01:47 PM cehteh: \o/ got it in 32 bit :)
01:47 PM cehteh: in theory at least, need to optimize it
02:57 PM cehteh: damn theories
03:41 PM Maya-sama is now known as Miyu
03:44 PM JoeLlama is now known as JoeMooCow
03:44 PM JoeMooCow is now known as JoeLlama
03:50 PM JoeLlama is now known as JoeMooCow
03:50 PM JoeMooCow is now known as JoeLlama
05:44 PM rue_mohr: why is trapazoilal profile no good?
05:45 PM cehteh: maybe i should go for that instead, at least for now
05:46 PM cehteh: well its not so good because it doesnt match physical properties
05:46 PM cehteh: maybe ok for spacecrafts, (constant acceleration gives linear speed increase)
05:47 PM cehteh: even there it has its limits :)
05:47 PM cehteh: but i suspect for steppers and other mechanical things which are not rocket science that hits you sooner
05:49 PM * cehteh ordered a teensy .. maybe i play with that, for now i complete this algorithm on the atmega
05:49 PM cehteh: stash it away and then go with trapezidoial simplification
05:50 PM cehteh: which isnt as trivial either because the pwm/timer step frequency is 1/x
05:51 PM cehteh: will be one division at least
05:51 PM rue_mohr: and its all steps anyhow
05:52 PM rue_mohr: they are all lumpy and stuff
05:52 PM cehteh: doh ... i have this nice smoothed ramp with one division ... but it overflows 32 bit
05:53 PM cehteh: uint32_t a = (position-start)*accel+OFFSET;
05:53 PM cehteh: uint32_t d = (end-position-1)*decel+OFFSET;
05:53 PM cehteh: uint32_t speed = (a*M + d*M) / (a*d);
05:53 PM cehteh: M and OFFSET are constants ...
05:54 PM cehteh: the later could be uint32_t speed = M/a + M/d; .. thats the working 2 division variant
06:00 PM cehteh: http://paste.debian.net/1054973/ thats the essence of it, copypasted taogether
06:48 PM rue_mohr: yes! I can set the input fields!
06:52 PM jesseg: rue_mohr, congratulations :D
08:17 PM rue_mohr: bad, bad baddness
08:17 PM rue_mohr: the list object doesn't work properly
08:17 PM rue_mohr: I cant use code to select multiple items
08:17 PM rue_mohr: there is a bug in the source
08:17 PM rue_mohr: the motif source
08:17 PM rue_mohr: damnit, am I the only person to use motif?
08:17 PM rue_mohr: EVER>
08:18 PM rue_mohr: EVER???
08:18 PM rue_mohr: this is getting close to the amount of work I'd have been into if I built my own gui
08:19 PM rue_mohr: THIS IS WHY I HATE USING OTHER PEOPLES CODE
08:19 PM rue_mohr: jesseg, you feel this, dont cha?
08:19 PM rue_mohr: I'm forcing motif to do things it cant
08:19 PM rue_mohr: simple things, like preselecting items in a list
08:20 PM jesseg: rue_mohr, yes I feel this too :P
08:20 PM rue_mohr: if (((lw->list.SelectionPolicy == XmSINGLE_SELECT) ||
08:20 PM rue_mohr: (lw->list.SelectionPolicy == XmBROWSE_SELECT) ||
08:20 PM rue_mohr: (lw->list.SelectionPolicy == XmEXTENDED_SELECT)))
08:20 PM rue_mohr: that last item should not be in there
08:21 PM rue_mohr: I'm trying to switch to *the other* mode while I call the function with this, but its not working)
08:30 PM rue_mohr: damnit, this'll be another thing that'll take 4 days to work around
08:30 PM rue_mohr: cause of one damn line of code some threw in back in 1989
08:53 PM rue_mohr: shoudl I just a months work and start writing my own gui?
08:53 PM rue_mohr: damnit
08:53 PM rue_mohr: should I junk a months work and start writing my own gui?
08:54 PM rue_mohr: if I have to write all my own motif widgets, then there wasn't a hell of a lot of value to using motif was there?
08:55 PM rue_mohr: this project wasn't supposed to take this long, and it wouldn't have if motif worked properly
08:56 PM rue_mohr: the sad thing is, motif probably has less bugs than anything more modern
08:56 PM rue_mohr: aka, post 1989
08:56 PM rue_mohr: this really sucks
08:59 PM rue_mohr: I been preventing myself from working on anything else till I get the main framework up for this thing
08:59 PM rue_mohr: and I'm gettig fed up with working on it
08:59 PM rue_mohr: if I stop, it'll never get worked on again
08:59 PM rue_mohr: I think we should give up on it
09:00 PM rue_mohr: make a note and go play with something fun?
09:00 PM rue_mohr: maybe one day we will write a gui, and we can redo all this work using it
09:00 PM rue_mohr: I feel really vien, that I thought any gui lib would just work and that I could use it for this
09:01 PM rue_mohr: your not, the world is just full of sucky coders
09:01 PM rue_mohr: awe
09:01 PM rue_mohr: most of them aren't even coders tho
09:01 PM rue_mohr: I'm not even a coder
09:01 PM rue_mohr: your closer than they are
09:01 PM rue_mohr: this sucks
09:02 PM rue_mohr: you could rewrite the list object
09:02 PM rue_mohr: RmList?
09:02 PM rue_mohr: sure
09:02 PM rue_mohr: then why not rewrite all the other motif widgets too?
09:02 PM rue_mohr: life is short
09:03 PM rue_mohr: thats why I used someone elses library in the first place
09:03 PM rue_mohr: why dont you help jesseg clean his up?
09:03 PM rue_mohr: the roads are close, but thats not the direction I was going
09:03 PM rue_mohr: make a note in the project folder and close the 23 windows
09:04 PM rue_mohr: well I do have like a million projects backed up now
09:30 PM jesseg: ??
09:30 PM jesseg: lol
09:43 PM vmt: jesseg: he has a habit of reflecting upon himself via irc
09:43 PM vmt: anyway, rue_mohr you should definitely implement your own gui shizzle, so that i can finally see what a guru you are
09:46 PM vmt: RMGui
11:03 PM rue_shop5: nomore software for atleast a month
11:40 PM day__ is now known as day