#avr | Logs for 2013-04-04

Back
[00:04:20] <langoliers> :)
[00:06:12] <langoliers> a dapa programmer with +5V pwr http://tinypic.com/view.php?pic=2jct4oz&s=6
[00:12:41] <Casper> I can't beleive that even online that there isn'T a toner seller that is cheaper than local store :/
[00:47:27] <GuShH> http://www.ebay.com/itm/251066005460 does it get any cheaper?
[00:49:01] <GuShH> it seems they do http://www.ebay.com/itm/180947008880
[01:11:24] <rue_bed> cluelessperson, dont think tom is making money on them, they are good programmers
[01:11:55] <rue_bed> it was my choice and I can etch my own damn boards
[01:12:23] <rue_bed> oneday I'm sure I will make a usb thing too
[01:26:18] <RifRaf> oh yay got a breakout board for me nano's, no more having to try turn a single 5V pin into 5 or 6, same for ground, that got annoying
[02:59:22] <langoliers> am i in the game? :) http://tinypic.com/view.php?pic=1zm2ubo&s=6
[02:59:46] <langoliers> but reset ***facepalm*** :(
[04:37:34] <Deffie> hello everyone, on avr, using sprintf from a char ptr to a char ptr, compiler warnings me that sprintf expects an unsigned int while my address is of type uint8_t, should I safely cast it to an unsigned int or theres a better solution ?
[04:42:06] <cluelessperson> rue_bed, Alrgiht, cool, thanks!
[07:07:27] <Kev> I have a raspberry pi that seems to freeze or at least lose network connectivity after a few days of uptime
[07:08:14] <Kev---> I'm using it as a monitoring solution far away so I kind of need it to stay up :)
[07:08:20] <Kev---> Is this a known problem?
[08:05:19] <langoliers> ^^ made nanotweezers from 2 PCI contact pins :) just solder them together
[08:05:54] <langoliers> ^^ made nanotweezers from 2 PCI contact pins :) just solder them together might be good for 01005 components too
[08:05:57] <langoliers> :)
[09:59:47] <[z_z]> so. brne start_loader is basically if(Z!=0) jump to bootloader?
[10:05:24] <seldon> Yes.
[10:06:04] <seldon> Note that it's a relative branch, so start_loader has to be phrased as it would for rjmp.
[10:07:19] <seldon> Oh, wait. The other way around. if Z is cleared (Z == 0), jump to bootloader.
[10:09:12] <DrLuke> Hey guys, I need to use a sine function on my avr. But it only takes floats as arguments. Is there any ways to work around this?
[10:09:39] <DrLuke> all my other variables are integers, and converting them to float just for that seems silly
[10:10:25] <seldon> Radians in integers seems kind of more silly, tbh.
[10:10:52] <DrLuke> seldon: not really
[10:10:58] <seldon> My google-fu reveals http://www.dribin.org/dave/trigint/ , though.
[10:10:59] <DrLuke> you just move the decimal point by a few places
[10:11:44] <DrLuke> seldon: yeah, that doesn't have some of the functions I need, sadly
[10:13:28] <seldon> Then I have nothing.
[10:14:52] <DrLuke> that library appears to ONLY have sin, but I also need atan and all that shazz
[10:15:16] <specing> DrLuke: do you need the functions to be fast or accurate?
[10:15:31] <DrLuke> a bit of both
[10:16:06] <specing> how many digits past the decimal point do you need?
[10:16:06] <DrLuke> it should be accurate down to an order of 0.1 degrees
[10:16:28] <DrLuke> so shifting the decimal points by 3 places
[10:16:58] <specing> do you prefer speed or memory space?
[10:17:03] <specing> *wasting
[10:17:13] <DrLuke> ugh tough questions
[10:17:23] <DrLuke> I guess wasting memory space
[10:17:45] <specing> ok
[10:17:54] <specing> go with precomputed arrays, then
[10:18:26] <DrLuke> so basically a lookup table?
[10:18:30] <specing> yes
[11:25:49] <[z_z]> So I'm looking at the BOOTLOADER_AVR32 project common/services/isp/flip/uc3/boot.S The way i see it, the bootloader will start when the userpage is erased because then the CRC polynomial doesn't match?
[11:28:36] <darsie> What size avr do you need to mine bitcoins (do sha256)?
[11:29:06] <langoliers> 50THz
[11:29:18] <darsie> I mean flash ;)
[11:29:38] <darsie> Will 16 K flash suffice?
[11:29:44] <darsie> Or 4?
[11:30:53] <seldon> Are you serious?
[11:31:16] <darsie> I'm asking this question seriously.
[11:31:25] <darsie> Doubt I'll mine with avr.
[11:31:29] <darsie> But it would be fun.
[11:31:38] <darsie> Could run on solar.
[11:31:45] <darsie> And I could clame I'm mining :).
[11:32:49] <darsie> Would need network connection, as it needs to reference the previous block ...
[11:33:21] <darsie> Hmm, block size is 256 K ...
[11:33:45] <darsie> Maybe with external RAM.
[11:33:45] <seldon> https://www.das-labor.org/wiki/AVR-Crypto-Lib/en has a hmac-sha256 implementation in 2712 bytes flash, which presumably includes sha256 code.
[11:33:56] <darsie> thx
[11:34:23] <seldon> You realise you're never going to find a single bitcoin, don't you?
[11:34:28] <darsie> yes
[11:34:41] <darsie> probably.
[11:35:00] <darsie> I could join a pool and mine satoshis :).
[11:45:46] <megal0maniac> More n00b questions from me :)
[11:46:26] <megal0maniac> Trying to get a mega32u2 and a mega32u4 to communicate using the USART
[11:46:56] <megal0maniac> abcminiuser: Oh! You're here
[11:47:05] <megal0maniac> I'm following your tutorial
[11:47:16] <abcminiuser> GREETINGS MINIONS
[11:47:27] <megal0maniac> I am a minion today
[11:47:30] <abcminiuser> Only 10 hour work day today, yesterday was 12 :S
[11:47:34] * megal0maniac hangs head
[11:48:06] <abcminiuser> Which tutorial?
[11:48:29] <megal0maniac> The USART one. I've been spending so much time doing nothing, so I decided it was time to get productive
[11:50:42] <abcminiuser> Ah goody :P
[11:53:17] <megal0maniac> You have some minutes to spare for a fool? :)
[11:57:33] <darsie> How many avrs have you destroyed and how did you do that?
[11:58:05] <megal0maniac> Who? Me?
[11:58:33] <seldon> Fire is the most efficient way.
[11:58:33] <darsie> everyone who destroyed >0 avrs.
[11:58:44] <darsie> seldon: But you haven't done that.
[11:59:24] <seldon> Alas.
[12:00:20] <megal0maniac> Possibly one. I set DWEN to a m328 which was on a board. Supporting circuitry made it impossible to recover. Removed the cap which was supposedly the culprit, got nowhere. Sent it to RikusW to have a look and it got lost in the mail. Not sure whether it was dead or alive :)
[12:00:55] <darsie> I'm just wondering what kind of (accidental) abuse it takes to damage an avr.
[12:01:13] <megal0maniac> Swap VCC and GND
[12:01:25] <seldon> 230V AC should do it.
[12:01:51] <megal0maniac> Friend: "Where did your chip go?"
[12:01:55] <megal0maniac> Me: "Everywhere"
[12:04:48] <seldon> If you connected several pins in such a way that n of them go output-up and one output-down, you could probably fry it.
[12:06:21] <seldon> For example if you connected two sides of a seven-segment display to two different ports.
[12:09:24] <megal0maniac> abcminiuser: In your example, you use URSEL. Are there other names for this register? I'm using m32u2
[12:10:31] <megal0maniac> Also noticed that most of the registers e.g UCSRB need to be specified as UCSR1B for some reason
[12:19:22] <abcminiuser> URSEL is only in some devices
[12:19:53] <megal0maniac> abcminiuser: Just figured that out. And specifying '0' is for code compatibility with multi-usart devices
[12:20:42] <megal0maniac> I mean '1'
[12:20:44] <megal0maniac> :)
[12:42:40] <carp3> Hi, ATMEGA16A is binary compatible with ATMEGA16 ?
[12:43:01] <megal0maniac> yes
[12:44:20] <OndraSter_> check datasheets, there is even specific "upgrade" datasheet for it
[12:44:27] <OndraSter_> there might be small difference in one or two registers
[12:44:32] <OndraSter_> (usually just renaming bits, but same usage)
[13:01:04] <carp3> is there any instruction/way to 'reverse' in binary ? i mean 011000 to 000110
[13:03:43] <seldon> Instruction no, way yes (several). http://graphics.stanford.edu/~seander/bithacks.html#BitReverseObvious
[13:04:31] <seldon> Note that the 64-bit stuff makes no sense on AVR, so skip those.
[13:04:34] <twnqx> sigh
[13:04:42] <twnqx> did anyone else use an FT230X with an AVR?
[13:05:03] <twnqx> i lose data every 512 bytes i try to transmit
[13:05:58] <OndraSter_> seldon, no
[13:07:16] <seldon> ?
[13:15:20] <OndraSter_> oh
[13:15:21] <OndraSter_> it was ment for carp3
[14:48:39] <twnqx> moved serial IO to some ft2232h i had around => same
[14:48:58] <twnqx> so i wanted to use the level shifter & exterl serial adapter from the other board
[14:48:59] <twnqx> => same
[14:49:08] <twnqx> (i kept the second in reset for the time)
[14:49:13] <RikusW> could be noise
[14:49:34] <RikusW> having two tx pins connected to the same line is a bad idea
[14:49:38] <twnqx> on both serial ports?
[14:49:45] <twnqx> nah, i only did that once
[14:50:03] <twnqx> to see if it's related to the FTDIs
[14:50:45] <twnqx> the funny thing is, the software does claim to not throw a 0 into the serial port at the time at all
[14:50:49] <twnqx> there's a magic extra byte
[14:50:58] <twnqx> after the 0 comes the originally scheduled byte
[14:51:00] <RikusW> sw bug maybe ?
[14:51:07] <twnqx> on one but not the other?
[14:51:14] <twnqx> like i said, i flashed them the same image
[14:51:17] <RikusW> hmm
[14:51:42] <RikusW> and both works but one give the occasional 0 byte ?
[14:52:13] <RikusW> sounds odd
[14:52:40] <twnqx> yes
[14:52:44] <twnqx> roughly every 8k
[14:52:49] <twnqx> and later on it misses some
[14:54:35] <RikusW> odd
[14:55:41] <twnqx> Error after 8119 bytes: expected a6 got 00
[14:55:41] <twnqx> Error after 8120 bytes: expected 01 got a6
[14:55:41] <twnqx> Error after 8648 bytes: expected b6 got c3
[14:55:52] <twnqx> i just let it send 0-255 consecutively in a loop
[14:56:08] <RikusW> http://www.bestjob.com.tw/pdf/ht2001.pdf got those at a local scrapyard, its already on AT backplates for a PC
[14:56:23] <RikusW> now I can use it with my ENC28J60 's
[15:01:34] <twnqx> if it would be noise, it wouldn't be EXACTLY 528 bytes after the 0 i get a short loss
[15:02:00] <twnqx> but it's always exactly 528 bytes later
[15:02:34] <RikusW> sw bug ?
[15:21:16] <twnqx> http://pastebin.com/GhyYkA5r that causes it now...
[15:21:40] <twnqx> totally not happy
[15:21:54] <megal0maniac> Do the USART pins require any special configuration before use? (e.g. pullups)
[15:22:13] <megal0maniac> Or set to output/input
[15:26:59] <twnqx> nope, they use overrides
[15:27:19] <twnqx> i just confirmed with strace that the 0 are really going through the kernel
[15:27:42] <twnqx> the chips are roughly three weeks in manufacturing apart
[15:27:46] <megal0maniac> LED is supposed to toggle high/low based on received signal over usart. LED only toggles high, then stays high. If I kill the serial line, the LED goes low after 6 seconds :/
[15:29:04] <megal0maniac> Is tobbor dead?
[15:29:33] <twnqx> don't talk with me about USARTs at the moment...
[15:29:57] <megal0maniac> twnqx: I'm not pm-ing you ;)
[15:30:25] <twnqx> mine is inserting a 0 every ~6kB
[15:30:31] <twnqx> and i can't figure out why
[15:31:07] <RikusW> megal0maniac: Led on U2S ?
[15:31:28] <megal0maniac> U2S is telling Teensy 2.0 to blink
[15:31:46] <RikusW> using builting uart mode ?
[15:31:57] <megal0maniac> No, app mode
[15:32:44] <RikusW> so you're using U2S fw at last ?
[15:33:04] <megal0maniac> Pure C code from AS6
[15:33:05] <RikusW> or have an uart only app in the U2S ?
[15:33:15] <RikusW> using USB ?
[15:34:05] <megal0maniac> It's an app which transmits serial data using the built in usart
[15:34:30] <RikusW> without any PC interaction ?..
[15:34:42] <RikusW> I'd have used the builtin UART
[15:34:50] <RikusW> and done an app on the PC instead...
[15:35:15] <megal0maniac> Correct. LED blinks at 1hz, and sends 0xff when it goes on and 0x00 when it goes off at 9600 baud to the teensy
[15:35:18] <RikusW> way easier to debug stuff
[15:39:01] <megal0maniac> I checked with the LA and everything is fine on the U2S side. It's the teensy (or at least its code
[15:39:55] <RikusW> ah yes, you got that nice toy :)
[15:40:27] <megal0maniac> LA or Teensy? :P
[15:40:59] <RikusW> both (LA)
[15:41:12] <RikusW> actually the U2S :-D
[15:42:18] <megal0maniac> Haha. Yeah, all 3
[15:45:55] <megal0maniac> RikusW: What do you still need for debugwire?
[15:46:09] <RikusW> a lot of sw on the PC side.... :(
[15:46:29] <RikusW> the dW autobaud soft uart is nearly complete
[15:46:36] <RikusW> but that alone won't be enough....
[15:47:13] <RikusW> Either I have to make it look like a JTAGICE mkii to AS6
[15:47:19] <RikusW> or write my own debugger sw
[15:47:38] <RikusW> (a virtual mkii thats actually on the PC)
[15:47:45] <RikusW> via a virtual comport
[15:48:00] <megal0maniac> Why not native dW over serial?
[15:48:11] <RikusW> you can do that if you'd like
[15:48:16] <RikusW> ruemohr.org
[15:48:23] <RikusW> spec is in docs
[15:48:41] <RikusW> use the transistor on the TX pin to make it open collector
[15:49:38] <RikusW> TX -> E VCC -> 10k -> B VCC -> 10k -> C -> RX -> dW pin
[15:49:42] <RikusW> NPN
[15:50:47] <RikusW> you can easily mess around since U2S can turn off DWEN easily
[15:51:17] <RikusW> and default dW baud = AVR clock / 128
[15:51:30] <RikusW> so feel free to mess around a bit :)
[15:51:43] <megal0maniac> I shall have a look
[15:51:58] <megal0maniac> Eventually I'll get a dragon. I think..
[15:52:10] <RikusW> I though you got it already ?
[15:52:42] <megal0maniac> What does the PC see when you connect the dragon? USB HID or serial or something else?
[15:52:46] <megal0maniac> No, not yet
[15:52:58] <megal0maniac> Haven't written enough AVR code to warrant it
[15:53:17] <megal0maniac> And now that I'm studying full time, the well is drying up ;)
[15:54:07] <RikusW> mailing you a slightly newer version of that doc
[15:54:34] <RikusW> the dragon is a custom device
[15:55:11] <RikusW> Atmel use the Jungo drivers for all their USB stuff
[15:55:28] <RikusW> but I connected to it easily enough using libusb in Linux
[15:55:37] <megal0maniac> The beta saleae software can do low/full speed usb. When I get the dragon... :P
[15:56:06] <RikusW> dragon to PC protocol is documented
[15:56:31] <RikusW> you can hack PDI :)
[15:56:44] <RikusW> its synchronous uart
[15:56:53] <RikusW> usrt...
[15:57:47] <RikusW> in particular the debug commands
[15:57:58] <RikusW> the program commands are documented already
[16:03:42] <megal0maniac> So much to do :)
[16:07:38] <megal0maniac> I'm off. Enough avr stuff for tonight. :)
[16:09:06] <RikusW> good night
[16:13:12] <twnqx> yey
[16:13:20] <twnqx> found a workaround for my problem
[16:13:42] <twnqx> don't trust the UDRE bit
[16:14:35] <twnqx> only 4 hours...
[16:25:46] <twnqx> but this is troublesome... how can i figure out if the transmitter is ready if the UDRE bit lies to me:S
[16:30:51] <RikusW> txc bit ?
[16:38:13] <twnqx> that one is cleared by interrupt
[16:38:25] <twnqx> but if the data runs dry... i lost
[16:38:41] <twnqx> yes, purely polling code that only uses TXC works
[16:38:52] <twnqx> wait... i didn't check if it works with a dely
[16:40:48] <twnqx> yeah, still works
[16:42:26] <twnqx> http://pastebin.com/bT7UhC2F so if this code works
[16:42:38] <twnqx> but polling UDRE0 instead doesn't
[16:42:44] <twnqx> on ONE of my chips
[16:42:50] <twnqx> i am kind of lost.
[16:43:43] <twnqx> polling UDRE0 works... if i transmit only single bytes
[16:44:24] <RikusW> add a little delay before the second byte ?
[16:44:45] <twnqx> can't
[16:44:53] <RikusW> or send only single bytes ?
[16:44:59] <twnqx> the queueing code is called from interrupt handlers, they won't like it
[16:45:02] <twnqx> can't do that either
[16:45:22] <RikusW> use the UDRE interrupt instead ?
[16:45:23] <twnqx> data volume is irregular, but up to one CAN packet per ms
[16:45:37] <RikusW> ISR()
[16:45:39] <twnqx> tried that (and gave up on it) long ago
[16:46:01] <twnqx> also, same thing - queue will run dry every now and then
[16:46:19] <RikusW> when it does you need to disable the interrupt
[16:46:27] <RikusW> until there is more data available
[16:46:36] <RikusW> preferably using a ring buffer
[16:46:43] <twnqx> that's exactly what my TXC interrupt does atm
[16:46:48] <twnqx> and yes, that's what i'm using
[16:47:05] <twnqx> well, it can figure out if the buffer is empty, and just not transmit any more
[16:47:21] <RikusW> if TXC works use that..
[16:47:23] <twnqx> works perfectly on the other chip
[16:47:33] <twnqx> the restart doesn't work
[16:47:39] <twnqx> it transmits 0s randomly
[16:47:43] <twnqx> every ~8k
[16:47:51] <twnqx> and exactly 528 bytes later it loses data
[16:47:55] <twnqx> random amounts
[16:48:08] <twnqx> which according to UDRE were ready to be transmitted
[16:52:11] <RikusW> weird problem...
[16:52:23] <twnqx> yes
[16:52:32] <twnqx> weird enough i am now crapping another PCB and another IC
[17:13:51] <antto> anyone familiar with the stk500v2 compatible bootloader?
[17:21:27] <RikusW> ayesw why ?
[17:22:26] <RikusW> I've made my own one
[17:23:42] <antto> is there a command to make it return the chip "type"
[17:24:35] <RikusW> read the signature
[17:24:35] <antto> or some way to ask it how big the flash is and how big the bootloader is
[17:25:23] <antto> #elif defined (__AVR_ATmega2561__) #define SIGNATURE_BYTES 0x1e9802
[17:25:26] <antto> this i guess?
[17:26:09] <antto> and the command for it is 0x30 ?
[17:26:40] <RikusW> read AVR068 at www.atmel.com
[17:28:16] <RikusW> #define CMD_READ_SIGNATURE_ISP 0x1B
[17:29:02] <RikusW> and then again it might be a avrdude broken bootloader using #define CMD_SPI_MULTI 0x1D
[17:29:05] <antto> ah wait.. with stk500 data is wrapped into "packets" with checksum?
[17:29:36] <RikusW> yes
[17:29:42] <RikusW> v2
[17:29:44] <RikusW> not v1
[17:29:58] <RikusW> xorsum actually
[17:30:48] <antto> v2 i meant
[17:32:13] <RikusW> v1 is obsolete anyways
[17:32:33] <antto> this document avr068 - is it for v2?
[17:32:47] <RikusW> yes
[18:28:53] <twnqx> :/
[18:29:36] <twnqx> seems it doesn't like the double speed 115200 mode in 16MHz
[18:31:49] <twnqx> no.. that just lessens the problems
[18:48:58] <R0b0t1> http://www.maximintegrated.com/datasheet/index.mvp/id/4627
[18:49:09] <R0b0t1> RTC w/ internal MEMS osc.
[18:55:42] <langoliers> h
[18:57:03] <langoliers> simple atmega48 test setup, am i in the game? :) http://tinypic.com/view.php?pic=1zm2ubo&s=6
[18:58:26] <DanFrederiksen> any of you tried buying atmegas from aliexpress? as low as 0.8$ a piece
[18:59:57] <DanFrederiksen> pretty cheap if they are real
[19:00:03] <DanFrederiksen> and they probably are
[19:00:11] <OndraSter_> fake copies?
[19:00:16] <OndraSter_> desoldered chips?
[19:00:47] <langoliers> ahah
[19:01:01] <langoliers> well if it is a $2 part
[19:01:06] <Malinuss> DanFrederiksen, the cheapest I can get for (only single unit though, you propably need to buy 1000 on aliexpress) is 3$ with shipping for atmega328, but you could propably get one of the smaller ones much cheaper (I pay 1.5$ for the attiny85 with shipping)
[19:01:20] <langoliers> atmega48 s pretty cheap brand new
[19:03:35] <Malinuss> not really ;P
[19:03:48] <Malinuss> or depends where you are looking I guess, and how many you want to buy
[19:08:26] <langoliers> http://tinypic.com/view.php?pic=e6rcjt&s=6 larger image, that reset is a facepalm :( routing it under the tqfp and out at the other side for pullup
[19:09:23] <Malinuss> langoliers, not 90 dagree turns in schematics are a no-go btw.
[19:09:55] <langoliers> it is the only exception... the reset diagonally under the tqfp
[19:10:47] <langoliers> oh and crosscoupling 2 nand gates for example...
[19:11:12] <langoliers> that demands symmetry
[19:22:35] <[w_w]> lol. your xtal is 12.000000 MHz? why so many zeros?
[19:22:47] <langoliers> yeah hahaha
[19:22:56] <langoliers> some actually have them printed :)
[19:23:11] <[w_w]> o_o
[19:23:27] <langoliers> they use precision xtals for usb
[19:24:04] <[w_w]> ah significant digits... meh... now its not funny anymore.
[19:24:21] <langoliers> most have 3 zeroes on them
[19:25:10] <langoliers> and the can do about 50-100ppm btw
[19:26:41] <langoliers> removed 3 zeroes don't need them :P
[19:28:22] <langoliers> this diagonal routing of reset looks better than routing around to bottom left, but makes pd3 pd4 more isolated ;/ looks like bottom is the way to go
[19:47:50] <Tom_itx> cuts into the gnd plane
[19:48:03] <Tom_itx> you routed the power pins yet?
[19:48:15] <Tom_itx> they usually criss cross
[19:48:18] <Tom_itx> pita
[19:50:31] <Horologium> mmmm...sir loin of elk for supper.
[20:10:57] <langoliers> do you usually conenct the USB's shield ?
[20:11:37] <Horologium> I don't
[20:11:45] <langoliers> gnd it maybe ?
[20:11:53] <Horologium> sure.
[20:11:54] <Horologium> can't hurt.
[20:12:39] <prpplague> langoliers: if you are asking if on a pcb design you connect a usb connectors shield to something, then yes, normally you connect that to the primary ground via a ferrite bead
[20:12:57] <langoliers> now i only dislike that atmega8 series is not rated at 12MHz at 3.3V with an xtal ;/
[20:13:23] <langoliers> this means it must go from 5V and clamp the D+, D-
[20:13:44] <R0b0t1> DanFrederiksen: I was able to get attiny85s for like $80/ea
[20:14:31] <R0b0t1> langoliers: It's not rated for 12MHz at 3.3V, but it's rated for like 10V
[20:14:37] <langoliers> R0b0t1<< life on mars is not easy
[20:14:48] <R0b0t1> I applied for Mars 1!
[20:14:50] <R0b0t1> I would know.
[20:16:38] <langoliers> Horologium haha the pendrive i just thorn apart has it connected to a VCC plane so it does not need to filter it i guess, since it regulates 3.3V from it to itself from that :)
[20:18:05] <langoliers> but i'm unsure if it may be grounded on some motherboards
[20:18:19] <Tom_itx> i ground it
[20:18:40] <Tom_itx> doesn't hurt anything to ground it
[20:18:52] <Tom_itx> the opposite may not be true
[20:19:05] <langoliers> kk
[20:20:06] <langoliers> it is probably a groundplane then, haven't measured it and tiny vias everywhere
[20:21:59] <langoliers> not confused yet? :) read some pinouts reversed http://www.doityourselfchristmas.com/wiki/images/f/fe/Usb_pinout.jpg http://www.usbpinout.net/wp-content/uploads/image/usb_pinout.JPG
[20:22:16] <metalliqaz> I figured out why my application was constantly resetting. It was the WDT but the root cause was that apparently wdt_disable() doesn't do anything if you don't first clear WDRF...
[20:22:28] <metalliqaz> buried deep in the data sheet
[20:22:37] <langoliers> http://image.pinout.net/pinout_USB_files/pc_usb_connectors_pinout.png
[20:25:33] <Tom_itx> metalliqaz,
[20:25:40] <Tom_itx> ; Turn off WDT
[20:25:40] <Tom_itx> cli ; Turn off global interrupt
[20:25:40] <Tom_itx> wdr ; Reset Watchdog Timer
[20:25:40] <Tom_itx> in r16, MCUSR ; Clear WDRF in MCUSR
[20:25:40] <Tom_itx> andi r16, (0xff & ~(1<<WDRF))
[20:25:41] <Tom_itx> out MCUSR, r16
[20:25:41] <Tom_itx> ldi r16, WDTCSR ; Write logical one to WDCE and WDE
[20:25:42] <Tom_itx> ori r16, (1<<WDCE) | (1<<WDE) ; Keep old prescaler setting to prevent unintentional time-out
[20:25:42] <Tom_itx> sts WDTCSR, r16
[20:25:43] <Tom_itx> ldi r16, ~(1<<WDE) ; Turn off WDT
[20:25:43] <Tom_itx> sts WDTCSR, r16
[20:25:44] <Tom_itx> sei
[20:27:29] <metalliqaz> yes well i already fixed it
[20:27:36] <Tom_itx> it sounded like the WDT or reset being on a port pin
[20:27:57] <Tom_itx> as in the case of the 32U2
[20:28:32] <metalliqaz> the avr-libc doc has a suggested snippet
[20:29:44] <Tom_itx>  /* Disable watchdog if enabled by bootloader/fuses */MCUSR &= ~(1 << WDRF);wdt_disable();
[20:31:32] <metalliqaz> pretty much
[20:31:35] <Tom_itx> i think it's normally disabled unless a bootloader enables it
[20:31:54] <metalliqaz> yep, DFU uses it
[20:33:56] <Tom_itx> you can disable jtag on the fly as well
[20:34:29] <metalliqaz> yes I intend to do that when I add powersaving features
[20:35:22] <Tom_itx> MCUCR |= (1<<JTD); twice in a row
[20:35:37] <Tom_itx> this bit must be written twice within 4 cycles
[20:40:15] <Richard_Cavell> that's peculiar, having a mechanism where you have to write a bit twice within 4 cycles
[20:40:19] <Richard_Cavell> why do they do that?
[20:40:49] <Tom_itx> not sure
[20:41:00] <Tom_itx> maybe so you don't mistakenly disable it
[20:41:03] <metalliqaz> so that busted code doesn't accidentally modify those registers
[20:41:42] <Richard_Cavell> but the code to set that bit twice is identical
[20:41:51] <Richard_Cavell> seems like a strange way to do it
[20:42:00] <Tom_itx> just how it's done
[20:45:10] <metalliqaz> glad i saw that jtag thing up there
[20:45:21] <metalliqaz> i didn't know that port F was useless by default
[20:55:50] <langoliers> do you think an USB-B female connector would do fine for a led lamp charger ?
[20:57:05] <Tom_itx> mini or micro-B
[20:57:25] <langoliers> a printer connector for example
[20:57:35] <langoliers> or the mini ...
[20:57:47] <langoliers> but that requires a mini cable
[20:58:07] <Tom_itx> suit yourself then
[21:02:14] <langoliers> though it would give an 500mA limit, it is 5hour full charge with a 2.2Ah cell
[21:20:07] <langoliers> so, by default i have 100mA from the usb port, i need to requiest 500mA ?
[21:24:40] <langoliers> http://en.wikipedia.org/wiki/Universal_Serial_Bus < i have read about charging ports, is d+ and d- shorted on the motherboard, or the device shorts them together to request 500mA ?
[21:41:48] * slidercrank makes a salad of tomatto
[21:44:52] <Casper> langoliers: the charger connect the d+ and d- via some resistors
[21:45:19] <Casper> and yes, normally you have to request for more than 100mA, except when the device detect that it's a charger
[21:45:52] <Casper> then it must identify the current limit (based on the D+ and D- voltage/resistors)
[21:45:57] <Casper> and not go over that
[21:46:19] <Casper> that is in theory, in practice... the devices just take what it want...
[21:46:27] <Casper> sadly... the usb group don't care...
[22:59:17] <metalliqaz> it's been working
[23:17:58] <langoliers> is the 1.5kohm resistor pullup critical for 3.3V ? how does it scale to 5V ?
[23:18:13] <langoliers> (usbd)
[23:19:23] <R0b0t1> If I put a 32kHz clock into the external clock pin, and then ckdiv by 1024... Can I run the an attiny at 31.25 Hz?
[23:20:00] <langoliers> http://vusb.wikidot.com/hardware
[23:20:24] <langoliers> the 1.5kohm pullup to 5V is clearly not equivalent to 3.3V pullup
[23:20:44] <langoliers> R0b0t1<< yeah why not ?
[23:21:03] <R0b0t1> Well, power consumption decreases with clock speed so...
[23:21:09] <langoliers> ;/
[23:21:10] <R0b0t1> Would there be any possible gain?
[23:21:14] <langoliers> 32kHz is low power
[23:21:37] <langoliers> it is a watch crystal lol
[23:22:22] <R0b0t1> Yeah
[23:22:27] <R0b0t1> But but, if I run it at 31HZ
[23:22:33] <R0b0t1> Would it draw even LESS power?
[23:23:18] <langoliers> like any cmos thing with a clock
[23:24:00] <langoliers> a 4093 will draw like 1-15uA and every single switching gate consumes AC current
[23:24:32] <R0b0t1> But is it switching the gates that consumes current? An indefinite pause could consume power, is there a point where decreasing clock will not decrease consumption?
[23:24:32] <langoliers> 10x frequency = 10x current
[23:24:34] <dunz0r> R0b0t1: At 31Hz it would be fairly unusable :)
[23:25:04] <R0b0t1> dunz0r: Well, it could be waiting for (relatively long) interrupt events, perhaps
[23:25:23] <dunz0r> Good point. It would be very interesting to test.
[23:25:25] <R0b0t1> Like have an external RTC, have an alarm pin wake up the µC once a day.
[23:25:46] <R0b0t1> I do not have test equipment, power consumption might be too low for me to measure in any case.
[23:51:54] <shorted_neuron> R0b0t1 ... what sort of power source do you have in mind, and how long do you want the thing to run off of it?
[23:56:44] <R0b0t1> shorted_neuron, zero-point energy, forever.
[23:56:49] <R0b0t1> Nah, just like a battery.
[23:57:18] <shorted_neuron> what size battery, and how long does it need to run?
[23:58:18] <langoliers> :)
[23:58:32] <langoliers> 1 megaohm * 1uA = 1V btw,
[23:58:45] <shorted_neuron> i have a weather widget, it was pretty easy to get it under 500uA power draw, so it runs off of a 400mAh lipo for a week without any trouble. tiny solar panel makes it run forever
[23:59:24] <langoliers> a lipo will stay charged for years...
[23:59:42] <langoliers> given you do not load it