#avr | Logs for 2014-02-22

Back
[05:29:28] <naftilos76> Hi, what can i do in a mega168 to generate a unique number in every chip with the rand() ?
[05:30:22] <naftilos76> I know i have to seed the rand with unique number which however is difficult because i do not have a rtc or any other source
[05:30:37] <naftilos76> anybody?
[05:31:17] <naftilos76> Is there anything unique for every avr chip?
[05:31:42] <naftilos76> such as an ID or something which i could use as a rand seed value?
[05:32:13] <Roter> interesting question, maybe you could save information into the mcu, and never delete it or something?
[05:32:36] <Roter> also read about eprom, i dont know anything about it, but it seems you can use it to save information
[05:33:46] <naftilos76> One solution is to generate my own but i was thinking about generating a unique number when every chips initialises for the first time, save it in eeprom and never generate it again
[05:34:58] <naftilos76> Generating my own truly unique numbers would need one compilation per chip
[05:38:25] <specing> naftilos76: at bootup do one xor sum pass through the whole address space
[05:39:05] <specing> afaik RAM contents is unspecified at bootup, I/O state depends on external signals (random?)
[05:39:30] <specing> you dont have to pass though flash and eeprom because those will either be your stuff or ones
[05:39:35] <naftilos76> That is one good idea!
[05:39:41] <naftilos76> Definitely random
[05:39:47] <naftilos76> Thanks man
[05:42:42] <specing> you can also xor registers
[05:42:56] <specing> and put this code in assembly before libc init
[07:31:44] <megal0maniac> If naftilos76 was still here, I'd say https://code.google.com/p/avr-hardware-random-number-generation/wiki/WikiAVRentropy
[07:32:13] <megal0maniac> Uses WTD clock jitter to generate randomness :)
[08:28:44] <inflex> lo folks... so, are AVRs still popular? I've been gone so long
[08:29:17] <Tom_itx> not sure, it's been damn quiet around here lately
[08:29:58] <phinxy> Do i need to do something in particular when i update a library? im updating 1.14 u8glib to 1.15.
[08:30:30] <Tom_itx> yeah
[08:30:37] <Tom_itx> cross your fingers and hope it works
[08:32:25] <phinxy> The new function "u8g_DrawTriangle" becomes red (i can right click and go to implementation) but it tells me undefined reference when i compile with it
[08:32:40] <inflex> hiya Tom_itx - been a while, yes.
[08:32:46] <inflex> Tom_itx: approaching 2 years now for me.
[08:54:13] <phinxy> problem solved. if using i2C it looks for a file which they have in their arduino library
[08:54:28] <inflex> Still think a lot of my true enjoyment came from working on the T13 and T10 chips
[08:54:42] <inflex> M48/88/168's were nice too, but a bit too easy in some ways
[10:05:40] <Roter> well, i guess im going to have to read up a bit, then continue, thank you anyway
[10:15:47] <megal0maniac> I'm playing with LCDs today
[10:15:48] <megal0maniac> And I have a question :)
[10:17:16] <megal0maniac> I'm using the upper-most 3 bits of PORTC for control. How do I write to them all at once without touching the other 5 bits?
[10:17:40] <megal0maniac> Read-modify-write is dangerous because of possible state changes mid-modify. Shouldn't be an issue here, but it's bad practice
[10:31:57] <Casper> megal0maniac: RMW... could use an atomic block while you do it
[10:32:00] <Casper> basically that disable the interrupts
[10:32:01] <Casper> so can't change
[10:32:04] <Casper> it is also recommended to do that for multi-bytes register and global variables that can change
[10:47:49] <megal0maniac> Casper: Thanks :)
[14:21:27] <Celerity> I have a question regarding timers
[14:21:50] <Celerity> As I understand, each timer can have 2 triggers right?
[14:22:10] <Celerity> In the compare mode, there would be OCRzA and OCRxB?
[14:22:16] <Celerity> s/z/x
[14:22:43] <specing> 'OutputCompareRegister'
[14:22:56] <specing> so you can compare the timer with two values simultaneously
[14:23:02] <Celerity> ok
[14:23:28] <Celerity> That's a feature though right? So that I can use one timer and have two functions running using it?
[14:23:35] <specing> yes
[14:23:48] <Celerity> ah thanks. this clears a lot of my doubts.
[14:24:48] <phinxy> is this button interrupt right? ISR(PCINT31){ //center press }
[14:25:21] <Celerity> nah, phinxy - as far as I understand you can read ports only for pin change interrupts
[14:25:50] <phinxy> yeah i got that but thats what im trying to do
[14:25:59] <Celerity> ok
[14:25:59] <specing> phinxy: 'PinChangeInterrupt31'
[14:26:18] <specing> it will trigger if it detects a change of state on pin 31
[14:26:25] <specing> whether that came from a button or not...
[14:26:47] <Celerity> phinxy - you need to trigger the isr with ISR(PCINTx_vect) {} where x is your interrupt port that is written in the datasheet
[14:27:36] <Celerity> for instance my port d is triggered by PCINT2_vect and inside that, I check which pin is high/low for my button.
[14:39:31] <phinxy> It seems like my button interrupts interrupt my display so it reboots
[14:40:20] <specing> wat
[14:41:32] <phinxy> specing, the display doesnt run without sei(); so it obviously depends on it somehow
[14:54:17] <megal0maniac> Wow. HD44780 is surprisingly simple :)
[14:54:34] <Lambda_Aurigae> yup.
[14:54:35] <megal0maniac> Don't even need a library for simple stuff
[14:55:12] <megal0maniac> If only I2C was so straightforward :/
[14:55:22] <Lambda_Aurigae> I haven't had any problem with it.
[14:55:39] <Lambda_Aurigae> http://homepage.hispeed.ch/peterfleury/avr-software.html
[14:55:52] <Lambda_Aurigae> some i2c stuff here that is super simple to use.
[14:56:03] <megal0maniac> Lambda_Aurigae: Yip, I've seen his libx
[14:56:05] <megal0maniac> *libs
[14:56:22] <Lambda_Aurigae> I actually combined his i2c and lcd libs and used pcf7584 chips to do an i2c interfaced 16x2 display.
[14:56:34] <megal0maniac> Ah, nice :)
[14:56:44] <megal0maniac> I've got the same thing
[14:56:45] <Lambda_Aurigae> and did that some,,,6 or 7 years ago.
[14:56:58] <Lambda_Aurigae> even had extra lines for buttons on the display.
[15:00:06] <megal0maniac> Shit, freenode. Bad day or what?
[15:01:26] <phinxy> My AVR Dragon goes into upgrade move randomly and i cant connect to it without waiting a couple minutes and doing an upgrade :|
[15:20:15] <megal0maniac> I love it when typing a question out puts the answer in your head :)
[16:10:43] <MrM0bius> what speed does the atmel parallel programmer program at approximately?
[17:53:36] <imac> Im trying to get a board working, if i burn the bootloader with an stk500v2 the arduino atmega2560 all goes well, then i can upload a sketch only once after that the serial interface times out
[17:53:44] <imac> i wrote the fuses accordingly
[18:00:02] <Casper> the bootloader only run for a second or 2
[18:51:54] <imac> yes casper
[18:52:12] <imac> but normally i should be able to upload a sketch
[18:52:46] <imac> ah wait would the reset be why i cant upload a sketch after i alread uploaded another sketch\
[18:55:25] <Casper> you have like a second or 2 after a reset or power up to issue a flash command
[19:01:04] <imac> unless i trigger a reset with the serial adapter
[19:02:45] <Casper> it's not a sketch, it's a program
[19:03:35] <Casper> the bootloader basically start, wait for a second or 2 for an input of some type, then if no input it boot the main program
[19:03:59] <Casper> if there is no other program the avr basically ends up to execute again the bootloader
[19:04:55] <Casper> short story: an empty flash is filled with "0xFF", which is a NOP, so the avr just "waste" time until it executed all those "waste time" operations and reach the bootloader area