#avr | Logs for 2012-05-05

Back
[03:10:11] <OndraSter> eyya
[05:28:38] <buhman> I have an array with 97,187 elements. When I try to compile it, I'm told "main.h:6020:1: error: size of array is too large"
[05:29:02] <Steffanx> You have that much RAM?
[05:31:17] <Steffanx> What's the idea with an array that large buhman ?
[05:31:35] <buhman> pcm audio data
[05:31:48] <buhman> and I should
[05:31:52] <buhman> oh, ram?
[05:32:07] <buhman> I should have that much flash I mean
[05:32:58] <Steffanx> You used the PROGMEM, to store it in flash?
[05:33:03] <Steffanx> And you have that much flash?
[05:33:20] <specing> buhman: Atmega128?
[05:33:27] <Steffanx> http://www.nongnu.org/avr-libc/user-manual/pgmspace.html
[05:33:34] <Steffanx> -the
[05:33:51] <buhman> 1284p
[05:34:39] <buhman> Steffanx: yeah; I read that somewhere, and that's what I'm doing
[05:34:48] <Steffanx> hmm
[05:35:31] <specing> I've never seen anyone make an array that was larger than 64k
[05:35:50] <specing> Addressing it may become a problem
[05:37:40] <Steffanx> Yeah, I think specing is right
[05:42:34] <Steffanx> What happens when you split it into two times 97k/2 buhman ?
[05:44:39] <buhman> yeah, I just shortened the array to 32766 and it works
[05:53:56] <buhman> heh, I think my DAC isn't quite working correctly :S
[06:03:26] <jacekowski> iirc there is array size limit on avrc
[06:03:37] <jacekowski> even if you have enough ram
[06:03:41] <jacekowski> and flash
[06:03:51] <jacekowski> 64k or 32k
[06:04:04] <jacekowski> i think it was 64k
[06:04:30] <jacekowski> iirc it was because of 16bit pointers
[06:04:58] <Steffanx> Yeah, that's it :)
[06:05:03] <specing> You have to use a supplementary register to be able to LPM more than 64K
[06:05:14] <specing> EIND or sth like that
[06:07:16] <Steffanx> 32k seems to be the limit jacekowski
[06:08:30] <specing> That is strange
[06:09:02] <Steffanx> Or not
[06:09:04] <Steffanx> " array indices are signed ints"
[06:09:17] <specing> D'oh GCC...
[06:10:35] <Steffanx> There also seems to be a size limit
[06:10:42] <Steffanx> defined by "SIZE_MAX"
[06:10:54] <Steffanx> So uint16_t a[32k] is also not valid
[06:11:06] <Steffanx> where uint8_t a[32k] is
[06:11:35] <specing> That is logical
[06:11:42] <specing> lpm is byte-addressed
[06:11:58] <Steffanx> :)
[06:18:49] <buhman> why would you have an array index if <0?
[06:18:52] <buhman> of*
[06:20:59] <buhman> and my DAC sounds pretty horrid, I have a DAC0800; is it supposed to be audio-grade? :P
[06:24:22] <specing> buhman: because GCC
[06:25:15] <Steffanx> specing, leave Trollville please :P
[06:25:39] <specing> since when is #avr Trollville?
[06:25:53] <Steffanx> I didn't say #avr is Trollville
[06:25:59] <buhman> Steffanx: I think you did
[06:26:05] <specing> you said "leave Trollville"
[06:26:12] <specing> And im in #avr
[06:26:22] <specing> That means #avr is Trollville
[06:27:04] <Steffanx> You live here?
[06:27:53] <specing> I don't know, do you?
[06:28:01] <Steffanx> I'm not sure
[06:29:40] <specing> You are not sure of your existance?
[06:29:49] <CapnKernel> You guys are having too much fun.
[06:29:53] <specing> :D
[06:30:02] <Steffanx> Sorry, granddad!
[06:30:06] <specing> CapnKernel: Are you behind The Great Firewall yet?
[06:30:15] <CapnKernel> No, still in Melbourne.
[06:30:18] <Steffanx> :(
[06:30:32] <CapnKernel> My poor VPN is lonely, absolutely no need to start it up :-)
[06:30:40] <specing> Hehe
[06:30:54] <CapnKernel> Pure, unadulterated, all the pr0n and news of Tibet I can handle.
[06:31:09] <Steffanx> :)
[06:31:34] <Steffanx> Doesn't Aussieland also have some strict rules about internet and stuff?
[06:32:28] <specing> CapnKernel: Have you declared Assanged your national hero yet?
[06:32:32] <specing> -d
[06:32:50] <Steffanx> Assange fits in your definition of hero?
[06:33:42] <specing> It doesen't in yours?
[06:33:52] <CapnKernel> How can it be possible that one of the world's most popular shopping cart programs is THIS lame?
[06:33:56] <Steffanx> No specing
[06:33:59] <CapnKernel> No support for tracking numbers
[06:34:10] <specing> Steffanx: Why not?
[06:34:11] <CapnKernel> No support for recording where one gets things from
[06:34:26] <CapnKernel> No notion of recording how much you paid for something
[06:34:56] <CapnKernel> But hey, it's got great support for banners and affiliate programs!
[06:35:14] <CapnKernel> No support for you, the shopkeeper, drawing up an order on a customer's behalf
[06:35:38] <CapnKernel> No support for zoom-on-mouseover of product images
[06:35:44] <Steffanx> Why should he specing ?
[06:36:14] <specing> I can undestand that you don't see him like that
[06:36:26] <Steffanx> You are talking about the website you, seeed and itead use CapnKernel ?
[06:36:26] <specing> You are dutch afterall
[06:36:54] <Steffanx> Hey! I didn't say i don't like him… he just isn't a 'hero' imho
[06:37:17] <CapnKernel> I use Zen Cart. That bitch is dumped first chance I get.
[06:37:20] <CapnKernel> Going now...
[06:37:46] <specing> I don't think the *current* heroes have the balls to go against not one government, but all governments around the world
[06:41:25] <Steffanx> The things he does really help you specing ?
[06:42:42] <specing> Not directly, no
[06:58:56] <OndraSter> http://clip2net.com/s/1SSUi
[06:59:17] <OndraSter> http://clip2net.com/s/1SSUA
[07:18:26] <Steffanx> OndraSter a fuse would be nice too imho
[07:18:37] <Steffanx> on the 'hv' side
[07:18:50] <OndraSter> that is mounted on the chassis
[07:18:52] <OndraSter> before entering the board
[07:19:19] <Steffanx> ah ok
[07:21:33] <OndraSter> also, this is 2 - 3VA transofmer
[07:21:42] <OndraSter> few mA fuses are not cheap
[07:22:11] <OndraSter> about 3VA at 240VAC :)
[07:54:00] <budwaa> Hi, any thoughts on this LRC I have for AVR? http://pastebin.com/VNS3DSjz
[09:50:51] <Steffanx> OndraSter alive?
[09:51:08] <OndraSter> nope
[09:51:18] <OndraSter> Bon Jovi?
[09:51:28] <Steffanx> Ok, you ordered the pcb's for your display from seeed, didn't you?
[09:51:36] <OndraSter> itead
[09:51:40] <Steffanx> Hmm
[09:51:49] <OndraSter> why?
[09:52:08] <Steffanx> You ordered all boards at once?
[09:52:11] <OndraSter> yes
[09:52:36] <Steffanx> So just jumped everything in your card and ordered..
[09:53:29] <OndraSter> ye
[09:53:35] <OndraSter> you can use CapnKernel now :)
[09:53:46] <Steffanx> I could
[09:54:16] <Tom_itx> Steffanx what are you making now?
[09:54:37] <Steffanx> Something I want to make for ages now
[09:54:46] <Steffanx> You already made one
[09:54:56] <Tom_itx> anemom?
[09:55:16] <Steffanx> Npo
[09:55:18] <Steffanx> no
[09:55:37] <Tom_itx> i'm not gonna go down my whole list...
[09:55:42] <Steffanx> o
[09:55:43] <Steffanx> v
[09:55:46] <Steffanx> en thingy
[09:56:05] <Tom_itx> oh
[09:56:15] <Steffanx> Actually this is just the controller board
[09:56:24] <Tom_itx> i thought you did that already
[09:56:27] <Steffanx> Noo
[09:56:48] <Steffanx> I finished one board, which used an AVR
[09:56:59] <Steffanx> I redesigned it
[09:57:13] <Steffanx> it now uses an STM32
[09:57:22] <Steffanx> It's also some sort of little dev. board
[09:57:30] <Tom_itx> way overkill for that
[09:57:45] <Steffanx> I know it's overkill
[09:57:51] <Steffanx> It has USB and bluetooth :P
[09:57:58] <OndraSter> lol
[09:58:14] <OndraSter> now you need also remote for fridge
[09:58:20] <OndraSter> and some slave... like a wife?
[09:58:43] <Steffanx> It's just a toaster oven used for smd stuff
[09:58:53] <OndraSter> I was just trying to make a joke :(
[10:00:01] <Steffanx> ARh
[11:37:09] <OndraSter> I broke the AVR Studio
[11:37:13] <OndraSter> it won't syntax highlight anything :(
[11:38:35] <OndraSter> yet it is enabled in options
[11:46:33] <abcminiuser_> exDM69, can you check if a polling interval of 5ms solves your issue?
[11:47:00] <exDM69> abcminiuser_: yeah, I can
[11:47:13] <abcminiuser_> 10ms would be a tad slow I think
[11:48:22] <abcminiuser_> ^ thanks
[11:59:52] <exDM69> abcminiuser_: 10 or 5 ms works, 1 or 2 ms does not
[12:00:04] <abcminiuser_> Ah good, I'll set them to 5ms then
[12:00:12] <abcminiuser_> Just to give it a bit of lee-way
[12:10:28] <buhman> how do I address more than 64k bytes?
[12:18:02] <specing> buhman: read about lpm and ld
[12:22:58] <OndraSter> hmm what is the fastest way (or easiest way) to do rotary encoder decoding? I found simple "lookup table" way
[12:23:22] <OndraSter> prevstate & (currentstate << 2)
[12:23:26] <OndraSter> and look into lookup table for that
[12:23:48] <elektrinis> interrupts
[12:23:51] <OndraSter> well yes
[12:23:56] <OndraSter> but decoding it :)
[12:24:02] <OndraSter> because CW and CCW have different "numbers"
[12:24:03] <elektrinis> 1sec
[12:24:21] <OndraSter> http://pastebin.com/x8gdwDLp
[12:24:27] <OndraSter> then create simple table with those 1101 1000 etc
[12:24:31] <OndraSter> and bind them LEFT or RIGHT
[12:24:35] <OndraSter> simple as that
[12:26:17] <elektrinis> http://pastebin.com/9ziugQHr
[12:26:27] <elektrinis> very fast and glitch-free
[12:26:34] <OndraSter> I have them on one interrupt
[12:26:39] <OndraSter> I like my way better :X
[12:26:40] <elektrinis> remove unneeded code
[12:26:47] <OndraSter> not possible :)
[12:27:25] <elektrinis> why
[12:27:31] <OndraSter> I have two interrupts per port
[12:27:37] <OndraSter> and one is used for something else
[12:27:57] <elektrinis> what device do you run?
[12:28:00] <OndraSter> xmega
[12:28:01] <jacekowski> OndraSter: depends on encoder
[12:28:13] <OndraSter> jacekowski, either I switched CW/CCW or I have it correctly
[12:28:15] <jacekowski> OndraSter: is it quadrature encoder?
[12:28:17] <elektrinis> so it should have many pin change interrupts
[12:28:30] <elektrinis> this was done on atmega324
[12:28:31] <OndraSter> elektrinis, two interrupts per port
[12:28:53] <jacekowski> OndraSter: what is the encoder type
[12:28:57] <OndraSter> yes
[12:28:57] <elektrinis> there are hardware interrupts and lower priority pin change
[12:28:58] <OndraSter> quadrature
[12:29:07] <OndraSter> what is wrong on my way, elektrinis
[12:29:24] <jacekowski> 4 pin?
[12:29:30] <jacekowski> 4 bit?
[12:29:36] <OndraSter> 3 pin
[12:29:39] <OndraSter> A and B
[12:29:41] <OndraSter> plus common
[12:29:45] <jacekowski> ahm, that kind
[12:31:48] <jacekowski> it's not so complicated to decode
[12:31:52] <OndraSter> yes
[12:31:55] <OndraSter> I like my way :P
[12:32:10] <elektrinis> everyone likes their way
[12:32:31] <grummund> OndraSter: have you looked at the on-chip quadrature encoder?
[12:32:39] <OndraSter> grummund, it works with counter
[12:32:44] <OndraSter> as far as I understood
[12:32:55] <OndraSter> sure I could do it through the counter..
[12:32:55] <grummund> any use?
[12:32:58] <OndraSter> nope
[12:33:12] <OndraSter> well I couldn't do it through counter actually
[12:33:18] <jacekowski> you don't need a counter for it
[12:33:38] <OndraSter> the builtin quadrature encoder works only with counter...
[12:33:51] <jacekowski> all you need to know is that pin has changed and it's current level
[12:34:05] <OndraSter> yes
[12:34:08] <OndraSter> what's wrong on my lookup table
[12:34:12] <OndraSter> two - three lines of code maybe
[12:34:17] <jacekowski> overcomplicated
[12:34:21] <OndraSter> no
[12:34:23] <OndraSter> simplest
[12:35:46] <grummund> OndraSter: it generates xmega events, hooking these up to a counter is just one way of using them
[12:36:25] <OndraSter> you _still_ need the code to decode the CW/CCW
[12:36:33] <OndraSter> no matter if you read the pins yourself or from some register
[12:36:37] <grummund> really?
[12:36:48] <jacekowski> hmm, 4 simple if's
[12:36:52] <OndraSter> I studied it a week ago... don't remember if there was specific CW/CCW
[12:37:18] <jacekowski> basically if you know that B has changed to LOW and A is high then it's clockwise
[12:37:49] <jacekowski> if B has changed to LOW and A is LOW then it's CCW
[12:38:00] <grummund> OndraSter: afaict it handles the count up/down for you
[12:38:10] <jacekowski> and you can do similiar thing on A change
[12:38:43] <OndraSter> atmel's website is down, can't get the detailed datasheet right now
[12:42:02] <OndraSter> now even PDFs can't be opened, it worked minute ago! :(
[12:43:25] <grummund> what's the project, anyway... something interesting?
[12:43:35] <mrfrenzy> their web monkeys are probably drinking beer
[12:43:35] <OndraSter> yes, the thing I've been posting images of for past month
[12:43:45] <OndraSter> the tiger boards :)
[12:44:15] <grummund> i must've been asleep that long then :p
[12:44:44] <OndraSter> <OndraSter> http://clip2net.com/s/1SSUA ... http://clip2net.com/s/1SSUi
[12:45:52] <grummund> hmm, yep that's a board with a tiger alright
[12:46:49] <OndraSter> 6.7 Quadrature Decoder
[12:46:49] <OndraSter> The Event System includes three Quadrature Decoders (QDECs). This enables the Event System to decode quadrature input on I/O pins, and send data events that a Timer/Counter can decode to trigger the appropriate event action: count up, count down or index/reset.
[12:47:46] <OndraSter> (this is from A1 or A3 datasheet, D4 has only one decoder)
[12:48:15] <grummund> so what are you using the Quadrature Decoder for exactly?
[12:48:24] <OndraSter> as an input
[12:48:36] <grummund> duh, you don't say ;)
[12:48:41] <OndraSter> (..)
[12:48:50] <OndraSter> just rotate the input knob and do what it can!
[12:49:10] <OndraSter> from my work with electronic lab stuff at school I found out that rotary encoders are:
[12:49:12] <OndraSter> a) easy to use
[12:49:19] <OndraSter> b) three buttons in one
[12:49:22] <OndraSter> c) awesome to use
[12:49:23] <OndraSter> d) sexy
[12:50:07] <grummund> ok, but without any other description it could be a position encoder on the wheels of your tiger robot for all i know
[12:50:48] <OndraSter> oh, there is on the second photo on the top
[12:50:50] <OndraSter> "waveform generator"
[12:51:07] <OndraSter> it is for entering the frequency mostly
[12:52:20] <OndraSter> http://search.digikey.com/us/en/products/BCAP3000%20P270%20K04/1182-1021-ND/3079285
[12:52:22] <OndraSter> Dear Santa :D
[12:54:02] <OndraSter> 3.04Wh :)
[12:54:44] <OndraSter> short circuit curremt: 9300A
[12:54:48] <OndraSter> I can see what I would be doing all day long
[12:54:56] <OndraSter> BANG
[12:55:32] <elektrinis> ESR must be in the sky
[12:55:49] <OndraSter> 0.29R
[12:55:56] <OndraSter> 0R29
[12:55:59] <elektrinis> thats a lot
[12:56:02] <Tom_itx> OndraSter you trying to do quad?
[12:56:05] <OndraSter> wait
[12:56:07] <OndraSter> 0.29mOhm
[12:56:13] <OndraSter> Tom_itx, quad what?
[12:56:23] <elektrinis> thats ok
[12:56:23] <Tom_itx> quadrature encoder
[12:56:35] <OndraSter> Tom_itx, sure
[12:57:01] <elektrinis> so 3.4Wh for 77 bucks?
[12:57:10] <elektrinis> 3.04
[12:57:11] <OndraSter> not bad for a cap
[12:57:11] <Tom_itx> http://tom-itx.dyndns.org:81/~webpage/avr/atmega328/PCINT0/quadrature/
[12:57:24] <elektrinis> get an A123 cell
[12:57:30] <elektrinis> 5Wh
[12:57:33] <elektrinis> for 6$
[12:57:37] <OndraSter> Tom_itx, same way as I intended it
[12:57:40] <OndraSter> but they didn't like it :(
[12:57:46] <Tom_itx> poop on them
[12:57:46] <OndraSter> elektrinis, A123 cell?
[12:57:48] <OndraSter> from a phone?
[12:57:52] <elektrinis> no
[12:58:09] <elektrinis> they are used in power tools
[12:58:15] <elektrinis> LiFePO4 chemistry
[12:58:19] <OndraSter> oh
[12:58:24] <elektrinis> ..and in high end electric supercars
[12:58:39] * elektrinis is using these cells in his bike
[12:58:51] <OndraSter> thanks Tom_itx, I don't feel like the awkward one anymore :D
[12:59:58] <elektrinis> http://e-motion.lt/bbpress/topic/140
[13:00:23] <Tom_itx> it works
[13:00:26] <Tom_itx> that's what matters
[13:02:20] <OndraSter> elektrinis, wanna build electric car with 18650 A123 batteries? :D
[13:02:24] <OndraSter> (18650 as a size, not amount)
[13:02:26] <grummund> hmm, sure that works Tom_itx ? updatePos() looks suspect to me
[13:02:28] <OndraSter> amount probably as well though lol
[13:02:35] <elektrinis> OndraSter, Tesla did.
[13:03:07] <elektrinis> they use 18650 lithium ion
[13:03:13] <elektrinis> ..many of them
[13:03:20] <OndraSter> :D
[13:03:45] <elektrinis> dont laugh, its not so bad
[13:03:52] <elektrinis> they spot-weld everything
[13:03:53] <OndraSter> how much means many?
[13:04:06] <elektrinis> cant recall
[13:04:19] <elektrinis> google it
[13:04:28] <elektrinis> few hundred
[13:04:56] <elektrinis> I made a spot-welder myself do deal with it
[13:05:21] <elektrinis> http://circuit.lt/?section=projektai&page=welder
[13:07:22] <grummund> The XMEGA Timer/Counter modules are able to use the quadrature events to count up/down when the event action is set to quadrature encoding.
[13:07:26] <grummund> As a result, the current position of the rotary device is tracked by the Timer/Counter, and can be directly read from the Timer/Counter CNT[H:L] register.
[13:07:29] <grummund> The Timer/Counter works normally and interrupts/events can be used.
[13:07:31] <grummund> Interrupts can be given at relative/absolute positions.
[13:07:34] <grummund> An extra Timer/Counter can be used to calculate rotation speed and acceleration.
[13:07:36] <grummund> OndraSter: ^^
[13:07:51] <OndraSter> grummund, but you would have to read the TCNT register, there is no "value changed" interrupt..
[13:08:14] <grummund> i would be surprised if it cannot be made to do that
[13:08:45] <OndraSter> I prefer mine and Tom_itx 's way better
[13:08:48] <grummund> pretty useless if it needs to be polled...
[13:10:33] <elektrinis> my method might look complex at first, but actually its jus two ifs
[13:10:46] <elektrinis> and you get interrupt on change
[13:11:03] <elektrinis> and it prevents reading bad value
[13:11:33] <OndraSter> so does this :)
[13:12:35] <elektrinis> a lot of changes may occur between interrupt and you reading the value
[13:12:41] <elektrinis> ringing, etc
[13:12:53] <elektrinis> rotation encoders are famous for ringing
[13:14:44] <OndraSter> lot of changes?
[13:44:12] <Tom_itx> grummund we tested it
[16:23:58] <budwaa> Is avr little endian?
[16:26:12] <karlp> it's 8bit man.
[16:26:34] <karlp> you _may_ have some cares about how your compiler decides to lay 16/32bit numbers in memory, but you really don't care.
[16:28:33] <grummund> Tom_itx: yeah in re-reading the logic looks good
[16:28:43] <specing> lol, endianess
[16:29:13] <budwaa> Yeah I mean 16 bit numbers in memory
[16:29:18] <budwaa> they must have an endiness :D
[16:29:41] <grummund> budwaa: yebut that is determined by the compiler not avr
[16:29:48] <budwaa> I do care because I have some code on a PC which is little endian
[16:30:19] <budwaa> Ok, so I guess its down the the math libraries for 16 bit math etc
[16:30:29] <budwaa> in the compiler
[16:30:34] <grummund> budwaa: if you re-ask the question what endianess does gcc use?...
[16:30:41] <grummund> then it's little endian
[16:30:58] <budwaa> thanks, and thanks for the understanding as well as the answer :D
[16:31:22] <grummund> but it shouldn't matter if the code is written properly
[16:31:50] <budwaa> Its come up when doing LRC checks on serial data
[16:32:01] <grummund> still, shouldn't matter
[16:32:09] <budwaa> How come?
[16:32:16] <budwaa> cos you are just summing the 16 bit
[16:32:41] <grummund> it's possible to write it so that endianess doesn't matter
[16:32:48] <budwaa> one time I can see it matters is when checking an odd number of bytes when you have to zero pad up to a whole number
[16:33:36] <grummund> you see wrong :;
[16:33:43] <grummund> ;)
[16:34:05] <budwaa> I think in the code I have it would be a problem
[16:34:13] <budwaa> but I don't know about other methods of coding it :D
[16:34:29] <grummund> sure, it's also possible to write bad code :p
[16:35:19] <budwaa> http://pastebin.com/A1QQPpU2
[16:36:07] <budwaa> thats the c++ code on the pc
[16:36:58] <grummund> that in itself is not endian dependent
[16:39:15] <budwaa> but if the avr compiler was big endian you surely wouldnt' get the same result on the avr as the pc.
[16:40:33] <grummund> unsigned short a, b=3, c=4; a=b+c;
[16:40:58] <grummund> do you think this code produces different results little vs. big endian?
[16:41:08] <budwaa> no
[16:41:19] <grummund> ok, so why is yours different?
[16:41:46] <budwaa> I think if I have say a 16-bit array on a little endian and send it to a big endian PC then the sum would be differrent
[16:42:32] <grummund> sure there can be problems but not within the code you posted
[16:43:25] <budwaa> ok, thanks.
[16:44:57] <grummund> the problem comes if pointer types are re-cast anywhere (e.g. between 8-bit and 16-bit types)
[16:45:46] <grummund> with the appropriate warnings enabled gcc will usually tell you about that
[16:54:37] <OndraSter> "If our planet was on different place in the space" http://procproto.cz/veda-a-technika/astronomie/jak-by-vypadala-nocni-obloha-kdyby-zeme-lezela-na-jinem-miste-galaxie/
[16:54:47] <OndraSter> wrong chan, nvm :)
[16:54:56] <grummund> Tom_itx: there's an easy saving of about ~40 bytes code size on that function
[17:02:39] <Tom_itx> i just did that to try pin change interrupts
[17:03:17] <Tom_itx> it's a mix of dean, rue and my code
[17:03:29] <grummund> heh. it shows ;)
[17:03:35] <abcminiuser__> Youwah?
[17:03:48] <grummund> like comments say one thing code says another
[17:03:56] <Tom_itx> pfft
[17:04:03] <Tom_itx> comments are just to confuse
[17:04:27] <Tom_itx> i never did go back and clean that up
[17:04:49] <grummund> ok rue wrote the comments, abcminiuser wrote the code, what did you do? :P
[17:05:14] <Tom_itx> heh
[17:05:18] <Tom_itx> i came up with the idea
[17:05:32] <grummund> and take the credit :P hehe
[17:05:37] <Tom_itx> rue was having trouble making his work so dean took it and did a version
[17:05:47] <Tom_itx> come to find out it was just a portx typo
[17:08:14] <Tom_itx> most of the code i have up there is just for learning
[17:09:05] <grummund> sure
[17:31:35] <j__> Hi, is it possible to use SPI on an atmega48 as a slave while having SS connected to ground?
[17:31:54] <j__> Because I'm seeing some very weird behavior.
[17:32:08] <Tom_itx> why would you gnd the pin?
[17:32:31] <Tom_itx> ss is an output
[17:33:11] <j__> Isn't it an input in slave mode?
[17:33:47] <j__> Connected it to ground should mean that the atmega48 is always selected, right?
[17:34:10] <Tom_itx> i would think the opposite
[17:34:21] <Tom_itx> isn't a high selected?
[17:34:49] <Tom_itx> it's been a while since i looked at spi
[17:34:54] <Tom_itx> is ss active low?
[17:35:06] <Steffanx> Most of the time, yes
[17:35:22] <OndraSter> when mega is slave, the SS pin must be tied to ground
[17:35:46] <OndraSter> CS is always low active
[17:35:51] <OndraSter> on like... everything
[17:36:27] <Steffanx> How can a website be so long show "Maintenance Notice" :S?!
[17:36:32] <Steffanx> -be
[17:36:35] <Steffanx> -long
[17:36:37] <j__> So I'm trying to communicate between a PC and an atmega48
[17:36:41] <OndraSter> hey, GMail was beta for few years, Steffanx
[17:36:43] <Steffanx> +for so long
[17:36:50] <Tom_itx> gawd Steffanx!
[17:36:51] <j__> here's my code http://pastebin.com/XY3Hz9Ah
[17:36:54] <Steffanx> Yeah, but Atmel is down for a day now?
[17:37:33] <OndraSter> actually, has anybody ever used mega in SPI slave mode? :o)
[17:37:52] <j__> When I run the code on the PC for the first time, it prints 'q', but the led connected to the microcontroller doesn't turn on
[17:38:15] <OndraSter> u sure the SPIF is set when in slave mode?
[17:38:16] <j__> when I run the code on the PC again it prints garbage.
[17:38:20] <OndraSter> I cant check datasheet
[17:39:30] <grummund> j__: which pin is LED connected?
[17:39:39] <j__> But here's the strange thing: If I connect SS to Vcc, and run the code on the PC (of course it prints the wrong thing this time), then connect it to ground again
[17:40:00] <j__> and then run code on the PC it works correctly
[17:40:07] <j__> and every time after that too
[17:40:40] <OndraSter> grummund, if you are thinking JTAG then I don't think that mega48 has jtag
[17:40:45] <j__> and led changes it's state every time then
[17:41:47] <j__> BTW i'm new to microcontrollers, so of course I could be doing something horribly wrong.
[17:41:54] <grummund> j__: might be noise at startup causing the bit stream to be out of sync
[17:42:05] <karlp> there's a bit in the spi section about the spi periph automatically switching modes when SS goes high or low
[17:42:10] <karlp> definitely reread that first.
[17:42:48] <grummund> j__: normally the SS state change resets the spi logic but since you have it shorted to gnd that's not possible
[17:42:51] <j__> I have seen something like that, but it only talked about master mode IIRC
[17:42:59] <OndraSter> yes, I had once DDR set as output AFTER enabling SPI and if there was any noise around SS line, the mega dropped to slave and it got stuck because it was waiting for flag on SPI (notice for others this is!)
[17:43:23] <grummund> j__: yep. but same in other direction... does the master not have SS output?
[17:43:33] <OndraSter> SS output for master is any GPIO pin
[17:43:40] <OndraSter> from*
[17:43:57] <grummund> OndraSter: in this case the AVR is slave device
[17:44:04] <OndraSter> yes
[17:44:12] <OndraSter> he is using paralell port
[17:44:24] <OndraSter> (parapin.h I suppose is parallel port)
[17:44:32] <j__> yes
[17:45:14] <grummund> j__: have the PC generate a SS output and hook that up too
[17:46:29] <grummund> j__: i didn't inspect your code closely but from what you describe it seems the most likely problem
[17:46:56] <j__> I'll try that.