#avr | Logs for 2013-09-30

Back
[07:00:35] <jadew> Casper, nice
[07:00:46] <jadew> I talked to my local distributor, they'll have them in stock in 2-3 weeks
[07:00:55] <jadew> I guess it's time I put my current scope on sale :P
[07:14:08] <w|zzy> Tom_itx: I got the mkII in the mail today thankyou. Im pretty sure i lent/gave the last one to someone else :D This is nice in the box though.
[07:28:42] <Tom_itx> where are you located? Au?
[07:47:47] <w|zzy> Yes. Au
[09:56:24] <hetii> re
[09:56:42] <hetii> re
[09:57:00] <hetii> re
[09:57:16] <hetii> re
[09:57:34] <hetii> re
[09:57:50] <hetii> re
[09:58:08] <megal0maniac_afk> hetii: Please stop
[09:58:42] <hetii> re
[09:58:44] <hetii> re
[09:58:49] <hetii> re
[09:59:02] <hetii> sorry - i just testing something :)
[09:59:30] <hetii> ok
[10:00:09] <megal0maniac_afk> Not here
[10:01:37] <sjokkis> guys, i'd love to get some feedback on a solution i've devised. i need to sample two adc channels (x and y on a joystick), and i've solved it like this: my data processing task is called periodically, it grabs a semaphore, and it starts the first conversion. then, when the adc conversion isr is called, it checks if we've just converted the first or the second adc channel. if it's the first, it queues the result, selects the second channel and then ...
[10:01:43] <sjokkis> ... initiates a new adc conversion. the second time the isr is called, having converted the second adc channel, it again queues the result, selects the first channel and then gives the semaphore so that the handling task can run on the two queued values. then, once the handling task has run and processed the result, it triggers a new conversion of the first channel, and the process repeats
[10:01:53] <sjokkis> it feels a little bit hackish to me. is it a reasonable way to do things, or can i do better?
[10:04:38] <sjokkis> to summarize, since that was a bit rambling:
[10:04:47] <sjokkis> 1. first conversion cycle started by init function
[10:04:56] <sjokkis> 2. isr triggered by first conversion, starts second conversion
[10:05:07] <sjokkis> 3. isr triggered by second conversion, gives semaphore
[10:05:21] <sjokkis> 4. handling task takes semaphore, processes data, goto 2
[10:09:48] <ColdKeyboard> Anyone using microcap around here?
[10:10:30] <bsdfox> sjokkis, that's a good way to handle it
[10:11:01] <sjokkis> bsdfox: thanks. never done this before so i wasn't quite sure <3
[10:11:05] <bsdfox> you're not performing the adc read inside the interrupt, right?
[10:11:19] <bsdfox> just setting it up to use the second channel inside the ISR
[10:11:25] <sjokkis> bsdfox: i'm reading the adc result and putting it in a queue for the task to read
[10:11:40] <bsdfox> yes that should be fine
[10:11:47] <sjokkis> bsdfox: queues are how tasks communicate with each other, or with interrupts, in freertos
[10:12:05] <bsdfox> adc conversions can be 'slow' so you wouldn't want to perform that task inside the ISR
[10:12:25] <sjokkis> oh, no. the task is called periodically, and tries to grab the semaphore and then process the data
[10:12:45] <sjokkis> the isr *only* queues data and initiates the next conversion
[10:13:09] <sjokkis> and then after sampling all the channels, currently two but maybe more in the future, the task initiates the next conversion "cycle"
[10:13:27] <sjokkis> since it seems silly to start a new cycle before i've processed the old one
[10:13:38] <bsdfox> yup. there's nothing wrong with that
[10:14:59] <sjokkis> if i were only converting one result, i could have the task block on trying to read the queue, but with two elements i need a semaphore i think
[10:16:57] <bsdfox> yeah the semaphore will be useful when you scale to more channels
[11:24:18] <ColdKeyboard> I'm looking for a circuit that is something like SR latch but on one positive impuls it changes state (toggle). Is there a schematic how to make a unclocked T-flipflop with transistors or something like that?
[11:24:49] <ColdKeyboard> I have found how to make SR latch with transistors but I need something with toggle ability, with transistors.
[11:55:48] <Joel_re_> hey
[11:56:10] <Joel_re_> how does one figure the min blocksize write supported on a sdcard
[11:56:46] <Joel_re_> I know that SDHC will support a min of 512bytes
[11:56:53] <Joel_re_> but what about the sdv2 cards
[11:58:23] <Tom_itx> read the spec
[11:58:46] <Tom_itx> 512 is the minimum of all but i dunno about bigger cards
[12:02:10] <Tom_itx> http://tom-itx.dyndns.org:81/~webpage/pdf/mmc/ProductManualSDCardv2.2final.pdf
[12:02:27] <Tom_itx> table 1.1
[12:07:38] <WormFood> http://wormfood.net/avrbaudcalc-2.0.0.php <-- anyone want to take a look at my updated bit rate calc, and give me your thoughts on it? Now the tables will rearrange themselves to fit the size of your browser window.
[12:08:00] <Tom_itx> were some added for xmega?
[12:08:11] <WormFood> not yet
[12:08:15] <Tom_itx> seems someone had one that wasn't there yet
[12:08:38] <WormFood> I need to check out the datasheets on the newer AVRs, and add the missing features.
[12:09:12] * Tom_itx gives WormFood a round tuit
[12:11:08] <Tom_itx> Joel_re, did you miss my reply?
[12:11:26] <megal0maniac_afk> ColdKeyboard: http://upload.wikimedia.org/wikipedia/commons/f/ff/JK-FlipFlop_(4-NAND).PNG
[12:11:28] <WormFood> does the changes I've made look good?
[12:11:31] <megal0maniac_afk> http://en.wikipedia.org/wiki/File:TTL_npn_nand.svg
[12:12:46] <Tom_itx> without checking the tables and data sheets, it looks good
[12:13:03] <megal0maniac_afk> WormFood: Yip. Much more space efficient
[12:13:39] <WormFood> I didn't change the math, just the css/html markup...and fixed a css vulnerability
[12:14:08] <WormFood> now if you enter something stupid, like a negative clock speed, it will make it positive...anything non-numeric will be changed to the default value.
[12:14:26] <megal0maniac_afk> Makes me want to get a 18.432mhz crystal. So much green...
[12:14:51] <WormFood> I also allowed it to print the clock speed tables, for stupid bit rates...like you can now find the optimal clock speed for a bit rate of "1"...hahaha
[12:15:14] <WormFood> before I wouldn't display the table if the bit rate was below 100
[12:18:12] <Tom_itx> ping Joel_re
[12:19:57] <WormFood> ok...I'm gonna make the new avrbaudcalc 2.0.0 the default now
[12:20:25] <megal0maniac_afk> Whee!
[12:21:10] <Tom_itx> do i need to update my link or did you rename it?
[12:22:01] <Tom_itx> WormFood ^^
[12:22:27] <WormFood> no need to change anything
[12:22:51] <WormFood> actually, avrbaudcalc.php is just a link, to the current version.
[12:23:34] <WormFood> when I update my site, I'll move that page, but I'll add a redirect to the new page, because so many pages around the web link to that page.
[12:25:02] <Tom_itx> yeah we don't wanna upset the balance of the interweb
[12:29:44] * WormFood agrees
[12:30:04] <megal0maniac_afk> You're the first result for "baud rate calc"
[12:30:14] <megal0maniac_afk> And only on the second page for "baud rate"
[12:30:18] <megal0maniac_afk> Not bad
[12:31:03] <megal0maniac_afk> Now, make a better, updated version of http://www.engbedded.com/fusecalc and you'll rule the world
[12:34:49] <WormFood> yeah, I was on the 2nd page for "baud" too...or maybe 3rd page
[12:35:19] <WormFood> it's been online for almost 8 years, and I have some big sites linking to that page, like sparkfun for example
[12:48:02] <WormFood> I haven't looked at that fuse calc much, but wow...it's SLOOOOW....and seems to be very inefficient...a lot of the stuff it does should be done in javascript
[12:48:40] <WormFood> check or uncheck a box, and it sends it to the web server....wow!
[12:49:00] <WormFood> now....where the hell can I find that database of avr parts?
[12:50:03] <Casper> WormFood: yeah too many pages do that... which I find sad...
[12:50:22] <Casper> worse is that most don't even have ads, so it's not even for that
[12:50:37] <WormFood> I'm tempted to learn javascript, just to duplicate the functionality of that page....the "right way"(tm)
[12:51:22] <WormFood> I contemplated putting ads on my page, because it's the most popular page on my site, but I decided I don't get enough traffic to make it worth the effort....also, I really do want it ad-free
[12:52:07] <WormFood> does anyone know where I can get the xml files used on that fuse calculator?
[12:54:02] <WormFood> hhhmmm....I'm guessing they're in avr studio
[12:56:03] <megal0maniac_afk> WormFood: C:\Program Files (x86)\Atmel\Atmel Studio 6.1\devices
[12:56:15] <megal0maniac_afk> That's where he got them from
[12:56:17] <WormFood> I don't have avr studio installed...can someone take a peek at those files in avr studio, and verify they have what I need, and send 'em to me?
[12:56:21] <WormFood> I don't use windows
[12:56:36] <WormFood> I try to avoid windows like the plague
[12:56:54] <WormFood> megal0maniac_afk, can you send 'em to me, please? (rar 'em up)
[12:57:31] <megal0maniac_afk> Heh :) Sure
[12:57:37] <WormFood> thanks :D
[12:57:54] <megal0maniac_afk> Can you deal with .7z?
[12:57:58] <WormFood> sure
[12:58:23] <WormFood> I'm a Linux guy...I can handle most any compression format you can throw at me (few exceptions)
[12:59:18] <WormFood> you can try to DCC it to me, but not sure if my router and client are in agreement for that ;)
[12:59:31] <WormFood> if not, I can fix it fast enough
[12:59:34] <WormFood> I think
[13:00:32] <megal0maniac_afk> It's all good. Irssi is on my server, so I need to get it on here anyway and I've got publicly accessible http
[13:00:40] <megal0maniac_afk> Now, to get it on there...
[13:00:44] <WormFood> ok, that will work for me
[13:01:45] <megal0maniac_afk> I love 7z. 100mb into 500kb :)
[13:02:05] <megal0maniac_afk> Granted, it's kind of expected with XML files, but still
[13:04:08] <megal0maniac_afk> WormFood: Got it?
[13:04:50] <WormFood> got it! thanks!
[13:07:14] <megal0maniac_afk> The XML files are icky
[13:07:27] <WormFood> yeah...nasty!
[13:07:50] <WormFood> I don't work with xml much...I do understand it somewhat...very structured....and very useless too
[13:08:08] <WormFood> I wonder what tools are available to manipulate that data into something more useful
[13:08:28] <megal0maniac_afk> Ooh!
[13:08:35] <megal0maniac_afk> abcminiuser_: ^
[13:08:45] <megal0maniac_afk> Was it xaml? Or something like that
[13:08:53] <abcminiuser_> Hva?
[13:08:58] <abcminiuser_> XSLT
[13:09:01] <megal0maniac_afk> That one
[13:09:11] <abcminiuser_> OH GOD SOMEONE EMPLOY ME
[13:09:20] <megal0maniac_afk> ??
[13:09:46] <abcminiuser_> Resigned today, moving back to Aus next year
[13:09:53] <abcminiuser_> Love the job, but too far from home
[13:10:03] <megal0maniac> 0.0
[13:10:09] <WormFood> I'm looking to hire someone
[13:10:19] * WormFood needs a nanny to help take care of his 1 year old daughter
[13:10:21] <megal0maniac> WormFood: Well abcminiuser_ knows XSLT :P
[13:10:32] <megal0maniac> WormFood: My mom does that
[13:10:46] <megal0maniac> Except he comes here. Daycare for 1 kid
[13:10:51] <WormFood> my mom is on the other side of the world from me...she's never even seen her granddaughter yet
[13:10:56] <abcminiuser_> I was thinking farmer more than nanny...
[13:11:04] <megal0maniac> WormFood: RikusW knows XSLT too
[13:11:06] <WormFood> there are lots of farmers here
[13:11:21] <RikusW> hi
[13:11:22] <megal0maniac> WormFood: RikusW is a farmer :D
[13:11:24] <megal0maniac> Sort of
[13:11:33] <megal0maniac> He's on a farm. Sometimes.
[13:11:35] <RikusW> Except I'm in the city for now
[13:11:53] <RikusW> I have messed around with XSLT a bit
[13:12:11] <megal0maniac> We're ( WormFood is) looking at the part files
[13:12:23] <megal0maniac> The ones used to make http://www.engbedded.com/fusecalc
[13:12:30] <RikusW> ah
[13:12:34] <megal0maniac> I've established that they're icky, and that's about it
[13:12:45] <WormFood> that fuse calculator is so bad, it makes me feel compelled to write a replacement
[13:12:59] <megal0maniac> Because WormFood made the most famousest baud rate calculator. And sadly, that's the most famousest fuse calc
[13:13:09] <RikusW> I have an app using
[13:13:16] <RikusW> Qt
[13:13:21] <WormFood> I like what they do with it. I like the info it gives you....but holy crap, they have no idea how to handle the client/server interaction
[13:13:50] <megal0maniac> And the parts list is a bit... short
[13:14:03] <WormFood> for those who didn't see it before, I just updated my bit rate calculator, take a look, and tell me what you think
[13:14:16] <WormFood> yes, the parts list you sent me was over 300 parts
[13:14:32] <megal0maniac> Well it was the whole directory. I filtered nothing
[13:14:39] <WormFood> http://www.engbedded.com/cgi-bin/fcx.cgi has 141 parts
[13:14:40] <megal0maniac> So prolly includes AVR32
[13:15:05] <WormFood> what are their part number format?
[13:15:10] <WormFood> for the avr32
[13:15:21] <Casper> ouch... the shelf thing I want to make... look like I need 9 sheets of plywood
[13:15:35] <megal0maniac> AT32*
[13:15:41] <WormFood> and the copyright on the fuse calc says this year...that implies they changed something
[13:16:13] <megal0maniac> Not necessarily
[13:16:30] <WormFood> so, 310 non-avr32 parts
[13:16:45] <megal0maniac> The ATA things I think are very old
[13:16:46] <WormFood> their fuse page has less than 1/2 the available AVRs on it
[13:16:59] <WormFood> AT90xxx family is very old (that is what I started with)
[13:17:24] <megal0maniac> abcminiuser_: That genuinely makes me sad. What are you looking at doing?
[13:17:41] <abcminiuser_> Will code for food
[13:17:46] <megal0maniac> I remember you mentioning pressure from family/girlfriend
[13:17:51] <abcminiuser_> I was hoping to stay within Atmel, but it's not feasible
[13:17:54] <abcminiuser_> Yeah, hence the move back
[13:18:09] <abcminiuser_> This was always my dream job, but I suppose there's always other places to work
[13:18:28] <megal0maniac> https://humblebundle-a.akamaihd.net/static/hashed/22367acef1dabd885a7f79722296c49e60cf865e.jpg
[13:18:47] <WormFood> I could also support avr32 with their fuses....but it looks like it'd be hairy
[13:19:06] <WormFood> abcminiuser_, you work (or did work) for Atmel?
[13:19:14] <megal0maniac> ???!!
[13:19:18] <abcminiuser_> Still do until Jan 1st
[13:19:20] <megal0maniac> How did you not know? :P
[13:19:44] <WormFood> https://scontent-a-lhr.xx.fbcdn.net/hphotos-prn1/76111_449601485156222_1121728533_n.jpg
[13:21:14] <megal0maniac> abcminiuser_: Well it'll look wonderful on your resume. Should be able to walk into most places. That, and your public image with LUFA and avrfreaks and whatnot. Just to find the right place
[13:21:55] <megal0maniac> WormFood: ATSAM is ARM I think
[13:22:03] <abcminiuser_> Job market is a bit tough in Aus but I'll manage
[13:22:07] <abcminiuser_> SAM is ARM
[13:22:18] <abcminiuser_> But not neccesarily ("Smart Atmel Microcontroller")
[13:22:24] <abcminiuser_> All shipped parts are ARM tho
[13:22:54] <megal0maniac> So total is 212
[13:23:46] <megal0maniac> abcminiuser_: My uncle sat on his arse for 2 years, but that was mostly by choice. He was high up where he used to work and when he moved to Aus, he was aiming too high
[13:23:59] <abcminiuser_> I
[13:24:06] <abcminiuser_> I'm not THAT picky
[13:24:24] <WormFood> so, 222 parts
[13:24:31] <megal0maniac> He has shares in his old company, so that was keeping the ship afloat
[13:24:36] <WormFood> how'd you get 212? are you excluding more than me?
[13:24:48] <megal0maniac> Yes, ATUC
[13:25:26] <WormFood> ls -1|grep -v ^ATSAM|grep -v ^AT32|grep -v ^ATUC|wc -l <-- now gives me 212 :D
[13:25:36] <megal0maniac> Whoo!
[13:25:44] <WormFood> yeah, I know...I could have combined all the greps into one
[13:25:46] <megal0maniac> I'm using ctrl and shift and selecting :P
[13:25:47] <WormFood> egrep
[13:25:52] <megal0maniac> Windoze!
[13:25:52] <WormFood> hahaha
[13:26:21] <WormFood> Linux *IS* user friendly....it's just picky about it's friends
[13:26:50] <megal0maniac> CTRL+A, CTRL+SHIFT deselect range, deselect another, etc
[13:27:02] <WormFood> believe me, I know
[13:27:15] <WormFood> and that shit is exactly why I despise windows, and hate using it
[13:27:28] <megal0maniac> I don't doubt your knowledge, I'm just matching your ls string :)
[13:27:44] <WormFood> that and the fact that it fails horribly at the most basic and simple tasks....like copying files.
[13:28:44] <WormFood> lets see...i have 20 gigs worth of files to copy...so I'll set them to copying, then step out to lunch...come back 30 minutes later to find it stopped 2 seconds after you walked out the door, to ask you some stupid question....DON'T STOP, KEEP COPYING! Give me a list of problems later, and let me deal with it them, you fucktards!
[13:29:17] <megal0maniac> And Linux, while I love it, always seems to fail with some proprietary driver on my laptop. Which is why I have linux on a box without a screen, and everything over ssh
[13:29:25] <WormFood> Linux will NOT stop at any file copy errors...it just moves on to the next file, and prints out a message
[13:29:43] <megal0maniac> But that's because it's made by people who think like the people who use it
[13:29:46] <WormFood> Linux runs great on all my thinkpads....T30, T60, T500, T520
[13:29:51] <megal0maniac> X220
[13:30:05] <WormFood> my gf has an X220...but never tried installing Linux on it
[13:30:13] <megal0maniac> Touchpad, sort of. Wireless no.
[13:30:26] <WormFood> I got 16 gig of ram in my T520, and linux is rockin' with it ;)
[13:30:58] <WormFood> and another thing about windows....it does not handle extra memory worth a shit. I've had Linux keep files in it's cache for a week....windows can't even do it for 2 minutes.
[13:31:12] <megal0maniac> I have 128mb of RAM on my ARM box, and 1gig of swap, and it's pretty rockin' too. Surprised at how well it uses swap
[13:32:21] <WormFood> I was at my friend's house the other day, copying shit off a usb memory stick...he has 16 gig of ram, but we were only copying about 8 gig worth of stuff....one movie has already been copied to the hard drive, so it should still be in cache...try to play that movie while other files copy, but nooooo windows won't let me (this is on an I7, at 4.1 Ghz)
[13:32:59] <WormFood> and he us using about 3-4 gig of ram....so all the extra ram should function as disk cache...but it seems winblows does not work that way.
[13:33:44] <WormFood> I download a rar'ed movie, and go to unrar it...it takes seconds, because it's still in the cache from when I downloaded it....I truly do not understand why windows does such a shit job of handling the cache.
[13:35:36] <WormFood> so...back to this fuse calc....I'm thinking it would probably be best to extract the xml data into a format that is a little more usable for php....and learn some javascript to handle the options, to make it output the right info for avrdude....no reason in the world why that should be serverside
[13:41:03] <megal0maniac> Theoretically, XSLT can strip all but the fuse stuff
[13:41:26] <megal0maniac> And make a wonderfully formatted file, if you know how to use it.
[13:41:41] * megal0maniac goes back to wiring flip flops
[13:42:13] <megal0maniac> WormFood: I wasn't actually being serious when I said you should make a fuse calc, but it would be a neat addition to the baud rate calc :)
[13:42:18] <RikusW> WormFood: are you using the AS6 xml file ?
[13:42:24] <RikusW> *files
[13:42:42] <megal0maniac> Yip
[13:42:53] <WormFood> whatever megal0maniac gave me
[13:43:04] <megal0maniac> AS6.1
[13:43:19] <WormFood> yeah, I know you were joking...I'm still in the evaluation phase right now...I can do it, but I don't have the skills
[13:43:34] <WormFood> I mean...I don't have the javascript skills to do it the right way
[13:43:36] <RikusW> for parsing the xml ?
[13:43:56] <WormFood> I can do it the same way that other page does, but then mine would be no better (unless I made a submit button)
[13:44:27] <megal0maniac> I don't have the skills either, unless it requires a counter made out of JK flip flops?
[13:44:56] <WormFood> I can learn javascript...I just need a good reason to learn it (or to learn enough to do what I want to do)
[13:45:51] <megal0maniac> RikusW: What did you do to your part files?
[13:45:56] <RikusW> its very much C like
[13:46:35] <RikusW> I converted it to a custom format, "tab indented xml" :-P
[13:46:39] <RikusW> no <>
[13:46:55] <RikusW> python style :)
[13:52:48] <OndraSter_> ZOMG PYTHON!
[13:52:50] <OndraSter_> learn { } :P
[13:53:05] <megal0maniac> Indentation is the future
[13:53:12] <OndraSter_> lies
[13:53:18] <megal0maniac> Like borderless TVs
[13:53:22] <OndraSter_> on another note, I have been doing lately most stuff in powershell... :D
[13:53:28] <megal0maniac> And frameless glass
[13:53:32] <OndraSter_> have not touched C/ASM/C++/C# in months
[13:53:34] <OndraSter_> just powershell at work
[13:53:34] <megal0maniac> Burn the witch!
[13:53:38] <OndraSter_> haha
[13:53:49] <OndraSter_> how else would I synchronize some json export with actual microsoft active directory!
[13:54:04] <megal0maniac> "microsoft directory"
[13:54:14] <OndraSter_> wondering if somebody would make a powershell interpreter for AVR
[13:54:21] <megal0maniac> "MICROSOFT directory"
[13:54:24] <OndraSter_> (to keep the talk avr related)
[13:54:25] <OndraSter_> yes?
[13:54:51] <megal0maniac> Can powershell extract stuff from XML files?
[13:54:53] <OndraSter_> I work at work and deal with windows server 2012 machines, so what, you wanna fight about it?
[13:54:54] <OndraSter_> sure
[13:54:55] <megal0maniac> We only want fuse info
[13:54:59] <megal0maniac> Okay do it
[13:55:02] <OndraSter_> ConvertFrom-Xml surely exists
[13:55:50] <megal0maniac> OndraSter_: Not at all. Just pointing out that of course you're going to need a microsoft proprietary tool to work with a microsoft proprietary piece of software
[13:56:12] <OndraSter_> well the other guy tried python... he gave up after a day
[13:56:18] <OndraSter_> I used a powershell and it works out of the box
[13:56:20] <OndraSter_> also
[13:56:21] <OndraSter_> [xml]$books = Get-Content C:\fso\Books.XML
[13:56:21] <OndraSter_> $books.catalog.book.title
[13:56:24] <OndraSter_> :P
[14:05:54] <megal0maniac> TI seriously knows how to overkill at packaging
[14:07:50] <megal0maniac> The box is 50cm x 50cm x 5cm for a lauchpad box 16cm x 16cm x 4.5cm containing a launchpad 5cm x 6.5cm x 2cm
[14:09:19] <OndraSter_> aye
[14:09:21] <OndraSter_> they do not screw around
[14:09:28] <OndraSter_> plus 36 hours shipping from TI order to my house
[14:34:34] <megal0maniac> Dammit I want to use an AVR!
[14:35:15] <N1njaneer> Use an AVR!
[14:35:28] <megal0maniac> I can't. I will get 0%
[14:35:45] <N1njaneer> School project?
[14:35:52] <megal0maniac> Yeah
[14:36:00] <N1njaneer> What are they forcing you to use?
[14:36:02] <megal0maniac> Counter with JKs
[14:36:20] <megal0maniac> 4bit, random sequence
[14:36:38] <N1njaneer> Ahhh
[14:36:54] <N1njaneer> PRNG?
[14:37:46] <N1njaneer> Yeah, just take a AVRTiny, put a reverse-biased LED on one of the ADCs, and make random 4-bit values all day long :)
[14:37:47] <jadew> I love TI packaging
[14:37:48] <megal0maniac> Sorry, set sequence. Just not 1,2,3 etc
[14:38:06] <jadew> last package I got from them came padded with about 20 bubble wrap bags!
[14:38:08] <N1njaneer> lol just swizzle the lones, then :)
[14:38:11] <jadew> BAGS
[14:38:12] <N1njaneer> +lines
[14:38:23] <N1njaneer> Jade: Yeah, TI will do that sometimes :)
[14:38:37] <megal0maniac> jadew: I'm going to start collecting their packages to package my own stuff. Got bags today too
[14:38:38] <jadew> you gotta love them :)
[14:39:03] <jadew> yeah, I put the bags aside, they're gonna be useful :)
[14:39:31] <N1njaneer> Get an impulse heat-sealer and you will use it on EVERYTHING :)
[14:40:13] <N1njaneer> Reseal polybags, reseal anti-stat bags, seal bubble-wrap it itself, and (most useful) seal the moisture-lock anti-stat bags back closed.
[14:40:22] <N1njaneer> +to itself
[14:40:40] <jadew> how much does one cost?
[14:41:31] <jadew> about $2? wth...
[14:41:53] <megal0maniac> What is the syntax for PORTB = (x << x)?
[14:42:00] <megal0maniac> And does it need to be |=?
[14:42:22] <jadew> megal0maniac, depends what you're trying to do
[14:42:22] <megal0maniac> Getting tired of messing around with single bits using 8bit masks
[14:42:45] <jadew> N1njaneer: http://dx.com/p/zw-ks-100-impulse-sealer-blue-237269 this?
[14:42:45] <megal0maniac> Set a pull-up
[14:43:02] <jadew> megal0maniac, then PORTB |= (1 << x);
[14:43:03] <megal0maniac> Ooh. Cheap
[14:43:19] <megal0maniac> x being PORTBx?
[14:43:20] <jadew> and make sure DDRB &= ~(1 << x);
[14:43:24] <jadew> yes
[14:43:27] <N1njaneer> Jade: Yup, that's a tiny one :)
[14:44:00] <jadew> N1njaneer, I don't think that one sucks the air out tho
[14:44:28] <N1njaneer> mega: Also, don't forget binary notation, it's occasionally useful -- "0b10011100" then you can see the break-out of the bits you are setting very straightforward
[14:44:57] <N1njaneer> jade: Just nip off the corner, suck the air out, and reseal. The auto-vacuuming ones are quite expensive.
[14:45:12] <megal0maniac> N1njaneer: It always feels wrong :)
[14:45:32] <megal0maniac> And the cheaper auto-vacuuming ones make more noise than vacuum
[14:46:22] <jadew> I'll have to convince my wife that she needs one, I kind of reached my quota for the month
[14:46:24] <N1njaneer> Just get a check vacuum-pump and a bicycle tire needle :)
[14:46:53] <N1njaneer> +cheap
[14:47:32] <megal0maniac> Now I want to shift a nibble into PB0-3. When I try to mask, I make it properly over-complicated. What is the easy way?
[14:47:57] <jadew> what are you trying to do exactly?
[14:48:32] <megal0maniac> Set PB0-3 to the next counter value in the array
[14:48:52] <megal0maniac> I have a uint8_t array containing the sequence
[14:49:09] <N1njaneer> PORTB = (PORTB & 0xF0) | value;
[14:49:13] <megal0maniac> while(~PINB4) it increments, delays, increments etc
[14:49:16] <jadew> PORTB = (PORTB & 0xF0) | val;
[14:49:24] <jadew> N1njaneer was faster
[14:49:26] <jadew> like a ninja
[14:49:28] <megal0maniac> :)
[14:49:30] <N1njaneer> assuming value is only lower for bits, else you'd want to mask that as well :)
[14:50:10] <megal0maniac> I want to explicitly set the lower four bits, leave the upper 4 alone
[14:51:06] <N1njaneer> PORTB = (PORTB & 0xF0) | (value & 0x0F); would be the foolproof way
[14:51:17] <N1njaneer> So if value is >15 the upper bits don't sneak through
[14:51:31] <megal0maniac> Gotcha
[14:52:19] <N1njaneer> mega: Also http://en.wikipedia.org/wiki/Linear_feedback_shift_register is some useful info and theory on kind of what you are trying to do, if you aren't familiar with LFSR's - very handy for stuff, and very simple to implement in hardware or software :)
[14:53:17] <megal0maniac> Ah, cool!
[14:53:30] * megal0maniac bookmarks
[14:53:45] <megal0maniac> Last q, difference between & and &&, or | and ||
[14:53:50] <megal0maniac> What is it?
[14:54:45] <jadew> && yields boolean output
[14:54:50] <jadew> & binary operation
[14:56:09] <N1njaneer> && and || will typically only be found inside of an if() condition evaluation
[14:56:38] <N1njaneer> &, |, ~, and ^ are bitwise-operators
[14:57:35] <N1njaneer> Similarly ! is condition invert, ~ is bitwise-invert
[14:58:32] <N1njaneer> But yes, as jade said it's more like the different between testing all bits (or more similarly zero vs non-zero condition) and bitwise binary operations.
[14:59:50] <megal0maniac> I literally learn something new every day. Going from Java to AVR C, after 3 years of not doing any programming, I feel like I'm back at square 1 :/
[15:01:17] <N1njaneer> You pick it up quick!
[15:01:36] <megal0maniac> Like a bicycle
[15:01:40] <N1njaneer> Just use liberal amounts of paranthesis to help make things clear when doing operations :)
[15:01:45] <megal0maniac> Just need to be persistent with it
[15:01:55] <N1njaneer> They don't slow anything down, and they generally make it a lot more readible
[15:01:57] <megal0maniac> Unlike now where I'm going to bed because I'm tired
[15:02:05] <N1njaneer> Also use trailing spaces on things - improved readibility
[15:02:08] <N1njaneer> And comment! :D
[15:02:15] <N1njaneer> have a good night!
[15:02:36] <megal0maniac> Got the readability thing right at least :) I love me some brackets
[15:02:37] <inkjetunito> don't forget glue :)
[15:03:48] <megal0maniac> I have quite a wide global reach here. Does this look normal to anyone? http://i.imgur.com/9qsObqC.jpg?1
[15:04:30] <megal0maniac> Thinking maybe it might be normal in some part of the world...
[15:06:22] <N1njaneer> Stylish
[15:07:07] <megal0maniac> I immediately ordered new, straight ones
[15:07:23] <megal0maniac> Just wondering if it's at all possible that they came like that
[15:19:05] <megal0maniac> Goodnight!
[15:21:44] <inkjetunito> such an ugly handle :o
[15:22:19] <megal0maniac_afk> I know, right?
[15:22:28] <megal0maniac_afk> And it's a Yamaha
[15:22:34] <megal0maniac_afk> I swear it's bent
[15:22:51] <megal0maniac_afk> i.e. not made like that
[15:36:23] <sjokkis> i'm trying to write to SPI, using interrupt, and in the interrupt handler i toggle an LED to see if it's working. i'm writing to the SPI interface in a loop. the interrupt seems to trigger once, but only once. do i have to take some sort of action to clear the interrupt flag so it can trigger again?
[15:37:03] <sjokkis> the datasheet says that the SPIF bit is cleared when the ISR triggers
[15:42:34] <OndraSter_> yes
[15:42:34] <OndraSter_> the code!
[15:42:34] <OndraSter_> mason! show us the code!
[15:46:42] <sjokkis> OndraSter_: http://pastebin.com/aqTge2b0
[15:49:40] <OndraSter_> oh freertos
[15:50:57] <sjokkis> the code in xSpiPutChar is just copypasted from an example online, that read the char from the buffer and returned it, for some reason
[15:51:27] <sjokkis> i'm going to have putchar write chars to a queue and then read the queue in the isr
[15:53:20] <sjokkis> but it seemed foolish to complicate things before the basics are working
[15:54:03] <Kre10s> sjokkis, that example you gave has nested C style comments /* */ ... you shouldn't do that
[15:55:19] <Kre10s> line 80 to 92 is what i'm talking about. are you using an editor with syntax coloring?
[15:56:02] <sjokkis> i'm using atmel studio. i commented out a block of code temporarily. it "expands" the inner /* */s when you do that. also, if it hadn't, this wouldn't have compiled
[15:57:10] <Kre10s> If you ask me... it _should_not_ compile
[15:57:19] <sjokkis> you're wrong
[15:57:30] <sjokkis> you're not reading the code closely enough
[15:57:57] <sjokkis> it adds a space to the inner comments, so it becomes / * and * /
[15:58:38] <Kre10s> A I see.... crafty use of white space...
[15:59:11] <sjokkis> OndraSter_: it seems that xSpiPutChar() blocks where it loops until the interrupt flag is cleared
[15:59:20] <sjokkis> OndraSter_: even though the ISR is called
[15:59:49] <Kre10s> some interrupts need manual clearing. or they will fire repeatedly.
[16:00:08] * Kre10s stumbled on that one recently.
[16:00:11] <sjokkis> Kre10s: the data sheet says SPIF is cleared when the interrupt triggers
[16:00:50] <sjokkis> taking out that while loop fixed things, though
[16:00:57] <sjokkis> something weird was going on, i suppose
[16:01:42] <OndraSter_> sorry sjokkis I have no idea how freertos works
[16:01:42] <OndraSter_> never used it
[16:01:55] <sjokkis> OndraSter_: this doesn't really have that much to do with freertos
[16:02:04] <sjokkis> OndraSter_: anyway, even though i don't understand quite why, i fixed it
[16:06:28] <braincracker> h
[16:21:01] <sjokkis> hm, kinda lame that the spi doesn't have a data register empty interrupt the way uart does
[16:21:05] <sjokkis> would have make this easier
[16:22:05] <OndraSter_> isn't data send finished equal to data register empty?
[16:22:05] <OndraSter_> since unlike UART it does not have any stopbits
[16:26:39] <N1njaneer> sjokis: For which AVR?
[16:37:09] <N1njaneer> sjokkis: Many/Most of them have a "SPI Serial Transfer Complete" interrupt. Perhaps you are a looking a model that does not?
[16:38:32] <N1njaneer> If it has SPI, it pretty much has that interrupte present. I just looked through 6 datasheets I have at my fingers for mid-range AVR devices and it is present on all of them.
[16:38:49] <N1njaneer> -e
[17:22:03] <sjokkis> N1njaneer: the at90usb1287. it has the STC interrupt that you mention. i'm just wondering how to best use it. with the uart, i call a putchar function that adds the chars to a queue, and then enables the data register empty interrupt. that interrupt then checks the queue and sends the next char if there's something in the queue. i guess i was just hoping i could do spi the exact same way, but with only the transfer complete interrupt, which ...
[17:22:09] <sjokkis> ... services both incoming and outgoing packets, i have to be cleverer i guess
[17:23:05] <N1njaneer> SPI is always driven either as a master or a slave. If the AVR is working as the master, it has to be sending placefiller bytes out in order to receive bytes in.
[17:23:22] <N1njaneer> So it kind of comes down to implementation.
[17:23:27] <sjokkis> N1njaneer: i see. how would i receive things from slaves, then?
[17:23:42] <N1njaneer> You have to poll the slave devices to see if there is data ready to be received.
[17:24:01] <N1njaneer> Or if there is always data ready, you skip the polling and just read them in.
[17:25:05] <sjokkis> oh, i see. then it sounds like i could, in my putchar function, simply initiate a transfer if the spi device is idle, and add to the queue if it's busy transmitting
[17:25:39] <sjokkis> though i would have to handle the possibility that it's busy receiving also, in case i've recently requested to receive data
[17:31:00] <sjokkis> or actually no
[17:32:51] <sjokkis> N1njaneer: if i'm using the STC interrupt to send out new data (let me know if that's stupid), how would you trigger it initially?
[17:33:18] <sjokkis> N1njaneer: after the first char, it should go on its own until i empty the queue, but unlike with UDRE in uart, there's nothing triggering it for the very first char
[17:33:28] <N1njaneer> Just prime the interrupt - essentially just run it manually in the putchar()
[17:34:02] <N1njaneer> The interrupt procedure (or function it calls) should always check to make sure things are clear-to-send before initiating anything anyhow
[17:34:32] <N1njaneer> So if you call it and it needs calling, it sends right away. (i.e. if SPI was sitting idle) but if you call it and it hasn't been previously primed, it kicks it over the first time.
[17:35:23] <sjokkis> N1njaneer: i didn't understand your last two messages
[17:35:41] <N1njaneer> I've written sets of FIFO service routines for the UARTS that handle incoming/outgoing data, so you can hand a chunk of buffer to outgoing UART and if there is enough buffer avaliable to handle it all, the write() function returns immediately. If some of all of the buffer is unavaliable, the write() blocks until buffer space is avalaible, then returns.
[17:35:44] <twnqx> sjokkis: no idea if this helps you, worksforme (tm) on at90: http://pastebin.com/kTXyYSZm
[17:36:15] <twnqx> but that's SPI. are you talking about SPI or UART?
[17:36:46] <sjokkis> twnqx: spi
[17:36:59] <N1njaneer> What I was speaking of is applicable to both.
[17:38:16] <sjokkis> N1njaneer: so, if i understand you correctly, in my putchar function i check if the spi is busy, and if it isn't i simply write to the data register. if it is busy, i queue the char and let the interrupt send it later.
[17:38:20] <N1njaneer> twn: You may want to consider wrapping your while(inuse) {}; inside of an atomic/critical section if you have any multithreading going on
[17:38:32] <sjokkis> N1njaneer: i did not understand "The interrupt procedure (or function it calls) should always check to make sure things are clear-to-send before initiating anything anyhow"
[17:38:52] <sjokkis> or "So if you call it and it needs calling, it sends right away. (i.e. if SPI was sitting idle) but if you call it and it hasn't been previously primed, it kicks it over the first time."
[17:40:08] <twnqx> N1njaneer: i don't use multithreading, but even if, i would want polling to be interruptible (since this is master-only anyway)
[17:42:04] <twnqx> if i was multithreadinh that would be a mutex anyway.
[17:42:21] <twnqx> my only concurrency are interrupt handlers
[17:56:00] <sjokkis> twnqx: is the inuse flag absolutely necessary, or is there another way to check if the spi interface is busy sending a char?
[17:57:12] <twnqx> i needed it for fire&forget of bulk transfers
[17:57:36] <twnqx> so some code would just say "here, have 260 bytes to send" and return immediately
[17:57:56] <twnqx> and transmission happens in background with the interrupt handler
[17:58:49] <codyps> twnqx: if you run SPI fast enough, that could get hard
[17:58:51] <sjokkis> yes, that how i intend to do it as well. i use a freertos queue that i push bytes into, and then they're gonna get sent out by the interrupt
[17:59:18] <twnqx> codyps: hm?
[17:59:27] <sjokkis> so like N1njaneer said i have to "prime" the interrupt, by manually sending the first byte
[17:59:29] <twnqx> i run it as fast as the chip allows
[17:59:32] <twnqx> yes
[17:59:38] <sjokkis> and i gotta figure out how to check if it's free to do that
[17:59:48] <sjokkis> which i suppose is what your inuse flag is for
[17:59:55] <twnqx> read the data sheet for SPCR/SPSR descriptions?
[18:00:09] <sjokkis> yeah i'm doing that, for the nth time today
[18:00:23] <N1njaneer> Sorry, phonecalls here :)
[18:00:41] <N1njaneer> Depending on the implementaion, yes, you may need to manually prime/kick the first byte to transmit.
[18:01:16] <sjokkis> i think that's the solution here. i just gotta find out how to tell when that's needed and when it's not
[18:01:41] <sjokkis> i could set a global flag when i kick off the first byte, and have the isr clear it when the queue is empty
[18:01:48] <sjokkis> but if i can do it without a global flag, i'd like to
[18:01:51] <codyps> twnqx: SPI can run at 1 byte every 32 cpu clocks, which doesn't give much time for an interrupt to run.
[18:02:01] <twnqx> master.
[18:02:21] <codyps> twnqx: just make sure to cut the speed down if you really want to do spi via interrupts
[18:02:33] <sjokkis> codyps: is it better to do looping spi?
[18:02:36] <twnqx> runs perfectly at 2mhz
[18:03:23] <twnqx> don't forget that you don't have to clock bytes back to back
[18:03:34] <codyps> sjokkis: it really depends. If you just want to bang out the data, and the reciever can take that speed, and you can push _other_ async tasks into interrupts, it makes a lot of sense to do polled spi transfers
[18:03:44] <twnqx> if you don't send you don't send, clock only runs while transmitting
[18:03:45] <N1njaneer> sj: Other option would be to use an RTOS or a periodic function that simply keeps polling/sending in lower-priority loop.
[18:03:57] <twnqx> lol rtos
[18:04:20] <sjokkis> codyps: my spi pushes bytes to a can transceiver, and it's the most important task the rtos is doing. does that sound like a usecase for polling spi to you?
[18:04:21] <twnqx> <codyps> twnqx: SPI can run at 1 byte every 32 cpu clocks <- a thread change on an RTOS takes longer than that
[18:04:23] <N1njaneer> Or if you need to bang out the whole buffer, just stay inside of a while() loop poll until the whole buffer is sent :)
[18:04:43] <codyps> sjokkis: on the other hand, if the recving device is slow or you need to poll something else (and can't interleave the SPI and <other thing> polling), interrupt based makes sense
[18:04:58] <N1njaneer> And if you need to pass a truely massive amount of SPI data, perhaps you want to consider another option beyond an AVR :)
[18:05:13] <sjokkis> it's not a massive amount of data at all
[18:05:14] <codyps> twnqx: right, which is why I'm saying you should look carefully at doing polled vs interrupt spi transfers
[18:05:19] <twnqx> just make sure you don't call external functions from your interrupt handler so you minimize the entry/exit code
[18:05:32] <codyps> because interrupt transfers will cut down the throughput
[18:05:37] <codyps> (potentially)
[18:06:18] <twnqx> *grumble* now you made me read the asm output
[18:06:19] <N1njaneer> I've done SDCARD via SPI, OLED via SPI, and two UARTS simultaneously (250kbaud continuous send and 19200 periodic) on a ATMEGA2560 at 8Mhz with no interrupts and it works just fine. :)
[18:06:57] <twnqx> i run an internal + an external CAN controller and UART in parallel with SPI, and several timers
[18:07:27] <sjokkis> i'll be running an external CAN controller with this
[18:07:37] <sjokkis> maybe i'll fancy attaching other things, but i haven't planned it yet
[18:07:48] <sjokkis> logging to an SD card would be neat, though
[18:07:48] <twnqx> codyps: i guess you are right
[18:08:07] <twnqx> sjokkis: that's what i use SPI for, some mbits of flash :P
[18:08:17] <N1njaneer> Basically my methodolody is -- code it as simple as possible the first time around, test it, take metrics, and see if it warrants needing changing. You would be surprised at times how many hoops you DON'T need to jump through, like interrupt-based processing on absolutely everything.
[18:08:25] <twnqx> stupid gcc saves 13 registers to the stack
[18:08:39] <sjokkis> N1njaneer: i suppose i've just gotten into the habit of using interrupts as much as possible
[18:08:51] <twnqx> uh, 16
[18:08:52] <sjokkis> N1njaneer: this is my first project using an RTOS, so i guess i can relax that habit a little
[18:08:57] <N1njaneer> Sometimes the overhead and headache of interrupts completely outweighs the benefits of a simple and clean poll loop :)
[18:08:58] <twnqx> push/pop alone will be 32 cycles
[18:08:59] <sjokkis> N1njaneer: since i have a scheduler and stuff now
[18:09:18] <twnqx> sjokkis: you have one HUGE problem there.
[18:09:19] <N1njaneer> Then you can probably feel less-bad about using polling.
[18:09:26] <sjokkis> twnqx: what's that?
[18:09:39] <twnqx> a task change means swapping all registers
[18:09:46] <sjokkis> so?
[18:09:48] <twnqx> 60+ clocks.
[18:09:50] <N1njaneer> Worst case you can always do something like poll, send 8 bytes (if avaliable), then sleep/reliquish, then come back and send more.
[18:10:16] <twnqx> compare to above figures for one byte transmission at top speed
[18:10:19] <sjokkis> twnqx: the CAN task runs at the highest priority, with nothing else running at the same priority to avoid round-robin fucking things up
[18:10:27] <twnqx> while you change tasks alone
[18:10:36] <twnqx> 2 bytes could have passed the SPI
[18:10:47] <sjokkis> hmmmm
[18:10:56] <twnqx> and that doesn't execute a single command in between
[18:11:07] <N1njaneer> I wish AVR had shadow/banked register capabilities like ARM with the FIQ register set. Don't waste time pushing/popping on an interrupt, just swap out the entire bank of registers!
[18:11:09] <twnqx> command, as in instruction.
[18:11:38] <twnqx> ah, the wonderful world of µC
[18:11:55] <N1njaneer> twnqx: If he's running SPI as he master, 2 bytes won't slip by since he's controlling the dataflow. I assume he is master? :)
[18:12:03] <twnqx> codyps: thanks for the heads-up, gonna rewrite the handler in asm
[18:12:03] <sjokkis> i'm master
[18:12:11] <twnqx> yeah
[18:12:13] <twnqx> but
[18:12:20] <twnqx> if his CAN bus runs at 500khz
[18:12:32] <sjokkis> hm, so i can use looping spi that's run periodically in my CAN task, or i can use interrupted spi that's fed by my CAN task and then runs whenever
[18:12:38] <sjokkis> i don't know what's better
[18:12:41] <twnqx> he can't afford to lose many cycles on the SPI interface...
[18:13:16] <N1njaneer> FPGA! Done! :D
[18:13:26] * twnqx never noticed that the timing is that tight.
[18:13:52] <twnqx> i am forwarding packets between two can ports to have directional man in the middle, log the packets to flash AND to serial
[18:13:53] <twnqx> :S
[18:14:13] <sjokkis> the CAN controller runs at 10MHz. i run at 16MHz
[18:14:25] <twnqx> the can bus is relevant
[18:14:30] <twnqx> and the spi bus
[18:14:41] <twnqx> and the overhead to access the can bus, of course
[18:15:13] * twnqx hugs his SJA1000 boards
[18:15:43] <sjokkis> N1njaneer: what do you think i should do?
[18:15:54] <twnqx> he suggested to drop in an FPGA :P
[18:16:18] <twnqx> (i would drop the AVR and go to ARM. same price, 10x the power or more)
[18:16:36] <sjokkis> can't
[18:18:16] <twnqx> i - personally - would still run an interrupt driven queue
[18:18:24] <twnqx> if it's fast enough all is well
[18:19:01] <twnqx> if not write the irq handler in asm (looking at the garbage gcc produced makes me angry), or poll in your mainloop
[18:19:16] <sjokkis> well, considering a looping spi would only be serviced periodically i think it's sort of a toss-up
[18:19:32] <sjokkis> i could probably service the loop like a hundred times a second, but still
[18:19:33] <twnqx> "serviced periodically" is not a good idea
[18:19:50] <twnqx> "interrupted periodically" would be the way to go
[18:20:32] <twnqx> if you receive a can packet via SPI that means you have at least *calculates* 17 bytes in a row
[18:20:45] <sjokkis> why does it mean that?
[18:20:57] <twnqx> 8 byte data, 4 byte header
[18:21:01] <twnqx> err
[18:21:04] <twnqx> yeah, 13
[18:21:41] <twnqx> (4 byte header for a 29bit address CAN header, 2byte for a 11bit address)
[18:21:43] <sjokkis> right, since it's gonna be CAN packets
[18:22:03] <twnqx> plus at least one command to send to the controller to teell it you want to receive a packet
[18:22:18] <sjokkis> is it ugly to use an interrupt to get the first byte, and then loop in the ISR to receive the rest of the packet?
[18:22:44] <twnqx> looping with interrupts disabled... is kind of ugly
[18:22:51] <sjokkis> that's what i thought
[18:22:51] <inflex> indeed
[18:23:04] <inflex> interrupts are the sort of thing you want to get in and out of as quick as possible
[18:23:14] <sjokkis> it seems kinda lame to trigger the interrupt 13 times for a single packet also, though
[18:23:16] <inflex> better to set a flag and process in the main body loop
[18:23:23] <sjokkis> once i get the first byte, i know there'll be 12 more coming immediately
[18:23:40] <twnqx> technically, if you can guarantee that your interrupt handler disabled the interrupt enable bit, you could re-enable interrupts in the interrupt handler
[18:23:50] <sjokkis> i know, but that's also a bit dirty
[18:24:49] <twnqx> just poll in a thread, and make sure the thread is not interrupted often
[18:25:14] <sjokkis> so how about this: i'll have the CAN task block on a semaphore, and the spi transmit complete isr gives this semaphore. then, the CAN task loops to retrieve the packet
[18:26:25] <sjokkis> when the CAN task has retrieved the whole packet, it exits the loop and blocks on the semaphore again
[18:26:41] <twnqx> sounds better
[18:26:49] <sjokkis> scheduler makes sure other things can run while the CAN task is blocked, so there's no wasted cycles
[18:26:53] <twnqx> still you have to disable SPI interrupts in the meantime
[18:27:18] <sjokkis> i can disable the spi interrupt while i'm in the CAN task loop
[18:27:50] <sjokkis> but since it's a binary semaphore, i don't strictly have to. it does save me some useless interrupt calls though
[18:27:51] <twnqx> ... why the hell does gcc save registers that it doesn't even use on the stack
[18:28:31] <twnqx> are ISR prologue and epilogue constant?
[18:29:13] <twnqx> oh god
[18:29:31] <twnqx> side effects of markign variables volatile...
[18:29:57] <twnqx> man this interrupt handler is unnecessarily slow...
[18:32:11] <N1njaneer> back! And yes, if it's that critical I'd go ARM. Something in SAM4 would do you well, and be about the same cost as an upper-end AVR, if you can't just do it in an FPGA :)
[18:33:44] <sjokkis> N1njaneer: it's not really critical. i probably have to send like 10 CAN packets a second
[18:34:12] <sjokkis> N1njaneer: also, university project in trondheim, norway where the avr is designed. we get them thrown at us. i get xmegas for free
[18:34:24] <vsync_> if its critical go x86
[18:35:08] <N1njaneer> sjokkis: Heh, our local Atmel FAE here has given us a half-dozen ARM devboards as well. It's nice to be in well with Atmel :)
[18:35:19] * twnqx wonders why his spi code blinks an LED
[18:35:23] <sjokkis> yeah, it's neat
[18:35:36] <sjokkis> what they don't just give us, they sell through the student electronics workshop at half price
[18:36:05] <twnqx> why don't you use at90can then:P
[18:36:45] <sjokkis> oh, this is a dev board they university's had made, and it has the at90usb
[18:37:13] <twnqx> too bad there's no at90usbcan ;(
[18:37:24] <twnqx> anyway
[18:37:26] <twnqx> bedtime, gn8
[18:37:44] <sjokkis> here's the price list for at90s at the electronics club: http://omegav.no/komp?search=AT90
[18:37:55] <sjokkis> price list in the far right column
[18:38:36] <sjokkis> they sometimes get whatever atmel has in store when they phase out an old model. i guess why they have 6700 of the AT90S8515-4AC
[18:59:37] <Casper> I hope this will be strong..
[19:05:57] <vsync_> the force is strong with this one
[19:07:04] <Fornaxian> that's just the garlic filled jalapenos he had for breakfast.
[19:09:43] <vsync_> with beans on the side
[19:10:51] <sjokkis> I told u I was hardcore
[19:14:28] <Casper> oh I got carried away...
[19:14:45] <Casper> I'm building a shelf thing... and I hope it will be as strong as I hope it will be :D
[19:14:46] <N1njaneer> Crust it with Jalokia powder, too.
[19:22:42] <vsync_> and peas
[19:23:21] <vsync_> it's gonna be 50 megatons
[19:23:36] <N1njaneer> OF FLAVOR!
[19:33:14] <sjokkis> i do not understand what the board designers were thinking when they make this pinout
[19:33:18] <sjokkis> it's just so strange
[19:33:40] <sjokkis> so, the spi pins are available on a header called portb right
[19:33:45] <sjokkis> that's fine
[19:34:18] <sjokkis> but the can header seems to be designed to make connecting to it as messy as possible
[19:34:24] <sjokkis> i have to use 4 1-pin cables to make it work
[19:37:51] <sjokkis> i mean what is this i don't even http://i.imgur.com/pYjDwLR.jpg
[19:38:20] <sjokkis> am i missing something or is this retarded?
[19:38:29] <vsync_> that's a standard 5x2 pin connector? you could use a 2x2 and cut the 'lock' out of it
[19:39:01] <sjokkis> well yes but if they'd just made this pinout nonretarded i could have used 2 2-pin connectors
[19:39:13] <sjokkis> but instead they went full retard
[19:39:42] <sjokkis> i just don't see how they intended people to connect these
[19:40:07] <sjokkis> and it's meant to be connected. this is a premade devboard that my university has had made
[20:03:49] <jadew> here's something interresting
[20:04:09] <jadew> maybe I'm missing something, but I think not
[20:04:40] <jadew> from the ATMEGA324PA datasheet: Bit 3– PCIF3: Pin Change Interrupt Flag 3
[20:04:40] <jadew> When a logic change on any PCINT31..24 pin triggers an interrupt request, PCIF3 becomes set
[20:04:40] <jadew> (one). If the I-bit in SREG and the PCIE3 bit in EIMSK are set (one), the MCU will jump to the
[20:04:40] <jadew> corresponding Interrupt Vector. The flag is cleared when the interrupt routine is executed. Alternatively,
[20:04:40] <jadew> the flag can be cleared by writing a logical one to it.
[20:05:03] <jadew> this is the interresting part: "If the I-bit in SREG and the PCIE3 bit in EIMSK are set (one)"
[20:05:09] <jadew> because there's no such bit in EIMSK
[20:05:19] <jadew> and there's no way to disable the interrupt vector
[20:11:29] <Fornaxian> jadew, it is in the PCICR register.
[20:11:46] <Fornaxian> datasheet page 71
[20:11:54] <Fornaxian> looks like there is a typo there.
[20:11:55] <jadew> Fornaxian, I know, I was about to see if it disables the interrupt vector or not
[20:12:34] <jadew> my initial guess was that it disables the interrupt altogether (the flag won't get generated)
[20:12:37] <Fornaxian> When the PCIE3 bit is set (one) and the I-bit in the Status Register (SREG) is set (one), pin
[20:12:38] <Fornaxian> change interrupt 3 is enabled.
[20:13:00] <jadew> however, I'm looking for a way to disable the interrupt call
[20:15:22] <jadew> hmm, looks like that really does disable the interrupt call
[20:15:25] <jadew> interresting
[20:53:28] <braincracker> women driving ferrari http://www.youtube.com/watch?v=SDjGidKc4DY
[20:54:07] <braincracker> home made electric gokart 24v starter motor fun http://www.youtube.com/watch?v=C5lp3fP1WKo
[20:55:04] <vsync_> i know of a guy who once rigged a starter motor to pull up his fishing lines on his boat
[20:55:23] <vsync_> was well funny when he fired it up with the lines in water he almost got the bait straight to his head
[20:55:44] <vsync_> and it was no lightweight metal thingy... and it comes outta the water super fast
[20:56:54] <Fornaxian> that gocart looks like fun.
[21:06:10] <vsync_> that ferrari thing was fun
[21:08:03] <jadew> it's always fun to watch rich people fuck up
[21:22:16] <sjokkis> when i'm communicating with the can controller, should i expect it to always get my register updates? i'm trying to change the operation mode now, to loopback, and i'm reading the same register back. half the time it's the value i wrote, and half the time it's another value. is that expected or am i doing it wrong?
[21:23:22] <sjokkis> should i be doing something like do { write_value(blah) } while (read_value() != blah) ?
[21:24:52] <sjokkis> for what it's worth, i made a super simple send/receive spi function http://pastebin.com/sF9F4Qhb
[21:33:37] <sjokkis> the library calls that function either as mcp2515_spi_transfer(reg, NULL) or as mcp2515_spi_transfer(0, &reg) so it seemed reasonable
[21:34:26] <sjokkis> to write or read, respectively
[22:27:11] <jadew> I went trough 12 boxes of ikea like this: http://i-cdn.apartmenttherapy.com/uimages/chicago/092908bwikea.JPG
[22:27:38] <jadew> filled with stuff, none of them contained duct tape
[22:28:24] <jadew> *ikea boxes
[22:28:56] <jadew> so freaking annoying... and the saddest thing, my project depends on it
[22:33:08] <Casper> jadew: I have 24 rubbermaid 53L box
[22:33:30] <Casper> now making a shelf for them
[22:33:40] <Casper> I'm at layer 4 now... out of 5
[22:34:30] <jadew> nice, I have some similar boxes too, but there's no sduct tape there
[22:34:38] <jadew> and I just realized I'm missing my glue gun
[22:34:46] * jadew moved recently
[22:36:42] <jadew> anyway, I'm off to bed, see ya