Once it gets going, the popularity is self-sustaining because everyone and their mom is making them in uber-mega-bulk. If you see a garbage-can shaped crystal in basically anything you scrap, you're basically guaranteed that it will be that frequency, even the el-cheapo ones from china with no markings on them. I think I have only twice (out of pulling like 20-30 of those things) found ones that weren't, and those had the frequency clearly marked. Also, the black 4-pin SMD ones (you know the ones I'm talking about) that you see all over the place are also, almost always, 32.768k too - just depending on whether their process is better suited to SMD. You also see garbage-cans on their side with the pins bent into a shape such that they can be surface mounted pretty often too (though I wouldn't use one in a board I designed - I'd use a black 4-pin one (note that there are only two unique pins - I forget whether they're tied together in pairs, or if two are NC - they're not a powered oscillator like many of the flat ones with 4 pins and that distinct shiny metal case (though some of those are just crystals too; for a while I used to pull those - they're surprisingly expensive, actually). But since I started making and selling boards, I have turned against using pulls - literally the only time I will use pulls now is if something mission critical failed, and I had no choice. Like the time I brought everything I needed to do a bunch of AVR development over my 1 week summer vacation, specifically some stuff regarding external crystals - but then realized I'd forgotten the 22pf caps for the crystals! So we went to the dump and raided the e-waste trailer (we = my father and I... thinking back, I'll bet back then he was just getting into his obsessive focus on SMPS's, so he wanted to get stuff to examine the SMPS modules anyway - dear god, at one point he literally had 30 computer power supplies stacked up. Eventually he decided he understood it well enough after obsessing for a year or so, and disassembling a dozen or two SMPS's - the computer supplies are kind of boring, because they're all the same inside anyway - what was a lot more interesting was random consumer electronics), and tore them apart when we got home, and I found my pair of 22pf caps and proceeded with my project... or the time when I was going from the summer place straight to my first job interview, but we lost the charger for my shaver... so we pulled a pot and a 5v supply and manually adjusted it while monitoring voltage to charge the battery so I could look sharp for the interview... (now we have a stash of parts there, of course - including at least one Espruino!)
And yeah, the fact that a binary counter can be used with them and easily convert to seconds is HUGE.
The one annoying thing is that there are 1000ms in a second instead of 1024; I do one thing where I prescale the clock by 32, then (since it's on an 8-bit AVR - no hardware division (like, I was thanking my lucky stars we had hardware multiplication :-P), so in a timing function, doing that to an unsigned long is right out the window! I think I right-shifted it 6 places, subtracted that from the original, then rightshifted the already right-shifted one one more place, and subtracted it again, and that gave me my millis() implementation...
But what was interesting when I tested it... it was WAY off, and I deduced that the half-assed way in which I;d connected the crystal was killing the accuracy because the stray capacitance was way wrong. That's one thing I wish I had a heuristic for, calculating how much stray capacitance I have, so I know what value caps to use (the datasheet warns several times of the importance of getting the capacitance right - at least for parts I'm working with now) - since I'm now making and selling boards, I kind of want to not completely bung it!
And the final aside I was getting to... the part I am focusing on now, it doesn't have a high-speed external crystal, it's internal oscillator only (atmel-now-microchip's AVR team broke up with MHz crystals a couple of years ago), but obviously they have watch crystals, and a proper 16-bit RTC timer now so they can use them (instead of the old atmega halfassery with the async 8-bit timer2)... naturally, customers buying their new flagship product want accurate clocks... they have what they call "autotune" (lol) - you put a watch crystal on it, and it counts clocks, and dynamically recalibrates the internal oscillator! Haven't played with it, since I went down a rathole with programming tools that I'm just emerging from - but if it works, it's damned cool. My breakout boards for those take garbage-can-shaped through-hole ones (all I could route) but I really wish I was able to calculate whether I had the right caps on it...
My god, why did I write this essay in a 2-week old thread, lol... I think I wanted a break from what I was doing (I feel bad for switching to Arduino for most tasks - I do still use Espruino for web stuff - but I'd have never gotten into the hobby and had all this fun if it weren't for Espruino. It is such a great way to get comfortable with how digital electronics work... but I've come to absolutely love the parts where I can work really close to metal, which requires the parts be simple enough that I can hold the concept of them in my head. Those who remember me may recall that quickly gravitated to getting low level within the Espruino VM....)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Damn, I've been away so long...
Once it gets going, the popularity is self-sustaining because everyone and their mom is making them in uber-mega-bulk. If you see a garbage-can shaped crystal in basically anything you scrap, you're basically guaranteed that it will be that frequency, even the el-cheapo ones from china with no markings on them. I think I have only twice (out of pulling like 20-30 of those things) found ones that weren't, and those had the frequency clearly marked. Also, the black 4-pin SMD ones (you know the ones I'm talking about) that you see all over the place are also, almost always, 32.768k too - just depending on whether their process is better suited to SMD. You also see garbage-cans on their side with the pins bent into a shape such that they can be surface mounted pretty often too (though I wouldn't use one in a board I designed - I'd use a black 4-pin one (note that there are only two unique pins - I forget whether they're tied together in pairs, or if two are NC - they're not a powered oscillator like many of the flat ones with 4 pins and that distinct shiny metal case (though some of those are just crystals too; for a while I used to pull those - they're surprisingly expensive, actually). But since I started making and selling boards, I have turned against using pulls - literally the only time I will use pulls now is if something mission critical failed, and I had no choice. Like the time I brought everything I needed to do a bunch of AVR development over my 1 week summer vacation, specifically some stuff regarding external crystals - but then realized I'd forgotten the 22pf caps for the crystals! So we went to the dump and raided the e-waste trailer (we = my father and I... thinking back, I'll bet back then he was just getting into his obsessive focus on SMPS's, so he wanted to get stuff to examine the SMPS modules anyway - dear god, at one point he literally had 30 computer power supplies stacked up. Eventually he decided he understood it well enough after obsessing for a year or so, and disassembling a dozen or two SMPS's - the computer supplies are kind of boring, because they're all the same inside anyway - what was a lot more interesting was random consumer electronics), and tore them apart when we got home, and I found my pair of 22pf caps and proceeded with my project... or the time when I was going from the summer place straight to my first job interview, but we lost the charger for my shaver... so we pulled a pot and a 5v supply and manually adjusted it while monitoring voltage to charge the battery so I could look sharp for the interview... (now we have a stash of parts there, of course - including at least one Espruino!)
And yeah, the fact that a binary counter can be used with them and easily convert to seconds is HUGE.
The one annoying thing is that there are 1000ms in a second instead of 1024; I do one thing where I prescale the clock by 32, then (since it's on an 8-bit AVR - no hardware division (like, I was thanking my lucky stars we had hardware multiplication :-P), so in a timing function, doing that to an unsigned long is right out the window! I think I right-shifted it 6 places, subtracted that from the original, then rightshifted the already right-shifted one one more place, and subtracted it again, and that gave me my millis() implementation...
But what was interesting when I tested it... it was WAY off, and I deduced that the half-assed way in which I;d connected the crystal was killing the accuracy because the stray capacitance was way wrong. That's one thing I wish I had a heuristic for, calculating how much stray capacitance I have, so I know what value caps to use (the datasheet warns several times of the importance of getting the capacitance right - at least for parts I'm working with now) - since I'm now making and selling boards, I kind of want to not completely bung it!
And the final aside I was getting to... the part I am focusing on now, it doesn't have a high-speed external crystal, it's internal oscillator only (atmel-now-microchip's AVR team broke up with MHz crystals a couple of years ago), but obviously they have watch crystals, and a proper 16-bit RTC timer now so they can use them (instead of the old atmega halfassery with the async 8-bit timer2)... naturally, customers buying their new flagship product want accurate clocks... they have what they call "autotune" (lol) - you put a watch crystal on it, and it counts clocks, and dynamically recalibrates the internal oscillator! Haven't played with it, since I went down a rathole with programming tools that I'm just emerging from - but if it works, it's damned cool. My breakout boards for those take garbage-can-shaped through-hole ones (all I could route) but I really wish I was able to calculate whether I had the right caps on it...
My god, why did I write this essay in a 2-week old thread, lol... I think I wanted a break from what I was doing (I feel bad for switching to Arduino for most tasks - I do still use Espruino for web stuff - but I'd have never gotten into the hobby and had all this fun if it weren't for Espruino. It is such a great way to get comfortable with how digital electronics work... but I've come to absolutely love the parts where I can work really close to metal, which requires the parts be simple enough that I can hold the concept of them in my head. Those who remember me may recall that quickly gravitated to getting low level within the Espruino VM....)