#avr | Logs for 2014-08-02

Back
[01:17:24] <Casper> Lambda_Aurigae: xdotool did the trick, far from being the best, but will work
[01:17:55] <Casper> Lambda_Aurigae: atleast I did one complete operation via command line, so it's a good start, now to fully automate
[06:04:52] <Jartza> ahh
[06:04:56] <Jartza> got the i2c working
[06:05:53] <Jartza> seems that the slave does clock stretching which my original code wasn't prepared for
[06:06:12] <Jartza> I thought no device nowadays does that :P
[06:19:05] <inflex> hiya Casper
[06:19:26] <inflex> Jartza: prepare for anything :D
[06:19:40] <inflex> I'm terrible for abusing timing tolerances on comms lines like I2C and SPI
[06:19:56] <inflex> thought at least with SPI most of the time they're just static shift registers that you clock out
[06:47:11] <Jartza> inflex: well, I'm not going to prepare for multi-master :)
[06:47:22] <Jartza> that I know for sure that I will only have one master
[06:55:15] <inflex> cna't blame you there
[13:52:06] <Jartza> argh
[13:52:13] <Jartza> I ran out of 4.7k resistors
[13:52:20] <Jartza> I only have 3k and 10k
[13:52:31] <Jartza> well, maybe 10k will also work with i2c
[13:52:47] <Casper> parallel 2
[13:53:30] <Jartza> well the pcb design doesn't exactly support that :D
[13:54:44] <Jartza> I still guess 10k will work just fine
[13:56:49] <Jartza> or the 3k as well, as my i2c is anyways slow one (100kbps)
[13:57:32] <Casper> there is some ways around that
[13:58:31] <Casper> stack the 2 resistors, "top" one, bend it's leg around the bottom one only once, right beside it's body. Do a solder joint there
[13:58:43] <Casper> if you do it well, it even look good
[13:58:54] <Casper> and only take "one leg space in the hole"
[13:59:05] <Casper> and just a bit wider
[14:03:13] <Jartza> well, I'm also running at 3.3V, I found some design guides that actually suggest smaller pull-ups
[14:03:16] <Jartza> like 2.7k
[14:03:52] <Jartza> so I guess 3k would be even better
[14:04:04] <Jartza> I can of course scope to see which one looks better
[14:04:42] <Jartza> for faster speeds they even seem to suggest 1.8k resistors
[14:38:50] <ivanshmakov> Jartza: Given that the pull-ups are effectively parts of RC-circuits when the bus’ own capacitance is considered, – it’s not all that surprising, I guess.
[14:40:15] <Jartza> yeah
[14:40:28] <Jartza> and with bigger resistance, the rise-up time is longer
[14:43:47] <ivanshmakov> (… As it takes longer for the capacitor to charge up. I guess I should now apologize for stating the obvious, though.)
[14:45:47] <Jartza> nothing is obvious for me ;)
[14:46:01] <Jartza> I've been learning electronics < 6 months
[14:47:24] <Jartza> I've done embedded programming a lot, but got frustrated a bit as I was always using hw made my someone else ;)
[15:20:15] <nabukadnezar43> does anyone know why simavr gets stuck on the 4th line: https://gist.github.com/anonymous/2c08c77e39b8bdb7ec4a
[15:21:46] <nabukadnezar43> this is the source: https://gist.github.com/anonymous/d409a7adeca11cc4106b
[15:21:54] <nabukadnezar43> simple led blink
[15:23:33] <Bushman> god my coding sucks
[15:23:36] <Bushman> i've made it to beep or not depending if velocity is positive or negative
[15:23:38] <Bushman> when i made it to not beep and turn the tone off when around +/- 2 it gets quiet when static but the beeping is borked and i donno why
[15:23:52] <Bushman> anyone care to take a look on my horrible code?
[15:28:10] <N1njaneer> Bushman: Is the proper micro defined for what you are trying to compile the target to?
[15:28:55] <N1njaneer> Er nabukadnezar43 :)
[15:29:32] <Bushman> let's skip to the part where i have it configured properly, the compiler/linker flags are ok and i'm just simply doing it wrong in the code.
[15:29:36] <Bushman> can we try that?
[15:29:46] <Jartza> sure
[15:29:47] <Jartza> :)
[15:29:48] <Bushman> cause it works in general
[15:29:57] <Bushman> it just breaks when i add more code
[15:29:59] <Bushman> :P
[15:30:06] <nabukadnezar43> N1njaneer, i don't know what's going on, i thought that would generate a vcd file to be loaded in gtkwave
[15:30:14] <nabukadnezar43> i'm just trying to figure out how simavr works
[15:30:17] <Bushman> as in it doesn't work as i expect it to
[15:30:52] <N1njaneer> nabukadnezar43: I think the general consensus here is to just use real hardware - the simulators are often inaccurate at best, and unusable at worst :)
[15:33:16] <nabukadnezar43> N1njaneer, i use real hardware, just wanted to figure out how to work with simavr
[15:33:36] <Bushman> N1njaneer: ?
[15:33:50] <N1njaneer> nabukadnezar43: Whyfor if you have real hardware to target? :)
[15:34:10] <nabukadnezar43> hehe curiousity i guess
[15:49:49] <wak11> zlog
[15:53:59] <ivanshmakov> OT. Nice to see that this channel is logged. But doesn’t Freenode require that any such logging be anounced in the topic, or something like that?
[15:54:18] <ivanshmakov> s/logged/publicly logged/.
[15:58:38] <A124> Freenode does require that yes.
[16:28:26] <Bushman> found the bug
[16:28:32] <Bushman> silly me...
[16:29:35] <Bushman> in main loop i was forcing a value on variable that is used in interrupt as sort of timed flip flop thingy :P
[16:29:56] <Bushman> so insted it doing flip flop all it did was flip flip flip
[16:29:57] <Bushman> XD
[18:04:37] <Jartza> haa
[18:04:44] <Jartza> got the ACK
[18:07:40] <Jartza> https://www.dropbox.com/s/bsojz1uynb0dsyd/Screenshot%202014-08-03%2001.46.38.png
[18:07:51] <Jartza> a bit fluctuating timings it seems
[18:08:05] <Jartza> clock stretching is a strange thing
[18:08:22] <wak11> zlog
[18:26:58] <Jartza> well, that was again a lesson learned
[18:27:19] <Jartza> always prepare for clock stretching and when that doesn't work, check the cables :D
[18:50:38] <Bushman> what should i use to print string contained in char temp[16]; ?
[19:10:17] <Lambda_Aurigae> Bushman, printf()
[19:15:00] <Lambda_Aurigae> is the string null terminated?
[19:16:29] <Bushman> i don't know. the string is a result of itoa(input, string, 10);
[19:17:00] <Bushman> char string[16]
[19:47:53] <Bushman> http://pastebin.com/ht7s7bxg
[19:47:58] <Bushman> i'm not even using the string after that
[19:48:02] <Bushman> it just does the conversion and shit hits the fan!
[19:54:22] <Lambda_Aurigae> why use itoa anyhow?
[19:54:28] <Lambda_Aurigae> why not just printf the integer?
[19:54:44] <Lambda_Aurigae> printf("%i\n",a);
[19:57:48] <Bushman> cause i need the string
[19:57:58] <Lambda_Aurigae> then sprintf
[19:57:58] <Bushman> i used sprintf.
[19:58:15] <Bushman> google is not my friend
[19:58:47] <Bushman> i should have used sprintf right away and not even touch itoa()
[19:59:02] <Lambda_Aurigae> yup.
[19:59:32] <Bushman> that's why i ALWAYS prefer to ask a live person than google -_-'
[19:59:56] <Lambda_Aurigae> but you didn't ask how to convert integer to string..you asked how to print a string..at least in here.
[20:00:14] <Bushman> yes.
[20:00:23] <Bushman> that might be my mistake too
[20:00:41] <Bushman> i wanted to verify my results with itoa()
[20:00:58] <Bushman> and then never print it again and just use the string...
[20:01:27] <Bushman> turns out i used sprintf and i was able to verify with printf just fine ;]
[20:02:23] <Bushman> to bad that wasted all my time i had to implement send_cw :(
[20:02:32] <Lambda_Aurigae> and, you were using atoi on something not an i
[20:02:42] <Lambda_Aurigae> it was an int32...isn't int 16bit?
[20:02:48] <Lambda_Aurigae> you need atol for that.
[20:02:58] <Bushman> itoa
[20:02:59] <Lambda_Aurigae> err..
[20:03:02] <Lambda_Aurigae> wait..
[20:03:08] <Lambda_Aurigae> I'm looking the wrong direction.
[20:03:28] <Bushman> ;)
[20:03:36] <Lambda_Aurigae> but, yeah,
[20:03:38] <Lambda_Aurigae> still
[20:03:46] <Lambda_Aurigae> atoi should work on int only.
[20:03:58] <Bushman> ;]
[20:04:24] <Lambda_Aurigae> int is 16 bytes, not 32.
[20:04:43] <Lambda_Aurigae> you are using a 32bit integer which is probably why itoa hacked hairballs.
[20:05:35] <Lambda_Aurigae> ltoa for long int.
[20:05:49] <Lambda_Aurigae> http://www.nongnu.org/avr-libc/user-manual/group__avr__stdlib.html#ga4f6b3dd51c1f8519d5b8fce1dbf7a665
[20:05:58] <Lambda_Aurigae> http://www.nongnu.org/avr-libc/user-manual/group__avr__stdlib.html#ga1d4c7b84110553544081a69a0fc49c52
[20:06:20] <Lambda_Aurigae> there is also utoa and ultoa for unsigned int and unsigned long.
[20:06:24] <Bushman> i see
[20:06:33] <Lambda_Aurigae> http://www.nongnu.org/avr-libc/user-manual/group__avr__stdlib.html
[20:06:36] <Lambda_Aurigae> rtfm dude.
[20:06:40] <Lambda_Aurigae> is all in there.
[20:06:59] <Lambda_Aurigae> and a fine manual it is!
[20:07:00] <Lambda_Aurigae> hehe
[20:08:20] <Bushman> ha! i've expected to hear that one today!
[20:08:24] <Bushman> rtfm XD
[20:08:40] <Bushman> turns out i was reading wrong manual
[20:08:43] <Lambda_Aurigae> I have to tell my techs that every day.
[20:09:11] <Lambda_Aurigae> we have these fancy computers with superfancy manuals...searchable and cross indexed and updated constantly with notes and tips..
[20:09:35] <Lambda_Aurigae> and invariably I get 3 to 5 calls a day asking me something that they could find in the manual,,which is how I find the answers.
[20:10:19] <Bushman> :P
[20:10:33] <Bushman> converts the long integer value from val != converts the integer value from val
[20:10:44] <Bushman> but you see why i could be missled?
[20:11:04] <Lambda_Aurigae> not if you look closely and understand the sizes of your variables.
[20:11:10] <Bushman> it says "intiger", does not say it's can't be long XD
[20:11:15] <Lambda_Aurigae> int is not the same as int32.
[20:11:25] <Lambda_Aurigae> says specifically int type.
[20:11:48] <Lambda_Aurigae> int __val,
[20:11:54] <Bushman> yea, it's all because of my lack of experience
[20:11:55] <Lambda_Aurigae> as opposed to long int __val,
[20:12:16] <Lambda_Aurigae> hehe
[20:12:31] <Bushman> next time i'll remember this situation and double check sizes compatibility :P
[20:12:32] <Lambda_Aurigae> this is C, not perl or python where they do the thinking for ya...
[20:12:51] <Bushman> hahaha XD
[20:13:09] <Lambda_Aurigae> kinda surprised you didn't at least get a warning from your compiler.
[20:13:13] <Bushman> i gotta use perl parser for AVR then!!1
[20:13:15] <Bushman> :D
[20:13:24] <Bushman> hmm...
[20:13:30] <Bushman> let me check backlog
[20:13:30] <Lambda_Aurigae> there is a java for the avr....
[20:14:39] <Bushman> warning: implicit declaration of function ‘itoa’ [-Wimplicit-function-declaration]
[20:14:44] <Lambda_Aurigae> in this particular case, sprintf is better than itoa or ltoa if you are doing base 8, 10, or 16...
[20:14:47] <Bushman> lost it in other warnings
[20:14:49] <Bushman> :D
[20:15:00] <Lambda_Aurigae> that's not quite what I would expect.
[20:15:03] <Bushman> totally base 10
[20:15:10] <Lambda_Aurigae> something about a cast or something would be my thought.
[20:15:42] <Bushman> need base 10 cause i need to send digits in morse code
[20:15:44] <Lambda_Aurigae> conversion of long to int without cast...or some such.
[20:16:27] <Lambda_Aurigae> but gcc does give some funky warnings sometimes.
[20:17:01] <Bushman> i sneed to add a loop on the string and case each digit and send it with tone sequences
[20:17:59] <Lambda_Aurigae> aahh...gone are the days when we had to actually learn morse code...
[20:18:14] <Bushman> the tone is generated by interrupt on a timer changing radio registers to generate FM deviation
[20:18:20] <Lambda_Aurigae> with my first ham license way back when it was all code and no talking.
[20:18:47] <Bushman> then there is this global variable where i can turn the tone_on
[20:18:47] <Lambda_Aurigae> long before I ever heard of a microcontroller or even microcomputer.
[20:19:30] <Bushman> so i need to use sequences of tone_on=1; delay(); tone_on=0; delay();
[20:20:08] <Bushman> OR figure a clever way of doing it with interrupts and not waste time on delay
[20:21:32] <Bushman> you still doing HAM radio?
[20:22:16] <Lambda_Aurigae> nope..got out of it years ago.
[20:22:32] <Lambda_Aurigae> when they introduced the 2 meter no-code I knew it was time to get out as they were turning ham into CB
[20:23:09] <Lambda_Aurigae> one thing to remember with interrupt routines and variables...if you change a global variable inside an interrupt routine, make sure to define that variable as volatile.
[20:23:11] <Bushman> but they still do CW contests
[20:23:15] <Jartza> ok
[20:23:23] <Jartza> my i2c looks more or less fine now
[20:23:24] <Jartza> https://www.dropbox.com/s/a6f0b927znldc3p/Screenshot%202014-08-03%2004.02.15.png
[20:23:51] <Bushman> Lambda_Aurigae: yes. a friend reminded me to do that.
[20:23:53] <Lambda_Aurigae> Bushman, I never was real fast and didn't get into the contests. just was a way to chat long distance.
[20:23:54] <Jartza> lot of interrupts going on at the same time, that's why the timing isn't always exact.
[20:24:25] <Bushman> but the contest isn't about CW fast
[20:24:38] <Bushman> it's about making as many QSOs :D
[20:25:52] <Lambda_Aurigae> still a contest.
[20:26:00] <Lambda_Aurigae> kinda useless far as I'm concerned.
[20:26:07] <Lambda_Aurigae> it was just fun tl
[20:26:18] <Lambda_Aurigae> it was just fun talking to people around the world.
[20:26:19] <Bushman> so why can't you just chat?
[20:26:29] <Bushman> oh...
[20:26:32] <Lambda_Aurigae> I have irc and a wife now.
[20:26:32] <Bushman> you do chat
[20:26:42] <Lambda_Aurigae> back then irc didn't exist.
[20:26:54] <Lambda_Aurigae> and I didn't even have a girlfriend so I could buy expensive radio gear.
[20:27:52] <Bushman> you still chat on RF...
[20:28:00] <Bushman> except no longer on 80m...
[20:28:10] <Bushman> now you chat on 12.5cm!! XD
[20:28:22] <Bushman> (wifi)
[20:28:31] <Lambda_Aurigae> not at this end.
[20:28:42] <Lambda_Aurigae> but, this computer sits right next to the router and is wired in.
[20:28:51] <Bushman> and not CW but TCP-IP
[20:28:56] <Bushman> but i'm wifi
[20:29:03] <Bushman> HA!
[20:29:11] <Bushman> you still chat via RF
[20:29:13] <Bushman> :D
[20:32:09] <learath> any make gurus?
[20:32:30] <Jartza> dunno about guru
[20:32:35] <Jartza> but shoot :)
[20:33:14] <learath> so. I've got The Dumb. I'm trying to build urjtag from source. it uses a makefile to generate a file (generated_cmd_list.h)
[20:33:45] <learath> the source files are all older. the minor detail that there are *new files* that just happen to be older does not bother make in the slightest :)
[20:33:53] <Lambda_Aurigae> makefiles are the most evil of black magic!
[20:33:55] <learath> I can pastebin the section if it would help
[20:34:09] <learath> Lambda_Aurigae: hey, I just figured out what the problem is, I'm happy :)
[20:34:24] <learath> I was tearing what little hair I have out
[20:34:29] <Lambda_Aurigae> and you just lost a bit of your soul in doing so!
[20:34:31] <Lambda_Aurigae> muahahahahaa..
[20:34:42] <Jartza> ahh
[20:35:00] <Jartza> the good old timestamp from the past bites your ankle
[20:35:15] <learath> It's a cool trick to dynamically generate a list of commands to allow in the urjtag interface.
[20:35:19] <learath> Too bad it's utterly broken!
[20:35:26] <Lambda_Aurigae> http://www.atmel.com/webdoc/index.html interesting collection of docs from atmel.
[20:35:55] <learath> Lambda_Aurigae: that's amazingly well laid out. What's the trick? Are they all word docs? :P
[20:36:08] <Lambda_Aurigae> no..all webdocs.
[20:36:18] <Jartza> http://www.atmel.com/webdoc/simulator/images/uc3_open2.png
[20:36:27] <Jartza> but do they sell those chip-openers? :)
[20:37:08] <Lambda_Aurigae> if you have to ask you can't afford it.
[20:37:30] <learath> the snippet is at http://pastebin.com/nCxRKGkj It's pretty cool
[20:37:59] <learath> but because generated_cmd_list is newer than the newest source file it will never regenerate, no matter what you do. So, try to compile in a new command? NONE FOR YOU!
[20:38:10] <learath> I could touch the file, but that's hacky as hell
[20:38:32] <Lambda_Aurigae> and can get you sent to jail in some countries.
[20:39:01] * Lambda_Aurigae is getting loopy from drugs and overwork.
[20:39:32] <Jartza> learath: ouch...
[20:39:57] <Jartza> just touch the file to make it older? :)
[20:41:53] <Jartza> touch -t 197201010000.00 generated_cmd_list
[20:41:56] <Jartza> or something :)
[20:42:28] <learath> hmm. I can make it PHONY I guess?
[20:42:38] <Jartza> you can yes
[20:44:01] <learath> hah. that did it. man that's silly
[20:44:02] <learath> meh
[20:44:03] <learath> who cares :P
[20:44:58] <Jartza> no it's not silly, it's phony :)
[20:48:35] <Jartza> but I guess I had a good day, got my i2c and soft-pwm working like I wanted
[20:48:59] <learath> cool
[20:49:35] <Jartza> made a stupid test with my i2c-rgb-lcd
[20:50:34] <Jartza> seems to work
[20:51:08] <Jartza> https://www.dropbox.com/s/w0omy35lgc1rle0/20140803_011.mp4
[20:51:10] <Jartza> :)
[20:54:59] <Tom_shop> is that a graphic lcd?
[20:55:40] <Jartza> nope, 20x2 alpha
[20:56:56] <Jartza> http://www.newhavendisplay.com/nhdc0220bizfsrgbfbw3vm-p-2411.html
[20:57:40] <Jartza> hmmh, video doesn't really show the transition between colors
[20:57:41] <Jartza> w00t
[20:57:50] <Jartza> it just shows some stripes on screen
[20:58:24] <Jartza> well, camera framerate and pwm framerate aren't in sync
[21:02:56] <Jartza> but I guess it's time to sleep, now that everything works
[21:03:04] <Jartza> more time to brake things tomorrow ;)
[21:07:02] <Jartza> nights
[21:27:52] <Bushman> can i #define VAL1 10 #define VAL2 5 and then do: char array[][]{VAL1,VAL2,....} ?
[21:28:03] <Bushman> will compiler digest that?
[21:28:45] <Lambda_Aurigae> should.
[21:29:15] <Bushman> ok, i'll try that
[21:36:49] <Duality> how hard is it to make a heartrate monitor
[21:37:10] <Lambda_Aurigae> not too difficult.
[21:37:25] <Duality> tell me
[21:37:33] <Duality> i was thinking of doing it with a ir led
[21:37:44] <Duality> and a something else to detect the ir
[21:37:59] <Duality> and then part of my finger inbetween
[21:38:24] <Lambda_Aurigae> ir phototransistor.
[21:38:28] <Lambda_Aurigae> or ir photodiode.
[21:39:02] <Duality> are those hard to find ? (i have lots of ir leds though)
[21:39:11] <Lambda_Aurigae> http://www.instructables.com/id/Do-it-yourself-a-heart-beat-monitor-with-AVR/
[21:39:37] <Lambda_Aurigae> http://www.freescale.com/files/microcontrollers/doc/app_note/AN4059.pdf?amp;tid=AMdlDR
[21:40:11] <Lambda_Aurigae> http://tinkerish.com/blog/?p=130
[21:40:24] <Lambda_Aurigae> plenty of them out there.
[21:42:24] <Duality> yea i know, but i was more asking about gathering the parts then the knowledge :)
[21:42:46] <Duality> also a point, i don't wana buy stuff
[21:44:02] <Duality> i have lots of those receiver kastjes (grr don't know the word)
[21:44:03] <Lambda_Aurigae> IR phototransistor in any TV.
[21:44:27] <Lambda_Aurigae> at least, any tv that can be controlled by an IR remote.
[21:44:39] <Duality> i see
[21:44:43] <Lambda_Aurigae> it's usually built into the demodulator.
[21:44:53] <Lambda_Aurigae> but rip stuffs apart!
[21:45:50] <Duality> and the demodulator has three leads ?
[21:45:58] <Lambda_Aurigae> no
[21:46:09] <Lambda_Aurigae> it would have one phototransistor or photodiode
[21:46:50] <Lambda_Aurigae> oh..leads.
[21:46:54] <Lambda_Aurigae> sheesh..
[21:47:00] <Lambda_Aurigae> it could, yes.
[21:48:03] <Duality> i have one of these though
[21:48:06] <Duality> https://iprototype.nl/docs/ir-reciever-technisch-datasheet.pdf
[21:48:37] <Duality> Lambda_Aurigae: i am sorry if iam offending you or wasting your time or any thing else that makes you feel bad
[21:48:45] <Lambda_Aurigae> nono....
[21:49:00] <Lambda_Aurigae> that's not the problem.
[21:50:20] <Lambda_Aurigae> new units probably are all integrated.
[21:50:28] <Lambda_Aurigae> I haven't taken a tv apart in a long time.
[21:50:52] <Lambda_Aurigae> last one I took apart had separate phototransistor built into a demodulator module.
[21:52:15] <Duality> yes that is a thing now adays. that's not so good for hobbiest :)
[21:53:22] <Duality> maybe a mouse has a ir detector, ir is it in the sensing ic ?
[21:56:12] <Duality> anyway
[21:56:44] <Duality> i got lots of junk laying around, i am sure some of it must have a ir diode / transistor thingy
[21:57:05] <Lambda_Aurigae> you could probably use a mouse to do it.
[21:57:21] <Lambda_Aurigae> a mouse has a 16x16 pixel imaging sensor.