#qi-hardware IRC log for Saturday, 2016-04-02

wpwrakthe boost regulator's enable input is a bit trickier than one would expect. only about 160 mV between rail and Vil/Vih. so significant leakage means that the pull-up has to burn a fair amount of power.02:53
wpwrakpage 4 of http://downloads.qi-hardware.com/people/werner/anelok/tmp/anelok-20160401.pdf02:55
wpwrakpull-up is R4, the transistor in question is Q102:55
wpwrakbefore i had an n-FET, but they can leak a lot more than a BJT02:55
wpwrak(note that gate/base is uncritical in this case, since this is basically USB's VBUS)02:56
DocScrutinizer05I'd use a cmos clock chip and a decent complete off11:17
wpwrakit's for disconnecting the battery when USB power is present ;)11:35
DocScrutinizer05why do you even need that?11:37
wpwrakbecause i won't want to empty the battery when i have usb power ?11:40
DocScrutinizer05but you empty the battery all the time when you don't have USB11:48
wpwrakwell, yes, if i don't have USB power, the battery is all i have :)11:50
DocScrutinizer05so what's the use to save some 20 minutes out of a month?11:51
wpwraksome people may keep their anelok connected most of the time11:52
wpwraksome won't, of course11:52
wpwrakthe latter group will have to buy batteries more often :)11:53
DocScrutinizer05well, I just can repeat myself: A cmos clock and goldcap backed up by battery, a decent powerbutton, and device getting powered up permanently when on USB11:54
wpwraksupercap problems, no thanks ;)11:56
wpwrakbesides, they're huge11:56
wpwrakand probably rather expensive, too11:57
DocScrutinizer05do the math, then reject11:58
DocScrutinizer05you need a goldcap for how much? 5 minutes?11:59
DocScrutinizer05you prolly can use a tantal capacitor12:00
wpwrakthe problem isn't time but that supercaps don't start cheap. the cheapest is about USD 0.50 and is large12:01
wpwrakbesides, such a circuit would complicate time management quite a lot. especially for RF.12:01
arossdotme total cost of ownership? $0.50 id say is cheep compared to buying a 2rd batt12:02
arossdotmeto replace the original dead one in the future12:02
wpwrakTCO = (cost(supercap) + cost(cmos clock)) * 3 + cost of supercap problems12:03
arossdotme+1 for using a supercap12:03
DocScrutinizer05what supercap problems?12:03
arossdotme(idk nothing about the problems, i just like the idea, if its a pain, then fine)12:04
wpwrakso that TCO is about ten batteries :)12:04
arossdotmehmm ok12:05
arossdotmei think i could still live with that12:05
DocScrutinizer051,5V: http://www.digikey.com/product-detail/en/ams/AS1801-BTDT/AS1801-BTDTTR-ND/309513612:08
DocScrutinizer05beat that12:10
wpwrakdon't forget that RF has timekeeping as well. and i will not necessarily have control of that stack. so even if i manage to "migrate" my RF time between chips, that may be of no use and i'd have to keep the system on regardless12:10
DocScrutinizer05you completely lost me12:14
wpwrakbesides, i may have to turn off the boost regulator also to prevent reverse charging. data sheet isn't entirely clear on that.12:15
DocScrutinizer05when you can't control the sytemtime in parts of your system, then you are doomed anyway if you depend on that time, no?12:15
wpwrakthe part that controls it is also the one that depends on it. all i have to do is ensure that it's powered12:15
DocScrutinizer05that's why I said "use a decent power button that triggers a `keep on` circuit"12:16
DocScrutinizer05sorry, I can't follow12:17
wpwrakbut that's something that's "always on" ... (BTLE)12:17
wpwraki do have a mechanical power switch for it (rfkill) if you don't want to use it. but it you use it, it has to be on.12:18
wpwrak(follow) at least initially i don't control the firmware inside the BTLE chip. so i can't make it use fancy time migration schemes. i don't even know if if they could be implemented in a useful way. communication protocols are not afraid of using pretty demanding timing.12:21
wpwrakso without prior solid R&D i wouldn't want to depend on such a scheme12:21
DocScrutinizer05you already depend on such a scheme for battery swapping12:24
DocScrutinizer05where your complete system loses time12:25
DocScrutinizer05you need to set time in BTLE when iuser turns it on with switch, no?12:25
DocScrutinizer05now extend your "battery swapping" time to days, with a decent power-off scheme, and resume from "battery-swap" off with the pretty nice time from CMOS RTC12:28
DocScrutinizer05heck, you even could use the RFKILL switch for powerswitch instead12:29
wpwrakfor battery swapping, i depend on something that's inexpensive and reasonably simple. and RF will inevitably go down when you swap the battery. no problem with that.12:29
DocScrutinizer05so which problem with a cmos clock instead?12:30
wpwrakrfkill has a specific purpose12:30
wpwrak$$$ and doesn't add anything useful12:30
DocScrutinizer05do your math12:30
DocScrutinizer05you're fighting 5 dozen problems that arise from trying to keep MCU always powered12:32
wpwrakas soon as RF enters the picture, i need to have power always anyway12:32
DocScrutinizer05huh? why?12:32
wpwrakbecause of timing. RF sleeps, then wakes up, briefly does its thing, then sleeps again. all this with precise timing.12:33
DocScrutinizer05I guess I missed to read the product reqirement spec12:33
DocScrutinizer05I wouldn't want to carry an always-on RF device with me12:34
wpwrakyou have rfkill to turn that off :)12:34
wpwrakno. rfkill is specifically for the tin hat faction. kill RF, let you use anelok.12:35
DocScrutinizer05yeah, evil anelok could be rooted so it enables RF in software when device powered on, even when code says it shouldn't12:36
wpwrakexactly. and don't forget that, at least for some time, i don't control the firmware in the RF chip.12:37
wpwrakmuch like we don't control the fw in the neo900 modem12:37
wpwrakbut that rfkill switch goes a bit beyond what we do there and is really impossible to bypass12:39
DocScrutinizer05so? we don't have a hw power switch for Neo900 modem either12:39
wpwrakyes, anelok doesn't have that vulnerability :)12:39
DocScrutinizer05when you system in control gets hijacked, there's nothing you can do except shut it down completely12:40
DocScrutinizer05please provide a product requirements spec, with usecases12:41
DocScrutinizer05(whn your system in control...) IF you even notice that rogue condition12:42
wpwrakis the "secure core" gets compromised, you obviously have a problem12:42
DocScrutinizer05there's no use in having a hw switch in your PCs internet cable, to mitigate virus attacks12:42
wpwrakthat rfkill also has some marketing dimension. it's an intuitively safe way to do it.12:43
wpwraksome people airgap their computers12:44
wpwrakand of course, that means no wireless either :)12:44
DocScrutinizer05please provide a product requirements spec, with usecases12:47
wpwrakanyway, no supercap, no clock chip, no I2C bus12:47
wpwraki don't have a finished document of that sort. but you can find most of the relevant information on the list12:48
DocScrutinizer05yeah, rather FETs and BJTs and buffer caps and always-on boost converters and pullups at the cliff of nA (my DMM ends there) and timekeeping with untuned crystals and battery swapping tricks and12:48
DocScrutinizer05I'd do a proper I2C rather, every day12:49
DocScrutinizer05to a 50ct RTC chip, with a 30ct cap as bupbat12:50
DocScrutinizer05and shut the whole rest down when not iused12:50
wpwrakmore like 50 cts. or 80 cts if you want specs that say that you can actually solder it.12:50
DocScrutinizer05you save that easily on other components that are not needed anymore12:54
DocScrutinizer05well, almost. When you count in assembly and complexity and design, more than compensate it12:55
DocScrutinizer05when user keeps anelok on USB 99% time, just don't 'switch it on' since it's always powered when on USB12:56
DocScrutinizer05nuke your whole USB-shots-dwon-battery12:56
DocScrutinizer05shuts-down even12:56
DocScrutinizer05battery swap? nuke the whole nifty RC timekeeper stuff12:57
DocScrutinizer05forget about quiescent currents completely since the device is 99.9% time off12:57
DocScrutinizer05forget RFKILL since you shut down the complete device12:58
DocScrutinizer05yeah you would need sw driven 'RFKILL' then for the 3 minutes you want to use anelok UI without BTLE12:59
DocScrutinizer05I guess even tinfoil hats can cope with that12:59
DocScrutinizer05if they *realy* are afraid RF could be infested with weird hacks or flaws, they won't switch on anelok in a security sensitive environment and situation, before they have inspected system state to make sure there is no such hack or flaw13:01
DocScrutinizer05you already got a RF-LED I've seen. Should be just good enough togethher with a sw-controlled power switch13:01
DocScrutinizer05and you can be absolutely sure your device will keep accurate time and not eat more than 500nA from battery when powered down13:02
DocScrutinizer05pretty simple to evaluate and verify from schematics, could prolly even get done algorithmically13:03
wpwrakthe rf led is for development. no really mean to be seen from the outside13:03
wpwrakonly the sMCU LED is intended to be visible13:03
DocScrutinizer05hmmm, how about you make that a dual-color LED then?13:04
DocScrutinizer05<1mA for blue is pretty much sufficient. Allow users who are more interested in a RF-always-on than a "I see RF is on" to break a 0R with a toothpick, to disable the LED13:07
wpwrakhmm, nasty trace, going all across the board. it would also leave the 3rd LED still internal. so for some development you'd still need to remove he case13:08
DocScrutinizer05err, there are 3-color LEDs ;-)13:08
DocScrutinizer05aka RGB13:09
wpwrakyou certainly have a taste for expensive components :)13:11
DocScrutinizer05decent design sometimes needs decent components13:11
wpwraki'd be more concerned about fringe features getting way too much weight :)13:13
wpwraklemme see how RGB vs. 3 LEDs compare, cost- and sourcing-wise ...13:14
wpwrakleds leds, 13 cents, all three of them. sourcing obviously not an issue. now, rgb, 3.3V compatible,  ...13:15
wpwrakhehe, there's a red, UV, yellow-green tri-color LED ;-)13:16
DocScrutinizer05seems a RGB LED could be even cheaper than 3 monochrome LEDs13:19
DocScrutinizer05for sure not significantly more expensive13:20
DocScrutinizer05DK lists 604 components LED RGB13:21
DocScrutinizer05that's an absolute fringe topic regarding CMOS RTC 13:21
wpwrakthis one is only 21 cents. no too much more expensive.13:21
wpwrak(blue has Vf = 3.1 V, so that's still 3.3 V compatible)13:22
DocScrutinizer05yes, I picked blue for RF for a reason, it has best efficiency at 3.3V13:22
wpwrakwell, let's check the tolerance ...13:23
wpwrakmmh. max 3.6 V. not so good.13:23
DocScrutinizer05forget tolerance, those Vf 3V1 are for nominal If13:23
wpwraksure. around 10 mA or less it should be nice13:24
DocScrutinizer05I suggest 1mA13:25
DocScrutinizer05or 2 maybe if you go flashy13:25
DocScrutinizer05If-nominal are 25mA13:26
DocScrutinizer05so tolerance is negligible13:26
wpwrak20 mA in this case13:26
wpwrakyes, but that's abs max, not the test current for Vf13:28
DocScrutinizer05aah k13:28
DocScrutinizer05I guess the LED is rather 'boring', I'd rather discuss the RTC ;-)13:29
DocScrutinizer05Vmin 0.9V, Vbat 1.2V, that's a 0.3V discharge at 500nA13:30
DocScrutinizer05500nA * 240s / 0.3V13:32
DocScrutinizer05~500E-9 * 240 / 0.313:32
DocScrutinizer05~500*10**-9 * 240 / 0.313:32
wpwrakno need to over-optimize leakage. the AAA will chemically leak after a few years anyway, so a few uA are fine.13:34
DocScrutinizer05(400uF) for a 4 minutes. So much about "goldcap price and problems)13:35
wpwrakand your RTC is still incompatible with BTLE. plus it doesn't accomplish proper battery separation on USB. you could do that by software, but that's a high-risk proposal, given that you'd have quite different threshold voltages13:38
DocScrutinizer05well, you really don't see what I suggest13:39
wpwraknaw, the current design is nice. enough. if someone shows me that BTLE can be made to work with such an external clock chip, then i might consider it for some future revision, but for now, i'd play it safe.13:40
DocScrutinizer05how is a RTC incompatible where a systemclock with RC based guessing of power-down time isn't ?13:40
wpwrakBTLE has nothing to do with that13:40
DocScrutinizer05so how does a RTC?13:41
wpwrakBTLE needs accurate wakeups for protocol timing. if you cut power, it can't wakt up. so you would have to synchronize the power-controlling clock system with the wakeups required by the protocol stack.13:41
DocScrutinizer05and how don't you need exactly same for battery swap now?13:43
wpwrakthat's all the details i know about the BTLE side. i don't know how long the pauses are and how precise the timing has to be. i would expect that it requires high accuracy, in the order of microseconds. this sort of protocol timing often does.13:43
DocScrutinizer05you completely lost me, I dunno what you're talking about13:44
DocScrutinizer05do you suggest to do battery swapping during a BTLE pause of 2ms?13:44
wpwrakbattery swap is unrelated. RF goes down when you swap the battery. that's not a problem - it'll recover after powering back up. RF protocols are designed to tolerate losses and such.13:45
DocScrutinizer05SO WHAT's THE PROBLEM WITH A RTC INSTEAD RC THEN? and allow "battery swap" to take 10 days of power down13:46
wpwrakbut an energy-efficient protocol can not afford sloppy timing. don't forget that sending and receiving (listening, where there is incoming data or not) are both almost equally expensive.13:46
DocScrutinizer05Oh My Gosh!13:46
DocScrutinizer05you just said RF is down during battery swap, and damn yep it better is13:47
wpwrakwhat i'm trying to get you to understand is that your "mostly off" operating scheme is not compatible with BTLE.13:47
wpwrakand we've already solved battery swap. no need to return to that.13:48
DocScrutinizer05so your anelok is an always-on RF device???13:48
wpwrakwe have a simple and sufficient solution for that. now you're proposing a much more comoplex solution.13:48
DocScrutinizer05honestly, provide product requirement specs!13:48
wpwrakwhen BTLE is enabled, then the chip is "always on", yes13:49
DocScrutinizer05I don't want a security dongle that has RF enabled all the time. Heck I don't even want my phone to have BT enabled all the time13:50
DocScrutinizer05I'm out. I don't know the product requirements so any design effort is pointless13:52
wpwrakit's just a question of connectivity. being able to be reached doesn't mean that it has to answer. but it may alert the user of an incoming request. then the user can choose what to do with it.13:52
DocScrutinizer05I'm out. I don't see how anelok "alerts user" when carried in pocket13:53
wpwrakit doesn't ;) but if it's on you desk, it will wake up and tell you what's going on13:54
DocScrutinizer05which point in product requirement specs is that?13:55
wpwrakso your workflow is: do whatever you're doing on your PC / mobile device. then pc / mob generates a request to anelok. anelok evaluates request and turns on. user then acks or denies request.13:57
DocScrutinizer05sorry I'm out. Not going to evaluate usecases on an adhoc basis13:58
DocScrutinizer05just a last comment on this one: why does anelok need to power up automatically and ask user to accept/deny? why can't user enable anelok *before* the request comes in?13:59
DocScrutinizer05and I don't expect an answer, I'm out13:59
DocScrutinizer05actually an answer doesn't make sense without context of a comprehensive collection of usecases which need to get optimized then to have a canonical design solution14:01
wpwrakpre-authorizing requests is a possibility i wouldn't exclude. in this case anelok would not have to alert the user and could answer automatically. but that would be one of those "for future study" scenarios14:04
DocScrutinizer05sorry I'm out. making arbitrary usecases from design details that are derived from... dunno component properties doesn't really make sense14:06
wpwrakso for now i assume that users want to acknowledge each transaction explicitly. in any case, this doesn't affect things as far as BTLE is concerned.14:06
DocScrutinizer05it does affect whole device design, since you could simply switch on the device before you expect any request to come in14:07
DocScrutinizer05and now for real, I'm out. Thi sleads nowhere and we got 18°C in the big bluebox14:08
DocScrutinizer05not only tinfoil hat anelok users will switch on RFKILL switch before they expect such request to happen, anyway. And they also will switch off RFKILL after they're done. So what's the problem with shutting down whole device with that "RFkill switch" and only keep a CMOS RTC running?14:16
DocScrutinizer05*massively* simplified more clean and more reliable design14:17
DocScrutinizer05http://media.digikey.com/pdf/Data Sheets/Austriamicrosystems PDFs/AS1801.pdf16:11
DocScrutinizer05just needs a diade from 3V3 Vdd to chip Vcc, and a resistor from battery to chip Vcc16:12
DocScrutinizer05assuming you don't run the rest of device in low power mode for significant fractions of time, and instead just switch it on when needed and then power it off again16:14
DocScrutinizer05or you already connect Vcc chip to system Vdd, and connect the battery more or less directly to chip's Vbat16:18
DocScrutinizer05(more or less directly) via a resistor that doesn't drop more than 0.2V@500nA16:19
DocScrutinizer05or even a diode, you told diodes can do that too16:20
DocScrutinizer05so your bom is: chip, diode, 220uF or even higher, depending on your batt swap time, plus the I2C stuff16:22
DocScrutinizer05plus you might want to dual-use the crystal, connecting SQW out to MCU's Xi32k16:23
DocScrutinizer05dunno what's your requirements for 32kHz on MCU without running a realtime clock there16:25
DocScrutinizer05when you don't need the 32kHz on MCU anymore, you even gain the 2 IO for I2C16:26
DocScrutinizer05and you don't need to worry at all (no hw powerfail, sw either) about 'closing shop' at powering down16:27
DocScrutinizer05waaaaay simpler and more solid design16:28
wpwrakstill rather heavy just to keep time through a battery swap16:30
DocScrutinizer05it's not to keep time trough battery swap, it's to keep device off when not in use16:31
DocScrutinizer05thus voiding all your quiescent current worries you constantly discuss here16:31
wpwraki don't think it can do that. or rather, it would need additional logic16:31
DocScrutinizer05yes, that logic is a hardware switch to power down whole anelok except RTC16:33
DocScrutinizer05switch on: everything up, incl LEDs and display, switch off and only RTC sucks battery16:34
DocScrutinizer05no shut down needed16:34
wpwrakto do it properly you'd need to be able to software-control the interrupt pin, so that you can use it as on/off switch16:34
wpwrakand forget the hardware switch. won't happen16:34
DocScrutinizer05you said you already have a hw switch16:35
DocScrutinizer05meh, I'm getting bored16:35
wpwrakfor rfkill. not for power. it has mechanical buttons for control, though. so you could multi-use these. requiring some more components, of course16:36
DocScrutinizer05what's the difference between rfkill and poweroff of whole device?16:36
wpwrakrfkill only affects RF16:37
DocScrutinizer05the BT only disabled in sw when device powered on? well, I guess everybody can live with that16:37
wpwrakalso, that rfkill switch is less convenient to operate than a button. besides, you'd need an auto-power-off then.16:37
DocScrutinizer05well, then use the button approach, I already explained how to implement that16:38
wpwrakyou're dreaming up a device that's inconvenient to use, just to make it fit your circuit :)16:38
DocScrutinizer05simply power MCU via the pushbutton until it sets a GPIO to active-high to open a FET parallel to the pushbutton16:38
wpwrakyes, the buttons would work. you'd need to dual-feed them, etc., but all that is doable16:39
wpwraki would't rely on an MCU-controlled FET to power down. what if the MCU goes erratic when under-powered ?16:40
DocScrutinizer05doesn't happen16:40
wpwrakwhat would be safe would be an i2c-controlled output of the RT16:40
wpwrakRTC even16:40
wpwrakbut this chip doesn't have such a thing16:40
DocScrutinizer05if you're paranoic, use a AC-driven (pushpull GPIO) voltage doubler made from a capacitor and two diodes to operate the FETs gate16:41
DocScrutinizer05doubles as watchdog when CPU hangs16:42
wpwrakthen the power-up sequence would be: user presses button, button forces boost EN high, mcu tells RTC via I2C to set its INT to "on", MCU retrieves time if it wants16:42
DocScrutinizer05yeah, why simple when we can do it digitally, but would work16:43
wpwrakfor standby: set alarm at now + estimated cap hold time, reassign RTC INT to alarm (implicitly letting EN drop)16:43
DocScrutinizer05but yes, you could do that, unless you need 32kHz at MCU and don't want a second crystal for that16:44
wpwraki don't think the MCU needs its own RTC clock in this case16:45
DocScrutinizer05since SQW and INT/ALARM are same pin for this particular chip16:46
wpwrakit could just run from its RC oscillator. burns a bit more power, but who cares16:46
DocScrutinizer05yeah, it does so only when device on16:46
wpwrakthe cMCU (with USB) has its own crystal, so no problem there16:47
DocScrutinizer05anyway, I *really* should try to get some fresh air16:47
wpwrakyes ;-)16:47
DocScrutinizer05and I got a problem with "helmet hair" I need to solve ;-)16:48
wpwrakah, ask for baldness cream at the pharmacy :)16:48
DocScrutinizer05("helmet hair" = terribly weird hairstyle after taking off helmet)16:49
wpwrakor get a "the beatles forever" t-shirt ;-)16:49
DocScrutinizer05yeah, that's my most likely approach16:49
DocScrutinizer05cut them 16:49
wpwrak(helmet hair) ah, thought it was the helmet approach to cutting: place helmet (the old military kind), cut off protruding hair, remove helmet, done :)16:50
DocScrutinizer05nah, mine is already too short for that16:50
DocScrutinizer0514mm now16:51
wpwrakno special treatment needed then :)16:51
DocScrutinizer05after taking off helmet, I look like a punk with a very creative new variant of irokese hairstyle16:51
DocScrutinizer05either cut hair down to 3mm or get brisk hair creme16:52
wpwrakoh dear. the press seems to be going for the kill today. this front page alone speaks volumes: http://www.infobae.com/16:53
wpwrakthis fellow was in charge of trains. among other nice things, he bought trains that were basically junk. probably making some handsome money on the side.16:53
DocScrutinizer05sounds like the usual pattern seen everywhere16:54
wpwrakthe other nice things include partial responsibility for a train crash that killed some 50 people16:54
wpwrakyeah, he overdid it a bit, though16:54
wpwraka mean, look a the pics of junk he bought: http://www.infobae.com/2016/04/02/1801434-194-fotos-los-trenes-inservibles-comprados-ricardo-jaime16:55
wpwrakwe should use that as our standard for refurbs. would make it a lot easier to find more ;-)16:56
DocScrutinizer05seems ALARM2 is working with chip Vcc as IRQ output17:10
DocScrutinizer05power-on states are yet to get inspected17:12
DocScrutinizer05seems SQW/INT works in 1Hz mode after power-up17:12
DocScrutinizer05so when you really want to control the main power switch from RTC INT you better make damn sure the MCU in itializes RTC during less than 500ms after main system power up17:13
DocScrutinizer05otherwise very funny effects will happen on battery insertion17:14
DocScrutinizer05(after full power down even for RTC)17:15
DocScrutinizer05I'd go for the GPIO controlled FET all days17:16
DocScrutinizer05of course you could connect the INT to the FETs gate as well, for ALARM wakeup - but only in parallel to a MCU GPIO17:18
DocScrutinizer05well then otoh what's the usecase for ALARM wakeup from system shutdown?17:20
DocScrutinizer05this datasheet is crap! :-<   INTA string appears exactly once17:26
DocScrutinizer05oops there's more, for " INTA"17:27
DocScrutinizer052 occurences, but no explanation which pin that is17:28
DocScrutinizer05anyway  >> 8.11.9 Bit 1: Alarm 2 Flag (A2F) A logic 1 in the alarm 2 flag bit indicates that the time matched the alarm 2 registers. This flag can be used to generate an interrupt on SQW/INT depending on the status of the INTCN bit in the control register. If the INTCN bit is set to logic 0 and A2F is at logic 1 (and A2IE bit is also logic 1), the INTA pin goes low. If the INTCN bit is set to logic 1 and A2F is logic 1 (and A2IE bit 17:29
DocScrutinizer05is also logic 1), the SQW/INT pin goes low. A2F is cleared when written to logic 0. This bit can only be written to logic 0. Attempting to write to logic 1 leaves the value unchanged.<<17:29
DocScrutinizer05http://cdn01.ib.infobae.com/adjuntos/162/imagenes/014/517/0014517260.jpg?0000-00-00-00-00-00  is really beyond any joke17:38
DocScrutinizer05you usually have to PAY to GET RID of such junk17:39
wpwrak(startup) time to first instruction is some 300 us. 1 second is something like eternity ;-)17:39
DocScrutinizer05yes, just saying17:40
DocScrutinizer05300us sounds sort of made up though. It takes longer for power to stabilize17:40
DocScrutinizer05possibly time for POR17:41
wpwrak(trains) in the comments, also some engineers from the field are commenting. pretty damning verdicts :)17:41
DocScrutinizer05where it's still the question when POR starts17:41
wpwrak300 us after reset is deasserted17:41
wpwrakso the MCU basically comes up "immediately"17:42
DocScrutinizer05so make sure your power-food plus reset-assertion plus 300us   <<  500ms17:42
DocScrutinizer05power-good even17:43
wpwrakthe boost regulator should be up within something like 5 ms past minimum voltage17:44
wpwrakand there isn't much else between it and the battery17:44
wpwraki.e., that 10 uF cap won't slow it for much :)17:45
DocScrutinizer05battery side? doesn't matter, it slows down RTC same way17:45
wpwrakthe whole system would probably back asleep less than 10 ms after battery insertion :)17:45
wpwrakwell, if it skips over DFU :)17:46
DocScrutinizer05which it can doo without problems since on USB VBUS power I'd expect it to stay powered anyway17:47
DocScrutinizer05I also suggest it needs to hold power-button during connecting USB to even enter DFU mode17:49
DocScrutinizer05(or whichever button)17:49
DocScrutinizer05and first thing you want to do after power-up is to make sure system stays on and then (same time basically since it's same resource) check if powerfail bit in RTC got set17:51
DocScrutinizer05if that's the case you know you got wakened by 1Hz mode on RTC and you want to set time anyway before powering down again17:52
DocScrutinizer05otherwise you prolly got awajened by power pushbutton or ALARM17:53
DocScrutinizer05you easily can tell apart the both cases (button vs ALARM)17:53
DocScrutinizer05for ALARM the flag is set in RTC17:54
DocScrutinizer05(I still wonder what's the usecase for ALARM wakeup, but "never do a we_dont_need_that" design decision when it doesn't cost more than a few 0402 components and doesn't introduce unpredictable or known high risk anyway)17:56
DocScrutinizer05well, maybe you can check a 20ms for BTLE imbound signals every second, based on a 1Hz repetitive Alarm, if you really want that always-online property17:58
DocScrutinizer05so yes. a FET on RTC SQW/INT seems good design18:00
DocScrutinizer05plus a pushbutton to bridge that and force device on18:00
DocScrutinizer05to keep device on you set ALARM time to current time and simply don't clear the IRQ18:02
DocScrutinizer05to switch off you clear the IRQ18:02
DocScrutinizer05there are two alarms, you can use one for power switch and thus don't mess with alarm time setting of the other18:04
DocScrutinizer05if you want to do something for bat swap housekeeping then power up the device's 3V3 as soon as you notice battery voltage drop, so you can charge up the "bupbat" RTC capacitor a bit more than just to 1V2 of AAA cell18:09
DocScrutinizer05would make a difference of 0V3 vs 2V4 usable capacitor discharge18:10
DocScrutinizer058 times backup time18:10
DocScrutinizer05would again need a decent prefail warning to work :-/18:12
DocScrutinizer05no use in powering up the device when the voltage on 10uF buffer capacitor starts to drop18:12
DocScrutinizer05HAH! you could use a voltage multiplier on SQW to charge the capacitor to 3V3 (or whatever Vmax) when you'd use the Vcc as IRQ output of ALARM (if that's even how stuff is supposed to work, the datasheet is pretty fuzzy and fsckdup there)18:18
DocScrutinizer05nah, doesn't work since your source (Vbattery 1V2) for driving the SQW electrically is also the destination (chip Vbat)18:21
DocScrutinizer05would nly work if AAA battery is connected to Vcc of chip, and that's not available in this scenario since we need it for INT instead of the SQW/INT pin18:22
DocScrutinizer05and even when it was, it seems the chip simply uses the supply with higher voltage for internal power18:23
DocScrutinizer05just make sure your capacitor can supply 500nA over 0.3V drop for as long as you need minimally to swap batery. For increased convenience user needs to power up the device before removing battery, which will result in almost 10 times longer timespan for batswap18:25
DocScrutinizer05NB the RTC chip was the first hit in DK for a timekeeping voltage <1V518:27
wpwrakfor INT to work, you need to power the whole chip. so that would be your D+C+chip scenario18:27
wpwrakthe NXP ? yes18:28
DocScrutinizer05I didn't check if there are smarter or cheaper or easier chips18:28
wpwrakah, i always sort by price :)18:28
wpwrak(alarm) you need that to wake up to recharge the cap :) that's how you keep it at a nice voltage18:28
DocScrutinizer05which cap you want to recharge?18:29
DocScrutinizer05the bupbat C? that one will be happy with voltages down to 0.9V18:29
wpwrakBTLE needs 16 us precision but in a 2 * 500 ppm window. so that translates to around +/-1 ms for a 1 s "poll" interval18:30
wpwrakthose chips are about 3 orders of magnitude away from that18:30
DocScrutinizer05hmm, that's a topic for another day18:30
wpwrakthe RTC cap. there is no bubat cap. bubat seems pointless, since it only keeps time but doesn't supply the interrupt18:31
DocScrutinizer05I don't think an inbound request for establishing a connection is in relation to BTLEs internal timing in any way18:31
wpwrakthis is the timing for being ready to receive things18:32
DocScrutinizer05sure, but before you can do that you need to sync anyway18:32
DocScrutinizer05I don't suggest to go to sleep when a connection already got established18:33
wpwrakso you turn off for 999 -x ms, power up for x ms, then listen for 2 ms, then power down again.18:33
wpwrakbeing able to sleep is the whole point of BTLE :)18:33
DocScrutinizer05I don't want to discuss this now, it's a fringe case18:33
wpwrakit's the most standard use of BTLE ;-)18:34
DocScrutinizer05not when you don't have BTLE enabled18:34
DocScrutinizer05not when the device is off18:34
wpwrakBTLE is all about knowing when someone will talk to you, and not wasting energy on listening outside that interval18:34
DocScrutinizer05so what?18:34
Action: whitequark stares at DocScrutinizer05 18:35
wpwrakin fact, i'm a little disappointed about their 500 ppm thing. i would have made that much narrower :)18:35
DocScrutinizer05I really don't want to discuss BTLE specs now. If you want to use BTLE, you power up the device18:35
wpwrak500 ppm is just too tight for RC but way beyond what even the worst xtal can do18:36
DocScrutinizer05and after you did that, RTC is not relevant in the whole game anymore18:36
wpwrakyup. none of these chips seem to be adequate for BTLE, even if we assume the stack can use "external" timing (which so far i haven't been able to confirm)18:37
wpwrakso the only benefit is lower power consumption in standby18:38
wpwrakiff btle is off18:38
wpwrak(rfkill or just not enabled)18:38
DocScrutinizer05benefit of BTLE? yes exactly. I expect the sleep timing hgetting handled inside chip18:38
DocScrutinizer05the purpose of RTC is to decently power down whole anelok18:39
wpwrakbenefit of the fancy RTC chip circuit vs. the simple RC18:39
wpwraki.e., both keep time, but one allows for lower-power standby18:40
DocScrutinizer05*sigh* we're back to square one now?18:40
DocScrutinizer05I'm out18:40
DocScrutinizer05please reread backscroll at around 10 to 20 lines before >>[2016-04-02 Sat 16:17:46] <DocScrutinizer05> *massively* simplified more clean and more reliable design<<18:45
DocScrutinizer05until >>[2016-04-02 Sat 18:44:54] <DocScrutinizer05> but yes, you could do that<<18:47
DocScrutinizer05and regarding your "keep the capacitor at charged state" you only do that to allow ALARM wakeup so you can do that. For nowmal operation of anelok you don't need repeated wakeups, you simply power up the device by pressing the powerbutton18:50
DocScrutinizer05and in shutdown mode the RTC runs from AAA cell18:51
DocScrutinizer05while when device powered up it runs from 3V318:51
DocScrutinizer05and during battery swap you run RTC from a buffer capacitor charged to Vbat (>=1V2) or Vcc (3V3) whichever was present during a few seconds before battery removal18:55
DocScrutinizer05connect RTC's Vcc pin to 3V3 via a diode and to battery via a resistor or diode with 0V@500nA18:57
DocScrutinizer05I think I already said that18:57
DocScrutinizer05or you simply connect 3V3 to RTC Vcc and the R from battery to C-bupbat18:59
DocScrutinizer05aka RTC Vbat19:00
DocScrutinizer05http://wstaw.org/m/2016/04/02/plasma-desktopeo2219.png http://wstaw.org/m/2016/04/02/plasma-desktopoA2219.png19:10
DocScrutinizer05you *probably* could even connect RTC Vbat to a buffer cap and to 3V3 via a diode, and connect RTC Vcc to battery directly19:14
DocScrutinizer05if everything in the datasheet is correct, this is the best way to integrate the RTC19:15
DocScrutinizer05together with above quoted http://wstaw.org/m/2016/04/02/plasma-desktopeo2219.png19:19
DocScrutinizer05BOM: RTC chip, crystal, buffer cap, diode from cap to 3V3 system Vdd, 2 GPIO and pullup R for I2C. On the savings side: R and C and one GPIO for the timekeeping-batswap hack, 2 GPIO and crystal for 32kHz. Further massive savings on sw side19:23
DocScrutinizer05for power you need one FET and a pushbutton but you save all the hassle with timekeeping, quiescent currents, writing to SD-card during system shutdown etc pp19:25
DocScrutinizer05so you spend one RTC chip, and one R, you save one GPIO and one C, and a lot of hassle with software and debugging and risk19:28
DocScrutinizer05and you can sanitize all that "always on" mess19:29
DocScrutinizer05and yes, you still could do your "switch it on every 10 seconds to charge capacitor so it could power up the device eventually" - but honestly you don't need that for all I can tell19:34
DocScrutinizer05without that, your device quiescent current is at a very easy to calculate max 500nA, for almost  infinite time (prolly years) from one AAA19:37
DocScrutinizer05and after a year your still could swap battery and still have a pretty accurate time (the RTC chip allows xtal calibration in software)19:38
DocScrutinizer05no risk of aborted writes on SD which could easily physically destroy the card19:39
DocScrutinizer05no sw design hassle19:39
DocScrutinizer05no hw design hassle19:40
DocScrutinizer05if that doesn't sound convincing then I dunno what would19:46
DocScrutinizer05the RTC chip is a 50ct. If you wanna get fancy, add a 1000uF polyacene cap19:47
DocScrutinizer05or 15000uF or whatever you like19:48
DocScrutinizer05http://www.digikey.com/product-detail/en/CPH3225A/728-1067-1-ND/4747400 11mF 3.2*2.5*0.8mm USD1.65@10019:57
DocScrutinizer05or the good ole (though large) XH414HG-IV01E 80mF at USD1.57@10020:01
DocScrutinizer05you should add a series resistor in the 3V3 diade line to limit charging current20:02
DocScrutinizer05>> Also, by optimizing its materials, a 1 minute rapid charge stores approximately 90% of full capacity.<<  http://media.digikey.com/pdf/Data Sheets/Seiko Instruments PDFs/CPH3225A_CP3225A.pdf20:05
DocScrutinizer05ESR 180 Ohm, so I guess this one doesn't really need any series R for charging limiting20:06
DocScrutinizer05won't hurt though20:07
DocScrutinizer054.6uAh (3.3-1.8) means over 10h RTC without battery20:10
DocScrutinizer05forget about my FET rumbling, you simply connect http://downloads.qi-hardware.com/people/werner/anelok/tmp/anelok-20160401.pdf p.4  R4 left side to INT of RTC (assuming that it's not nINT)20:20
DocScrutinizer05I guess you can nuke R16 and C5 then20:22
DocScrutinizer05the power button should pull high EN of boost converter20:45
DocScrutinizer05so you need a series resistor to EN and connect the pushbutton switch behind that one20:46
DocScrutinizer05from EN directly to bat+20:50
DocScrutinizer05watch out X2 and X4 don't mechanically interfere!21:06
DocScrutinizer05err x2 and x3, sorry21:06
DocScrutinizer05xtals can have very spooky long-distance interference when same frequency21:08
DocScrutinizer05I'd suggest to use only one xtal and share the clock, but we can't do that here, unless you find a RTC chip with one pin more for 32k_out21:09
DocScrutinizer05do you know how they calibrate xtal wrist watches? they use a ultrasonic body microphone and touch the glass with the tip21:11
DocScrutinizer05if you really don't like the "high cost" of 11mF supercap, you can use a 100uF for ~6 minutes (when charged to 3V3, 30s when charged to 1V2 from battery)21:23
DocScrutinizer05a 11mF however is way smaller than a 100uF ;-)21:26
DocScrutinizer05and I still dunno what are the expected "problems with supercaps"21:42
DocScrutinizer05maybe this quote can mitigate your worries? >> Its heat-resistant design allows for Pb-free reflowable SMT board attachment.<<21:43
DocScrutinizer05>>Pb-free reflowable: 260°C peak<< http://www.digikey.com/en/product-highlight/s/seiko-instruments/cph3225a21:49
DocScrutinizer05(way smaller) well 1206, aka 3.2*1.6mm (vs supercap 3.2*2.5*0.8mm) but 2.3mm high, USD0.94 (0.48@100) http://www.digikey.com/product-detail/en/avx-corporation/12066D107MAT2A/478-9818-1-ND/582219721:57
DocScrutinizer05I'd go for the 1 buck more for a decent 11mF without even thinking21:59
DocScrutinizer05100 times the capacity for just 3 times the bucks22:00
DocScrutinizer05marginally different footprint22:01
DocScrutinizer05matching crystals for the AS1801: http://www.digikey.com/product-search/en/crystals-and-oscillators/crystals/852333?k=crystal&pv724=1446&pv724=1449&FV=22c0060%2Cfff4000d%2Cfff8016d%2C8c0013&mnonly=0&newproducts=0&ColumnSort=1000011&page=1&quantity=0&ptm=0&fid=0&pageSize=2522:08
DocScrutinizer05the cheapest is also the most precise, alas QTY-avail: 022:08
DocScrutinizer05I'd prefer through hole anyway, less mechanical coupling22:10
DocScrutinizer05mount the two 43k xtals with 90° ange to each other, as for from each other as possible22:18
DocScrutinizer05ideally both through hole standing still with 90° rotation along axis22:20
DocScrutinizer05and a two millimeters free wire at least22:20
DocScrutinizer05can't say this is verified wisdom, rather a guts feeling22:21
DocScrutinizer05ugh, lemme try again22:22
DocScrutinizer05mount the two 32k xtals with 90° angle to each other, as far from each other as possible22:22
DocScrutinizer05wpwrak: sorry for another wall of text but I think it's worth reading it22:29
--- Sun Apr 3 201600:00

Generated by irclog2html.py 2.9.2 by Marius Gedminas - find it at mg.pov.lt!