#avr | Logs for 2013-02-19

Back
[03:13:09] <RikusW> http://adamsblog.aperturelabs.com/2013/02/atmel-sam7xc-crypto-co-processor-key.html
[10:28:47] <mashku> Hi
[10:29:03] <OndraSter> hi
[10:29:03] <tobbor> OndraSter! like, totally tell us about the project!
[10:29:12] <mashku> I am trying to program atmega328 and I get error
[10:29:19] <mashku> error: prog_uint8_t does not name a type
[10:29:22] <mashku> any help?
[10:29:43] <mashku> gcc-avr 1:4.7.2-2
[10:32:13] <OndraSter> what is prog_uint8_t supposed to be?
[10:34:26] <mashku> I have no idea, its not my code
[10:34:35] <mashku> but this code compiles on other platforms
[10:35:51] <mashku> I gues uint8_t
[10:43:49] <mashku> OndraSter, ok fixed
[10:44:06] <mashku> by changing to uint8_t
[10:44:55] <OndraSter> :)
[16:47:38] <tats> i'm trying to do a system reset using the watchdog timer on an atmega1280. i tested on an atmega168 (arduino duemillanove) and it works fine. but on the 1280 after the reset the chip seems to be stuck in a loop.
[16:48:23] <tats> i believe it might have to do with the fact that after a software reset the watchdog timer is enabled at 15ms and the system doesn't have the time to disable it before the restart.
[16:51:45] <tats> here's the code containing my functions: http://pastebin.com/YP8cJnE4
[16:52:01] <tats> it's based on the doc of avr/wdt.h
[17:00:32] <tats> i actually seem to be having the same problem with my atmega168. it works fine on atmega328.
[17:28:39] <Valen> so I'm after mcu suggestions, requirements are at least one high speed PWM, pref 2. ability to run from a single lipo cell. hardware USB would be nice
[17:33:10] <Malinuss> Valen, if you want hardware usb, the number of chips are already waaay down
[17:33:28] <Malinuss> Valen, also this http://www.atmel.com/v2pfresults.aspx#(actives:!(8238,8394,8362,8282,8431,8300,8358,8392,8378,8445,8236,8449,8474,8248,8264,8447,8256,8254,8286,8462,8429,8458,8466,8400,8302,8278),data:(area:'',category:'34864',pm:!((i:8238,v:!n),(i:8394,v:!n),(i:8362,v:!n),(i:8282,v:!(0,1,2,3,4,5,6,7,8,9)),(i:8431,v:!n),(i:8300,v:!n),(i:8358,v:!n),(i:8392,v:!(0,1)),(i:8378,v:!n),(i:8445,v:!(0,3,4,5,6,7,8)),(i:8236,v:!n),(i:8449,v:!n),(i:8474,v:
[17:33:28] <Malinuss> !(0)),(i:8248,v:!(0,1)),(i:8264,v:!n),(i:8447,v:!(0,1)),(i:8256,v:!(1,2,3,4)),(i:8254,v:!n),(i:8286,v:!n),(i:8462,v:!n)),view:list),sc:1)
[17:33:34] <Malinuss> oh fuck
[17:33:45] <OndraSter> screw atmega*u* or atusb -- use xmega ;)
[17:33:56] <Malinuss> well, just go to atmel.com and click the mcu select page
[17:34:09] <Malinuss> pretty nice broswe tool they've got there
[17:34:13] <Malinuss> *browse
[17:34:45] <Valen> I'm not totally wed to AVR either
[17:34:57] <OndraSter> xmega is AVR
[17:34:59] <OndraSter> but much better
[17:35:04] <OndraSter> oh well
[17:35:04] <Valen> thats some url Malinuss lol
[17:35:17] <OndraSter> if you have some questions, use google or leave them in PM - I am off
[17:35:18] <OndraSter> gn
[17:35:23] <Valen> GCC compatible is a help too
[17:35:31] <Valen> lol, thanks OndraSter
[17:35:32] <OndraSter> yep, atxmega
[17:35:40] <OndraSter> = atmega with advanced core and more features
[17:35:42] <OndraSter> way more features
[17:35:45] <OndraSter> and lower price :P
[17:35:45] <OndraSter> gn
[17:35:49] <Valen> i was planning on searching around just figured somebody might say *this* one
[17:35:55] <Valen> eg the xmega
[17:35:56] <Valen> ;->
[17:36:34] <Valen> mcu is up against 2Mhz LED driver, so there's some competition lol
[17:36:57] <Valen> i think i have seen some of the xmegas with built in amplifiers, that'd be handy
[17:38:04] <yunta> + for xmegas, as always
[17:40:04] <Valen> xmega max vcc 3.6v?
[17:40:25] <Valen> I'll need a voltage regulator to run off a lipo cell at 4.1-4.2v
[19:24:24] <creep> Valen<< try an LDO
[19:24:49] <Valen> i'm really space constrained, so trying to minimise parts count
[19:25:06] <creep> well it is like a sot223 ic
[19:26:04] <Tom_itx> couple diodes would drop it too
[19:28:09] <Valen> all the time though
[19:28:20] <Valen> also battery constrained ;->
[19:29:17] <creep> Valen<< http://www.fairchildsemi.com/pf/FA/FAN2558.html
[19:29:44] <creep> this is 3.6V 180mA ldoFAN2558S36X
[19:29:59] <Valen> i know, but its a few extra mm of board space
[19:30:11] <Valen> the ~10mm taken up by the MCU is already lots
[19:30:40] <Valen> 10x10mm
[19:32:19] <Horologium> http://www.pcbheaven.com/userpages/High_Efficiency_Battery_Boost_Regulator/?topic=worklog high efficiency boost regulator..
[19:32:49] <creep> Valen<< this is 6 pin sot-23 lol.
[19:33:07] <Valen> yeah, see its huge ;-P
[19:33:22] <Valen> I'm going to use 604 or smaller SMD's because 805's are too big
[19:33:26] <creep> 3x3mm ;<
[19:33:47] <Valen> the competing design is 3x of those sized IC's
[19:33:54] <Valen> and a handfull of SMD's
[19:34:10] <creep> aha...
[19:34:13] <creep> get bare chips then
[19:34:17] <creep> and wire bond them
[19:34:19] <Valen> LED driver, USB lipo charger, and a comparator for undervoltage cut out
[19:34:38] <Tom_itx> 0603 are a good size to work with
[19:34:52] <Tom_itx> 0402 i can do but i didn't care for it as much
[19:34:52] <Valen> if i can replace all of those with a MCU then i can add features and make it niftier, but its still a size issue
[19:35:02] <Valen> soldermask Tom_itx?
[19:35:08] <Tom_itx> yeah
[19:35:25] <Tom_itx> i do 0603 without ok
[19:35:28] <creep> i do 0402 for fun
[19:35:42] <Tom_itx> i have some but don't care for it
[19:36:01] <Tom_itx> but i'm not making one or two of something
[19:36:08] <creep> good to see some electronic guys wtf on my board ^^
[19:40:45] <creep> 0805 is about right for soic stuff and 0603 will come handy in case sot23-6 and tqfp and dfn stuff
[19:43:21] <creep> Valen<< you rather worry about lipo safety
[19:43:41] <creep> lithium burns underwater
[19:44:48] <creep> you can be sure if somebody dies in lithium fire, or just burns down a car/house they will find you
[20:04:35] <Valen> well every mobile phone made since like 2000 seems to be ok ;-P
[20:05:01] <creep> they already have the protection circuity in the battery.
[20:05:10] <Valen> so?
[20:05:59] <creep> you decide
[20:07:03] <Valen> I use lipos in combat robots all the time
[20:07:15] <Valen> modern lipos aren't that bad
[20:09:59] <creep> sure they are not that bad, i tried them a few weeks ago
[20:10:16] <dunz0r> I use LiPos in my robots too, without protection circuits.
[20:10:32] <dunz0r> As long as you don't overcharge, short circuit or puncture the packs, your safe :)
[20:10:40] <creep> took about 30 seconds to summon a nice fire
[20:10:49] <creep> difficult to extinguish
[20:11:00] <Valen> shorting and puncturing aren't that bad, they don't catch fire any more as a rule
[20:11:01] <Valen> just smoke
[20:11:12] <Valen> and did you do something silly to cause that creep?
[20:11:26] <creep> yes tested a thing like you are building
[20:11:33] <dunz0r> The weight/power ratio is hard to beat in LiPos.
[20:11:48] <creep> had a buck regulator charger charging it unattended
[20:12:19] <dunz0r> Well... no shit.
[20:12:21] <creep> i was lucky to hear the boom
[20:12:25] <Valen> I am using a commerical linear charger running from USB
[20:12:33] <Valen> so I'm not that worried
[20:12:41] <dunz0r> creep: Did you charge it in a fire safe bag like you should?
[20:13:09] * dunz0r charges with a fancy RC-charger with the battery in a safety bag
[20:13:19] <dunz0r> Sort of fancy at least, it's got a display and everything
[20:13:37] <creep> well it was just put into a thick glass bowl, and power sourced with a lab supply. but it exploded and the cells flown across the room igniting stuff
[20:17:35] <creep> i still don't know what was the trigger, i have used the lamp for weeks
[20:18:09] <creep> used 0.5% voltage reference to set 4.18V limit
[20:18:23] <creep> and used 1A current source limit too
[20:21:29] <creep> but i was always unconfident about buck regulator charging lithium cells, because of the dc connection to the input source through the pnp transistor
[20:24:40] <Valen> to be safer a fuse and an over voltage cutout would be an idea
[20:24:45] <Valen> as an independant circuit
[20:25:04] <Valen> but overcharge is about the only thing that will cause lithium problems these days
[20:25:05] <creep> this sounds magical
[20:25:40] <Horologium> what happens when you charge them if they are too cold?\
[20:25:42] <Valen> not really, i mean its a comparator and a fet
[20:25:53] <Valen> decent charger shouldn't do that
[20:25:54] <creep> Horologium<< no idea :)
[20:26:03] <creep> won't take charge maybe
[20:26:13] <Horologium> have been told it is not good to do so but didn't catch why.
[20:26:17] <Valen> charge them at low rate till they warm up is the advice i have
[20:26:19] <Horologium> need to talk to the battery guy about that.
[20:26:32] <Valen> if the electrolyite is frozen weird shit is going to happen in the cell
[20:26:45] <Horologium> he has coil heaters under the batteries in his car and the charge circuit won't kick on till they are above 0C
[20:26:45] <creep> Horologium<< well, the stuff freezes, and it is definitely bad for electrolyte mobility
[20:30:34] <creep> i like the a123 type, that is not that explosive and less fire hazard, and environmentally friendly
[20:30:45] <creep> btw it has a 3.6V fully charged voltage...
[20:31:03] <creep> 3.3V nominal
[20:31:19] <creep> so Valen may prefer using it and not have ldo
[20:31:21] <Horologium> I just avoid charging batteries outside their natural habitat.
[20:31:41] <creep> but unfortunately they are not small... like 18mm diameter and 65mm long
[20:32:19] <creep> ( this is the 1.1Ah cell )
[20:33:07] * Horologium pats his stack of 24AH 12V gell cells.
[20:33:27] <creep> http://www.a123rc.com/category-66-b0-A123RC+ElementCell.html
[20:33:28] <creep> :)
[20:33:44] <creep> i'd pat 4 of this instead http://www.a123rc.com/goods-468-Excitingly+Powerful+A+123+20ah+PRISMATIC+CELLS.html
[20:34:04] <Horologium> bought a pallet of them....brand new still in individual packing...nobody else bid on them...got the pallet for 5 dollars.
[20:35:03] <Horologium> wonder how long my house would run on 2400AH of battery power.
[20:35:26] <creep> well if you use up 10% of it, then not too long
[20:35:49] <creep> since they do not like to be fully discharged unless they are deep discharge gel type
[20:36:22] <creep> and you can count on 100-250 cycles from it
[20:36:56] <Horologium> not sure what they were meant for but they are the size of a car battery.
[20:39:58] <creep> car batteries are meant to be used for starting the car ;) not deep cycling
[20:40:20] <Valen> get an optima yellow top or whatever
[20:40:26] <Valen> it'll start your car and deep cycle
[20:41:06] <Horologium> think I will likely ebay these like most stuff I get from the auctions.
[20:42:26] <creep> for long term i'd definitely get a123 packs, or at least some lifepo4
[20:44:04] <creep> nah started hacking another piece of shit from tesco corps
[20:44:21] <creep> it was an ir toaster oven
[20:44:32] <Valen> I'd go A123 if they would fit, lifepo4 how are they for life these days?
[20:44:38] <Valen> A123 claimed 10 year calander life
[20:45:01] <Valen> I have seen an A123 shoot the end out of itself like a cannon btw
[20:45:11] <creep> not sure, the lifepo4 are lower current, but they used to say 2000-3000 cycles from those too if not abused
[20:45:28] <Valen> thats what A123 claimed and i believe they got pretty close
[20:45:38] <Valen> A123 is lifepo4 just brand named
[20:45:44] <creep> a123 is just the original developer/inventor and they make the best quality
[20:46:37] <creep> i'm sure most cheap replica from china uses the plans from a123systems ;)
[20:46:52] <Valen> yeah but with crap QC
[20:46:57] <creep> how good are they remains a question
[20:46:58] <Valen> and with chemistry QC matters
[20:47:04] <krphop> is there a way to use the value in a variable as a variable? like x = "portd"; $(x) = blabla
[20:47:23] <Roklobsta> hey, have any of you messed with Atmels zigbee family of radio chips?
[20:48:04] <creep> krphop<< no.
[20:48:12] <creep> C is not a script
[20:48:17] <krphop> damn heh
[20:48:40] <Valen> A123 are gone now arent they
[20:48:55] <creep> krphop<< it compiles to native cpu instructions
[20:48:57] <Valen> pragmas might do what you want or pointers
[20:49:32] <Valen> perhaps even macros
[20:49:36] <creep> just use a macro ?
[20:51:47] <krphop> hmm, ok, i'll look into those options
[20:51:58] <Valen> the other issue with lifepo4 cells is the lack of a super easy to use 1 cell linear USB charger ;->
[20:52:06] <krphop> is there a 'name' for using variables as i described?
[20:52:19] <Valen> what are you actually trying to do?
[20:52:56] <krphop> for example - port = "PORTD"; $(port) |= _BV(1);
[20:53:03] * Valen has a feeling you are trying to independently create pointers
[20:53:11] <Valen> no thats a line of code
[20:53:16] <Valen> what are you trying to do?
[20:53:26] <krphop> i'm trying to use the value of a variable as a variable
[20:53:37] <Valen> wht?
[20:53:43] <Valen> why?
[20:53:45] <krphop> or rather, use the value of a variable as a register
[20:53:50] <krphop> to do just what i posted
[20:54:10] <krphop> sorry, n00b at c and avrs
[20:54:14] <Valen> no, you still being too low level
[20:54:30] <Valen> you are trying to do something and this is the way you have determined to do it
[20:54:33] <Valen> what are you trying to do
[20:54:40] <krphop> i'm writing a function to do my port writing for me
[20:54:56] <creep> what are your opinions on ir lamp vs halogen lamp ?
[20:55:12] <Valen> what do you mean do your port writing
[20:55:12] <krphop> so i don't have to specify specific ports/pins in the actual code, aside from variables to point to pins
[20:55:33] <krphop> to write to a port output
[20:55:47] <creep> Valen<< with a123 you can do a light bulb or whatever current limiting to 10A, and turn charging off with a mosfet after reaching 3.65V
[20:56:01] <Valen> you can do that with lipo too if you want
[20:56:10] <creep> hahaha
[20:56:10] <Valen> or any CC/CV charge
[20:56:29] <Valen> do keep in mind it'll only charge to 70-90%
[20:56:45] <krphop> or rather, to write to a port register
[20:56:53] <creep> you try this with an 1-3Ah lipo and i'm sure it will burst into flames
[20:57:11] <Valen> krphop: it sounds like you want defines
[20:57:19] <Valen> #define SOFT_POWER_PORT PORTE // holds the power on
[20:57:19] <Valen> #define SOFT_POWER_PIN PE6
[20:57:42] <Valen> then in the code I just do operations on SOFT_POWER_PIN
[20:58:35] <krphop> so to go HIGH on that, you'd do SOFT_POWER_PORT |= _BV(SOFT_POWER_PIN); ?
[20:59:19] <creep> Horologium<< haha lol, i can use the heater lamps from laser printers in an ir oven i think
[20:59:20] <Valen> I use the avr035 stuff so its a bit simpler
[20:59:35] <Valen> //self power switch, out and off, turned on in main()
[20:59:35] <Valen> SETBIT(SOFT_POWER_DDR,SOFT_POWER_PIN);
[20:59:35] <Valen> C_CLEARBIT(SOFT_POWER); //hold power on
[21:00:16] <Valen> creep: the lipo only cares about the current coming in, it cares not how you limit it
[21:00:42] <creep> Valen<< lipo limit is officially 1C, some types state 2-3C
[21:00:44] <Valen> krphop: that sets the DDR direction, and then clears that pin
[21:00:51] <Valen> new ones do 5C
[21:00:59] <creep> charging a li-po/li-ion above 2C is hot
[21:01:18] <Valen> its within the specs its within the specs
[21:01:18] <creep> ok i won't do that
[21:01:26] <Valen> I wouldn't either
[21:01:32] <Valen> but it won't instantly catch fire
[21:01:42] <krphop> Valen: ok, i'll go read that doc and see what i find
[21:01:54] <krphop> thanks!
[21:01:55] <Valen> everybody is needlessly terrified of lithium
[21:01:57] <creep> how does this differ from a halogen lamp? http://gongtao.en.alibaba.com/product/618443059-214100976/Quartz_Short_Wave_Infrared_IR_Lamps.html
[21:02:11] <Valen> any battery is dangerous
[21:02:21] <creep> it heats to lower temperatures and it is not even air-tight i think
[21:02:35] <Valen> I've had lead acids explode and throw boiling sulphuric acid everywhere
[21:02:47] <Valen> ni-mh's spew KOH around
[21:03:04] <creep> Valen<< they put KOH in your food
[21:03:19] <Valen> the SLA's give off a nasty chlorine type gas too it felt like
[21:03:30] <Valen> there is a question of concentration creep
[21:03:42] <Valen> this stuff took finger prints off in about 15 seconds
[21:03:46] <creep> ok, don't eat the ni-mh acid
[21:03:59] <Valen> its a base i believe
[21:04:08] <creep> yes
[21:04:28] <Valen> and i've been burnt from shorts with pretty much every kind of cell
[21:04:38] <Valen> they are a little packet with an buttload of energy in them
[21:04:41] <Valen> be careful!
[21:05:20] <Valen> but people are friggin blasé about petrol, packed full of all sorts of fire, and carcinogens
[21:07:34] <creep> oh i see
[21:07:35] <creep> Energized, the quartz tube blocks and absorbs 95% of near infrared and visible light sent up from heat alloy wire, which make the temperature in the tube rise, producing pure silicon-oxygen bond of molecular vibration, radiation far from the red line. 95% of visible light, near-infrared light can be transformed into far-infrared radiation,far infrared ray with the wavelength>2.5 micron is named as far infrared far infrared. Far-infrar
[21:07:35] <creep> ed heating refers to the use of 2.5 to 25 microns wavelength radiation heating technology.
[21:07:47] <creep> soo, the quartz tube is the magic
[21:08:43] <Valen> krphop: if your looking to pass pins and stuff into functions look at pointers
[21:09:05] <Valen> but there be dragons ;-P
[21:17:06] <rue_shop2> the -e option on the avr ERASES THE EEPROM TOO!
[21:34:09] <krphop> Valen: ok, after reading avr035, maybe i should explain the issue i'm having
[21:34:30] <krphop> i was previously bit shifting to write to my port addresses
[21:34:43] <krphop> like PORTD |= (1 << PIND7)
[21:35:08] <krphop> but what i was finding is that is actually writing 1 to the less significant bits as well
[21:36:09] <krphop> i wonder if i have a compiler issue
[22:02:25] <Casper> krphop: that turn on the 7th bit on PORTD, leaving the others as it
[22:02:57] <Casper> and not "only the bit 7"
[22:27:02] <Valen> you never have a compiler issue ;-P
[22:30:18] <krphop> Casper: it 'should' yes, but doesn't seem to be doing so
[22:30:46] <Valen> whats the other pin doing
[22:30:49] <Casper> are you sure that there is no constant before that?
[22:30:51] <Casper> I mean
[22:30:53] <Valen> have you perhaps damaged the AVR
[22:31:08] <krphop> its possible i've the chip is wonky, i dunno
[22:31:25] <Casper> if gcc see that something before changed it, and you then change it again, and nothing between those 2 could have changed it, it's possible that it save time by not reading...
[22:31:40] <Casper> oh
[22:31:46] <Valen> writing a byte to the port is pretty common, you aren't going to have a compiler bug there
[22:31:58] <Casper> you mean that you see it on the output? and not analysing the code generated?
[22:32:00] <Valen> blowing a chip to short 2 pins internally however is also pretty common
[22:32:12] <krphop> Casper: yeah
[22:33:04] <Casper> try to write the value directly, if it still fail then you have a blow chip
[22:33:37] <krphop> as in write with a bit mask instead of bit shifting in? i'll have to test that
[22:34:01] <Casper> no
[22:34:03] <Valen> the end result should be the same
[22:34:09] <Valen> it'll optimise it out
[22:34:15] <Casper> PORTB=0x80;
[22:34:23] <krphop> Casper: so, bitmask...
[22:34:46] <Casper> direct value...
[22:34:47] <Valen> note also that is not performing the or function
[22:35:18] <Casper> not a mask... if a direct value still give an issue, you are sure that it's not a compiler or bug
[22:37:06] <Valen> also reduce your progam to the minimum
[22:38:22] <Casper> DDRB=0xFF; PORTB=0x00; _delay_ms(250); PORTB=0x01; _delay_ms(250); PORTB=0x02; _delay_ms(250); PORTB=0x04; _delay_ms(250); PORTB=0x08; _delay_ms(250); .... and so on
[22:38:43] <Casper> walking bit could be good to see if all is in good shape
[22:39:18] <Valen> dont forget a 0x00 in there
[22:41:48] <Casper> true
[22:41:51] <Casper> hey
[22:41:52] <Casper> it's there
[22:45:08] <Valen> Casper: lol right
[22:45:12] <Valen> didn't see that one
[23:05:06] <krphop> ok, its the writing of 0s thats an issue i think
[23:06:01] <krphop> doing the direct value worked fine across the board
[23:06:05] <krphop> just one pin at a time
[23:06:39] <krphop> but take a look at this - http://pastebin.ca/2315870
[23:06:49] <krphop> so this walks up my portB lighting up LEDs
[23:06:57] <krphop> but then it turns them all off at once
[23:07:11] <krphop> instead of walking back down
[23:09:14] <krphop> Casper: ^^
[23:13:24] <Casper> DDRB=0x3F; ← why?
[23:13:33] <Casper> incomplete port?
[23:13:44] <krphop> yeah, PORTB7 and 8 are my crystal
[23:14:01] <krphop> err, 6 and 7, sorry
[23:14:37] <krphop> if i swap and use this - http://pastebin.ca/2315871
[23:14:41] <krphop> it works fine
[23:14:44] <krphop> walks up and back down
[23:16:49] <Casper> wait is it port B or D that is in trouble?
[23:16:59] <krphop> any of them
[23:17:00] <krphop> oh shit
[23:17:05] <Casper> I wrote B in the example, but you said D earlier...
[23:17:16] <krphop> i have ~ in the wrong spot!
[23:17:38] <krphop> PORTB &= ~(1 << PORTB5); works
[23:17:39] <krphop> PORTB &= (~1 << PORTB5); does NOT
[23:17:45] * Casper slaps krphop :D
[23:18:29] <krphop> fsck'ing nots
[23:20:22] <Roklobsta> make a define to deal with that. In fact I recall there are some in avrgcc headers to help with that stuff.
[23:20:49] <krphop> i'd like a function that sets based on a string whether its 0 or 1
[23:20:57] <krphop> so i don't have to if out the value in the code
[23:21:07] <krphop> which, i guess now that i know wtf was wrong, i can do
[23:24:50] <Roklobsta> use the _BV() define.
[23:25:06] <Roklobsta> as in SS_PORT &= ~(_BV(SS_BIT));
[23:25:31] <krphop> yeah, but i still have to if out whether its a 0 or a 1 so i can AND vs OR it
[23:26:23] <Roklobsta> maybe the olde "x?y:z" might help.
[23:30:27] <Casper> ... it's funny that they deprecated _BV() and undeprecated it later on...
[23:41:20] <Roklobsta> *they*