<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kshitij Vaze on Medium]]></title>
        <description><![CDATA[Stories by Kshitij Vaze on Medium]]></description>
        <link>https://medium.com/@kshitijvaze?source=rss-2808af1dbb32------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*nZPj07R8GGRfmH2P4t945g.jpeg</url>
            <title>Stories by Kshitij Vaze on Medium</title>
            <link>https://medium.com/@kshitijvaze?source=rss-2808af1dbb32------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 11:02:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kshitijvaze/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Sleep-Deprived Human Finally Knows The Sweet Joys of Rest]]></title>
            <link>https://medium.com/@kshitijvaze/a-sleep-deprived-human-finally-knows-the-sweet-joys-of-rest-ad7dde39efa3?source=rss-2808af1dbb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad7dde39efa3</guid>
            <dc:creator><![CDATA[Kshitij Vaze]]></dc:creator>
            <pubDate>Mon, 31 Aug 2026 02:54:35 GMT</pubDate>
            <atom:updated>2026-08-31T02:54:35.518Z</atom:updated>
            <content:encoded><![CDATA[<p>Goodest of morning lads!</p><p>Albeit a single day weekend, it was amazing to catch up on all the sleep debt from last week. I slept for 13 hours on Sunday, and had another 7 hours of good sleep, from 12–7 AM.</p><p>I try writing something in the morning for about 30 mins to an hour, so here we are. Work is looking calm for the day, nothing too surprising is expected to pop-up.</p><p>I have a bunch of thoughts that I am penning down was random notes that I hope to turn into articles and blogs for you all to read on this app and on substack. Hell, I even have a little diary that holds all these ideas that I have — just so that I don’t skip out on any of these.</p><p>Back to what I wanted to talk about — recovering sleep debt and how GOOD it feels. If you have seen or known me since my college days, you’d know how much of a coffee addict I really am, and how much do I love not sleeping and just doing something that I believe helps me get better at something or the other. In college, I used to say that I have a hatred for the damn bed, and a profound love for my desk instead.</p><p>I even continued this through my first two jobs, and the results were not bad at all. I was performing fairly well, blasting coffee through my system — even dry scooping it a fair few times in a day. I was living off of 4 hours of sleep a day, and no I am not joking.</p><p>I was in a fairly big company you see, and I could hide from others by sitting in a corner with my laptop post 3PM, so that I can just be left along when the sleep deprivation hit me like a dump truck. I could just coast along, cut corners when I wanted to, and it was really easy to hide my un-productive hours.</p><p>Now, cut to me being at a startup, where the hours are unforgiving, the team is literally 12 people, and the days are 6 a week, instead of 5. One mis-step when it comes to sleep, and I am SEEN by any and everyone when I am not as productive. Screw the optics for a moment. The work I am supposed to do has a disproportional impact on the company’s outlook.</p><p>The ramifications of me not being as productive as I can be, of me cutting corners when I shouldn’t have, of me not being as alert as I need to be, are quite simply put — catastrophic. I used to hear from a few seniors of mine that nothing forces you to fix your sleep and lifestyle like a demanding job does. And I was finding that out in real time!</p><p>So, about a couple months ago, I made 3 promises to myself.</p><p>1–7 hours of good sleep, and 1 hour of creative mental exercises in a day are NON-NEGOTIABLES for me.</p><p>2 — I want to physically tire myself throughout the day so much, that it becomes impossible for me to function without a minimum of 6 hours of rest.</p><p>3 — I wanted to focus and “Lock-in” as much as I can WHILE I am awake, and not waste time by not immersing myself into the task at hand.</p><p>So how has it turned out for me?</p><p>Quite fucking amazing I’d say!</p><p>Sleeping 7 hours consistently since a month now is a blessing. Man, I wish I had listened to my friends and family and quite literally EVERY single person around me when they told me to sleep more!</p><p>As for the second promise, sport and working out after work is an amazing way of doing that. It is mentally relaxing, and I finally am comfortable with working out alone — something I used to HATE the last time I was trying to be regular at the gym. And sport is simply a delight to be involved in. I gotta write about that sometime later!</p><p>As for “locking-in” on the task at hand while I am awake — that’s something I am still working on. I need to lessen my distractions — socials, music, and general “scrolling”. There has been progress made on that front, but I need to do better at it, and I guess that comes with more conscious application of myself and my mind — be it while I am at work, or at my own desk back home, trying to learn something.</p><p>If you are still reading this long ass post that I am writing literally on twitter’s (still not calling it X) “Create new post” tab (yes, it’s THAT spontaneous), I can only thank you for giving my ramblings a read.</p><p>I thought this’ll be relatable to all of you, considering most of you lot are coming out of college and into the world of employment. And for some reason, if you are new here — do follow, innit?!</p><p>Alright then, back to your regularly scheduled scrolling you go!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad7dde39efa3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A note on Thread Local Storage in OS]]></title>
            <link>https://medium.com/@kshitijvaze/a-note-on-thread-local-storage-in-os-ccff4799a2cd?source=rss-2808af1dbb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccff4799a2cd</guid>
            <category><![CDATA[operating-systems]]></category>
            <dc:creator><![CDATA[Kshitij Vaze]]></dc:creator>
            <pubDate>Wed, 19 Aug 2026 10:05:49 GMT</pubDate>
            <atom:updated>2026-08-19T10:05:49.505Z</atom:updated>
            <content:encoded><![CDATA[<p>SO — let’s talk about TLS, not Transport Layer Security, but the other one -&gt; Thread Local Storage.</p><p>This is a goddamn oxymoron if I have ever seen one, because as per Wikipedia — it is defined as a memory management technique in operating systems that used static/global memory, that is LOCAL to a thread. How the fuck does that even work? Well, let’s find out.</p><p>The concept allows storage of data that appears globally in a system, within separate threads of a system. The implementation of this concept itself is specific to the OS that you are using. We, shall take a look at the Pthreads implementation, which is defined as follows -</p><p>The functions pthread_key_create and pthread_key_delete are used respectively to create and delete a key for thread-specific data. The type of the key is explicitly left opaque and is referred to as pthread_key_t. This key can be seen by all threads. In each thread, the key can be associated with thread-specific data via pthread_setspecific. The data can later be retrieved using pthread_getspecific.</p><p>In addition pthread_key_create can optionally accept a destructor function that will automatically be called at thread exit, if the thread-specific data is not <em>NULL</em>. The destructor receives the value associated with the key as parameter so it can perform cleanup actions (close connections, free memory, etc.). Even when a destructor is specified, the program must still call pthread_key_delete to free the thread-specific data at process level (the destructor only frees the data local to the thread).</p><p>I came across this term while learning about tasks in FreeRTOS. According to the manual, we can store arbitrary data from the task into the Task Control Block itself! This is used to store data that would be otherwise stored in a global variable, by a non-reentrant function. What the hell is a re-entrant function?</p><p>It is a function that can be called by multiple threads without any side effects . Now usually, critical sections of the memory is used for global values to be stored and accessed by such a func, but repeated use of the critical section shall lead to system performance degradation, so TLS is preferred over here.</p><p>Enough theory, let’s see a practical example of this. There is a global called errno that is used in C to for providing extended error codes for common std lib functions.</p><p>Now here’s where things get interesting.</p><p>Imagine two threads executing the same function simultaneously. Thread A calls a library function, which fails and sets errno to EACCES. At almost exactly the same time, Thread B calls another library function, which fails and sets errno to ENOENT.</p><p>If errno were truly a single global variable shared by the entire process, Thread B could overwrite the value before Thread A gets a chance to read it. Thread A would then see the wrong error code. That would make the entire concept of multithreaded programming rather painful.</p><p>This is where TLS comes in.</p><p>Although errno looks like a global variable, modern implementations typically make it thread-local. Each thread gets its own instance of errno, so when Thread A writes EACCES, it is writing to Thread A&#39;s copy of errno. When Thread B writes ENOENT, it is writing to Thread B&#39;s copy.</p><p>So we have something that is globally accessible in the source code, but physically/logically separate for every thread.</p><p>And THAT is the entire fucking trick behind Thread Local Storage.</p><p>The variable is global from the perspective of the program’s interface, but its storage is local to the thread accessing it.</p><p>In fact, this is exactly why TLS is so useful for implementing otherwise non-reentrant library functions. Instead of having one shared piece of state that every thread must synchronize access to with a mutex or critical section, each thread gets its own copy of the state.</p><p>Conceptually, you can think of it like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*0_3tqG02JFm8USCns2zDxw.jpeg" /></figure><p>There isn’t one errno being fought over by every thread. There is effectively an errno associated with each thread.</p><p>And now the oxymoron starts making sense — Thread Local Storage is global in scope, but local in storage. TLS doesn’t make a global variable magically thread-safe. It changes the storage model so that each thread gets its own instance.</p><p>That same fundamental idea exists in FreeRTOS when we store task-specific data in the Task Control Block. The exact mechanism is different from POSIX TLS, but the underlying philosophy is the same: give each execution context its own instance of state that would otherwise have to be shared globally.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccff4799a2cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A note on task-events in FreeRTOS]]></title>
            <link>https://medium.com/@kshitijvaze/a-note-on-task-events-in-freertos-f4f06781cba3?source=rss-2808af1dbb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4f06781cba3</guid>
            <category><![CDATA[tor]]></category>
            <category><![CDATA[operating-systems]]></category>
            <category><![CDATA[freertos]]></category>
            <dc:creator><![CDATA[Kshitij Vaze]]></dc:creator>
            <pubDate>Wed, 12 Aug 2026 04:13:40 GMT</pubDate>
            <atom:updated>2026-08-12T04:13:40.669Z</atom:updated>
            <content:encoded><![CDATA[<p>Y’all gon learn some today.</p><p>In an OS, there are task states that are governed by an FSM, with each task transitioning to and from these states. The FSM usually maintains the states of a task as running, blocked, suspended, and ready.</p><p>Let’s take a look at their meaning, and the way these transitions occur. I am well aware that this is quite rudimentary, trivial even for some — but not a lot are into OS to begin with, so lemme make it a bit easier to make sense of!</p><p><strong><em>Le Running State </em></strong>— Exactly what you’d think of it to be. A task that is actively being executed on the processor is said to be in the running state.</p><p><strong><em>Le Blocked State</em></strong> — This is where it gets interesting. A blocked state is said to be invoked for a task when it is not being executed on the processor. But, not because it chose not to be executed, but because it’s waiting for an EVENT to happen. The event can be temporal, or synchronization related in nature, and I believe a brief about these is in order.</p><p>A temporal event is something that’s related to time. In the context of an OS, it occurs when a delay period expires and leads to a timeout, or something like that.</p><p>A synchronization event is something that originates from another task or an interrupt. It can be a semaphore, queue, mutex, or a message buffer that’s yet to basically do it’s job, because of which the task we are concerned about is not in a position to start executing.</p><p><strong><em>Le Suspended State </em></strong>— This is kind like when a task is put in timeout by a function called vTaskSuspend() (in the context of FreeRTOS). It means that the scheduler will not be able to schedule it even if it became sentient, and like, really wants to (lol). This is rarely used in most applications.</p><p><strong><em>Le Ready State </em></strong>— Here, everything that is needed fro a task to run, is ready for it to do so. All it needs now, is some real-estate on the processor and it can start executing. There might be a bunch of tasks that are in the ready state in an application, and the OS shall schedule them according to their priority, and the scheduling algorithm that’s at it’s heart.</p><p>Do take a look at the FreeRTOS tasks FSM down below -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*UM-zMaPLVbTj1zNno7XPpg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4f06781cba3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Note on IoT Pipelining over Cellular Networks]]></title>
            <link>https://medium.com/@kshitijvaze/a-note-on-iot-pipelining-over-cellular-networks-cb9643994014?source=rss-2808af1dbb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb9643994014</guid>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[embedded-systems]]></category>
            <dc:creator><![CDATA[Kshitij Vaze]]></dc:creator>
            <pubDate>Thu, 30 Jul 2026 12:49:02 GMT</pubDate>
            <atom:updated>2026-07-30T12:49:02.588Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y_fmrxH7n9pOtCDclnAU-g.png" /></figure><p>To make a long-ish story short, we are literally sending AT commands over UART or any other suitable peripheral to the 4G module of your choice, and those are responsible for setting up and executing data tx and rx operations, regardless fot eh application that you are running. It’s hilariously simple to be very honest with you, and sounded too good to be true the first 15 times I used the thing. But, it is. And I am in awe.</p><p>Now, for the longer version.</p><h3>What are AT commands</h3><p>These are called “Attention” (AT) commands which are the foundation of any and all cellular communication. They were originally developed for something called the “Hayes 300 Baud smart modem”, but then kept on evolving into what is now a standard set of commands for doing a bunch of things over cellular modems. These commands can be sent to the device via a serial port, text, or a connectivity management platform. They can be used to change device settings, get a status update, reboot the device, and perform other functions.</p><p>Now, there’s some funny business that went on in the 80s with AT commands, and as recommended reading — look up “ping of death” on google to see some hilarious ways of getting a model to drop the call and connection entirely.</p><p>Coming back to the point, there’s primarily 2 sets of AT commands, basic and Extended. The basic ones are written as “AT&lt;command_name&gt;”, while the Extended ones are written as “AT+&lt;command_name&gt;”. Further, there are 4 categories of AT commands, namely test(=?), read(?), set(=) and execution(none). The braces are the suffixes of the respective commands.</p><p>Now, I won’t bore you with the mundane details of listing AT commands. Rather, we shall now take a look at the flow of steps that are executed to establish a connection, and then proceed to transmit data.</p><h3>The setup</h3><p>We shall spare a few lines to set the context of the example that we are considering. The scenario for this example is of an IoT edge node that is using your favourite 4G connectivity module, be it a SimCom or a Quectel module. The edge node has an MCU (that’s a Microcontroller, for my CSE folks), which is responsible for collecting the sensor values (generic, can be literally anything), arranging them into a chosen message schema, and making it ready to be transmitted. The module, is supposed to be woken up, given the task of initializing and verifying the network uplink connectivity, and then, given the commands to actually send the packets of data that have been prepared.</p><p>A brief about MQTT, for the uninitiated — MQTT (Message Queuing Telemetry Transport) is a lightweight, publish-subscribe network protocol designed for resource-constrained devices operating on high-latency or low-bandwidth networks. Instead of using a client-server architecture where a client talks directly to a server, MQTT clients publish messages to a central Broker, which then distributes those messages to any clients subscribed to specific Topics.</p><p>Keep in mind, the responsibility of maintaining the MQTT packet formatting lies with the MCU and that of transmitting the packet lies with the 4G module. Also, the whole system is driven by the MCU. Meaning that the microcontroller shall handle the timing of sending data, the commands involved in order to get the module to transmit, and maintaining the desired timing determinism of data tx. Also — THIS IS HAPPENING OVER STRINGS BEING SENT VIA A SERIAL PROTOCOL. I don’t think people truly realise how simplistic this truly is, lol!</p><h3>Flow of commands</h3><p>Here’s a list of commands that shall typically be used to execute this.</p><h3>1 — TO ATTACH TO THE NETWORK AND INITIALIZE THE APN (access point network)</h3><p>First up, you’ll bring up the cellular network via -&gt; <em>AT+CPIN?</em></p><p>Then, you check the strength of the signal via -&gt; <em>AT+CSQ</em></p><p>Then the network registration — meaning that yoyr device literally logs into the carrier network and registers as a valid device — with-&gt; <em>AT+CREG?</em> <em>AT+CGREG?</em> <em>AT+CEREG?</em></p><p>Followed by the command to set up the Access Point Name of the carrier that you are using, via -&gt; <em>AT+CGDCONT=1,”IP”,”&lt;your_carrier_apn&gt;”</em></p><p>Now, once you are done with this, there’s something called a packet data protocol, that needs to be setup. This is basically a bridge between your private device, and the wider cellular network from your carrier. It assigns an IP to your device, and carries important details like your Access Point Name (APN) and your Quality of Service (QoS) preferences.</p><p>Ever seen a full 5-bar connection on your phone but your damn youtube video still won’t buffer? That’s most likely because of a PDP failure! You set it up with the following command -&gt; <em>AT+QIACT</em></p><h3>2 — OPEN A SOCKET AND CONNECT TO A BROKER</h3><p>Now, once you are in the network — all that’s left to configure and connect is the destination of your data. In our setup, it is an MQTT server, that’s accessible to us, via an MQTT broker. Naturally, the broker is blessed with a domain, port, and an IP. In order to connect to that, you first need to open a client via the command -&gt; <em>AT+QMTOPEN=</em></p><p>And then connect to a broker with the username and password of your choice via -&gt; <em>AT+QMTCONN=0,”client001&quot;,”username”,”password”</em></p><h3>3 — PUBLISH TO A TOPIC, AND SUBSCRIBE TO A TOPIC</h3><p>With all that being setup and ready to go, all that is left is for us to publish to a topic in order to send data, and subscribe to another topic in order to receive data. This is achieved via the following commands -&gt; <em>AT+QMTPUB=0,2,1,0,”sensors/data”</em> <em>AT+QMTSUB=0,1,”sensors/cmd”,1</em></p><p>Once the device is ready to disconnect form the network, it can do so via -&gt; <em>AT+QMTDISC=0</em></p><p>And then close the comms via -&gt; <em>AT+QMTCLOSE=0</em></p><h3>Real-World Nuances &amp; Operational Realities</h3><p>While typing strings over UART makes sending data sound trivial, there’s a bunch of stuff that is just waiting to mess up your comms and line up a long debugging session for you out there. Lemme attempt to document a few, so that you know what you are up against.</p><h3>Carrier CGNAT, Private IPs, and Inbound Connections</h3><p>When your modem gets an IP address via AT+QIACT, do not expect a public IPv4 address. Cellular carriers route IoT traffic through <strong>Carrier-Grade NAT (CGNAT)</strong>. Your device receives a local, private IP (often in the 10.x.x.x or 100.64.x.x block) behind a massive stateful firewall.</p><p>You see, you cannot host a server on your MCU and initiate inbound connections from the internet to your device. The MCU <em>must</em> always initiate outbound TCP connections (like MQTT or HTTP client sockets) to a public IP. The CGNAT router will keep a temporary NAT table entry open to forward return traffic to your modem.</p><h3>APNs and DNS Resolution</h3><p>Setting the correct APN via AT+CGDCONT is critical. If your APN string is wrong, the network will reject your activation attempt entirely.</p><ul><li><strong>Public APNs vs. Private APNs:</strong> Standard SIM cards use shared carrier APNs. Corporate or custom IoT SIMs use <strong>Private APNs</strong>, which route your module’s traffic over an IPsec tunnel straight into your cloud infrastructure (AWS VPC, Azure VNet, etc.), bypassing the public internet entirely.</li><li><strong>DNS Caching:</strong> Standard 4G modules resolve hostnames via carrier DNS servers during execution of commands like AT+QMTOPEN. If DNS resolution fails due to poor signal, hardcoding primary/secondary IP addresses or manually setting a public DNS (e.g., 8.8.8.8 via modem DNS settings) can drastically cut down on socket initialization times.</li></ul><h3>Payload Compression &amp; Managing Cellular Bills</h3><p>Cellular data plans for IoT are billed strictly by the megabyte or kilobyte. Sending human-readable JSON like {“temperature”: 24.5, “humidity”: 60.1} costs ~40 bytes <em>plus</em> TCP/IP and MQTT headers. This, is a very nice way to make your network provider very, very rich with all this traffic that you are sending over! A way to handle this would be a simple switch from JSON to a packed binary payload (like <strong>Protobuf</strong>, <strong>CBOR</strong>, or raw struct byte arrays) cuts payload sizes by 60–80%.</p><p>Remember that every transmission appends IP, TCP, and MQTT overhead. Aggregating 10 telemetry readings into a single payload array sent once every hour costs significantly less than publishing 10 individual messages every 6 minutes.</p><h3>Keep-Alive Pings vs. Power Constraints</h3><p>To keep a TCP connection alive through CGNAT, MQTT uses a <strong>Keep-Alive timer</strong>. If no data is sent before this timer expires, the client sends an PINGREQ packet, expecting a PINGRESP. But, here’s the downside to doing this frequently — keeping an active 4G module attached to a TCP socket consumes <strong>100mA to 200mA</strong> constantly, which will kill a battery-powered device in days. So, on battery powered edge nodes, we set long MQTT keep-alives, transmit data, then explicitly close the socket, send AT+QPOWD=1 (or drop the module into Deep Sleep / eDRX / PSM mode), and put the MCU to sleep.</p><p>On systems that have their power input from the mains, we keep the connection open with a reasonable keep-alive (e.g., 60 to 120 seconds) to ensure the CGNAT firewall doesn’t silently drop the socket mapping.</p><h3>Engineering Pitfalls &amp; Survival Strategies</h3><p>If you expect AT command communication to act like a synchronous function call in C++, your firmware will crash in production. Here’s a few pitfalls that can mess up your systems real fast, if not handled with appropriate care.</p><h3>Unsolicited Result Codes (URCs)</h3><p>The most common mistake engineers make is treating the modem like a simple Request-Response device. AT commands don’t just reply with OK or ERROR. Modules issue <strong>Unsolicited Result Codes (URCs)</strong> at <em>any given millisecond</em> over UART. For example, while your MCU is preparing a payload, the modem might spit out:</p><ul><li><em>NITZ: 26/03/30,10:30:15</em></li><li><em>+CEREG: 0</em></li><li><em>+QMTSTAT: 0,1</em></li></ul><p>If your UART driver blindly expects OK after sending AT+QMTPUB, but receives +QMTSTAT: 0,1 (indicating the broker closed the connection), your state machine will lock up. This a good rule of thumb would be to build a dedicated UART ring buffer and an asynchronous parser thread/loop that segregates <strong>Command Responses</strong> from <strong>Background URCs</strong>, and handle each of these appropriately.</p><h3>Double Response &amp; String Parsing Logic</h3><p>Modems echo characters back over UART by default (ATE1). If your MCU sends AT+CSQ, the modem sends back: <em>AT+CSQ</em> <em>+CSQ: 24,99</em> <em>OK</em></p><p>If you aren’t stripping echoes (ATE0) or writing robust line-by-line parsers, your string matching code will accidentally match the command string you sent rather than the result string returned by the module! Always validate the trailing OK or ERROR sequence before advancing state machine steps.</p><h3>Securing the Channel: Certificates and MQTTS</h3><p>Sending plain MQTT over port 1883 over cellular exposes credentials and sensor data to interception. Production systems require <strong>TLS (MQTTS over port 8883)</strong>. Securing communications over AT commands requires extra steps:</p><ol><li><strong>Load Certificates into Module Flash:</strong> You must write root CA certificates, client certificates, and private keys to the module’s internal storage using AT file storage commands (e.g., AT+QFUPL).</li><li><strong>Configure SSL/TLS Contexts:</strong> Associate the loaded certificate files with an internal SSL context using commands like AT+QSSLCFG.</li><li><strong>Bind TLS to the Socket:</strong> Configure AT+QMTOPEN to use the configured SSL context ID rather than a plain TCP connection.</li></ol><p>Handling TLS handshakes on tiny 8-bit or 32-bit MCUs is tough due to RAM constraints. Offloading the entire TLS encryption stack to the 4G module via AT commands is the ultimate feature of modern cellular modules — provided you handle certificate expiration and update mechanisms gracefully!</p><h3>REFERENCES</h3><p><a href="https://www.campuscomponent.com/blogs/post/Let-us-Discuss-How-MQTT-Protocol-Works-in-4G-Modules">https://www.campuscomponent.com/blogs/post/Let-us-Discuss-How-MQTT-Protocol-Works-in-4G-Modules</a></p><p><a href="https://en.wikipedia.org/wiki/Hayes_AT_command_set">https://en.wikipedia.org/wiki/Hayes_AT_command_set</a></p><p>And of-course, Google!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb9643994014" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Note On Memory Allocation in RTOS]]></title>
            <link>https://medium.com/@kshitijvaze/a-note-on-memory-allocation-in-rtos-15e1ba36339f?source=rss-2808af1dbb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/15e1ba36339f</guid>
            <category><![CDATA[operating-systems]]></category>
            <dc:creator><![CDATA[Kshitij Vaze]]></dc:creator>
            <pubDate>Fri, 24 Jul 2026 06:59:40 GMT</pubDate>
            <atom:updated>2026-07-24T06:59:40.012Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*t-loAnc17X5SvXNUh39FFw.jpeg" /></figure><h3>Static Vs Dynamic Memory Allocation</h3><p>Dynamic alloc is the simplest and most hassle free way of doing this. The API is simpler, there is less design and planning and lesser footprint of the final executable that is loaded onto the RAM. Static on the other hand, is a lot more determinism about it, and ensures that there is no fragmentation in the heap. For those unaware, fragmentation of memory means that there is memory available, but not in a contiguous manner, making things available when diagnostics ask about it, but not when the system actually needs it.</p><p>There is a glaring lack of uniformity when it comes to the standard C functions of allocating and freeing memory, such as malloc(), calloc(), and free(). What, you really thought that they are same regardless of the architecture and toolchain that you are implementing it on? LoL. Also, they have no way of knowing about fragmentation of the heap, so that’s another major issue about these. So, OS Like FreeRTOS said — “Fine. I’ll do it by myself”, and started treating memory management as a feature, instead of leaving it to the programmer. They have implemented 5 ways of managing the heap, creatively naming them heap_1.c,heap_2.c,heap_3.c,heap_4.c, and heap_5.c!</p><p>There are also special alloc and free functions in FreeRTOS, called pvPortMalloc(), vPortFree() and others, that primarily exist and are used for offering thread safe implementations of these memory functions.</p><p>We’ll take a look at the very creatively named 5 implementations of heap memory management in this now -</p><h3>heap_1.c</h3><p>This is tailored to those who do not need a lot of compute to be honest. Lemme explain. Applications that can declare their tasks and primitives before the Kernel starts are invited to use this implementation. heap_1 implements a version of pvPortMalloc(), which divides a simple uint8_t array called the FreeRTOS heap into the size of how many bytes have been requested every time that it’s been called. Each call invokes 2 pvPortMalloc() calls, one for the TCB of the task, and the second for the task stack of the caller.</p><p>This makes the FreeRTOS code seem to consume a lot of RAM, since the arrays are statically allocated at compile time, but this ensures determinism of memory and non-fragmented memory at runtime.</p><h3>heap_2.c</h3><p>This implements vPortFree(), and does a simillar division of the massive FreeRTOS Heap array as heap_1 does. This one uses a best-fit algorithm, and this ensures that the freed memory is always used again when called upon. For example. Suppose there’s 3 blocks of memory that’as freed, each of 5, 25, and 100 bytes.</p><p>Say that there’s been a call for 20 bytes of the memory. The algo shall split the 25 byte block into 20 and 5, before returning a pointer to the 20 byte block, and marking the 5 byte block as available for future pvPortMalloc() calls (kinda inaccurate, but shall do for now).</p><h3>heap_3.c</h3><p>LoL, this literally uses malloc() and free() from the stdlib that you and I are all too familiar with (you know how these things work, right????). I guess the makers of this were lazy bastards, who literally suspend the damn scheduler when these functions are called for memory allocation and freeing. Proper madlads, I tell you!</p><h3>heap_4.c</h3><p>This is heap_2.c but better. Same principles so far, divide a large uint8_t array into smaller parts when pvPortMalloc() is called, and collect the freed memory back. But here, we make it available via the first-fit algorithm. This ensures that pvPortMalloc() uses the very first block of memory that is big enough to hold the requested memory. This implementation combines adjacent blocks of memory that are freed into a single block of memory that is available to be allocated, minimizing the risk of fragmentation.</p><h3>heap_5.c</h3><p>This improves upon the heap_4’s implementation (a recurring theme, isn’t it) , by being able to combine multiple memory spaces into a single heap. I’ll be dead honest with you — even I am lost at this point. How the hell is this even possible? I’ll get around to that in a later post I suppose.</p><p>So, which creative heap_X.c file should you actually pick for your project?</p><p>If your system is hyper-critical, runs fixed tasks, and needs 100% determinism without the risk of memory leaks, <strong>heap_1.c</strong> (or raw static allocation) is your best friend. If you’re building a standard IoT device or embedded app that constantly creates and deletes queues, tasks, or buffers on a single RAM bank, <strong>heap_4.c</strong> is the gold standard. And if your hardware designer gave you a complex microcontroller with RAM scattered across multiple memory banks, <strong>heap_5.c</strong> saves you from going insane.</p><p>FreeRTOS taking memory management into its own hands isn’t just control-freak behavior — it’s the difference between a system that runs forever and one that silently crashes 3 weeks into deployment because of a fragmented heap.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15e1ba36339f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Note On Getting Started With OS]]></title>
            <link>https://medium.com/@kshitijvaze/a-note-on-getting-started-with-os-79a772f7d822?source=rss-2808af1dbb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/79a772f7d822</guid>
            <category><![CDATA[electronics]]></category>
            <category><![CDATA[microcontrollers]]></category>
            <category><![CDATA[operating-systems]]></category>
            <dc:creator><![CDATA[Kshitij Vaze]]></dc:creator>
            <pubDate>Thu, 23 Jul 2026 05:47:04 GMT</pubDate>
            <atom:updated>2026-07-23T05:47:04.746Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*njBvEHfnial6xm12pOSSLQ.png" /></figure><p>Right, so here’s a bit more detailed guide on how to get into OS, and a bit more about the intricacies that you can expect to be challenging to you.</p><p>The recommended way from me, is still the Mastering FreeRTOS manual and a simple WeAct Studios STM32F446 Dev board that you can mess around with. The Manual has all that you need when it comes to theory, and the dev board is more than capable enough to help you implement things.</p><p>Also, please — USE LLMs TO HELP YOU LEARN BETTER. PLEASE DO. But do NOT use them to substitute the process of thinking.</p><h3>The Heart-beat of an OS</h3><p>Now, some intricacies. Let’s start with the Tick source. The concept is quite simple, the OS has 0 sense of time. Or Timing. And that’s quite important when it comes to scheduling things, which is the whole point of the RTOS. So, there needs to be a stable, consistent source of rhythm, that the RTOS can take as reference and structure its operation around. On ARM chips like the STM32F446, this usually comes down to configuring the SysTick hardware timer to fire a hardware interrupt at a fixed frequency, typically every 1 millisecond.</p><p>Every single time that timer overflows, the processor pauses whatever code it’s running, hands control to the RTOS tick handler, and increments an internal counter. That tick handler is the heart rate of your system. It is where the scheduler checks if a sleeping task needs to wake up, if a timeout has expired, or if it’s time to hand the CPU over to a different task. Without that steady heartbeat, the RTOS is completely blind to duration, delay, or cadence.</p><h3>The break-down of operations</h3><p>Next, we have processes, threads, and tasks. When you come from desktop systems like Linux or Windows, you’re used to a clear boundary between a process, which has its own isolated memory space via virtual memory, and threads, which share memory within that process. On microcontrollers, you can essentially drop the concept of traditional processes altogether. Small microcontrollers rarely have a full Memory Management Unit to enforce memory isolation, so everything lives in one big, flat physical memory space.</p><p>In an RTOS context, we talk about tasks. A task is really just a simple, self-contained C function that runs in an infinite loop, never returning. The RTOS creates the illusion of running multiple tasks simultaneously by performing context switches. When it decides to switch tasks, it saves all the CPU registers of the current task onto its stack, updates the stack pointer, loads the saved register state of the next task, and jumps straight into its code. To the hardware, it is just executing instructions continuously, but to you, it looks like a bunch of independent programs executing in parallel.</p><h3>What needs to be done ASAP, and what can wait</h3><p>You need to also take a good long look at their priority, which is a nicer way of saying what needs done ASAP and what can wait and be tackled in the CPU’s free-time, so to speak. Priority in a real-time system isn’t a friendly suggestion or a general hint to the system, it is a strict operational rule. The FreeRTOS scheduler operates on a strict preemptive basis, meaning the highest-priority task that is ready to run will ALWAYS get the CPU. If a low-priority task is mid-execution and a high-priority task suddenly becomes ready because new sensor data came in, the RTOS immediately suspends the lower one and hands over the core.</p><p>If multiple tasks share the exact same priority, the RTOS will divide time between them using time-slicing on every tick interrupt. But this strict priority mechanism brings a major trap known as task starvation. If you write a high-priority task that spends all its time processing data in a tight loop without explicitly yielding or blocking to wait for an event, lower-priority tasks will literally never run a single instruction. Designing a stable RTOS application means ensuring high-priority tasks do their job quickly, block themselves to wait for the next event, and get out of the way.</p><h3>The Guardians of Memory (and data)</h3><p>Then, shall come the things that help make comms between them easier and help protect data from corruption — Semaphores, Mutexs, Locks, and Queues. Since every task shares the same memory space, if two tasks try to write to the same buffer or talk to the same hardware peripheral at once, you get instant data corruption. Queues are your primary tool for moving data safely from one place to another; they copy data safely between tasks and handle blocking for you when a queue is empty or full. Semaphores are used for signaling events rather than passing actual payload data, where a hardware interrupt can give a semaphore to signal a worker task to wake up and process something.</p><p>Mutexes are special locks designed specifically for protecting shared resources like an I2C or UART bus. Unlike simple locks, a proper RTOS Mutex includes built-in protection against Priority Inversion. This nasty phenomenon happens when a low-priority task holds a lock, a high-priority task gets blocked waiting for that lock, and an unrelated medium-priority task kicks in and starves the low-priority task, unintentionally blocking the high-priority task too. The Mutex solves this via priority inheritance, temporarily boosting the low-priority task’s priority so it can finish using the resource quickly and give control to the high-priority task.</p><h3>Having our way with the CPU regardless</h3><p>Then, you might take a look at interrupt management, and how interrupt priority is managed alongside task priority. It is extremely important to realize that hardware interrupt priority, managed directly by the microcontroller’s hardware interrupt controller, sits completely above RTOS task priority. An interrupt will ALWAYS interrupt a running task immediately, regardless of how high that task’s priority is set. Because of this, you have to keep your Interrupt Service Routines absurdly short and fast.</p><p>You should never do heavy processing or wait for slow hardware inside an interrupt. Instead, the interrupt should do the bare minimum, hand off the real work to a task using a queue or a semaphore, and exit. Furthermore, you cannot call standard RTOS API functions inside an interrupt handler because doing so can corrupt scheduler states. You have to use dedicated “FromISR” versions of those functions, which safely handle communication from interrupt context and can request the RTOS to perform a context switch immediately as the interrupt exits.</p><h3>The toughest (and most fun) thing to do</h3><p>A nice way to put this all together, is memory management, critical sections, what makes them special and how to protect them, how to manage the heap and stack, and a lot more that comes with it. Memory management on a microcontroller requires you to be very explicit about where every byte goes. When you create a task, the RTOS allocates a dedicated slice of RAM to act as that specific task’s stack, which holds its local variables, function arguments, and saved CPU state during a context switch. If a task uses too many nested functions or huge local arrays, it will overflow its stack and corrupt adjacent memory, making stack monitoring tools during development non-negotiable. For dynamic allocations, FreeRTOS provides configurable heap management schemes that let you pick the right balance between static allocations, simple dynamic allocation, or full thread-safe memory management.</p><p>Finally, when you have quick code operations that absolutely cannot be interrupted by anything — like modifying a shared global bit-mask — you wrap them in a critical section. Entering a critical section temporarily disables hardware interrupts up to a configured threshold, ensuring that neither another task nor an interrupt can touch the system mid-operation. Keeping these critical sections down to just a few nanoseconds is the key to maintaining a system that stays truly real-time.</p><p>Now, do I know all about these? Hell no I don’t. But, I am learning, and attempting to share my conclusions and thoughts with y’all. So, if you are still reading, well, follow along lads!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79a772f7d822" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Eerie Similarities Between Control Systems and Artificial Intelligence]]></title>
            <link>https://medium.com/@kshitijvaze/the-eerie-similarities-between-control-systems-and-artificial-intelligence-5acb887f3dbe?source=rss-2808af1dbb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/5acb887f3dbe</guid>
            <category><![CDATA[control-system]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[electronics]]></category>
            <dc:creator><![CDATA[Kshitij Vaze]]></dc:creator>
            <pubDate>Mon, 01 Jun 2026 09:17:42 GMT</pubDate>
            <atom:updated>2026-06-01T09:17:42.940Z</atom:updated>
            <content:encoded><![CDATA[<p>Alright, this is going to be a bit of a long one, but at its very core, Control Systems and Artificial Intelligence are 2 routes for achieving the same thing: reducing the gap between what is and what should be.</p><p>A thermostat wants the room to be 22°C. A cruise controller wants the car to be at 80 km/h. A robot arm wants its end effector to be at a specific coordinate. A large language model wants its generated output to match the statistical patterns of human language. In every case, there is some notion of a desired state, a current state, an error between the two, and a mechanism for reducing that error.</p><p>This is why the philosophical foundations of both fields are staggeringly similar. They are fundamentally about decision-making under uncertainty. The system studies the input, observes the environment, processes information, takes a controlling action, observes the consequences of that action, and then adjusts its future behavior accordingly, while remembering the behavior of it’s past actions. Whether the adjustment happens through PID gains, adaptive control laws, gradient descent, or reinforcement learning is merely an implementation detail.</p><p>In fact, if you strip away the terminology, many AI concepts sound suspiciously familiar to anyone with a controls background. A loss function is just a generalized error signal. Gradient descent is a tuning mechanism. Training is a tuning and optimization process. Reinforcement learning agents continuously interact with a plant-the environment-and attempt to maximize a reward signal that is effectively another form of performance metric. The language changes, but the underlying feedback loop remains.</p><p>What’s interesting is that the two disciplines diverged historically because they evolved to solve different classes of problems.</p><p>Control theory grew up around physical systems. Engineers already knew a lot about the systems they were controlling. They could derive equations for motors, aircraft, power converters, and industrial processes. The challenge was designing a controller that could guarantee stability, robustness, and performance.</p><p>AI emerged from a different problem space. Here, the system itself was often unknown or too complex to model explicitly. Nobody can write down differential equations describing every nuance of human language, image recognition, or strategic reasoning. Instead of deriving a model, AI attempts to learn one from data.</p><p>You could almost describe the distinction as:</p><p>&gt; Control Theory assumes knowledge and optimizes behavior.<br>&gt; AI assumes data and learns knowledge.</p><p>Yet even that boundary is becoming blurry.</p><p>Modern robotics routinely combines both. A drone might use classical PID loops running at kilohertz frequencies to stabilize its attitude, while a neural network performs object detection, path planning, or adaptive navigation.</p><p>Autonomous vehicles fuse model-based control, optimization, estimation theory, machine learning, and sensor fusion into a single system. The wall between “AI” and “Control Systems” becomes harder to see the deeper you go.</p><p>Some researchers even argue that intelligence itself is simply an extraordinarily sophisticated control problem. Biological organisms continuously sense their environment, predict future states, take actions to achieve goals, and update internal models based on feedback. From that perspective, the human brain can be viewed as perhaps the most advanced adaptive control system ever observed.</p><p>The irony is that many newcomers see AI as the futuristic field and control systems as the old-fashioned one. But beneath the surface, much of modern AI stands on foundations built by decades of work in control theory, optimization, estimation, information theory, and signal processing. The mathematical DNA is shared, and the electronics nerds (I try to be one) who happen to be in the know simply stand steadfast, smiling, albeit menacingly.</p><p>So while it isn’t technically correct to say that a PID controller and a neural network are the same thing, it is fair to say that they are descendants of the same idea:</p><p>-&gt; Observe reality. Compare it to a goal. Measure the error. Adapt. Repeat.</p><p>Everything else is just a matter of how sophisticated the adaptation mechanism becomes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5acb887f3dbe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Growing Pains of A Young Engineer]]></title>
            <link>https://medium.com/@kshitijvaze/growing-pains-of-a-young-engineer-673279c4e99f?source=rss-2808af1dbb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/673279c4e99f</guid>
            <dc:creator><![CDATA[Kshitij Vaze]]></dc:creator>
            <pubDate>Sun, 31 May 2026 14:32:46 GMT</pubDate>
            <atom:updated>2026-05-31T14:32:46.110Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j-V5flj-tHqpdDHyLGRrpQ.png" /></figure><p>For most of my career so far, I’ve been a junior engineer. The workflow was familiar: get assigned a task, understand the requirements, spend a few days buried in documentation, code it up, test it on hardware, validate the behavior, and finally push it up for review. If I misunderstood a requirement, someone caught it.</p><p>If I forgot an edge case, someone caught it. If I made a questionable design decision, someone caught it. That’s not a criticism of my work-it’s simply how engineering teams are supposed to function. Junior engineers are given room to learn, make mistakes, and gradually develop the intuition that only comes from experience. The safety net exists for a reason, and I’ve been fortunate enough to work with senior engineers who provided exactly that.</p><p>But now, for the first time, I’m stepping into something different. I’m joining a startup as a founding engineer, and somehow, despite still feeling like I’m figuring things out as I go, I’m going to be one of the oldest engineers on the team. That realization has been sitting in the back of my mind for weeks because the nature of responsibility changes. It’s no longer enough to simply complete the task that lands on my desk. I have to be the person asking whether the task itself makes sense.</p><p>I have to think about the requirements that nobody wrote down, the assumptions nobody challenged, and the failure modes nobody thought about. Instead of focusing solely on implementation, I need to think about performance, scalability, maintainability, manufacturability, and user experience-all before a product ever reaches a customer.</p><p>The review process doesn’t disappear, but the assumption changes. As a junior engineer, the implicit expectation was that somebody more experienced would eventually look over my work and catch what I missed. Now the question is no longer “Did I implement this correctly?” but rather “What have I forgotten to consider?”</p><p>That’s a significantly harder problem because it requires anticipating unknowns rather than fixing known issues. The bugs that matter most aren’t the ones that crash immediately; they’re the ones that quietly survive testing, make it into production, and reveal themselves six months later when a customer uses the product in a way nobody expected.</p><p>The interesting thing is that the fear isn’t coming from a lack of confidence in my technical skills. I know how to read code, write code, debug systems, bring up hardware, trace issues through software stacks, and spend unreasonable amounts of time staring at logs trying to understand why something isn’t behaving as expected. What feels daunting is realizing how much engineering exists beyond writing code.</p><p>Engineering, at scale, is less about implementation and more about judgment. It’s about understanding trade-offs, managing risk, making decisions with incomplete information, and accepting that every shortcut eventually sends an invoice. The code is often the easiest part; deciding what code should exist in the first place is where things become difficult.</p><p>I suspect this role will force me to develop a completely different set of instincts. Up until now, I’ve spent years learning how systems work. The next phase will be about learning how products succeed-or fail. I’ll have to think not just like an engineer, but like someone responsible for the entire lifecycle of a product.</p><p>What happens when the hardware behaves differently than expected? What happens when manufacturing introduces variability? What happens when a customer does something that never occurred during testing? What happens when a design decision made today limits the company six months from now? Those questions don’t always have clear answers, but they still need to be asked.</p><p>And honestly, that’s what makes this opportunity exciting. There is a ridiculous amount that I don’t know yet, and there are gaps in my knowledge that I haven’t even discovered. There will be mistakes, there will be decisions that seem obvious in hindsight, and there will undoubtedly be moments where I wish there was a senior engineer sitting next to me saying, “Have you considered this?”</p><p>But that’s also where the growth happens. Technical skills can be learned from books, documentation, and experience. Judgment is earned the hard way-through ownership, accountability, and occasionally being wrong.</p><p>For the first time, I’ll be much closer to the consequences of my decisions. That’s equal parts exciting and terrifying. The safety rails are disappearing, and with them comes the opportunity to develop the kind of engineering judgment that can’t be taught in a classroom or learned from a tutorial. There’s a tremendous amount left for me to learn, but that’s exactly what makes this next chapter worth pursuing.</p><p>If there’s one thing I’ve realized through this transition, it’s that engineering maturity isn’t about having all the answers. It’s about becoming comfortable with being the person responsible for finding them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=673279c4e99f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Does A Device Seamlessly Connect To The Wi-Fi]]></title>
            <link>https://medium.com/@kshitijvaze/how-does-a-device-seamlessly-connect-to-the-wi-fi-7d0bec113db5?source=rss-2808af1dbb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d0bec113db5</guid>
            <category><![CDATA[wifi]]></category>
            <category><![CDATA[electronics]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Kshitij Vaze]]></dc:creator>
            <pubDate>Sat, 23 May 2026 08:23:48 GMT</pubDate>
            <atom:updated>2026-05-23T08:23:48.889Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eAoFpltxbf3-RE4dknxfLA.png" /></figure><h3>How Devices Actually Connect To WiFi</h3><p>Most people think connecting to WiFi means entering a password and magically getting internet access. In reality, an absurd amount of distributed networking machinery spins up underneath that single click. Within a few seconds, your machine performs radio scanning, 802.11 management exchanges, authentication, cryptographic key derivation, DHCP negotiation, ARP discovery, DNS resolution, TCP session establishment, NAT traversal, and often TLS encryption setup before a single webpage appears on the screen.</p><h3>A Brief History of WiFi Standards</h3><p>Before diving deeper, it helps to know that WiFi didn’t start as the fast, secure protocol we use today. The original 802.11 standard from 1997 delivered only 2 Mbps. Subsequent amendments brought 802.11b (11 Mbps), 802.11a/g (54 Mbps), and eventually 802.11n (600 Mbps), 802.11ac (several Gbps), and 802.11ax (WiFi 6/6E). Each generation improved modulation schemes (from Barker coding to OFDMA), added MIMO antennas, and introduced better security. Today’s devices still fall back to older rates for compatibility, which is why a 2024 laptop can connect to a 2008 router.</p><p>The most fascinating part is that the router fundamentally does not care whether the client is running Linux, Windows, macOS, Android, Zephyr, FreeRTOS, or a tiny lwIP stack running on an MCU. Once packets leave the network interface controller, every machine on Earth is forced into the same protocol grammar. That shared protocol language is what truly makes the internet interoperable.</p><h3>Why “Interoperable” Is Harder Than It Sounds</h3><p>Interoperability isn’t automatic. Hundreds of engineers at the IEEE, IETF, WiFi Alliance, and vendor test labs spend years writing conformance tests. A router from TP-Link must work with a laptop from Apple, a phone from Samsung, and a smart plug from Tuya. The WiFi Alliance runs certification programs to ensure devices don’t just follow the spec on paper but actually behave correctly in real-world radio environments with interference, fading, and different antenna designs. Without this invisible testing infrastructure, your laptop might only connect to routers from the same brand.</p><p>WiFi itself is not “the internet.” That distinction matters enormously. WiFi is merely a wireless Layer 2 transport defined by the IEEE 802.11 specification. It defines radio modulation, airtime arbitration, MAC addressing, frame structures, retransmission behavior, and management signaling. It does not define IP addressing, routing, DNS, TCP, HTTP, or internet access. Those belong to higher layers of the networking stack.</p><h3>The Difference Between a Router, a Switch, and an Access Point</h3><p>In professional networking, these are separate boxes. A switch connects devices at Layer 2 within the same subnet. A router forwards packets between different subnets or to the internet. An access point converts wired Ethernet into wireless 802.11. Home “routers” combine all three plus a firewall and DHCP server. Understanding this distinction helps explain why you can have multiple WiFi access points (same SSID) but still need a router to leave your local network.</p><p>A modern consumer router is actually multiple independent networking systems hidden behind a single plastic enclosure. Inside that device exists an Access Point implementing 802.11 wireless communication, a Layer 2 switch handling local forwarding, a Layer 3 router forwarding IP packets between networks, a DHCP server assigning addresses, a NAT engine translating private and public traffic, a DNS forwarder caching queries, and usually a firewall enforcing packet filtering policies. Consumer networking hardware compresses decades of networking engineering into a tiny silent box sitting in the corner of a room.</p><h3>Connecting to the network</h3><p>The entire process begins at the radio layer. When a WiFi chipset powers on, the NIC enters scanning mode and begins sweeping across RF channels listening for nearby Access Points. Routers continuously transmit Beacon Frames, which are specialized 802.11 management frames broadcast periodically, typically every 100 milliseconds. These frames advertise the existence and capabilities of the network. They contain metadata such as the SSID, supported PHY standards, encryption capabilities, supported data rates, channel width, timing synchronization parameters, and power management information.</p><p>At this stage, no IP traffic exists whatsoever. No sockets exist. No routing exists. No TCP sessions exist. The client merely learns that an Access Point exists nearby and what capabilities it supports. The entire interaction is still purely Layer 2 radio communication.</p><p>Modern clients usually perform both passive and active scanning. In passive scanning, the device simply listens for beacon frames and builds a list of visible networks. In active scanning, the client transmits Probe Requests asking whether a specific SSID exists nearby. Access Points matching that SSID respond with Probe Responses. Active scanning dramatically reduces discovery latency, which is why modern devices can populate a WiFi list almost instantly.</p><p>Once a network is selected, the client begins the authentication and association process. Historically, 802.11 authentication was nearly meaningless. Early implementations effectively consisted of the client saying “authenticate me” and the AP replying “okay.” Modern WiFi security instead relies on WPA2 or WPA3 layered on top of the basic 802.11 authentication framework.</p><p>The famous WPA2 four-way handshake is where real cryptographic security begins. Contrary to popular belief, the WiFi password itself is not directly used as the encryption key for traffic. Instead, the password derives a Pairwise Master Key, after which both the client and AP exchange nonces and derive temporary session keys. This process establishes encryption keys for unicast and multicast traffic while simultaneously protecting against replay attacks. The resulting traffic encryption is usually AES-CCMP.</p><p>At this point, encrypted wireless communication exists between the client and the AP, but the device still does not possess an IP address. It exists only as a Layer 2 participant identified by its MAC address.</p><p>The association phase formally registers the client with the Access Point. The AP now maintains state information for the device, including encryption keys, QoS capabilities, sequence counters, supported transmission rates, and power-saving state. The client officially becomes part of the Basic Service Set, which is the logical collection of wireless stations managed by the AP.</p><p>Only after this does Layer 3 networking begin.</p><h3>Getting access to the internet via said network</h3><p>The device now needs an IP address, subnet mask, default gateway, and DNS server information. This is where DHCP enters the picture. DHCP itself operates over UDP, which surprises many people because the client does not yet possess an IP address. The solution is broadcasting. The client transmits packets using source IP 0.0.0.0 and destination IP 255.255.255.255, effectively shouting into the local network asking whether any DHCP server is available.</p><p>This process is commonly called DORA: Discover, Offer, Request, Acknowledge.</p><p>The client first broadcasts a Discover packet asking whether any DHCP server exists on the network. The router responds with an Offer packet proposing an available IP address along with additional configuration parameters such as subnet mask, lease duration, DNS servers, and gateway information. The client then sends a Request packet indicating it wishes to use that offered address, after which the router replies with an Acknowledge packet officially leasing the address to the client.</p><p>At that exact moment, the device becomes a valid Layer 3 node on the network.</p><p>Internally, the router maintains several critical tables that make this communication possible. The DHCP lease table maps MAC addresses to assigned IP addresses, allowing the router to remember which device owns which address. Simultaneously, ARP tables maintain mappings between IP addresses and MAC addresses because Ethernet and WiFi fundamentally deliver frames using Layer 2 addressing, not IP addresses directly.</p><p>This distinction is extremely important. IP addresses are logical identifiers used for routing between networks, while MAC addresses are hardware identifiers used for local delivery inside a broadcast domain. When a device wishes to communicate locally, it must first resolve the destination IP into a MAC address using ARP. Only then can the frame actually be transmitted over Ethernet or WiFi.</p><p>What makes networking extraordinary is that none of this machinery depends on the operating system running on the client device. The router does not understand Linux kernel internals, Windows NT networking APIs, BSD socket layers, or embedded RTOS abstractions. It only understands standardized packet formats.</p><p>Internally, Linux and Windows networking stacks are radically different systems. Linux networking is deeply integrated into the kernel and exposes socket interfaces like socket(), bind(), connect(), send(), and recv(). The Linux kernel TCP/IP stack handles routing decisions, congestion control, packet retransmissions, fragmentation, checksum generation, and traffic scheduling before eventually passing frames to the NIC driver.</p><p>Windows uses the Winsock API instead, exposing interfaces like WSASocket() and its own internal networking architecture. Yet despite these differences, both systems ultimately emit standards-compliant Ethernet, IP, TCP, UDP, and 802.11 frames.</p><p>From the router’s perspective, a TCP SYN packet generated by Linux must look identical to one generated by Windows. That universality is the entire foundation of networking interoperability.</p><p>Once DHCP completes, normal communication can finally begin. Usually the first operation is DNS resolution. The client asks a DNS server to resolve a human-readable hostname like google.com into an IP address. After receiving the destination IP, the client initiates a TCP three-way handshake consisting of SYN, SYN-ACK, and ACK packets. Only after this stateful transport session is established does actual application-layer traffic begin flowing.</p><h3>Letting the packets flow</h3><p>For HTTPS traffic, the process continues even further with TLS negotiation, certificate validation, cipher suite agreement, ephemeral key exchange, and encrypted session establishment before application payloads are exchanged.</p><p>Meanwhile, the router performs Network Address Translation because devices inside home networks typically use private RFC1918 addresses that are not globally routable on the public internet. NAT rewrites packet headers, tracks connection state, and maps internal private addresses onto a shared public IP provided by the ISP. Without NAT, home routers would require globally routable addresses for every local device.</p><p>Embedded systems fundamentally follow this exact same process. An ESP32, STM32 paired with an ESP8266, Raspberry Pi Pico W, industrial PLC, smart bulb, or automotive telematics module all perform the same conceptual workflow. They scan for Access Points, authenticate, associate, negotiate DHCP leases, resolve DNS, open sockets, and transmit TCP or UDP traffic. The only thing that changes is implementation complexity.</p><p>An embedded networking stack may use lwIP, FreeRTOS+TCP, Zephyr networking, or vendor SDK implementations instead of full Linux networking subsystems, but the generated packets still conform to the same standards. That is why an MCU with a few hundred kilobytes of RAM can coexist perfectly on the same network as enterprise Linux servers and gaming desktops.</p><p>The internet works because every machine agrees to speak the same protocol language. Not the same operating system. Not the same programming language. Not the same CPU architecture. A Linux server in Germany, a Windows laptop in India, and an ESP32 in a garage workshop can all communicate flawlessly because every device eventually reduces itself to the same universally agreed packet structures:</p><pre>802.11<br>Ethernet<br>IP<br>TCP<br>UDP<br>DNS<br>HTTP<br>TLS</pre><p>That standardization is arguably one of the greatest engineering achievements humanity has ever built.</p><p><strong>What Actually Happens When WiFi “Drops” or Is “Slow”</strong><br> Most connectivity problems happen not at the password or IP layer but during radio contention or interference. When many devices share the same channel, 802.11’s CSMA/CA protocol forces them to wait and back off. Slow WiFi often means high airtime utilization, not a bad internet connection. Likewise, “connected but no internet” usually means DHCP succeeded but the default gateway or DNS forwarder failed — Layer 2 works, but Layer 3 is broken. The next time WiFi feels slow, check whether the issue is local (high latency to the router) or beyond (high latency to 8.8.8.8).</p><h3>Conclusion</h3><p>What makes WiFi fascinating is not the radio waves, the encryption, or even the routing itself. It is the fact that billions of completely different machines can all participate in the same conversation.</p><p>A Linux server running on x86 hardware, a Windows laptop, an Android phone, an ESP32 running FreeRTOS, and an industrial PLC built fifteen years ago all speak through the exact same protocol layers. Beneath radically different kernels, drivers, APIs, and hardware architectures, every device eventually reduces itself into the same sequence of standardized frames and packets. That universality is what makes networking work.</p><p>The moment a device connects to WiFi, an enormous cascade of systems activates underneath the surface: RF negotiation, authentication, encryption, DHCP leasing, ARP discovery, DNS resolution, TCP state synchronization, NAT traversal, and often TLS cryptography. All of this happens in seconds, silently, thousands of times per day, across billions of devices.</p><p>Most users never see any of it. They simply click a network name and expect the internet to appear. But underneath that single click exists decades of engineering, protocol design, mathematical rigor, hardware interoperability testing, and global standardization work coordinated across vendors, operating systems, silicon manufacturers, and networking organizations.</p><p>The internet does not function because every machine is the same.</p><p>It functions because every machine agrees on the same language.</p><p>And honestly, that may be one of the greatest examples of large-scale engineering cooperation humanity has ever built</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d0bec113db5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[So…you wanna work for a Deep-Tech startup?]]></title>
            <link>https://medium.com/@kshitijvaze/so-you-wanna-work-for-a-deep-tech-startup-5500ccb6af7f?source=rss-2808af1dbb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/5500ccb6af7f</guid>
            <dc:creator><![CDATA[Kshitij Vaze]]></dc:creator>
            <pubDate>Thu, 07 May 2026 11:53:00 GMT</pubDate>
            <atom:updated>2026-05-07T11:53:00.996Z</atom:updated>
            <content:encoded><![CDATA[<p>I want to speak to all my juniors who wish to get into a Deep-tech startup. This is again, going to be a bit of a long read.</p><p>I have written something like a roadmap, but it’s not going to be short, and definitely not going to be easy.</p><p>So listen up.</p><h3>1 — Get extremely good at what you do.</h3><p>If it’s mechanical, then design, analysis, DFMA, FEA, CFD, CAD/CAM, additive manufacturing, 3d-printing, composites, WHATEVER it is that you do.</p><p>If you are into Electronics, analog, digital and power electronics, RF, antenna theory, Microwave tech, VLSI (this shit alone encompasses about a hundred more fields), Embedded systems (this shit too, alone encompasses about a hundred more fields), PCB designing, circuit designing, WHATEVER it is that you do.</p><p>If you are from CSE, Low-level systems, RTOS, Linux and other OS, Computer architecture, drivers, DBMS, Comp Networking, Robotic software (this shit too, alone encompasses about a hundred more fields), and a lot more like these.</p><p>And no, “good” here does not mean watching a few youtube playlists and making a weather app. Deep-tech startups operate in domains where failure has actual consequences. A bad PCB layout can fry a board. Poor thermal analysis can destroy a product enclosure. A badly written driver can deadlock an entire system. Weak antenna tuning can ruin an RF product. Garbage mechanical tolerances can make manufacturing impossible at scale.</p><p>These companies survive or die based on engineering competence, because unlike many software-only startups, they are often dealing with hardware lead times, manufacturing costs, compliance, testing cycles, thermals, EMI/EMC, field failures, reliability and physics itself.</p><p>That is the thing most people miss. Deep-tech is not aesthetic engineering. It is consequence-heavy engineering. You are expected to know WHY something works, WHY it fails, HOW to debug it, HOW to optimize it and HOW to build around constraints. Constraints are the entire game here.</p><p>Power constraints, memory constraints, cost constraints, weight constraints, manufacturing constraints, latency constraints, thermal constraints, certification constraints, supply chain constraints. The engineers who thrive in these environments are usually the ones who can work inside limitations instead of crying about them.</p><p>And another thing — stop looking at fields in isolation. Real-world engineering is interdisciplinary as hell. Embedded engineers eventually deal with hardware. Hardware engineers eventually deal with firmware.</p><p>Robotics engineers touch controls, software, electronics and mechanical systems all at once. RF engineers need signal processing knowledge. Linux developers end up understanding boot chains, toolchains, drivers, device trees and hardware bring-up. The deeper you go, the blurrier the boundaries become.</p><h3>2 — Produce undeniable proof of your skill.</h3><p>Talk is cheap lads, anyone and everyone can get that part done. But you have to put your money where your mouth is, and stifle any and every doubt on your capacities. It can be a youtube video, a blog, a consistent series of progress updates on twitter, articles on medium, ANYTHING. But the fact of the matter is, resumes aren’t enough anymore. You need to have ATTENTION to your craft, and Social Media is the best way to get that under your belt.</p><p>And when I say proof, I mean REAL proof. Not a perfectly polished portfolio copied from someone else’s GitHub.</p><p>I mean build logs, debugging sessions, architecture diagrams, failure analysis, teardown posts, oscilloscope captures, kernel panic investigations, thermal measurements, stack traces, PCB revisions, manufacturing defects, simulation outputs, optimization journeys — REAL engineering artifacts.</p><p>Because the biggest green flag in deep-tech is not perfection. It is evidence that you can survive complexity.</p><p>Most startups are not looking for textbook toppers. They are looking for people who can enter chaos and still make progress. Someone who can sit with a broken board for 11 hours and still keep debugging.</p><p>Someone who can trace failures methodically instead of randomly changing things and praying. Someone who documents their process. Someone who can communicate technical ideas clearly. Someone who can take ambiguity and convert it into execution.</p><p>This is why social proof matters so much. A person consistently posting deep technical work publicly creates asymmetrical trust. If I see someone spending months building drivers, optimizing boot time, designing custom hardware, reverse engineering protocols, implementing RTOS scheduling or bringing up boards from scratch,</p><p>I already know they are serious. Half the filtering is done automatically.</p><p>And here’s the funny thing — most people are terrified of posting because they think they are not “expert enough”. Meanwhile the internet is filled with confidently incorrect people farming engagement with surface-level content.</p><p>Deep-tech founders LOVE seeing genuine builders, even if the work is imperfect. Authenticity and depth are rare now.</p><h3>3 — Apply through any and every way possible.</h3><p>Now, coming to the job market. This shit is a Call of Duty Free for all lads, and it really is every MF for themselves. Talk to current and ex employees, try and get a referral, e-mail them on the mail ID in their careers page, try and DM their founders on twitter — USE ANY AND EVERY TACTIC THAT YOU HAVE UP YOUR SLEEVE TO GET A FOOT IN THE DOOR LADS.</p><p>Because here’s the brutal truth — deep-tech hiring is nowhere near as standardized as people think. A lot of genuinely great startups do not even have proper hiring pipelines. Some don’t have HR teams. Some founders personally review applications. Some hire because they saw one cracked engineer post something insane online. Some hire because a trusted engineer vouched for someone. Some roles never even get publicly posted.</p><p>People underestimate how much persistence matters here. One cold DM may get ignored. Ten thoughtful messages over time may not. One detailed mail showing genuine understanding of their product may stand out massively from the sea of generic “Dear Sir/Madam” spam. If you are applying to a robotics startup, READ THEIR PAPERS, watch their demos, understand their stack, study their product constraints and then reach out intelligently. Most applicants never do this.</p><p>Also, stop treating networking like some fake corporate ritual. In deep-tech, networking is literally just engineers finding other competent engineers. That is all it is.</p><p>If you consistently post meaningful technical work, contribute to discussions, help people debug issues, write blogs, contribute to open source or show interesting experiments, people start recognizing your name over time. Opportunities compound from visibility.</p><p>And finally, understand this properly — deep-tech is not an easy path. The learning curve is brutal. The domains are insanely deep. The debugging can be soul-crushing.</p><p>The hours can get ugly close to deadlines. Hardware failures will humble you. Software failures will humble you. Manufacturing will humble you. Physics itself will humble you.</p><p>But if you genuinely love engineering, there are very few things more satisfying than building real systems that interact with the real world. Not dashboards. Not pitch decks. Not “AI-enabled blockchain synergy platforms”.</p><p>Real machines. Real systems. Real engineering.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5500ccb6af7f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>