#avr | Logs for 2014-05-01

Back
[01:33:39] <superware> I have an SPI setup with ATmega328 as master and ATtiny85 as slave, any idea why I'm getting garbage on the master instead of 0x6699cc? http://pastebin.com/YQsHBwsr
[01:41:36] <superware> anyone?
[03:53:36] <superware> can someone please help me with this http://pastebin.com/YQsHBwsr SPI setup, I'm getting garbage at the master (ps, a loopback on the master works)
[03:54:19] <Tom_itx> do you send an extra byte to the slave?
[03:55:50] <superware> what do you mean by extra? it's 4xspi_transfer both
[03:59:03] <superware> maybe there's something I don't understand, the slave should wait for the master to send something first, but it seems while (USISR & _BV(USIOIF)); isn't forever
[04:01:31] <superware> Tom_itx?
[04:01:44] <guanche> is there anybody here aplplying for the hackaday contest?
[04:02:21] <Tom_itx> iirc you gotta send an extra byte to flush the slave buffer
[04:02:32] <Tom_itx> been quite a while since i did spi
[04:02:43] <Tom_itx> later...
[04:04:29] <Roter> Hey guys! I have a atmega32, it doesnt have any code, but for some reason all of the pins output 0.7V. I use 5V.
[04:06:58] <Xark> Roter: They are likely just defaulting to input and that is just a bit of leakage.
[04:06:59] <specing> guanche: what contest?
[04:07:17] <guanche> the hackaday price specing
[04:07:54] <guanche> I was looking at a post saying entry period had ended, but I now see it's for another contest
[05:24:41] <superware> since my SPI slave (ATtiny85 USI) doesn't have an SS pin or "while ((USISR & _BV(USIOIF)) == 0);" timeout, how can I sync it with the master SCK? the slave can get the last 2 SCK pulses from one master transfer, wait forever, and then get the first 6 of the next master transfer..
[05:25:55] <superware> hi :)
[05:47:00] <Roter> I cant get TCNT1 working... I have an atmega32, it has a pin connected to D5. And im trying to make the led blink with timers. The code is only about 16 lines: http://pastebin.com/GCyirmF7 . The LED turns on and does not turn off(blink). What should i do?
[05:49:30] <antto> how long is that period?
[05:51:17] <Roter> i dont realy care about the period, i actualy tryed from 5000 to 40000 incrementing by 5000, still nothing happens
[05:51:25] <Roter> i havent made the calculations yet
[05:51:57] <Lambda_Aurigae> wouldn't that be blinking like 100 times a second?
[05:53:07] <Roter> that would probably be the problem
[05:53:44] <Lambda_Aurigae> I could be wrong, just a wild guess from your numbers.
[05:55:05] <Roter> yeah, looks like it blinks, but extremly fast, so i will look into changing the code a bit
[05:55:10] <Roter> thank you guys, again
[05:55:24] <Lambda_Aurigae> prescaler
[05:55:53] <superware> since my SPI slave (ATtiny85 USI) doesn't have an SS pin or "while ((USISR & _BV(USIOIF)) == 0);" timeout, how can I sync it with the master SCK? the slave might get the last 2 SCK pulses from one master transfer, wait forever, and then get the first 6 of the next master transfer..
[05:57:11] <Lambda_Aurigae> no clue here superware..never worked with the USI..
[06:01:37] <Lambda_Aurigae> but, let us look at ye olde datasheet.
[06:03:05] <superware> thanks, please see http://pastebin.com/YQsHBwsr
[06:03:39] <Lambda_Aurigae> well, as the USI does not have SS functionality, it shouldn't be needed.
[06:04:04] <superware> sorry, a sec
[06:07:39] <superware> sorry, please see http://pastebin.com/03FMBh0U
[06:09:25] <superware> Lambda_Aurigae: well, sometimes the master is only getting 0x000000 and sometimes 0x112233, unclear when exactly but it seems like a timing thing.
[06:18:11] <Lambda_Aurigae> superware, sorry but it looks ok to me other than you are ORing things into the USICR where the datasheet shows writing the whole byte in without an OR.
[06:18:38] <superware> oh
[06:18:44] <Lambda_Aurigae> page 111 of the datasheet.
[06:18:56] <Lambda_Aurigae> it's all in assembly, no C source, but,,,
[06:19:05] <Lambda_Aurigae> I don't know if it will make a difference though.
[06:19:21] <superware> and USISR |= _BV(USIOIF) vs. USISR = _BV(USIOIF) ??
[06:19:30] <Lambda_Aurigae> but you might not be forcing certain bits to 0.
[06:20:00] <Lambda_Aurigae> look at the code in the datasheet.
[06:20:05] <Lambda_Aurigae> it's rather simple.
[06:21:19] <superware> it sometimes work and sometimes doesn't (after I resets, if either works or doesn't)
[06:46:57] <superware> Lambda_Aurigae: any idea? :|
[06:47:12] <Lambda_Aurigae> no clue.
[06:47:23] <Lambda_Aurigae> as I said earlier, I've never used the USI on those chips.
[06:47:42] <superware> ok, thanks. anyone with USI experience?
[06:48:03] <Lambda_Aurigae> you might want to implement some kind of hardware reset/SS line.
[06:48:07] <superware> though I don't know if it's USI related, since I am getting data sometimes
[06:48:42] <Lambda_Aurigae> the USI doesn't have any SS implementation but you could still do it in software with a separate line.
[06:49:10] <superware> can I uset the RESET pin in the attiny85 slave for this?
[06:49:11] <Lambda_Aurigae> run an extra wire between the chips and just toggle it once before starting spi comms....
[06:49:32] <Lambda_Aurigae> I suppose you could....
[06:49:41] <Lambda_Aurigae> you can turn the reset pin into an i/o pin too
[06:49:46] <superware> and still reset the chip.. :)
[06:49:58] <Lambda_Aurigae> but that will require a high voltage serial programmer to reprogram it.
[06:50:54] <superware> yeah, I guess the chip will be in "reset" if I take it low at startup, before program execution, right?
[06:51:06] <Lambda_Aurigae> have you considered or tried using TWI mode?
[06:51:35] <superware> I need the communication to be done without interrupts, is it possible with TWI?
[06:51:37] <Lambda_Aurigae> that seems more robust than the SPI implementation.
[06:52:15] <Lambda_Aurigae> sure it is.
[06:53:22] <superware> but the slave will need internal clock right?
[06:54:22] <Lambda_Aurigae> it is going to need a clock source of some kind no matter what....I am guessing you are already running on the internal RC oscillator.
[06:55:06] <superware> yep
[06:55:37] <Lambda_Aurigae> http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=51467
[06:55:37] <superware> seems too complex for me :) https://code.google.com/p/codalyze/source/browse/cyz_rgb/trunk/usiTwi/usiTwiSlave.c
[06:58:22] <Lambda_Aurigae> I'm looking for some simpler code for you.
[06:58:34] <Lambda_Aurigae> I wish they would just put real spi and twi hardware on those chips.
[07:00:32] <superware> thanks for helping out
[07:04:06] <Lambda_Aurigae> every one I'm seeing is using interrupts.
[07:04:47] <Lambda_Aurigae> http://d-tools.cvs.sourceforge.net/d-tools/dtools-avr-code/attiny45-slaves/
[07:07:32] <superware> the counter overflow interrupt is huge :)
[07:07:40] <Lambda_Aurigae> yup.
[07:07:45] <superware> I think I'll stay with SPI
[07:08:00] <superware> but it seems difficult to get them synced
[07:08:23] <Lambda_Aurigae> looks so with the USI...you need some kind of extra sync line.
[07:09:05] <Lambda_Aurigae> http://jaxcoder.com/Projects.aspx?id=280385176
[07:09:12] <Lambda_Aurigae> some code to play with for spi mode.
[07:09:39] <Lambda_Aurigae> although, it does use interrupts too.
[07:10:26] <superware> ISR(USI_OVERFLOW_vect) yeah
[07:11:19] <Lambda_Aurigae> again, USI in SPI mode is not exactly robust.
[07:11:44] <Lambda_Aurigae> are you needing full 2 way comms?
[07:11:53] <Lambda_Aurigae> or just a trigger and have the slave send data back?
[07:12:59] <superware> I need to send a command (query or reset) to the slave, and get 3 bytes back
[07:13:06] <Lambda_Aurigae> you could use one line from the master to the slave to trigger comms...then 2 other lines for clock and data and just send data back manually without the overhead.
[07:13:41] <superware> isn't this SPI with two-wires?
[07:14:00] <Lambda_Aurigae> it's one way spi,,,
[07:14:16] <superware> you mean half-duplex?
[07:15:12] <Lambda_Aurigae> yeah.
[07:15:28] <Lambda_Aurigae> and, from what I'm seeing, other people are having your problem with the USI in SPI mode.
[07:16:12] <Lambda_Aurigae> http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=27396
[07:16:41] <Lambda_Aurigae> one solution....it's all in assembly and uses interrupt routine...but down toward the bottom they explain why it's getting out of sync and how to fix it, kindasorta.
[07:19:18] <superware> SPI mode 0 and 1?
[07:20:58] <superware> I've tried adding USISR = _BV(USIOIF); just before cmd = spi_transfer(0); to reset any partial transfers, but no luck
[07:21:03] <Lambda_Aurigae> umm...dunno..I would just do it in software.
[07:46:01] <superware> Lambda_Aurigae: attiny85 datasheet states "The USI three-wire mode is compliant to the Serial Peripheral Interface (SPI) mode 0 and 1, but does not have the slave select (SS) pin functionality" and it shows the timing-diagram (figure 15-3, page 110), but since the clock is only coming from the master, I still can't understand how can the bits (cycles) themselves can be in sync? bit0-bit0, bit1-bit1
[07:46:01] <superware> etc..
[08:32:07] <superware> is it possible to programmatically set the RESET pin as I/O pin?
[08:35:47] <gchristensen> superware: what mcu?
[08:39:52] <gchristensen> superware: looks like there is a "RSTDISBL" fuse bit which lets you do that. but from software, I'm not sure. you might be able to add another AVR which is able to twiddle its fuses :)
[08:40:48] <superware> ATtiny85
[08:43:07] <jacekowski> once you set RSTDISBL you can't program it anymore
[08:43:21] <jacekowski> as in, only HVP will work
[08:44:41] <gchristensen> well that's good to know
[10:49:04] <Santh> Hi, I’ve got a strange problem with an ATtiny4313, a software detection of a pushed button works, but not with an interrupt… (INT0) I’ve triple checked my code, the button is on the right pin, anyone has ever seen a bug like this ? http://pastebin.com/6nRYeftF
[12:29:59] <filterbox> is there any way to program and ATxmega32A4U through the DPI interface using another arduino? I googled and it looks like some people were talking about it but I havent seen anything actually posted, or finished and shown working. in theory it should just be two 220ohm resistors connected to RX TX -> PDI (atxmega side) and then just implemented in software right?
[12:30:32] <Lambda_Aurigae> in theory, yeah.
[12:51:31] <Lambda_Aurigae> pdi doesn't seem to be a complex protocol as programming protocols go.
[13:23:13] <R0b0t1> So.
[13:23:15] <R0b0t1> I have an avr.
[13:23:25] <R0b0t1> I load a program to this avr, with avrispmkII. The program runs.
[13:23:32] <R0b0t1> And then, just as suddenly, after about 30s it stops.
[13:25:18] <Jordan_U> R0b0t1: What is the program?
[13:26:26] <R0b0t1> Well, I realized it might be the watchdog. Sec.
[13:26:33] <R0b0t1> (even though it shouldn't be enabled, hrmm)
[13:29:25] <R0b0t1> Nope, not the wdt it would seem.
[13:29:27] <R0b0t1> Jordan_U: http://bpaste.net/show/VSPABbjTO1Jyzrz214UX/
[13:30:13] <R0b0t1> oh heh maybe it was the isp
[13:30:32] <R0b0t1> nope
[13:31:20] <Jordan_U> R0b0t1: And you're testing if it halted by checking for "ack" from serial?
[13:34:42] <R0b0t1> I am now, yes.
[13:36:31] <R0b0t1> Hm, I guess that was it. I'll have to look into why it's not working.
[13:36:59] <Jordan_U> What was it?
[13:37:39] <R0b0t1> The serial port. Guess I asked to soon, that was on my check list
[13:41:27] <R0b0t1> Still not sure why the arduino libs aren't init'ing it properly
[13:49:08] <Lambda_Aurigae> gotta love arduino libs...not.
[14:34:03] <BusError_> ERROR - could not open /sys/class/gpio/export/r/n");
[14:50:43] <R0b0t1> Lambda_Aurigae: ikr
[14:50:53] <R0b0t1> don't have time to port this thing
[14:51:24] <Lambda_Aurigae> internal kiloohm resistor?
[14:51:31] <R0b0t1> so if anybody is here, what else should I be looking at in the programming process? I have an unresponsive bootloader.
[14:51:52] <R0b0t1> fuses, clock, watchdog(?), uh
[14:52:29] <R0b0t1> I think the peripheral registers are "sticky" (sometimes) and maybe the ones I got to work are a minefield and it all goes back to the nonfunctional serial code
[14:52:30] <R0b0t1> idk
[14:52:35] <Lambda_Aurigae> no clue what the bootloader is so no way to know.
[14:53:20] <R0b0t1> http://bpaste.net/show/aB46khyXfgosXMM61mWf/
[14:55:21] <Lambda_Aurigae> time to put some LEDs on and some blinky code to see what is going on.
[14:56:19] <guanche> what's your mcu R0b0t1?
[14:56:50] <guanche> the first thing I would do is unit-testing on the serial connection
[14:57:20] <guanche> would disable the watchdog also, until everything works, and see what's wrong with it
[14:57:51] <R0b0t1> guanche: atmega644p.
[14:57:55] <R0b0t1> well yeah it is disabled
[14:58:01] <R0b0t1> I had to rule out shenanigans.
[14:58:18] <guanche> can you comunicate properly through serial?
[14:58:41] <R0b0t1> No. Working on that bit.
[14:59:01] <R0b0t1> But I tried to phrase the question to catch things that would happen before port configuration.
[14:59:12] <guanche> it shouldn't take you much to leave that working
[15:00:08] <guanche> what I'm missing is the tx line put as output
[15:00:30] <R0b0t1> herpaderpaderp
[15:00:34] * R0b0t1 checks
[15:00:37] <guanche> when the chip powers up, all port pins default to input
[15:02:14] <R0b0t1> I know. I didn't catch it because this same code works on what is, essentially, the same setup.
[15:02:18] <R0b0t1> I'm trying to spot the difference.
[15:03:50] <R0b0t1> You'd also think Serial.begin() would set pinmode.
[15:05:15] <guanche> are you using an usb to ttl adapter or a max232?
[15:05:20] <R0b0t1> ASDJFKWEJFAKSDJF what.
[15:05:25] <R0b0t1> ftdi232, so usb
[15:05:46] <guanche> never used ftdi, try first not setting it as output
[15:06:03] <R0b0t1> It doesn't work either way.
[15:06:07] <R0b0t1> ...
[15:06:12] * R0b0t1 checks board schematic
[15:06:31] <guanche> oh, then chances are you're not setting up the peripheral properly
[15:07:27] <guanche> that's whay I said unit-testing, with any tutorial on the internet you might be able to copy, paste, and flash, and see it working
[15:13:22] * R0b0t1 double checks something...
[15:13:35] <R0b0t1> Yeah I'm doing unit tests
[15:13:38] <R0b0t1> I think
[15:13:40] <R0b0t1> the board guy
[15:13:46] <R0b0t1> did not fix the flipped rx and tx
[15:13:49] <R0b0t1> AHA
[15:13:53] * R0b0t1 goes to beat him over the head
[15:14:34] <guanche> hehe, I use to print "hello\r\n" or something like that at first while I open minicom or other
[15:14:57] <guanche> the try until I see the text on the screen
[15:15:37] <guanche> I mean, in a loop, each half a second or so
[15:15:58] <R0b0t1> that's what I was doing, basically, I asked in here once I was at a complete loss
[15:16:15] <R0b0t1> i.e. my unit tests were failing for no descernable reason
[15:16:29] <R0b0t1> the hardware guy has received a good thumping
[15:17:08] <guanche> sometimes, when I forget and haven't got my code arround, just paste and flash some tutorial from the internet, and then twist the wires until it's working
[15:18:22] <guanche> I more or less remeber everything, but as I'm not 24-7 around atmegas, and also use stm32, etc
[15:27:58] <R0b0t1> GUANCHE NO
[15:47:16] <Daulity> hmm just had a creazy idea about making a locig analizer
[15:47:20] <Daulity> logic
[15:47:33] <Tom_itx> just buy one
[15:48:35] <Daulity> Tom_itx: i have one
[15:48:45] <Tom_itx> why make one then?
[15:48:48] <Daulity> for fun
[15:48:52] <Tom_itx> i have a saleae and love it
[15:48:55] <Daulity> don't you understand :)
[15:48:59] <Daulity> Tom_itx: same
[15:49:03] <Daulity> that thing is awesome
[16:25:27] <chupas> anyone know of a tool to search for compatable AVRs (or any micro) by pin description
[16:43:53] <Jordan_U> chupas: For the subset of automotive rated controls (which for me is perfect, for you maybe less so) there is http://www.atmel.com/products/automotive/automotive_microcontrollers/default.aspx?tab=parameters
[18:15:54] <sirpatrick> I am writing a library for a thermocouple and am trying to figure out the best way to let the user of my library know that the error bit in the SPI response from the device has been set.
[18:16:08] <sirpatrick> is there a best practice for this?
[18:17:33] <sabesto> return value
[18:17:41] <sirpatrick> I was thinking of possibly just returning 0. So when someone uses my library they can just do a a check to make sure it isn't 0
[18:17:56] <sabesto> returning 0 means success
[18:17:59] <sirpatrick> duh
[18:18:26] <sirpatrick> well the function regularly returns int32_t
[18:21:25] <sirpatrick> I guess my method could take a reference of the returned value to be parsed
[18:21:27] <sabesto> you can return that value by passing a pointer to the function
[18:21:39] <sirpatrick> our minds are in sync lol
[18:21:50] <sabesto> then the return function of the function can be success/error
[18:21:54] <sirpatrick> yup
[19:27:26] <clixxIO_> www.tokyohackerspace.org
[19:27:44] <clixxIO_> I'm doing a talk on Internet-of-Things on the Attiny85
[19:33:48] <Lambda_Aurigae> gotta love buzzword bingo.
[19:34:52] <hotch> very nice clixxIO_ : i’ve heard good things about the tokyo hackerspace
[19:35:47] <clixxIO_> They're nice people. They've had a good run of success on hackaday.com with projects too
[19:37:47] <Casper> clixxIO_: congrat to not have said arduino :D
[19:38:06] <hotch> ha
[19:38:23] <clixxIO_> Thanks - well I have my own little Event-Framework
[19:38:32] <Tom_itx> may have saved getting banned
[19:38:47] <clixxIO_> so I don't really need any Arduino software at all
[19:39:26] <clixxIO_> https://github.com/clixx-io/clixx.io/tree/master/eventframework
[19:40:16] <clixxIO_> Arduino only have loop(), but I have loop(), time(), pinchange(), serial() and iotmessage()
[19:42:04] <sirpatrick> clixxIO that's really cool!
[19:42:14] <clixxIO_> Thanks
[19:43:22] <clixxIO_> plus, with Arduino, you can't write on Linux and Windows
[19:44:01] <clixxIO_> whereas with this EventFramework, you can test code on Linux/your-desktop/laptop
[19:45:36] <jadew> I didn't catch the discussion since the beginning, but I think having frameworks for such tiny devices is silly
[19:46:38] <jadew> most of the time it adds unnecesary overhead and the ammount of time it saves is insignificant, unless you're doing something really basic that doesn't matter anyway
[19:46:45] <clixxIO_> It's not really a framework, but an event Framework
[19:47:06] <clixxIO_> Actually, not so.
[19:47:48] <clixxIO_> What this does is make it easier to access hardware interrupts, timers, serial ports, looping all which a hacks to standard C
[19:48:21] <clixxIO_> It's about code readability and removing 20 years of C hardware hacks
[19:49:15] <clixxIO_> ie everything you "need" in C is a hack, serial-ports, timers, interrupts, even 'main()'
[19:49:27] <jadew> what do you mean hack?
[19:49:42] <clixxIO_> a hack to get something to work
[19:50:09] <clixxIO_> that the compiler/language wasn't design to handle. But are the basics of computing
[19:50:42] <clixxIO_> is a serial-port a basic part of a computer? or a GPIO pin? or a timer?
[19:51:01] <clixxIO_> imo they are
[20:27:23] <jadew> sorry, had to go afk for a while
[20:27:34] <jadew> they are and they are exposed via registers since the begining of time
[20:27:55] <jadew> and languages are designed to work with that
[20:28:34] <clixxIO_> I agree with that
[20:29:18] <jadew> you can even map them to structures, so you get more natural access to them
[20:29:19] <clixxIO_> however, pin interrupts are implemented with a callback, which usually goes outside main(), when in fact, logically, they should go inside main()
[20:29:32] <jadew> well, no
[20:29:52] <jadew> by definition an interrupt interrupts the execution of the current process
[20:30:16] <clixxIO_> right, so it should be close to the code that it is interrupting
[20:30:24] <jadew> no
[20:30:32] <LoRez> no, it jumps to the new code
[20:30:46] <clixxIO_> then back
[20:31:02] <jadew> yes, but the point is that it freezes whatever is going on at that point
[20:31:05] <jadew> emphasis on whatever
[20:31:11] <jadew> as in "it doesn't care"
[20:31:14] <clixxIO_> so you end up with a program where the execution is all over the place
[20:31:22] <LoRez> so?
[20:31:31] <clixxIO_> that's not clear
[20:31:37] <jadew> of course it is
[20:31:38] <clixxIO_> or easily readable
[20:31:45] <jadew> you just organize your stuff better
[20:31:46] <LoRez> jumping into the middle of main() for an ISR isn't clear.
[20:31:53] <jadew> I agree
[20:33:15] <clixxIO_> I'm trying to organise it better. That's what my event-framework is for
[20:33:37] <clixxIO_> it can take some time debugging ISR's in the real world
[20:33:53] <clixxIO_> in complex environments
[20:34:04] <clixxIO_> they're not trivial to get working correctly
[20:34:06] <jadew> you're overcomplicating something that doesn't need to be
[20:34:19] <jadew> sure they are, ISRs are not that big of a deal
[20:34:35] <LoRez> event frameworks can be useful. I used my ISRs to poke events into mine.
[20:35:05] <jadew> like a message queue?
[20:35:26] <clixxIO_> Here's an example of a pin change program : https://github.com/clixx-io/clixx.io/blob/master/examples_eventframework/interrupt.cpp
[20:35:58] <jadew> are you comming from a c# background?
[20:36:32] <clixxIO_> Originally C then C++ then Python, now back to C++.
[20:36:34] <jadew> clixxIO_, that's very pretty and all, but 1) the entire code has to be in one file
[20:36:47] <clixxIO_> why?
[20:37:01] <jadew> because you can't have partial classes
[20:37:40] <jadew> which means the entire App class needs to be defined in there
[20:38:36] <jadew> and 2) you're adding more overhead to already slow devices
[20:39:27] <jadew> actually I guess you could declare it all and implement it separately
[20:40:06] <clixxIO_> what's an example of a partial class? not-following
[20:40:34] <jadew> however, if you do that, you're defeating the purpose
[20:40:41] <clixxIO_> what would be an example ?
[20:40:52] <jadew> a partial class is when you declare part of a class here
[20:40:59] <jadew> part of the same class in some other file
[20:41:47] <jadew> c++ needs a complete declaration
[20:42:08] <jadew> so when the code will get bigger, you'll have to define that class in some header file, the entire file
[20:42:17] <jadew> and then implement whatever pieces you have in whatever files
[20:42:33] <jadew> basically ending up with the same thing you were running from, only more obfuscated
[20:43:18] <clixxIO_> is this possible on small processors?
[20:43:35] <jadew> the processor doesn't matter, it's a compiler thing
[20:44:39] <jadew> clixxIO_, answer me this: what will you do when your program is 10k lines of code?
[20:46:00] <clixxIO_> jadew: The App class should never grow so big. Other user classes would be added but I can't see how having other big user classes would cause any problems
[20:46:58] <clixxIO_> for example, Qt is a huge framework. But user programs that pull that in aren't overly difficult to manage
[20:47:29] <jadew> clixxIO_, what if you need the functionality of an ISR from a user class?
[20:48:12] <clixxIO_> declare the class as an object within the App class.
[20:48:51] <clixxIO_> jadew: give an example of a user-class name
[20:49:02] <jadew> pipe
[20:49:50] <clixxIO_> well declare an instance of pipe within the App class
[20:50:00] <jadew> what does that solve?
[20:50:56] <clixxIO_> the App class is only an entry point for the program. It doesn't do away with classes or the ability to have huge and complex class structures
[20:50:57] <jadew> first of all, let me ask you something
[20:50:59] <jadew> why OO?
[20:51:30] <clixxIO_> OO can hide the complexity of the hardware, and give a good degree of platform independance
[20:52:08] <clixxIO_> so change the Makefile, and the program can run on entirely different hardware platform
[20:52:26] <jadew> can do the same with any library that was made to work like that
[20:52:30] <jadew> OO or not it doesn't matter
[20:52:54] <jadew> the reason I asked about the user class needing the ISR is because it goes against OO principles
[20:53:27] <jadew> and... your thing seems to be OOP
[20:54:03] <clixxIO_> ISR's are implemented differently on different compilers. So I don't agree that an 'any library' solution can make code portable
[20:55:20] <clixxIO_> OO is all about signals and interfaces and an ISR simply generates a signal
[20:55:26] <jadew> clixxIO_, you make portable OO code just as you do non OO code
[20:55:33] <jadew> I don't want to piss you off or anything, but if you're going to work on that thing, think honestly about the advantages you get from it
[20:55:49] <jadew> in the end it might complicate things more than you need
[20:56:01] <LoRez> jadew: he obviously thinks it will offer some advantages
[20:56:12] <jadew> OO is not about signals and interfaces
[20:56:35] <jadew> OO is about how the thing runs and how data is organized
[20:56:40] <clixxIO_> I think it is, OO is about hiding complexity
[20:56:47] <jadew> generally speaking lower level OO objects shouldn't rely on higher level ones
[20:57:31] <clixxIO_> well, this is just my experimental idea
[20:57:59] <jadew> yeah, if you think it's going somewhere, don't mind me, or anyone else for that matter
[20:58:16] <jadew> but I think you'd be better off with a list of smart macros
[20:58:28] <clixxIO_> jadew: The questions are good.
[20:58:35] <clixxIO_> I appreciate them
[20:59:01] <clixxIO_> I'll have to answer them to other people as well
[20:59:52] <jadew> let me tell you what's the biggest disadvantage of that approach (keep in mind I'm a c++ fanboy)
[20:59:53] <clixxIO_> macro's won't do it. I'm personally sold on the callback idea
[21:00:03] <clixxIO_> shoot
[21:00:04] <jadew> the OO is the biggest disadvantage
[21:00:21] <jadew> because AVRs are usually super small
[21:00:22] <clixxIO_> I see OO as being the biggest advantage
[21:00:24] <jadew> with shit for memory
[21:01:14] <jadew> when your object eats up 4 bytes and pushes "this" to the stack for every call, that's an issue
[21:01:15] <clixxIO_> C++ doesn't have to be huge
[21:01:43] <jadew> it doesn't, but considering the limitations of AVR devices, OOP is usually a luxury
[21:02:11] <clixxIO_> I'm happy to live in luxury for a while :-)
[21:02:26] <jadew> I suppose it depends on what your target devices are
[21:02:40] <clixxIO_> The target devices are Attiny85's
[21:02:55] <jadew> how much sram do those have?
[21:02:58] <jadew> 1k?
[21:03:16] <clixxIO_> about that
[21:03:26] <clixxIO_> (it's a lot)
[21:03:29] <jadew> 512
[21:03:32] <Lambda_Aurigae> I have yet to find, for me anyhow, any advantage to an OO language.
[21:03:47] <Lambda_Aurigae> on microcontrollers or full blown computers.
[21:03:49] <jadew> Lambda_Aurigae, there are tons of advantages
[21:04:07] <Lambda_Aurigae> oh, i'm sure there are. Just none that I've found in my programming experiences.
[21:04:10] <jadew> you can do a lot of crazy stuff when OOP is involved
[21:04:43] <clixxIO_> good stuff too
[21:04:54] <clixxIO_> the typical application here is home automation
[21:04:57] <jadew> I meant good stuff :P
[21:04:57] <Lambda_Aurigae> the only thing I've ever seen that would have any kind of advantage far as I can tell is the limiting of access to variables to certain sections.
[21:05:27] <jadew> that's just a perk
[21:05:39] <clixxIO_> One can't be expected to spend two weeks on making some sort of controller that should be possible to make in two-hours
[21:06:11] <clixxIO_> So OO and C++ cut down the programming complexity
[21:06:53] <clixxIO_> cmon.. avr-gcc and make are too hard to make an IoT switch
[21:07:13] <clixxIO_> and figuring out PB4 and so on
[21:07:14] <Lambda_Aurigae> when I was the IT guy for a software development company I often wrote things for the crew in C in an hour or two that they were having trouble making in their OO languages they were working on....mostly I think they were stuck not being able to think outside the OO things and their Java and C#
[21:07:58] <clixxIO_> Sure. But you are super clever
[21:08:20] <clixxIO_> and there's obviously lots of people these days that only think in C# and Java
[21:08:49] <clixxIO_> that's the way it is now
[21:08:56] <Lambda_Aurigae> I don't see how using C++ to make an "IoT" switch would be any easier than doing it in C.
[21:09:50] <jadew> app.on(); rather than PORB |= 1 << 3;
[21:10:03] <Lambda_Aurigae> having never had a programming class beyond basic and pascal in highschool, I have never learned the advantages I guess.
[21:10:14] <Lambda_Aurigae> does C++ have app.on() built in?
[21:10:18] <Lambda_Aurigae> or do you have to write it?
[21:10:25] <jadew> and void app.on() { pins.out(3, 1); }
[21:10:44] <clixxIO_> jadew: right
[21:10:48] <jadew> Lambda_Aurigae, you have to write it
[21:10:59] <Jordan_U> jadew: That benefit is, IMHO, much more because it was made into a function rather rather than doing bit manipulation directly.
[21:11:17] <Lambda_Aurigae> or void appon() { PORTB |= 1<<3;}
[21:11:26] <jadew> Jordan_U, that's an advantage only if you're super lazy
[21:11:35] <jadew> otherwise it's called overhead
[21:11:36] <Lambda_Aurigae> you can do functions in C as well as C++
[21:11:43] <clixxIO_> It's more readable though.
[21:11:50] <jadew> still overhead
[21:11:50] <Lambda_Aurigae> how?
[21:12:03] <jadew> as I said earlier, want cleaner stuff, make some macros
[21:12:08] <Lambda_Aurigae> yeah.
[21:12:12] <Lambda_Aurigae> macros are awesome.
[21:12:48] <Lambda_Aurigae> so far, nothing special in C++ far as I can see....
[21:12:56] <clixxIO_> It would still be possible to have the main App() as a C++ class, then all callbacks going to C functions
[21:13:29] <jadew> clixxIO_, of course, but I'd deffinitely wouldn't do bit manipulation via a proxy function
[21:13:45] <jadew> that stuff is supposed to take 1 tick
[21:14:02] <jadew> why make it it into a 16 - 20 clock cycles thing?
[21:14:33] <jadew> just think about the performance impact it has once you start working on something other than a blinky
[21:14:47] <clixxIO_> ah - I might have missed the macro thing. So you're saying use a macro to get the one instruction output target
[21:14:56] <jadew> precisely
[21:15:11] <clixxIO_> yeah, good idea
[21:15:22] <Lambda_Aurigae> bingo...if you make it a function in a class you are building up all kinds of junk unless the compiler can optimize it away.
[21:15:48] <clixxIO_> making perfect sense
[21:16:25] <Lambda_Aurigae> the kind of thing we learned when a full fledged computer only had 8K of ram for program and data and ran at 1MHz.
[21:17:04] <clixxIO_> I was there, so it's not foreign. I don't consider that Attiny85 as tiny
[21:17:05] <Lambda_Aurigae> and could still run games like Elite!!!
[21:17:05] <jadew> well, I've learned this stuff on a 50 MHz pc :P
[21:17:36] <Lambda_Aurigae> I learned programming on TRS-80, Apple-II, and Vic-20
[21:17:53] <clixxIO_> same
[21:18:03] <clixxIO_> same era
[21:18:07] <jadew> me on Z80
[21:18:11] <Lambda_Aurigae> my first computer being the vic-20 that is sitting in my basement and works still today.
[21:18:28] <clixxIO_> I still have the official Z80 programming book, Assembler of course
[21:18:40] <jadew> but didn't get into ASM until my first 486
[21:19:10] <Lambda_Aurigae> I taught myself basic and 6502 assembler then took pascal class in highschool.
[21:19:28] <clixxIO_> I sortof stopped assembler on the 386. Going to 4GB RAM was too mind blowing
[21:19:55] <jadew> I took BASIC classes in the 2nd grade and been self thought ever since
[21:19:56] <clixxIO_> the memory architecture of the '386 was wtf
[21:19:57] <Lambda_Aurigae> then had a guy from Sandia National Labs who was working on a project I was involved with give me his extra copy of K&R Teach Yourself C.
[21:21:33] <Lambda_Aurigae> Sun 3/260 workstations, in 1998, running 21inch 256 color monitors with optical mice at the office..and a full GUI environment called Suntools on top of Unix.
[21:21:44] <Lambda_Aurigae> god I miss those machines!
[21:22:02] <Lambda_Aurigae> and had my amiga at home with a pirated C compiler shortly after that.
[21:22:40] <jadew> I've learned Pascal and C++ from the help files of the compilers
[21:22:44] <Lambda_Aurigae> the microcontrollers I work with today are faster than those machines...hehe
[21:23:17] <jadew> I used to think I can do anything in pascal lol
[21:23:31] <Lambda_Aurigae> jadew, yeah...pascal in the early days rocked.
[21:23:53] <Lambda_Aurigae> as did fortran...for math intensive things FORTRAN was GOD.
[21:23:56] <jadew> I thought it will be my main language for ever
[21:24:08] <jadew> now I don't even remember how to define a variable
[21:24:14] <Lambda_Aurigae> I still have a book full of orbital tracking programs I wrote in FORTRAN back in the late 80s.
[21:24:15] <jadew> var i : integer;
[21:24:16] <jadew> ?
[21:24:52] <Lambda_Aurigae> I really should scan those things in and see if I can remember how they work.
[21:25:04] <Tom_itx> i still have turbo pascal here somewhere...
[21:25:06] <Lambda_Aurigae> scan and OCR..
[21:25:22] <jadew> Tom_itx, I still have the machine on which I learned Pascal, with turbo pascal on it :P
[21:25:37] <jadew> it's behind me
[21:25:54] <jadew> and the original IBM-M keyboard that I used for so many years
[21:26:12] <Lambda_Aurigae> click click click
[21:26:27] <jadew> pretty much
[21:26:41] <jadew> it's amazing how far mechanical switches have come
[21:26:51] <clixxIO_> I'm also a Turbo Pascal person
[21:26:52] <Tom_itx> i got one of those old kbds still
[21:26:54] <Lambda_Aurigae> it's amazing how far electronics in general have come.
[21:26:56] * jadew is typing on cherry browns now
[21:26:58] <Tom_itx> not IBM but similar
[21:27:00] <clixxIO_> I had Pascal on my first Z80
[21:27:02] <Tom_itx> actually 2
[21:27:08] <Tom_itx> still using it
[21:27:23] <Tom_itx> had to reseat the chips in their sockets on it once
[21:27:25] <jadew> Tom_itx, I have 2 IBM Ms, one was a gift from a friend (got it this year for my birthday)
[21:27:26] <Lambda_Aurigae> I should see if I can find commodore CPM for my c-128
[21:27:38] <jadew> he found it in bad shape and reconditioned it for me
[21:27:46] <Lambda_Aurigae> I like the old M keyboards but wifey doesn't.
[21:28:17] <Lambda_Aurigae> sitting here in my recliner with the keyboard in my lap, mouse on the arm of the chair, monitor on a swing arm in front of me....right next to the wife.
[21:28:18] <jadew> Lambda_Aurigae, same here, which is why I have a quiet keyboard now
[21:28:23] <Lambda_Aurigae> it interferes with her tv.
[21:28:29] <jadew> (I've been on a quest for a good keyboard for years)
[21:28:30] <clixxIO_> last night my wifey was having keyboard problems - the Anthy (Japanese) wasn't working
[21:28:59] <Lambda_Aurigae> cheap 10 dollar wireless Hip Street keyboard seems to work here for now.
[21:29:07] <Lambda_Aurigae> batteries last me 6 months or so.
[21:29:27] <Lambda_Aurigae> was on the clearance shelf at Theisens farm store of all places.
[21:29:36] <Tom_itx> still have an old dos box around too
[21:29:44] <jadew> I hate cheap keyboards, I code a lot and when stuff isn't working properly, that's the last thing you need, a shitty keyboard that doesn't register keys
[21:30:00] <jadew> I've smashed several keyboards in rage
[21:30:11] <clixxIO_> also the switches on cheaper keyboards bottom-out harder
[21:30:23] <clixxIO_> not good for the fingers imo
[21:30:44] <Lambda_Aurigae> Tom_itx, same here...I keep lots of old computers around...a real XT with 10MB hardcard and single floppy drive...286...386...486dx-50...amd K6-2...
[21:30:52] <jadew> clixxIO_, come on.. I don't think you'll get injury from typing :P
[21:31:01] <Lambda_Aurigae> jadew, you can actually.
[21:31:25] <Lambda_Aurigae> although usually it's bad posture while typing rather than the keys not pressing right.
[21:31:32] <clixxIO_> I get sore fingers dude.
[21:31:53] <jadew> I never had any issues like that and I've been typing every day for the past.. many years
[21:32:01] <clixxIO_> and my right hand is mouse-busted, had to swap to left mouse
[21:32:10] <jadew> and I type A LOT (I'm a programmer
[21:32:11] <jadew> )
[21:32:35] <clixxIO_> you flow sentences over
[21:32:39] <jadew> clixxIO_, usually when the mouse is on the left side, it indicates that the person using it has recently masturbated :P
[21:32:44] <clixxIO_> to the next line so yes you
[21:32:47] <clixxIO_> must be
[21:33:05] <Lambda_Aurigae> jadew, or is left handed.
[21:33:18] <clixxIO_> jadew: never thought of it like that
[21:34:17] <jadew> clixxIO_, first rule of masturbation: always close the browser/folders/vide players and put everything back, before you go to clean yourself
[21:34:24] <jadew> *video
[21:35:12] <clixxIO_> I leave everything open for my wife to see
[21:35:22] <clixxIO_> umm.. maybe not
[21:37:02] <clixxIO_> The days of dial up BBS's weren't better
[21:37:14] <jadew> BBS?
[21:37:20] <Lambda_Aurigae> bulletin board system
[21:37:26] <Lambda_Aurigae> pre-internet
[21:37:27] <clixxIO_> but I did find character-only displays better for programming concentration
[21:37:28] <jadew> ah
[21:37:35] <jadew> how was porn back then?
[21:37:46] <Lambda_Aurigae> 16 colors...256 colors in later days!
[21:38:00] <clixxIO_> and about 300x200 picture size
[21:38:08] <jadew> 320x200
[21:38:10] <Lambda_Aurigae> 4096 colors in HAM mode if you were on an amiga BBS.
[21:38:19] <clixxIO_> 640x480 if you were lucky
[21:38:20] <jadew> 256 colors, MCGA?
[21:38:29] <Lambda_Aurigae> something like that.
[21:38:37] <Lambda_Aurigae> I was mostly commodore back in those days.
[21:38:47] <Lambda_Aurigae> c-128 and amiga-1000
[21:39:10] <jadew> comodores looked nicer, but the z80 was a much better machine
[21:39:24] <Lambda_Aurigae> the amiga rocked...multi-processor system.
[21:39:25] <jadew> at least that's how I remember it
[21:39:34] <Lambda_Aurigae> and the c-128 had a z80
[21:39:39] <Lambda_Aurigae> and a 6502 derivative.
[21:39:45] <Lambda_Aurigae> could even run cpm
[21:39:53] <jadew> were there earlier versions that sucked?
[21:40:05] <Lambda_Aurigae> c-64 only had the 6510
[21:40:14] <jadew> I remember that the comodores at school were slower than the regular z80 stuff (keyboard only)
[21:40:19] <jadew> ah ha!
[21:40:23] <Lambda_Aurigae> and the vic-20 had the 6502 with only 8k of ram.
[21:40:24] <jadew> that's the ones we had
[21:40:25] <jadew> c64
[21:40:39] <Lambda_Aurigae> schools had a lot of commodore PET machines which were basically a C64
[21:40:53] <Lambda_Aurigae> only a built in mono monitor and different video and audio chip.
[21:41:25] <clixxIO_> I just found a weird python bug - putting a comma turns a string variable into a set
[21:41:32] <Lambda_Aurigae> c128 had a much nicer basic OS
[21:41:36] <jadew> oh man.. I remember my first day of programming
[21:41:42] <clixxIO_> an accidental comma after a variable
[21:42:02] <Lambda_Aurigae> I thought python was a bug.
[21:42:10] <Lambda_Aurigae> :}
[21:42:11] <jadew> I sit next to a colegue and a girl who had previous lessons
[21:42:18] <jadew> and she typed some random garbage on the keyboard
[21:42:24] <jadew> and I was like "wow!!"
[21:42:39] <jadew> "some day I want to type like that too!"
[21:43:04] <Lambda_Aurigae> I have got to get the electronics stuff back out soon. It's been in the basement too long without having random electrons fired through it.
[21:43:58] <Lambda_Aurigae> and school will be out in a month and a half which means kids will be wanting to build robots again soon.
[21:44:14] <jadew> how old?
[21:44:21] <Lambda_Aurigae> 12ish to 18ish
[21:44:25] <jadew> nice
[21:44:26] <Lambda_Aurigae> middle school through highschool.
[21:44:37] <jadew> mine is just learning to walk
[21:44:38] <clixxIO_> The robot stuff is all new
[21:44:45] <Lambda_Aurigae> not my kids.
[21:44:50] <jadew> ah
[21:44:53] <clixxIO_> I go to the Uni to help the students out with robot making
[21:44:54] <Lambda_Aurigae> don't have any of my own.
[21:45:01] <jadew> got it
[21:45:15] <Lambda_Aurigae> but I do electronics and microcontrollers and robotics teaching thing with 4H and scouts
[21:45:42] <Lambda_Aurigae> help them with their badges and things.
[21:46:03] <jadew> neat, where do you live?
[21:46:12] <jadew> (country)
[21:46:13] <Lambda_Aurigae> and recently learned that the local highschool here has a 3D printer and kids are teaching the teachers how to teach 3D modelling and 3D printing.
[21:46:23] <Lambda_Aurigae> USA, Iowa, 3rd cornfield to the left.
[21:46:29] <jadew> haha
[21:46:43] <Lambda_Aurigae> the cornfield thing isn't far off.
[21:47:01] <Lambda_Aurigae> I have chickens and ducks running around my yard and cornfield on 2 sides of my property.
[21:47:02] <jadew> I'd love to live on a farm
[21:47:16] <Lambda_Aurigae> it is a lot of work.
[21:47:30] <jadew> that's fine, I'm SUPER lazy
[21:47:33] <Lambda_Aurigae> and you can't just take a day off when you don't feel well...at least not easily.
[21:47:36] <jadew> so it wouldn't bother me
[21:47:50] <Lambda_Aurigae> the chickens still need to be fed
[21:47:54] <Lambda_Aurigae> eggs need to be collected
[21:48:03] <Lambda_Aurigae> they need to be let out in the morning and locked up at night.
[21:48:40] <clixxIO_> I'm trying to get into the robotics of that
[21:48:57] <clixxIO_> I thnik quadcopters could be good there
[21:49:04] <jadew> Lambda_Aurigae, sounds very... therapeutic
[21:49:14] <clixxIO_> In a previous marriage I had a farm
[21:49:24] <clixxIO_> was nice
[21:49:58] <Valen> Lambda_Aurigae: the missus keeps saying she wants chickens because CHEAP EGGS
[21:50:07] <Valen> I keep saying eggs from the shop are *really* cheap
[21:50:09] <Valen> ;->
[21:50:27] <jadew> lol Valen, good point
[21:51:10] <clixxIO_> My ex-wife was a disaster. The arrival of chickens was the beginning of the end
[21:51:26] <jadew> if I'd live on a farm I'd only have plants someone else would plant and water and whatever and animals I wouldn't need to care about
[21:51:38] <Lambda_Aurigae> in the winter we have to carry water out to the chickens.
[21:51:39] <jadew> clixxIO_, how come?
[21:51:40] <clixxIO_> chickens made noise - violated suburban lease
[21:51:54] <clixxIO_> wife had to buy farm - farm bought
[21:51:57] <jadew> clixxIO_, so you ate them?
[21:52:01] <jadew> ah
[21:52:08] <clixxIO_> 1000km to farm from Sydney every two weeks
[21:52:19] <Valen> wow not awesome
[21:52:20] <jadew> no way
[21:52:25] <clixxIO_> drive to farm 20 times per year - go crazy
[21:52:32] <Lambda_Aurigae> we like living on the farm.
[21:52:38] <jadew> clixxIO_ chickens must have been starving
[21:52:52] <clixxIO_> the chickens were fine
[21:53:16] <Valen> wifey wants horses, so we are looking at getting a place either around marsden park or further north west (bilpin) (we were looking south west around camden but airport = mega noise)
[21:53:20] <clixxIO_> well as dinner
[21:53:35] <Lambda_Aurigae> well, is bedtime here...
[21:53:40] <Valen> should be able to get around 50Ha or so for around $500k if we go a bit further out
[21:53:53] <Valen> then I'm going to build a concrete castle on it ;->
[21:53:59] <clixxIO_> I know Bilpen well
[21:54:14] <Valen> really how is it?
[21:54:43] <Valen> wifey has only streetviewed it, I was planning on heading out there on the weekend just to get a feel for it
[21:54:45] <clixxIO_> It's lovely but there are huge land taxes on larger properties
[21:55:00] <clixxIO_> Bilpen is on the side of the hill
[21:55:27] <clixxIO_> depends if you are on the north or south side of the highway
[21:55:42] <clixxIO_> to the North, it's nice
[21:55:44] <Valen> holy crap lol
[21:55:55] <Valen> just ran a number through the land tax calculator
[21:56:49] <Valen> it really seems an exponential curve there doesnt ityeah over $412,000
[21:57:20] <clixxIO_> that's NSW specific
[21:57:29] <Valen> yeah
[21:57:59] <clixxIO_> so on the right-side (north) there's all these squiggly lanes running everywhere
[21:58:13] <clixxIO_> in a sortof sub-valley
[21:58:19] <Valen> land tax doesn't include the value of the house or improvements does it its just the sale value of the bare land?
[21:58:29] <clixxIO_> I'd say there are some treasures to be had there
[21:59:00] <Valen> yeah I think thats what she was looking at, battleaxe blocks where somebody has sold off the back of their property
[22:00:13] <Valen> lol http://www.osr.nsw.gov.au/taxes/land/about has a youtube video link "Your guide to land tax in NSW"
[22:00:20] <Valen> This video is private.
[22:00:22] <Valen> awesome
[22:02:12] <clixxIO_> That valley stretches for about 20km
[22:02:40] <clixxIO_> don't go too far from the road though, 10minutes of driving is an exta ten minutes on your trip
[22:02:50] <clixxIO_> on every trip*
[22:03:12] <clixxIO_> they are mostly 20km roads because of the windiness
[22:03:55] <Valen> yeah, not too much fun
[22:04:20] <clixxIO_> personally I'd go as close to the great divide as possible. It's a long way from the cliff up to Bilpen
[22:05:08] <clixxIO_> Bilpen is on the verge of being 'far'. But manageable
[22:05:18] <Valen> thats what we were thinking
[22:05:33] <Valen> we'll try and get closer if we can
[22:05:45] <clixxIO_> There's a little suburb right on the top of the cliff
[22:05:47] <Valen> if prices are ok and we have the money we'll go for marsden park or something like that
[22:05:51] <clixxIO_> lot's for sale there
[22:06:12] <clixxIO_> it's opposite the pub, do you know the place I mean?
[22:06:15] <Valen> the long term view is to subdivide it into 1/4 acre blocks when we retire
[22:06:23] <Valen> I've never been out that way
[22:06:32] <Valen> only up the gt western
[22:08:23] <clixxIO_> https://maps.google.com.au/?ll=-33.531084,150.63053&spn=0.004534,0.006051&t=m&z=17
[22:09:09] <Valen> new google maps is kinda crappy
[22:10:24] <Tom_itx> what are the 'class' ratings on SD cards about?
[22:11:18] <Valen> speed
[22:11:29] <Tom_itx> 10 the highest?
[22:11:35] <Valen> class 10 can read/write at a certain speed
[22:11:38] <Valen> roughly
[22:11:59] <Valen> http://en.wikipedia.org/wiki/Secure_Digital#Speed_class_rating
[22:38:46] <clixxIO_> gotta run girls
[22:50:38] <Brittanyan> Hey guys just wondering if I can grab some ideas on something I'm trying to do.
[22:51:00] <Brittanyan> I'm trying to use SPI between my AVR chip and a Raspberry Pi where the Raspberry Pi is sending characters over one at a time.
[22:51:51] <Brittanyan> My problem is that although I can handle it sending one over and echoing it back. I'm not sure how I can sync it all up so it sends one, which then adds to an array in the AVR. then another which adds to the next element in the array and so on.
[22:52:35] <Brittanyan> Does anyone have an idea that I can use so that I can have my AVR on standby until it receives a first character, and then enters a loop where it increments an array and stores each time?
[22:57:09] <tzanger> can you set up a wake on pin change on the SS# pin?
[22:57:44] <Brittanyan> I could do.
[22:57:50] <Brittanyan> I haven't been using that so far given that I only have one slave.
[22:58:16] <tzanger> I don't think the SPI peripheral works in sleep nor can it wake from sleep, but I could be wrong
[22:58:39] <Brittanyan> though that's not really my main issue. given that 'wake' could literally be a value that's not 0 or 255, (which no valid character is)
[22:59:07] <Brittanyan> my issue is having a synchronized stream of characters going from master to slave.
[23:04:01] <tzanger> how is this an issue? SPI is synchronous, it shouldn't be a problem
[23:04:12] <Brittanyan> maybe I'm just not doing it right.
[23:08:48] <tzanger> what is the exact issue you're running in to?
[23:27:24] <Brittanyan> More that I don't really know how to do what I want to do.
[23:27:37] <Brittanyan> I want an array to fill up with characters sent via SPI
[23:50:43] <Gumboot> So I was in here a while back talking about PRNGs and long multiplication and stuff...
[23:52:47] <jadew> and?
[23:53:18] <Gumboot> Had a bit of an idea how to design something that needed only one eight-bit multiply, recently, and did some work around it and came up with something that passes all the randomness tests. Was wondering if it has a place in a standard library somewhere.
[23:54:25] <jadew> 8 bit... so it has a period of what... 10?
[23:54:28] <Gumboot> Actually, I have a handful of variants. I scratched some things out in 8051 assembly (tools were handy and I know it better) and actually the 16-bit multiply version came out in less code because of the memory addressing. I thought maybe that wouldn't be a problem in AVR.
[23:55:00] <Gumboot> jadew: The state can be anywhere between 3 and 40 bytes, with a period to match.
[23:55:16] <Gumboot> It's just that it's light on the arithmetic.
[23:55:23] <jadew> so where is the 8 bit thing?
[23:55:28] <jadew> what exactly is 8 bit?
[23:55:43] <jadew> you mean the multiplication algo is done via 8 bit op codes?
[23:55:44] <Gumboot> The multiplier. 8-bit value times 8-bit value giving 16-bit result. As offered by hardware.
[23:55:56] <jadew> I see
[23:56:08] <Gumboot> Without the need to issue, like, 10 of them to implement a full 32-bit multiplier.
[23:57:05] <jadew> what algo did you use?
[23:57:12] <Gumboot> Multiply-with
[23:57:19] <jadew> * prime % prime?
[23:57:20] <Gumboot> multiply with carry, but with carefully chosen multipliers.
[23:57:32] <jadew> talking about the PRNG
[23:57:48] <Gumboot> http://en.wikipedia.org/wiki/Multiply_with_Carry
[23:58:30] <jadew> interresting
[23:58:58] <Gumboot> And the dieharder battery of tests to validate its randomness.
[23:59:42] <jadew> how accurately can you control the period?
[23:59:59] <Gumboot> Has to be a safe prime, I think.