My investigations into why the clock won’t keep time await new parts, so I’m going to take a detour while I wait.
In part 10, I mentioned that one of my ideas revolved around using a premade Real-Time Clock module to drive the timekeeping. Every RTC on the market, whether it’s a single chip or a small expansion board, uses some form of serial communication to provide the main device with data. Since all of them contain full calendaring information including months and years, alternatives to serial communications are not viable. There are a shedload of ways to handle it, but I’m only going to talk about two of them – Serial Periferal Interface (SPI) and Inter-Integrated Circuit (I2C). Both date from the early 1980s and are widely supported standards. SPI came out of Motorola, while I2C was introduced by Phillips Semiconductor, but are manufacturer agnostic standards.
Both are Master/Slave setups ultimately interested in trading data between the microcontroller/microprocessor and whatever periferal device its trying to access and transfer one bit at a time per data wire. Neither is strictly better, which is why both have persisted for over four decades. Each has its own strengths and weaknesses. I read up on the details in anticipation of having to implement them myself. I knew enough to be confident in getting an SPI compliant code written, but had to look for I2C examples. When I found them, I discovered that the MSP430 series implements a number of serial protocols at a very low level, including both SPI and I2C, so I don’t have to write either. However, having learned the basics of how these protocols work, I had a bunch of ideas. Since the MSP430s can be used as either a master or slave device in either of those protocols, I can expand upon the modular idea from the Pluggable MSP to simply building periferal modules outright and not having to manage everything from a single microcontroller.
But that’s for the future. Today, I’m going to discuss the protocols.
I’m going to start with SPI, because it was the first I got my head around. The first obvious difference between SPI and I2C is that SPI uses at least four wires, while I2C uses exactly two. Two of the SPI wires are for signalling, and two for data. The signalling wires are Chip Select and the Clock signal. Like with the clock signals we used for shift registers, the clock tells the periferal when data is to be exchanged. The chip select line indicates to the periferal that it should respond. Because the chip select line is only ever high or low, this is where the ‘at least’ four lines comes in. Each SPI periferal needs its own chip select signal. However, that doesn’t mean we’ll be eating up another valuable pin for each SPI device we want to add. Even if we just stick to things already covered in these articles, we can stack shift registers to control an arbitrary number of chip select lines. It’s crude, and I’ve been reading about multiplexers and demultiplexers, which have some more fun (and faster) options for controlling more lines. Ultimately you won’t need more than six total pins to talk to an arbitrary number of periferals. Whatever funky addressing schema you can dream up will do you.
So what does that leave? The two data lines. These are known as the MOSI and MISO lines. Or Master Out/Slave In and Master In/Slave Out. The names really do say it all. Each wire carries data in one direction, driven by the clock signal to determine when the next bit is sent.
The SPI protocol defines how to read the signalling and the data bits but does not dictate the content of the data. The periferal manufacturers can decide how to handle that. For example, one device I have is a thermocouple driver. Basically, the logic end of a thermometer. When you trigger its chip select and start sending a clock signal, it ignores the MOSI line and sends a data packet on the MISO line which consists of the temperature on the probe, the controller’s temperature, and any error flags it has. It will only send one of these per activation, and always sends that format. It is just a thermometer, it’s got one function. I’ve also read up on a FRAM chip that uses SPI. It requires you send it a command, then an address. After the address, it will either listen for bits to write to that address, or start sending bits read from that address. It will keep incrementing its address as you keep sending clock signals, allowing for an arbitrarily long read or write. Those Real-Time Clocks which use SPI are somewhere in between, with fixed packet sizes but requiring commands and addresses so that it knows what you want to do between setting the time, setting alarms, or reading some element from it.
I2C is starkly different from SPI in that is only ever uses two wires, with most of the signalling going on the data wire. It still uses a clock signal on one of those wires, to keep the master and slave working in tandem. Since you don’t have the luxury of dedicated wires for additional signals, the data packets on an I2C bus are bracketted by start and stop indicators which are created by the relative timing of the data and clock lines going to particular levels. These start and stop signals fell into the “I’m going to need a reference” sort of deal where I would have to look up the details every time it matters. But, once a start signal is indicated, you now have the attention of every slave device on the bus – how do we indicate who we’re talking to? The first byte of data sent from the master after the start contains an address. This address value indicates which periferal we are trying to reach.
While the addressing on a logical level allows for quite a few connected devices, you will run into one practical hurdle. The address number of a periferal is set by the manufacturer, and is often impossible to change. So you can’t use more than one periferal of the same type from the same manufacturer. They would simply all answer and cause chaos on the data line. After the address byte, the periferal with that address sends a single bit back along the same data line to acknowledge that it is there and listening. The master then sends a command byte, which is followed by another acknowledgement by the slave. After the command, who is talking in what order depends on the type of periferal and what command the master gave. Each byte gets acknowledged until the master goes ‘stop’.
While I2C cuts down on the hardware complexity by getting rid of the need to manage chip select signals and only ever using two wires, it does so by increasing the complexity of the data protocol and imposing some limitations. SPI is full duplex, meaning both master and slave can be sending data at the same time. Each line is also unidirectional, so you never get the issue where more than one device is trying to drive the line at the same time.
What you want to use is all about trade offs. Since each has its benefits and drawbacks, they’ve comfortably coexisted for almost as long as personal computing has been around.
The RTC modules I ordered use I2C. After all, how many clocks do you need? Hopefully next time, I’ll get to share what my daughterboard designs managed to achieve.
I’m running low on these queued up – I have to get something working on the most recent hardware.
Does the hardware look like this?
That’s a winner. Love the label on the IC.
No, that’s far too orderly.
The 3L capacitor made me chortle.
It ain’t the Time Division I learned about 65 years ago. Sort of looks the same when it’s graphed out but and no modulation.
Thanks USC, for reminding me how far behind the curve I really am.
These are newer protocols from the 1980s.
The modern stuff (QAM) is fascinating.
The math gets ugly fast. Somebody did a great video about it that explained it visually in way the made me finally intuit.
Not the same, but similar to explaining a FFT here.
https://youtu.be/spUNpyF58BY?si=7XY0ybceVs6ibNSu
From the ded thred. Been watching inspection videos on YouTube. It’s is… shocking.
https://youtube.com/@constructivainspections
The sort of things he’s finding, I have no idea how the builders would ever fix them without razing and starting over. Just wow.
I can’t watch any more. Horrifying.
The new code thing where you can’t put outlets on the side of the kitchen island is fucking stupid.
Where are you supposed to put the outlets for the stand mixer? On top of the island where spills will get fluids into the outlet?
Yep. Or some kind of two tier island. It’s just getting ridiculous.
And further, as Gustave’s link shows it makes no difference because the builders get it wrong anyway.
I’m still shaking my head about the low voltage bundle routed around the joist. Unreal.
Just notch out the joist. Problem solved.
/derp
Just build a chase around it.
/not really sarc
The NEC is out of control. The 3 year cycle ensures and demands that changes be made to justify the cycle. From the licensing perspective
Year 1 – changes announced/discovered in new code but not yet adopted or in CE classes
Year 2 – new code adopted, code update classes released. God help you if you work in two separate states/code juridctions
Year 3 – new code used
And then repeat. Basically 1-2 years at most of everyone mostly being on the same page.
I assume they’ll build around it vs. re-pulling the bundle. So it’ll look like shit but be functional.
My BIL just showed me a picture where the plumbers cut a hole for two 3 or 4 inch sewerlines through the main load bearing beam. Staggeringly dumb things like that happen all the time.
24? Or you use GMT and a table with the offsets. But that’s no fun.
How Many Time Zones Are There?
OT – Guess you could say it sucks?
Vacuum cleaner manufacturer Dyson to cut around 1,000 jobs in the UK
The math to adjust for time zone is cheaper and easier to implement than running and synchronizing twenty-four RTC modules.
Multiplexing solves the need for excess wiring, I have ran light shows with as few as 5 wires, synced to music as well
Vcc, Ground, Clock, and?
1 line per array, I had several doing different things
More seriously, I was looking at demultiplexers for the chip select line for the SPI devices.
What about too low for too long?
Federal Reserve Chair Jerome Powell on Tuesday expressed concern that holding interest rates too high for too long could jeopardize economic growth.
As long as government spending is completely unconstrained, GDP will keep going up.
‘growth’
https://www.cbsnews.com/news/william-stampfl-mummified-body-us-mountaineer-found-vanished-peru-2002/
If you haven’t seen Touching the Void, do so. If it didn’t include testimonies from the actual climbers, you’d say Hollywood pushed the suspension of disbelief too far.
Into thin air
Everest the hard way
Many more, I always wanted a 6k meter peak. Annapurna comes to mind
Ah…timing and clocks. Fun fact, most of the radar processing systems I work(ed) on operated on a 2.67 MHz clock
This clock has been taking too long to get working properly.
For UnCiv:
Cheap fried fish sandwiches in Albany/Troy:
https://www.msn.com/en-us/news/us/ted-s-fish-fry-celebrates-75-years-with-75-cent-sandwiches-across-capital-region/ar-BB1pDfo5
The problem is Ted’s Fish Fry isn’t that good. I don’t know how they stay in business.
Money laundering and/or political favors, if they’ve made it for 75 years.
https://www.washingtontimes.com/news/2024/jul/8/democrats-to-roll-out-fleet-of-dark-brandon-buses-/
Da fuq?
I look forward to one of these buses running over a pedestrian or crashing into other vehicles.
Sounds like a threat to me.
I have said it before and I’ll say it again. Biden and/or his team are absolutely terrible at politics.
Its the team for sure. Given the photo floating around of his speechwriters, I am guessing the campaign is staffed with 20 something year olds.
Ownbestenemy:
They’re so invested in “fighting the man” they don’t realize they are the fucking man at this point.
They believe this photo is an intimidating way to turn the tables on the Let’s Go Brandon crowd. They’re not looking to recruit new voters to their side. They are feeding their own echo chamber.
And they completely fail to recognize that this just confirms the beliefs of the MAGA crowd that Biden’s team is both stupid and dangerous.
https://youtu.be/7xxgRUyzgs0
The left, even up into the rulership positions, is populated largely with emotionally immature pseudo-adults who throw tantrums when they don’t get what they want. This is another tantrum.
@Nephilium – So 90s Pop Punk Rockers?
OBE:
I’m happily settled into my role as the man. There’s a reason that the Descendents Suburban Home is such a great song.
I definitely hear that song differently as an old man. They are coming here in November. I think I’ll take my daughter.
I don’t think they are “fighting the man” so much as they are “fighting the orange man*”.
*who is bad, very bad
Who is stupid enough to be excited by the Dark Brandon meme? Someone too young to recognize what a Nazi rally or a thousand recreations in modern media looks like?
Go watch what a real Fascist or Totalitarian dictator rally looks like. One that has A/V messages crafted to make you feel like the person is all powerful. Then ask your self why they would want to promote that message to you for this president?
I can’t believe they’re really leaning into that dark Brandon thing.
It’s literally a way to call him evil.
Their base: “And?”
So, I was wondering if banana candy tastes like the Gros Michel banana, since it doesn’t taste like the modern Cavendish.
Turns out you can still by Big Mikes… for $17/each. https://miamifruit.org/products/gros-michel-banana-box-order?variant=40552608923728
I have no interest in Big Mike’s banana.
Yes, but $17 is less than downtown!
the goddamn tik tok culture war is getting to me. A young woman hiking in the mountains in Romania was attacked and killed today by a brown bear and the first thing I thought about was the stupid man vs bear thing.
Funny enough there was a man hiking a couple hundred meters behind her who saw the attack and reported it.
the comments are split between the bear should be hunted and it is not the bear’s fault, it was in its enviroment and briwn bears do not attack unprovoked. There have been plenty of attacks though recently. There has been like a 7 year moratorium on hunting which increased the population, coupled with bear coming near humans looking for food.
there was a comment saying the man should have tried to fight the bear to save the woman.
Romania has about two thirds of the E.U. bear population.
I could really use a rug for the bedroom. Got a source for that?
Alternative joke: I thought Greeks and Turks were more bear-y than Romanians.
Crazy Hamid’s Grounded Rugs?
The Aegeans are Werewolves, all descended from Lycaon.
It is known.
If it’s not the bear’s fault, who’s fault is it? (Don’t answer that, I reached my quota for stupidity today before lunchtime.)
Y’all have some pretty mountains, though.
Not the bears fault? So, are you saying there otter be a law?
Was the woman wearing a short skirt made out of honey and trout?
Are you implying she had a honeypot?
All wrong questions.
Right question: Was the woman armed? I think I know the answer.
Romania wrestles with bear problem
As attacks continue, the animals leap onto the election agenda.
https://www.politico.eu/article/romania-bear-attacks-on-humans/
Vote Brown?
Like watching your mother-in-law wrestle with bear — entertaining even if you don’t care who wins.
Deport them?
If you don’t want to be eaten by a bear, you’re a far-right SCIENCE! denier
https://www.politico.eu/article/tomas-taraba-slovakia-climate-a-bear-attack-far-right/
one way or another
https://www.youtube.com/watch?v=_zBwRDEFMRY
Deport them to Ukraine to fight in the war against the Russian bears. Russian have the numbers though more than 100k
You need better signage.
“No bear attack zones”
“No Mauling”
Sean:
So they have a right to regulate bear arms?
Just pass a law designating certain areas “bear free zones”.
https://frinkiac.com/caption/S07E23/212194
I wrestled a bear, once.
@NA
Its time for other EU countries to take their fair share of bears. Anyone who fishes is racist against browns.
Update the bear has been shot by the rangers that went to try to recover the body, who were armed. the victim was apparently 19 female.
Shit like this is why I would not hike alone.
I’m going to Alaska next week to hike and sightsee in the Denali Nat. Park. I hope to see but not experience brown bears in the wild. The black bears in my neck of the woods are nowhere near as aggressive or large.
And be sure to hike with someone who runs more slowly than you.
Timeloose:
https://cowboystatedaily.com/2024/07/08/hunter-uses-handgun-to-finish-off-angry-charging-1-000-pound-kodiak-bear/
Enjoy Denali!
Not hiking alone kind of defeats the whole purpose of hiking.
That said, don’t be stupid about it. Buy and use an emergency locator beacon, leave a copy of your itinerary with someone, and have necessary emergency equipment with you.
Thanks GT and Tundra. Maybe Animal will let me borrow a 10mm for the week. My guide is supposed to carrying bear spray, I hope a rifle as well. I will not be able to bring my own as it is at the bottom of a lakeriverpond in Schnecksville.
Not hiking alone kind of defeats the whole purpose of hiking.
Unless it’s one of those things that keeps your family tight, however.
I dig hiking with my wife. We have very different interests, but both love getting out into the mountains. The kids, too. Grown and gone but still like to do our summer hiking trip with us.
But I agree – there is something groovy about a solo hike. No way I would do it in Grizzly country, though.
My guide is supposed to carrying bear spray
Get some for everyone in the group. I’m pretty sure I’ve rented it before, since obviously you can’t fly with it.
I’m really jealous. We’re at like 25 NPs but haven’t made it to AK yet.
EvilSheldon:
I do that even when I’m just going for a bike ride around the neighborhood. I let the girlfriend know when I’m heading out, when I’m heading back, if I changed route, and the like.
I’ll hike with you, I’m faster….
I’ll see what I can do with buying spray when we get there. I’ll be there with my wife and MIL as well as about 5 others in our group. I also want to bring a multitool and some other handy stuff in my checked bag. I don’t like not having tools.
I picked up a new pair of hiking boots from Oboz. They appear to make quality water proof stuff that is in the sweet spot of affordability and quality.
https://obozfootwear.com/en-us
Good stuff.
I’m a fan of Darn Tough wool socks, too. Even with waterproof shoes.
https://www.youtube.com/watch?v=bIUQApnhENU
FedEx is spying on you.
When it absolutely, positively, has to be spied on overnight.
I’ve set up accounts at UPS and FedEx just so I can have my shit delivered to the local independent Mailboxes, Etc. knock-off. Very convenient, secure, and keeps the undesirables away from my apartment.
Who Isn’t spying on you?
My dog.
https://imgur.com/asJlcDe
She’s busy
Very busy.
Mine’s busy too:
https://ibb.co/hgd4ZL5
Speaking of FedEx and lists, my new holster arrives tomorrow!
Awesome
https://nypost.com/2024/07/09/us-news/supreme-court-justice-sotomayors-bodyguard-shoots-would-be-carjacker-outside-her-home/
Supreme Court Justice Sotomayor’s bodyguards shoot would-be carjacker outside her home
Two deputy US Marshals shot a would-be carjacker who pulled a gun on him while they were guarding Supreme Court Justice Sonia Sotomayor’s home in Washington, DC, authorities said.
The marshals were parked outside Sotomayor’s home in northwest DC on July 5 when Kentrell Flowers, 18, allegedly walked up to one of their cars around 1:15 a.m. and pointed a gun one of the federal agents, the US Marshals Service told The Post.
Nice neighborhood.
Stay away from the comments.
Now, I feel compelled to go read them.
Looked like a mix of stupidity about gun control and people supporting 2nd amendment rights. By the way, what kind of attachment is that under the barrel, a laser or flashlight? Looks like a POS.
Why the fuck does Sotomoayor have an armed guard of US Marshalls outside her home 24/7?
Not to mention the old cliche. She’s the cunt who wants to take your right to defend yourself but surrounds herself with armed men.
USMS Judicial Security Division does their thing. But 24×7 protection generally is only when they’re travelling, or there is an elevated threat level.
Bad feds!
Who will give me odds on if she has the self-awareness to see why making people easier to victimize by disarming them might be a bad thing?
not
gonna
happen
Won’t even cross her mind.
Making people easier to be victimized is the whole point of gun control. It’s a win-win for them. they cant resist govt thuggery and high crime keeps the people demoralized and beaten down.
Make no mistake – gun controllers have malicious intent. If they did not and had sound arguments they would not lie EVERY SINGLE TIME they open their mouths.
One of the federal agents drew his weapon and fired several shots at the suspect, with the second officer also firing his weapon at Flowers.
Flowers, of Southeast DC, was arrested and treated at a local hospital for non-life-threatening injuries, officials said.
Qualified professionals.
Did they go door to door to check for collateral damage?
Inquiries are being made about the lack of links.
lack of links
pit of despair
Don’t even think of trying to escape.
Passive voice is being used 😂
You know me all too well, chiquita.
I have something juicy for OMWC, too. Not that he reads the site.
Red meat?
I heard he likes veal.
Bears and hikers: If you hike in bear country the necessary equipment includes this – https://www.smith-wesson.com/product/model-69
If you are unarmed and get eaten…well, sorry to hear that. Really not all that different than the loons that jump in bear enclosures at the zoo to pet the bear and apologize for global warming.
Eh, I’ve done it. If I died then it would have been my own fault, no big deal and not anyone else’s business.
Passive voice is being used
Balls were dropped.
Deadlines were missed
“For example, one device I have is a thermocouple driver.” Damn. I’d be tempted to start every first impression with that. I wouldn’t, because reality, but I’d *long* to.
It’s embarrassing and refreshing to read this. I understand the words, and have a vague sense of some of the basics (read: monstrously little), and put together, *literally* none of this makes sense. I wouldn’t be able to describe “What I’m reading” to someone if they asked. On the plus side, I do enjoy knowing how folks’ brains all work differently.