#avr | Logs for 2012-06-15

Back
[03:21:12] <cousteau> linux here. How do I load a .hex to an AVR?
[03:21:34] <profil> cousteau: I use avrdude
[03:21:53] <cousteau> (if possible, without installing the complete AVR Studio thing)
[03:22:03] <cousteau> cool, is it easy to use? let me install it
[03:22:20] <cousteau> (I had seen 2 candidates in repositories and couldn't decide)
[03:24:59] <profil> cousteau: really easy to use, I got a upload: in my makefile
[03:25:06] <profil> avrdude -p m328p -P /dev/ttyACM0 -c stk500v1 -F -u -U flash:w:$(PRG).hex
[03:25:20] <profil> to a atmega328p
[03:29:32] <cousteau> ... (1) I don't see the "AVR Studio" device in /dev, (2) I have no idea how to connect it to the board (it's a custom board made in my lab)
[03:29:58] <cousteau> now I'll have to wait for the guys that know how to use this thing to be available to help me
[03:32:32] <mrfrenzy> if you have local people who can show that's ofcourse faster
[03:32:55] <mrfrenzy> but you'll learn a lot if you study the datasheet, follow the traces/schematic and see which connector on your board connect to the programming pin
[03:36:18] <cousteau> turns out the micro was already programmed
[03:36:39] <cousteau> (but out of curiosity, what /dev should I use?
[03:37:54] <mrfrenzy> whichever port your programmer is connected to
[03:52:46] <cousteau> well, it's on a USB
[03:53:34] <cousteau> but the only ttyUSB I see is an FTDI that is on the board, not the AVR Studio thing
[03:54:12] <cousteau> ...also, another guy needed the board so now I can't try... let's see if I can find another programmer
[03:58:11] <mrfrenzy> type dmesg
[03:58:22] <mrfrenzy> look for a /dev mentioned when you plugged in your usb
[03:58:22] <cousteau> only thing that seems to change is /dev/bus/usb/001/015
[03:58:59] <cousteau> [ 4440.769004] usb 1-1.1: new full-speed USB device number 15 using ehci_hcd
[03:59:47] <cousteau> that's all it says when I plug the programmer... does it work even without a microprocessor connected to it, or does it need a microprocessor?
[04:01:16] <cousteau> maybe I need to load a module or install something... it's one of these, by the way http://enshop.avrvi.com/index.php?route=product/product&product_id=35 (USB)
[04:05:13] <cousteau> ...I hope this doesn't have to do with the Xilinx jtag udev rules messing with this
[04:05:15] <profil> cousteau: this could help you maybe, http://stackoverflow.com/questions/5412727/avrisp-mkii-doesnt-work-with-avrdude-in-linux
[04:06:43] <cousteau> ok, so I have to write my own udev rule? yay, so much fun, hadn't had to do that since I installed Xilinx :(
[04:07:22] <profil> I have no idea, I'm using my arduiono to program, the mkii is to expensive for me
[04:09:46] <RikusW> cat /etc/udev/avarice.rules
[04:09:47] <RikusW> SUBSYSTEM!="usb_device", ACTION!="add", GOTO="avarice_end"
[04:09:47] <RikusW> # Atmel Corp. JTAG ICE mkII
[04:09:47] <RikusW> SYSFS{idVendor}=="03eb", SYSFS{idProduct}=="2103", MODE="660", GROUP="dialout"
[04:09:47] <RikusW> # Atmel Corp. AVRISP mkII
[04:09:47] <RikusW> SYSFS{idVendor}=="03eb", SYSFS{idProduct}=="2104", MODE="660", GROUP="dialout"
[04:09:48] <RikusW> # Atmel Corp. STK600
[04:09:48] <RikusW> SYSFS{idVendor}=="03eb", SYSFS{idProduct}=="2106", MODE="660", GROUP="dialout"
[04:09:49] <RikusW> # Atmel Corp. Dragon
[04:09:49] <RikusW> SYSFS{idVendor}=="03eb", SYSFS{idProduct}=="2107", MODE="660", GROUP="dialout"
[04:09:50] <RikusW> LABEL="avarice_end"
[04:10:04] <RikusW> this might help you ?
[04:10:19] <cousteau> I'll use it... but I was expecting a more elegant solution
[04:10:33] <cousteau> like, installing something from repositories
[04:10:43] <RikusW> unless you sudo this is the solution ;)
[04:11:07] <cousteau> what do you mean "unless you sudo"?
[04:11:12] <RikusW> and make sure you're on the dialout group
[04:11:24] <cousteau> yes, I just added myself to dialout
[04:11:26] <RikusW> you could run avrdude as root.....
[04:11:42] <RikusW> but not such a good practice
[04:12:02] <cousteau> oh, and just use /dev/bus/usb/001/234 ?
[04:12:29] <RikusW> if you are root avrdude should work without udev rules
[04:12:49] <RikusW> afaik anyways
[04:13:07] <cousteau> if there's no port...
[04:14:05] <RikusW> avrdude use libusb so it don't need special device files
[04:14:22] <cousteau> oic
[04:14:33] <cousteau> so it just detects where the avr is?
[04:14:51] <RikusW> it detects the usb programmer directly
[04:14:54] <cousteau> and thus there's no need for a -P /dev/... option?
[04:15:02] <RikusW> using the VID+PID
[04:15:22] <RikusW> you use -P usb
[04:15:27] <cousteau> oh
[04:16:21] <RikusW> I have a Qt4 gui for that too
[04:16:31] <RikusW> if you're willing to compile it yourself
[04:16:54] <cousteau> "For the JTAG ICE mkII, if avrdude has been configured with libusb support, port can alternatively be specified as usb[:serialno]."
[04:17:12] <cousteau> RikusW, well, there's also the AVR Studio program...
[04:17:25] <cousteau> (well, not sure if it's available for Linux, but I think so)
[04:17:31] <RikusW> yes, are you using Linux or Windows ?
[04:17:46] <RikusW> AS is NOT available for Linux.... :(
[04:17:52] <cousteau> good
[04:18:38] <RikusW> http://sites.google.com/site/megau2s/home -> SW -> RavrProg do qmake then make
[04:18:55] <RikusW> you'll need to have qt4 and libusb 0.1.12 dev files installed
[04:19:32] <cousteau> No, I'm using Windows, when I said /dev/ttyUSB0 I meant C:\dev\ttyUSB0.exe ⸮
[04:20:05] <RikusW> AS4/5 should help then
[04:20:16] <cousteau> (it was a joke)
[04:20:47] * RikusW still have to see C:\dev\ :-P
[04:21:23] <cousteau> anyway, I needed (1) a jtag, (2) a program to load it, (3) knowledge on how to use it, (4) a microprocessor to program, (5) a .hex file
[04:21:31] <cousteau> so far I managed to get (1)
[04:21:44] <RikusW> you have the jtagice mkii ?
[04:21:55] <cousteau> yes
[04:22:04] <RikusW> nice, I only have a dragon
[04:22:14] <cousteau> I'm filthy rich
[04:22:33] <cousteau> either that, or I'm in an electronics lab and the mkII isn't mine but from the lab
[04:22:40] <RikusW> I hope you know haw to program ? ;)
[04:23:20] <RikusW> you need avr-gcc to convert C to .hex
[04:23:37] <cousteau> well, the program I want to load is already compiled, so I just need to ask the guy who compiled it for the .hex
[04:23:44] <RikusW> you already know about avrdude
[04:24:16] <RikusW> you'll need to have it compiled for the specific AVR you will be using.
[04:24:31] <cousteau> ...or if it isn't compiled, then ask for the assembly source and compile it (using avr-as, I guess)
[04:25:14] <RikusW> so you don't have any AVR chips yet ?
[04:25:23] <cousteau> also, I know about avrdude, but not how to use it
[04:26:00] <cousteau> RikusW, there's _one_ board with this AVR in _all_ the lab, and another guy is using it right now
[04:26:27] <RikusW> which AVR would then be ? some ATmega ?
[04:28:36] <theos> hi
[04:28:36] <tobbor> theos! like, totally tell us about the project!
[04:28:40] <cousteau> I have no idea
[04:28:49] <theos> ... i smell rue_mohr
[04:29:07] <theos> tobbor! we finally meet old pal
[04:29:36] <theos> can the mosi/miso/sck pins be used for io?
[04:29:48] <cousteau> well, the thing is, I don't know how to use anything, I don't even need to load the program because apparently it's already loaded (this is a simple uC that just activates some power sources on a board so that other parts can work), so... no idea what I'm doing still here
[04:31:00] <cousteau> also I can't work because someone took the board... I think I'm going home
[04:31:01] <RikusW> theos: if you don't use SPI why not
[04:31:38] <theos> RikusW ah cool thanks
[04:31:56] <RikusW> theos: if you want to use it for programming too you'll need to take that into account when designing the circuit
[04:32:20] <RikusW> in particular you don't want drive contention (multiple sources driving the lines)
[04:32:22] <theos> RikusW making a dev board. so yeah need that into account :)
[04:32:49] <RikusW> so if you only connect other devices inputs to those lines you should be fine
[04:32:56] <RikusW> or use resistors
[04:33:02] <theos> hmm
[04:33:41] <RikusW> if you add other SPI devices they will only be active when their SS line is low
[04:35:00] <theos> just need one spi for the moment
[04:35:45] <theos> i want to use internal oscillator so will have to set the right fuses. that looks like a problem
[04:36:01] <RikusW> internal osc is used by default
[04:36:23] <cousteau> p.s. it's an ATtiny, just if one of you were still curious
[04:36:51] <theos> ah thats good news :) so i dont need to set fuses?
[04:37:02] <RikusW> theos: probably not
[04:37:23] <RikusW> theos: what AVR is that ?
[04:37:23] <theos> how do i set the frequency though? or is it set by voltage?
[04:37:29] <theos> atmega8l
[04:37:59] <theos> reading the datasheet. its same as atmega8
[04:38:17] <RikusW> its 8MHz by default afaik
[04:38:30] <RikusW> using the internal RC osc
[04:38:57] <theos> oh
[04:39:10] <theos> "This clock may be selected as the RC Oscillator system clock by programming the CKSEL Fuses"
[04:39:32] <RikusW> look at the factory default values
[04:41:49] <theos> looks like default frequency is 1Mhz
[04:45:58] <RikusW> looks like it
[04:45:58] <theos> thanks
[04:46:18] <theos> i missed that while reading the datasheet :S
[04:46:21] <karlp> clkdiv8
[04:46:30] <karlp> the fuse of forgetfulness
[04:46:34] <RikusW> 0xE4 should be 8MHz
[04:46:37] <RikusW> for the lfuse
[04:47:26] <RikusW> theos: will you be using a bootloader ?
[04:48:04] <theos> nop
[04:48:19] <RikusW> then only change lfuse from E1 to E4
[04:48:45] <RikusW> what software will you be using ? AS4/5 or avrdude ?
[04:48:58] <theos> avrdude
[04:49:17] <RikusW> its somewhat easier when using terminal mode
[04:49:20] <RikusW> add -t
[04:50:10] <theos> yup i have to use -Ft :D
[04:51:37] <RikusW> -F is not so good
[04:51:54] <RikusW> you should use the correct part -p m8
[04:52:30] <theos> yes i use the correct part. but it says error in signature
[04:52:53] <theos> maybe the firmware is old or i have an illegal usbasp
[04:53:11] <RikusW> in terminal mode -> read lfuse
[04:53:50] <RikusW> then write lfuse 0 0xE4
[04:54:10] <RikusW> what signature does it read ?
[04:54:57] <RikusW> eg: avrdude: Device signature = 0x1e958a -> avrdude: Expected signature for ATMEGA32 is 1E 95 02
[04:55:10] <RikusW> what Device signature = 0x1e958a do you get ?
[04:55:20] <RikusW> 0xFFFFFF means improper connection....
[04:56:03] <theos> do i need to connect programmer to the board? :D
[04:56:29] <RikusW> what were you thinking ? :-P
[04:56:43] <RikusW> remember mosi -> mosi and miso -> miso
[04:56:44] <theos> i have to make the board first!
[04:56:53] <RikusW> you could use a breadboard
[04:56:56] <theos> yup that part i understood
[04:57:11] <theos> :D
[04:57:33] <RikusW> some people make the mistake of crossing miso -> mosi..... than won't work
[04:57:40] <RikusW> *that
[04:57:56] <theos> yeah i made sure that i understand what pin goes where
[04:58:41] <theos> thanks. cya blackouts here :/
[09:01:37] <rue_mohr> theos, boo!
[09:09:24] <theos> :D
[09:09:36] <theos> i missed tobbor. didnt know it was here :)
[09:14:38] <rue_mohr> hah
[09:14:59] <rue_mohr> tobbor was taken out of #electronics because they abused it
[09:16:29] <specing> How so?
[09:16:42] <specing> Did flyback spam CANUCK ?
[09:16:57] <rue_mohr> yes, and then they banned me from the channel for it
[09:17:04] <specing> Oh I see you've disabled it
[09:17:11] <rue_mohr> no
[09:17:15] <specing> LOOOOOOOOOO...OOOOOL
[09:17:19] <theos> :/
[09:17:22] <rue_mohr> I'v removed tobbor from the prescence of idiots
[09:17:33] <theos> good step
[09:24:22] <rue_mohr> a=(2+3)*3 -->> 15
[09:24:27] <rue_mohr> wrong channel
[09:24:54] <theos> :D
[09:26:31] <specing> rue_mohr: Is someone asking for precedence rules? LOOL
[09:32:00] <rue_mohr> :)
[09:32:25] <Sgt_Lemming> http://i.imgur.com/MZpFd.jpg <--- AVR powered bike light :-D
[09:36:12] <theos> lo Sgt_Lemming !
[09:36:19] <Sgt_Lemming> lo
[09:39:49] <rue_mohr> specing, it works as long as you dont start the formula with a bracket, cause aparently it cant handle deleting the head of its dll
[09:40:23] <rue_mohr> void eqNode_DeleteNode(eqNode_t * this){
[09:40:23] <rue_mohr> printf("Delete: ");
[09:40:23] <rue_mohr> eqNode_Show( this) ;
[09:40:23] <rue_mohr>
[09:40:23] <rue_mohr> if (this->rhs != NULL) this->rhs->lhs = this->lhs;
[09:40:23] <rue_mohr> if (this->lhs != NULL) this->lhs->rhs = this->rhs;
[09:40:25] <rue_mohr>
[09:40:27] <rue_mohr> free(this->detail);
[09:40:29] <rue_mohr> free(this);
[09:40:31] <rue_mohr> this = NULL;
[09:40:33] <rue_mohr> }
[12:44:27] <RikusW> anyone here used Serial Vector Format for JTAG before ?
[12:45:51] <RikusW> I might just add a SVF module to my project giving it much greater flexibility ;)
[15:16:28] <RikusW> The IEEE 1532 for JTAG specification enables concurrent in-system programming of multiple devices minimizing production programming times.
[15:16:36] <RikusW> seems like nice idea
[15:28:13] <Kevin`> stuff like that is normally only meaningful when not using proprietary programming tools :)
[15:29:59] <RikusW> seems like SVF and HSDL is open spec
[15:34:31] <RikusW> and atmel does create svf files for atmega
[15:36:46] <Borthwick> Does an AT90USB device need a Windows 7 driver if implemented as a memory stick?
[15:37:28] <RikusW> probably not
[15:37:45] <RikusW> usb classes is standard more or less
[15:37:54] <RikusW> CDC does need an inf file
[15:38:23] <Kevin`> Borthwick: windows requires a "driver" for some devices that follow the standard interfaces, but I think it has exceptions for things like memory devices to allow them to work without users complaining. if you JUST implement a memory device (no dual function) it'll probably be fine
[15:38:24] <RikusW> afaik mass storage don't need an inf file
[15:39:04] <RikusW> in Linux standard usb classes just WORKS :)
[15:41:53] <Borthwick> I have an AT90USB microcontroller implementation of a memory stick and it takes 4 minutes to 'mount' on Windows 7, but seconds on XP. Other standard flash drives mount in Windos 7 in seconds.
[15:42:36] <Borthwick> How do you monitor an AT90USB comminication with a windows OS? Is there some special software to see what Windows is doing in the background>?
[15:43:27] <RikusW> you mean looking at the usb traffic ?
[15:43:35] <RikusW> snoopy pro maybe ?
[15:43:37] <Borthwick> Its just this custom device that takes ages to get a drive letter. I was wondering what hthe heck its doing to take so long. Only in Windows 7 though. And how to snoop on it.
[15:44:13] <Borthwick> Well windows seems to be searchign for what to do. I could try snoopy pro I guess..
[15:45:08] <Borthwick> I just cant stand the fact that XP knows what to doi but winodws 7 is being a moron. A desktop software driver ort a jhack or spmething would be so nice to know about.
[15:45:24] <drgreenthumb> heh you have some patience to have figured that out. I would have unplugged it within 30 seconds after no response and it never would have mounted :)
[15:45:41] <Borthwick> Its for a client.
[15:45:43] <drgreenthumb> 4 minutes, that's crazy
[15:46:00] <drgreenthumb> hmm where's Dean when you need him? :P
[15:46:05] <Borthwick> They had the device andf firmware done by a company that wont let them at the firmware source code
[15:46:35] <Borthwick> so they asked me, their desktop software developer to look at getting it to work for their windows 7 clients who keep complaining about it not woirking
[15:46:41] <Borthwick> so im paid to have patience!
[15:46:43] <Borthwick> lol
[15:47:00] <drgreenthumb> Borthwick, abcminiuser on this channel is the author of LUFA. if nobody here knows you could try him when he's around and/or the LUFA mailing list.
[15:47:06] * RikusW wonders if the at90usb lockbits are set :-P
[15:47:35] <RikusW> without the fw it will be difficult to fix.... unless win7 can be "fixed"
[15:47:58] <Borthwick> Id have to 'fix' windows 7 but only for this specific device
[15:47:59] <Borthwick> somehow
[15:48:15] <Borthwick> I have the hex file but its beyond me to decompile it!
[15:48:38] <drgreenthumb> heh how can you fix random peoples windows installations before they plug the thing?
[15:48:44] <RikusW> even if you can it would mean a LOT of work
[15:48:52] <drgreenthumb> I guess you can direct them to download something, is that the idea?
[15:49:02] <Borthwick> i have developed desktop software with an msi installer
[15:49:04] <RikusW> Borthwick: it can easily be disassembled
[15:49:14] <Borthwick> id jjust get the installer to run a script or whatever it needs
[15:49:19] <RikusW> making sense of that is another matter altogether
[15:49:29] <Borthwick> the 'whatever it needs' bit is the million dollar question though!
[15:50:01] <drgreenthumb> it probably needs some .inf file. because Windows.
[15:50:24] <OndraSter> heh, I took apart microwave... it has 4bit microcontroller with 2kB ROM (2048*8bit) and 64B RAM (128*4bit) lol
[15:50:26] <OndraSter> in SDIP42 package!
[15:50:40] <RikusW> 4-bit ?! heh
[15:50:44] <OndraSter> :)
[15:50:57] <OndraSter> it has "high current output ports"
[15:50:57] <vectory> nothing else? xD
[15:51:00] <OndraSter> upto 20mA!
[15:51:02] <Borthwick> the software is for tunign vehicle engines. It displays 4 'tunes' that represent specific engine perutations. The software uploads thes users's tunes as 4 files that live on the chip. The chip gets inserted into the car
[15:51:06] <Borthwick> works a charm on XP
[15:51:17] <Borthwick> damn Windows 7! Dam it all to heck
[15:51:20] <Borthwick> lol
[15:51:22] <RikusW> Borthwick: avr-objdump will disassemble the hex file, then you'd need to learn avr-asm
[15:51:58] <Borthwick> Rikus, that sounds cool
[15:52:00] <drgreenthumb> and reverse engineer it without comments. fun fun
[15:52:24] <OndraSter> reverse engineering or getting work USB stack on xmegas even with documentation and samples with comments is pain :P
[15:52:31] <RikusW> drgreenthumb: and without register names too =-O
[15:52:39] <Borthwick> How hard can it be. Its a file system that decrypts on the chip using a simple bit shiftiong algorithm
[15:52:54] <Borthwick> the car gets to see the unecrypted version of the data
[15:52:58] <vectory> drgreenthumb: you should kinda know, what the chip does, before you start, no?
[15:53:02] <Borthwick> the fiels are 'wncrypted' to the user
[15:53:08] <Kevin`> for something like a microwave, it would be faster to reimplement the code from scratch than to bother with disassembly
[15:53:11] <Borthwick> only me and my client kow the secfret decryption!
[15:53:14] <Borthwick> boahahaha
[15:53:21] <OndraSter> Kevin`, that is different topic lol
[15:53:32] <drgreenthumb> vectory, sure yeah I know AVR ASM well enough to do some things. but reverse engineering a big .hex? heh it'd take me months at least.
[15:53:46] <Borthwick> its a small hex for me
[15:53:49] <RikusW> Borthwick: so is the at90 plugged into the car to upload the tuning ?
[15:53:57] <Borthwick> still, ive never programmed firmware
[15:54:11] <RikusW> how large is the hex file btw ?
[15:54:39] <OndraSter> is there some "program flow chart" plugin for atmel studio?
[15:55:18] <Kevin`> Borthwick: you may be better off trying to reproduce the PROBLEM with your own source, if you know what library was used
[15:55:24] <Borthwick> where do you get avr-objdump?
[15:55:34] <Kevin`> then just tell your client or whoever how to fix it
[15:55:49] <RikusW> Borthwick: its part of WinAVR
[15:55:50] <Kevin`> seems to come with avr-gcc/gcc-avr for me
[15:55:56] <Borthwick> They are on bad terms with the guys who did their firmware
[15:56:04] <Borthwick> theyd want me to redo the firmware for them
[15:56:10] <Kevin`> Borthwick: also remind them that not having the source for their own product is a recipe for failure
[15:56:12] <Borthwick> which is cool but a bit terrifying!
[15:56:48] <Borthwick> which is why id like a windows 7 hack for this
[15:56:49] <Kevin`> even worse than not having the source for an application you want to keep working long term ;)
[15:56:50] <Borthwick> for now anyway
[15:56:58] <Borthwick> i can get the installer to apply said hack
[15:57:09] <Borthwick> just want to know what windows 7 is doing
[15:57:15] <Borthwick> specifically
[15:57:34] <Borthwick> which is where this snoopy pro thing comes in right?
[15:58:03] <RikusW> you might be able to get away with creating an inf file, read the windows DDK docs for creating a usb mass storage inf file
[15:58:25] <RikusW> Borthwick: do you know some USB specs at least ?
[15:58:33] <Borthwick> yes
[15:59:28] <RikusW> so how large is that hex file ? (kb?)
[16:00:25] <OndraSter> if I have got USB (root) hub, it sends all the data to all the devices and only if the address matches the device actually uses them?
[16:00:49] <Borthwick> Rikus: just chcking
[16:00:56] <RikusW> even 10kb can represent a significant amount of reverse engineering work, like many weeks
[16:02:58] <Borthwick> 28Kb
[16:04:31] <Kevin`> 28kb is a pretty large project, although hopefully most of that would be library code and never-removed debug library usage
[16:04:32] <RikusW> that would be about 5000 lines of asm
[16:04:50] <RikusW> Kevin`: remember thats the hex file size
[16:05:20] <Borthwick> yes the hec file is 8kb
[16:05:22] <Kevin`> RikusW: well, to ME, 28kb is a pretty large project
[16:05:30] <Kevin`> RikusW: oh right, I see what you mean, hex encoding
[16:05:35] <RikusW> and about 12kb of avr code
[16:05:41] <Borthwick> for what this thing does, id imagine it is mostly library code
[16:06:00] <Borthwick> soirry 28kb
[16:06:02] <Borthwick> hec
[16:06:04] * RikusW wonders if they used LUFA without permission...
[16:06:05] <Borthwick> hex
[16:06:46] <Borthwick> interesting idea. Its open source though isnt it
[16:06:57] <RikusW> unfortunately avr-objdump don't put in register names, only their address
[16:07:22] <RikusW> it is, but you must give LUFA credit
[16:07:29] <RikusW> unless you pay
[16:08:17] <RikusW> http://www.atmel.com/Images/doc0856.pdf AVR instruction set
[16:08:25] <RikusW> which at90 do you have ?
[16:08:43] <Borthwick> AT90USB?
[16:08:54] <RikusW> http://www.atmel.com/Images/doc7593.pdf for 646/647/1286/1287
[16:09:08] <RikusW> http://www.atmel.com/Images/doc7707.pdf for 82/162
[16:09:30] <RikusW> you'll need these docs too
[16:10:01] <Borthwick> usb646
[16:10:11] <RikusW> Borthwick: do you have a programmer for putting the hex on the AVR chip ?
[16:10:24] <Borthwick> my client dows
[16:10:42] <Borthwick> theres some flip program or something where it can go on via the usb right?
[16:10:53] <RikusW> yes
[16:10:53] <Borthwick> they put the hexx on themselves anyway so yes
[16:11:25] <RikusW> so they use the flip bootloader then..
[16:11:44] <Borthwick> Yes I believe they do...
[16:12:15] <Borthwick> the chip uses an SST memory chip
[16:12:27] <Borthwick> the mass storage device has a fat file system
[16:12:29] <RikusW> what for ? the tuning data ?
[16:12:35] <RikusW> ah
[16:12:49] <RikusW> how large is it ?
[16:12:57] <Borthwick> a dummy file ngoes at the start, then 4 encrypted files after that
[16:13:14] <Borthwick> the dummy file makes sure the encrypted data starts out at the correct memory address
[16:13:56] <RikusW> sounds dodgy....
[16:14:02] <Borthwick> Its 492KB
[16:14:16] <RikusW> what if windows decides to put those files somewhere else on the filesystem.....
[16:14:40] <Borthwick> The user can copy and paste their tune files into it as long as they go in the correct order an after a fat format
[16:14:50] <Borthwick> the software i mnade handles that stuff though
[16:15:17] <Borthwick> i write to the chip in the coirrect order via the software
[16:15:26] <Borthwick> dummy file, file 1, 2, 3 and 4
[16:15:28] <Borthwick> and it works
[16:15:56] <RikusW> untill windows decides to put those files at another location...
[16:16:06] <Borthwick> the chip uses those files as the data soiurce, unbit shifts them and the car 'sees' waht it needs'thay are MBW tune binary files
[16:16:16] <Borthwick> BMW rather
[16:16:21] <Borthwick> the car
[16:16:40] <RikusW> so its bitshifted for "encryption" ?
[16:16:47] <Borthwick> thats riht
[16:16:50] <Borthwick> not too strong!
[16:16:56] <Borthwick> its working fine on XP
[16:17:08] <RikusW> thats like no encryption at all :-P
[16:17:29] <drgreenthumb> heh I'm wondering which is more incompetent, Borthwick's client or the original dev company.
[16:17:42] <Borthwick> the company that built the foirmware pulled it off and the desktop softwares job is to just write and read from the device and provide an interfact for manipulating eacvh fgile on screen in tabs
[16:18:00] <Borthwick> its all done, just that idiotic Windows 7 thing
[16:18:13] <RikusW> how does that get transferred to the car itself ?
[16:18:14] <jacekowski> well AES uses XOR for encryption
[16:18:26] <jacekowski> bitshift isn't perfect
[16:18:30] <RikusW> jacekowski: a bit more than just xor...
[16:18:32] <Borthwick> I never had to deal with hoiw the car 'sees' the data
[16:18:37] <jacekowski> RikusW: it's xor in the end
[16:18:45] <Borthwick> i just had to build the desktop software
[16:18:46] <jacekowski> keystream xored with data
[16:19:01] <jacekowski> keystream is based on data and everything
[16:19:38] <RikusW> jacekowski: and then there is that nice mixcolumns function too....
[16:19:38] <Borthwick> i had to get the specific algorithm to bitshift the data so the software would rened the 'unencrypted data' for the user
[16:19:39] <jacekowski> but thing is, bitshift isn't very bad thing if you do it right
[16:19:52] <jacekowski> RikusW: that's when it generates keystream
[16:20:09] <Borthwick> to 'encrypt' and 'decrypt', i just run the data through the algorithm
[16:20:11] <jacekowski> RikusW: last operation is to XOR keystream with data
[16:20:13] <RikusW> jacekowski: and when it encrypts the data too
[16:20:26] <Borthwick> it was quite cute and convenient to implement
[16:20:26] <jacekowski> XOR is the encryption
[16:20:36] <jacekowski> thing is
[16:21:07] <jacekowski> if your keystream is safe then it doesn't matter
[16:21:23] <jacekowski> but
[16:21:25] <Borthwick> Im in XP righ tnow, and plugging the device in makes the winodw pup up instantly with all 5 files in it
[16:21:27] <jacekowski> bitshift isn;t
[16:21:51] <RikusW> jacekowski: the XOR is interleaved with other stuff which prevents it accumlating
[16:22:00] <Borthwick> in xp, windows sees it as a disk file in device manager instantly, but 4 minutes later, it gets a drive letter
[16:22:12] <Borthwick> that 4 minutes, there is NOI usb traffic
[16:22:18] <jacekowski> RikusW: it doesn't work that way
[16:22:18] <Borthwick> windows 7 is 'doing something'
[16:22:27] <jacekowski> RikusW: there is keystream that is generated by AES
[16:22:31] <Borthwick> i woant to know what
[16:23:00] <jacekowski> RikusW: keystream is based on the key and data
[16:23:16] <jacekowski> RikusW: and that generates keystream of same lenght as the data
[16:23:33] <jacekowski> RikusW: and then that keystream is XORed with data
[16:23:46] <jacekowski> and that's all it takes
[16:23:54] <jacekowski> to do the final step
[16:24:03] <RikusW> jacekowski: have you read the AES spec ?
[16:24:06] <jacekowski> as long as keystream isn't doing bad things
[16:24:13] <jacekowski> yes
[16:25:30] <jacekowski> all those MixColumns, shiftrows, subbytes
[16:25:39] <jacekowski> is used to generate the keystream
[16:25:58] <jacekowski> but then when you have your keystream you have to use it to encrypt the data
[16:26:11] <jacekowski> and that's where to xor comes in
[16:26:33] <RikusW> hmm
[16:26:44] <jacekowski> because it's fast, reversible if you have original keystrem
[16:27:04] <jacekowski> but at the same time it doesn't make encrypted data look anywhere like original data
[16:27:20] <Borthwick> Heres a buitshift alogorithm right out of my source code
[16:27:21] <Borthwick> * takes an int from rawBytes int array and turns it into processed int
[16:27:21] <Borthwick> * @deprecated
[16:27:21] <Borthwick> * @param toProcess
[16:27:21] <Borthwick> * @param a
[16:27:21] <Borthwick> * @param b
[16:27:22] <Borthwick> * @return
[16:27:22] <Borthwick> */
[16:27:23] <Borthwick> private static int process(int toProcess, int a, int b) {
[16:27:23] <Borthwick> int t1 = toProcess & a;
[16:27:24] <Borthwick> int t2 = t1 >> 1;
[16:27:24] <Borthwick> int t3 = toProcess & b;
[16:27:25] <Borthwick> int t4 = t3 << 1;
[16:27:25] <Borthwick> int e = t2 | t4;
[16:27:26] <Borthwick> return e;
[16:27:26] <Borthwick> }
[16:27:36] <jacekowski> however, that's why known plaintext attacks sort of work on AES
[16:27:44] <RikusW> afaik the key is expanded to a larger block of data, and data isencrypted 16 bytes at a time
[16:27:47] <jacekowski> because if you know encrypted data and the plaintext
[16:28:01] <RikusW> usnign multiple cycles
[16:28:07] <jacekowski> RikusW: yes
[16:28:07] <Borthwick> that function, with specified values for a and b, will bot encrypt and decriypt toProcess
[16:28:15] <jacekowski> RikusW: that's the process of generating keystream
[16:28:35] <RikusW> you mean cypertext ?
[16:28:43] <jacekowski> no
[16:28:58] <jacekowski> ciphertext is created when keystream is XORed with plain text
[16:29:02] <Borthwick> btw its java but the syntax is ++ too i believe
[16:29:26] <jacekowski> which is where known plaintext attacks comes into play, as you can recover original keystream
[16:29:29] <jacekowski> however
[16:29:41] <jacekowski> so far there is no easy way of recovering they key from keystream
[16:29:47] <jacekowski> not on full AES
[16:29:58] <jacekowski> there are some attacks for weakened version of AES
[16:30:38] <RikusW> Borthwick: what values are used for a and b ? 0x55555555 and 0xAAAAAAAA ?
[16:31:18] <Borthwick> intiger values
[16:31:23] <Borthwick> any number in int form
[16:31:34] <jacekowski> RikusW: same thing with one time pad encryption,
[16:31:42] <Borthwick> 5 and 6 or 46 and 43 or whatever
[16:31:43] <jacekowski> RikusW: if you XOR that one time pad with plaintext
[16:31:54] <Borthwick> integer
[16:31:55] <jacekowski> RikusW: you will never recover the plaintext unless you have the pad
[16:31:58] <Borthwick> sorry bad spelling
[16:32:15] <jacekowski> RikusW: that's the beauty of XOR when used at last stage of the encryption
[16:32:28] <Borthwick> brb
[16:32:47] <RikusW> yeah I've read about onetime pad
[16:33:05] <RikusW> but AES is a bit more than just XOR
[16:33:17] <jacekowski> yes
[16:33:29] <RikusW> then there is the CBC mode too
[16:33:29] <jacekowski> whole strenght of aes comes from how keystream is generated
[16:34:20] <jacekowski> but even then, you can create very simple encryption with XOR and few additions
[16:34:31] <jacekowski> that will be very hard to break
[16:35:04] <RikusW> jacekowski: you know that simple XOR accumlates right ?
[16:35:26] <jacekowski> not that way
[16:35:28] <jacekowski> i mean
[16:35:47] <jacekowski> keystream XOR plain text == cipher text
[16:36:06] <Borthwick> me is back
[16:36:21] <Borthwick> Ok i got snoopy pro
[16:36:23] <RikusW> C = P ^ a ^ b ^ c; -> z = a ^ b ^ c; P = C ^ z;
[16:36:28] <Borthwick> ill see what it canb do
[16:36:48] <jacekowski> yes
[16:37:09] <jacekowski> RikusW: that's why you use it only once
[16:37:16] <jacekowski> RikusW: at the last stage
[16:37:25] <Borthwick> my problem is windows 7 is not communicating via usb for 4 minutes. i checked with anothe product called usbLyzer
[16:37:54] <Borthwick> it gets infor from the device and decides it doesnt have enough to go ojn until it runs 50 laps around the hard disk
[16:39:17] <RikusW> jacekowski: so you know the original name of AES ?
[16:40:33] <RikusW> Rijndael ;)
[16:42:43] <drgreenthumb> hrm, Studio 6 installation is pretty awful. at least 4 different installers have launched since I started this and it's still not done :o
[16:43:38] <drgreenthumb> Borthwick, I figured I'd flash the Atmel mass storage demo onto this at90usbkey dev board I have here (chip is pretty similar to yours) and we'll see how my win7 reacts.
[16:46:03] <drgreenthumb> whee! and now an IO exception during install. wat.
[16:46:54] <drgreenthumb> heh well alright if you don't want to stick around then I won't :P
[16:51:02] <drgreenthumb> oh heh. it lied about me having enough disk space for this. my fault for believing it.
[16:54:54] <RikusW> jacekowski: unless you uses CBC mode giving AES a few identical 128bit block will produce identical 128bit encrypted blocks....
[16:55:01] <RikusW> -s
[17:00:32] <OndraSter> who was searching for ABCMU?
[17:02:15] <OndraSter> looking for*
[17:02:41] <RikusW> Borthwick was
[17:02:58] <drgreenthumb> heh something is messed up with Borthwick's firmware for sure
[17:03:07] <drgreenthumb> both LUFA and the Atmel demos pop up instantly
[17:03:22] * abcminiuser_ has been drinking
[17:03:31] <abcminiuser_> Not a good time to ask questions :P
[17:03:36] <drgreenthumb> and heh I used LUFA to rescue the original firmware off the usbkey :D
[17:03:42] <OndraSter> :D
[17:03:54] <OndraSter> overwrote bootloader with LUFA and dumped the flash? :D
[17:04:15] <drgreenthumb> didn't need to dump the flash. abcminiuser_'s mass storage demo brought it up as a fat vol.
[17:04:21] <OndraSter> heh
[17:04:22] <OndraSter> cool :D
[17:04:40] <abcminiuser_> Wheeeee
[17:07:41] <RikusW> OndraSter: I used my usb bootloader to dump the flip bootloader... I loaded mine as an app....
[17:07:48] <OndraSter> ah
[17:07:50] <OndraSter> opposite :)
[17:08:10] <RikusW> the lockbits are partly set preventing a programmer from reading flip...
[17:08:24] <RikusW> but the flash can still be read using LPM
[17:08:53] <RikusW> atmel could've set the LPM lockbits for the bootsection... but didn't :)
[17:08:56] <Kevin`> not too meaningful since you can just download flip form atmel ;)
[17:09:07] <RikusW> afaik the flip hex file is somewhere on atmel.com...
[17:09:44] <RikusW> finding it is another matter :S
[17:10:15] <drgreenthumb> heh actually in my case, the usbkey actually has the .hex on the flash, with some other random docs and files. so I just needed access. lufa was perfect.
[17:10:44] <abcminiuser_> Weeeewoooowweeeeeeeewwwooooooo
[17:10:45] <RikusW> drgreenthumb: on the external flash ?
[17:10:49] <drgreenthumb> yep
[17:11:20] <RikusW> seems like someones blood alcohol levels is too high ? :-P
[17:12:23] * OndraSter has today fixed one microwave oven... fuse was blown
[17:12:26] <OndraSter> the 5kV fuse!
[17:12:41] <OndraSter> I bought random microwave with burnt bottom motor for 7€ incl. shipping
[17:12:50] <abcminiuser_> My coworker was refused service at the pub, something I thought impossible in Norway
[17:12:51] <OndraSter> and it had EXACTLY the same fuse in the SAME box even!
[17:13:02] <OndraSter> huh
[17:13:11] <RikusW> abcminiuser_: why ?
[17:13:35] <abcminiuser_> RikusW, too drunk :P
[17:16:03] <abcminiuser_> https://www.youtube.com/watch?v=32CkOkpOcSc
[17:21:52] <drgreenthumb> how to shoot yourself in the foot, by Dean Camera ;p
[17:21:58] <abcminiuser_> :P
[17:23:11] <Tom_itx> you should be using one of my programmers there
[17:23:22] <OndraSter> :D
[17:23:36] <OndraSter> with link to your website behind him eh?
[17:24:12] <abcminiuser_> Hey I was strongarmed into it
[17:24:16] <abcminiuser_> 30 mins prep
[17:24:18] <Tom_itx> i need to find a pc with sound i guess
[17:24:31] <Tom_itx> no atmel pendant on your shirt?
[17:24:38] <Tom_itx> no embroidered logo?
[17:25:25] <OndraSter> abcminiuser_, I think I have already asked, but I was gone for 3 days so I have surely forgotten the answer
[17:25:41] <OndraSter> the Q: is this some kind of requirement for newcommers in the team? :D
[17:25:43] <Tom_itx> well at least there's no ring on your finger yet
[17:25:56] <OndraSter> to make one video :P
[17:25:56] <abcminiuser_> We just changed out logo to a super ugly one
[17:26:23] <abcminiuser_> It's a new initiative, to put up a TON of videos with tiny tips and tricks
[17:26:24] <OndraSter> yes, it is ugl
[17:26:25] <OndraSter> y
[17:26:27] <OndraSter> ah
[17:26:34] <OndraSter> just as the new style of datasheets is .... ugly
[17:26:36] <OndraSter> the blue-ish ones
[17:26:44] <OndraSter> it is 28MB for the XMEGA AU!
[17:26:45] <abcminiuser_> I was made to do it since I'm apparently expendable :P
[17:26:45] <Tom_itx> so we can expect to see alot more of you?
[17:26:46] <OndraSter> arrgh :D
[17:27:02] <abcminiuser_> No, that's my one apperance
[17:27:07] <Tom_itx> haha
[17:27:10] <Tom_itx> so you think
[17:27:17] <OndraSter> so you hope
[17:32:39] <OndraSter> can anyone pls take a look at XMEGA AU datasheet, doc8331.pdf (if it helps), page 253?
[17:32:50] <OndraSter> There is bit SETUP/TRNCOMPL1
[17:32:57] <OndraSter> combined, depends on usb endpoint type
[17:33:07] <OndraSter> but it has the same description for both
[17:33:14] <OndraSter> it doesn't seem right
[17:33:32] <OndraSter> Bit 4 – SETUP: SETUP Transaction Complete Flag
[17:33:32] <OndraSter> This flag is set when a SETUP, IN, or OUT transaction has completed successfully. This flag is cleared by writing a one
[17:33:32] <OndraSter> to its bit location.
[17:33:32] <OndraSter>  Bit 4 – TRNCOMPL1: Transaction Complete Flag
[17:33:32] <OndraSter> This flag is set when a SETUP, IN, or OUT transaction has completed successfully. This flag is cleared by writing a one
[17:33:35] <OndraSter> to its bit location.
[17:34:15] <OndraSter> arrgh, two lines lower, "This bit is not sed when ping-pong is disabled."
[17:34:26] <OndraSter> sed!
[17:39:13] <chupas> Im having an issue where a Pin is not being read the correct state when running the program in real time, but if I pause it via JTAG it seems to work correctly. ANy ideas wahts going on here?
[17:39:37] <OndraSter> are you reading the correct register? :)
[17:39:41] <OndraSter> piece of code would help
[17:40:29] <chupas> if(bit_get(PINA,BIT(3)) == 0)
[17:40:58] <chupas> it catches the press the first time, then 10ms later i do the same thing and it does not catch it that time
[17:41:13] <chupas> unless i put a break after the first time
[17:42:32] <OndraSter> maybe some problem in circuitry?
[17:42:40] <OndraSter> and when it is hit the breakpoint there is little delay?
[17:43:15] <chupas> eh its just a pin to a grounded button, with internal pullups enabled
[18:12:52] <Posterdati> hi
[18:13:03] <Posterdati> is avr-gcc compatible with at90usb?
[19:04:39] <w|zzy> Posterdati: http://www.avrfreaks.net/wiki/index.php/Documentation:Tutorials_gcc_AT90UsbKey
[20:03:12] <drgreenthumb> mmm Kitty Phone Deluxe. how incredibly useful. I must build this. http://img341.imageshack.us/img341/8140/19032012630s.jpg
[20:09:41] <Kevin`> oh man, cats with wireless. they would be annoying you 24/7 :D