Category: Uncategorized

  • Develop with CH32V003 MCU: Setting up Environment

    Recently i came across this Little MCU: CH32V003. It’s RISC-V MCU, having small flash and RAM. My Mcu is So8 variant with 16KB of flash and 2 KB of ram, even smaller than the Atmega328 on Arduino Uno, but that maybe enough for some usecases.

    So let setup the software.

    WCH has an IDE called moun river. While it’s on the better side of vendor-provided IDE(Thanks God it’s based on modern VSCode, instead of that Eclipse), i still want a setup that is not vendor dependent. I decided to use docker to containize my setup and be able to quickly recover if i screw up something.

    Quick search on the internet, there is already a docker image that include toolchain and necessary tool to work with this MCU and WCH-LinkE(The debugger): https://hub.docker.com/r/islandc/wch-riscv-devcontainer. But unfortunately, this image does not include SDK, so we will have to pull the SDK later.

    We also use VScode dev container extension to setup dev enviroment inside that container.

    The first step we need is creating a directory that is our project root, in this example, i will called it hello_world.

    Next, cd to proj root and create a dir called ‘.devcontainer’, this store our docker config file.

    Then add devcontainer.json to tell dev container ext how to setup the image. I ask Claude for this because tbh i’m not expert in Docker.

    {
      "name": "WCH RISC-V Development",
      "image": "islandc/wch-riscv-devcontainer:latest",
      
      // Features and settings
      "features": {},
      
      // VS Code customizations
      "customizations": {
        "vscode": {
          "extensions": [
            "ms-vscode.cpptools",
            "ms-vscode.cmake-tools",
            "marus25.cortex-debug"
          ],
          "settings": {
            "cmake.configureOnOpen": true,
            "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
          }
        }
      },
    
      // Container configuration
      "privileged": true,  // Required for USB debugging
      "mounts": [
        // Mount USB devices for debugging
        "source=/dev,target=/dev,type=bind"
      ],
      
      // Port forwarding (if needed)
      "forwardPorts": [],
      
      // Post-create command
      "postCreateCommand": "echo 'WCH RISC-V Dev Container Ready!'",
      
      // Keep container running
      "overrideCommand": false,
      
      // User settings
      "remoteUser": "root"
    }

    Now use Dev Container ext and “reopen in container”, in theory, it should work fine, and we are in the container now

    Next part will be pulling the SDK and setup a hello_world project

  • The Small Phone Paradox

    Right on cue, just like every year. Yesterday Apple dropped the iPhone 17 lineup at their “Awe Dropping” event, and within hours the internet was flooded with the usual complaints: “Why are all these phones so massive?” People started begging for smaller phones like they were asking Santa for world peace. The comments sections were full of folks mourning the death of the iPhone Mini and demanding Apple bring back something you can actually use with one hand.

    But here’s the thing that cracks me up – Apple didn’t even hint at a smaller phone. Instead, they gave us the iPhone 17 Air, which despite being super thin at 5.6mm, still rocks a big screen. The regular iPhone 17 bumped up to 6.3 inches, and the Pro models are as huge as ever. Apple clearly got the memo that nobody actually puts their money where their mouth is when it comes to small phones.

    This whole situation is like watching that friend who constantly complains about wanting to eat healthier while ordering pizza for the third time this week. Or how everyone says they hate reality TV but somehow The Bachelor is still cranking out seasons after 20+ years. We’re really good at saying one thing and doing the complete opposite.

    The small phone crowd is genuinely passionate, don’t get me wrong. They’ll write novels about how phones should fit in your pocket without looking like you’re smuggling a sandwich. They post throwback photos of their old iPhone SE like it’s a beloved family pet. They make solid points too – smaller phones are way easier to use with one hand, and you don’t need a purse just to carry the thing around.

    But when it comes time to actually buy a phone, most of us end up going bigger. Because let’s be honest – we all got hooked on watching YouTube videos on our phones. We want to see our Instagram photos without squinting. We need keyboards where our thumbs don’t feel like they’re playing Twister. That massive screen isn’t just for show anymore; it’s basically our TV, computer, and game console all rolled into one pocket-sized rectangle.

    It’s like how people say they miss small local restaurants but still hit up McDonald’s twice a week. Or how everyone complains about social media while scrolling through TikTok for three hours straight. There’s this weird gap between what we think we should want and what we actually reach for when nobody’s watching.

    The thing is, the small phone people aren’t totally wrong. They’re pushing back against this idea that everything has to keep getting bigger and “better.” In a world where phones are basically turning into tablets and laptops are the size of dinner tables, wanting something that actually fits in your hand feels almost rebellious.

    Maybe the real problem isn’t that people don’t want small phones – it’s that they want small phones that don’t suck at everything else. The iPhone Mini was pretty great, but the battery died faster than a houseplant in my care. Most small Android phones end up being the cheap, crappy versions with terrible cameras. People want the impossible: a phone that’s small but still takes amazing photos, lasts all day, and runs every app perfectly.

    Looking at yesterday’s iPhone 17 launch, it’s pretty clear Apple has moved on from the small phone experiment. The iPhone Air might be thin, but it’s not small. The focus is all on better cameras, faster chips, and longer battery life – all stuff that’s easier to pull off in a bigger package.

    The small phone fans will probably keep fighting this battle every year, posting their annual “please make phones smaller” rants every time September rolls around. And honestly, good for them. Even if they’re outnumbered, having different options is better for everyone. Some people really do prefer smaller phones, even if there aren’t enough of them to make Apple’s accountants happy.

    Until then, we’ll keep watching this funny dance between what people claim to want and what they actually buy – which is pretty much human behavior in a nutshell.

  • Beaware of HMC5883 Module

    I was toying with cheap GY-721 module. This module is basically a break out for HMC5883L digital compass.

    But that is story of the past. Turn out this module is so popular that the Chinese decided to replace the original chip with qmc5883 IC.

    Not a new story, they have already clone a lot of STM32 MCU, this IC is a child play for them.

    EXCEPT

    Their clone is nothing close to the original. The I2C address is different, the register map is also different.

    And to make it worse, there are 2 variants of QMC5883: QMC5883L and QMC5883P.

    You guess it right, THE VARIANT is nothing close, aparently they come from diffrent vendors.

    And when you buy cheap ass GY271 module, it’s a lottery which chip you will get.

    I learnt it the hard way today.

    HMC5883L datasheet: https://www.farnell.com/datasheets/1683374.pdf

    QMC5883L datasheet:

    http://wiki.sunfounder.cc/images/7/72/QMC5883L-Datasheet-1.0.pdf

    QMC5883P datasheet:

    https://www.qstcorp.com/upload/pdf/202202/%EF%BC%88%E5%B7%B2%E4%BC%A0%EF%BC%8913-52-19%20QMC5883P%20Datasheet%20Rev.C(1).pdf

  • I vibe-coded CVbuilder

    I’m so fed up with the online CV builder service. Imagine spending your priceless time using their tool to customize your CV, just to be hit with “Please subcribe to our overprice service to download”. F*ck no.

    I gave up, i can not find any decent one.

    So, with the power of Claude, i vibe-coded https://github.com/phb98/CVbuilder.

    This tool will auto generate your CV from A single Json file, that contain your personal info. All locally, with a single python script.

    It only has templates for now, but you can easily ask your favorite AI to add more, the project is simple enough for them.

    It’s not fancy, it lacks customization, but it perfectly fits my usecase.

    Give it a try.

  • A terminal editor that just works: MS Edit

    I was born a little too late to be familar with VI/ Emac war, and try as I might, i can not get used to VI key binding.

    So most of the time, when i need to edit some config file in terminal, nano is my go to choice. It’s simple, it’s everywhere, and it just works. But its key binding is stucking at the 90s(or even 80s, idk). The shortcut to save file is not Ctrl+S, Or Ctrl-F does not bring the pop up to search. I know i should learn its own set of shortcut, but i do not use it frequently enough to have it stick to my brain.

    Recently, Microsoft has just released Edit. They claimed it was a revamp version of their old Edit editor(And what is that name, why computer nerd keep coming up with names that impossible to 1-word google search: Carbon, go, edit, nano).

    I’ve been using edit for a while now. Nothing to complain, it works everywhere: Windows, Linux and even Mac. And thanks to Rust build system, it’s very simple to build: Install Rust and cargo build. You are done.

    It’s has clean interface, fast, and most important, “21st standard” shortcut: Ctrl S to save, Ctrl F to find, Ctrl Q to quit. That is just what i want.

    Maybe in the future it will become the standard text editor(But tbh I don’t think linux people will accept any MS-Software in their software stack, even if it’s 100% opensource).

    So, please give it a try: https://github.com/microsoft/edit

  • Yes, I think LLM is great

    I remember the first time i tried LLM, it was back in early 2023, when chatGPT was super hyped. I had to bought an UK phone number and a VPN simply chatGPT was not available in my country. I also set up some accounts for my boss and coworkers.

    And oh boy it was magical. The idea of a chatbot was not new at all, we had already had chatbot way before that, and i think those bots were just some regex matching combined with if-else hell. Those are very limited and show no intelligent at all. Their answers were all over the place, sometime even worse then elementary student. Then we had Alexa/Google Assistant/Siri, those are more advance, but most of the time i felt like they are just search engine wrapper, with some fun functions like setting timer, playing song or asking the weather. Still, they were nothing magical after playing with them for a while.

    But chatGPT was different. At some moments i felt like i was talking to real human. It can do nothing and everything: You can not ask it to start a time like Alexa, or what the weather like today like GG assistant, but you can ask it to write a python code to generate a protobuf file from a C header file, or ask it how the Japan economy is from 80s to 2020s. The first “public” version of chatGPT was pretty bad, the code they wrote barely worked(or not worked at all), and maintaining it is a big no. It halluciate a lot, so don’t even think using them in your professional codebase. Then i tried CoPilot(before Microsoft had the free tier), they were autocomplete-on-steroid, they could detect the pattern in your code and finish what would you write, good if you are writting repeat pattern like logging, bad for anything else.

    In 2 years, AI/LLM has advanced, like a lot. Their code is now better, i could say on par with junior developers, but in some way, better than senior dev thanks to being trained on countless “legal” repoes. But still, it’s a hit or miss, especially if you are working with less popular language/framework(Verilog/VHDL guys in shatter). Apart from coding, they are now even can do Internet search themself, so there would be no outdated data in their answer(let’s hope they are smart enough to know when to do query instead of halluciating)

    Some people dislike the rise of using LLM/AI, and i understand that, some have good reasons like “The answer is too unreliable” or “It would dumb yourself down”. etc. They are right.

    But this has always been the case when new tool is invented: The invention of paper/ink means human don’t have to remember the whole book anymore. Or the invention of power tools means human become less muscular. We gain something, we lose something. It’s on us to decide if it’s worth it. And I decided that i can accept the tradeoff of AI/LLM. We lose the “authority” of the stuff LLM generates, but we get them fast.

    AI/LLM would not go anywhere in the future, better to adapt to it instead of trying to resist it. We need to learn about their short coming to work around that. But “everything is toxic it just depends on the dose”, too heavily depend on LLM/AI is bad, and i won’t try to argue that. If you are one of those “vibe coder”, I suggest you stop doing that, at least at this level of LLM we are having. Nobody can say how good LLM would be in the future.(But “vibe coder” maybe good for me, someone has to clean up the mess after all, i could make a killing out of it).

    So, i do think LLM is a good thing for us. Just don’t over do it.

    PS: I think it’s time for something more personal, maybe next post would be something i am working on.

  • This blog setup

    Hi

    So this is the second post, come faster than I expected. Quite proud of myself. Today I gonna share a little about my little blog setup.

    This domain(bacphan.dev) was bought about 2 year ago, from google domain, before squarespace acquire it. I bought it because i always want an custom email domain, then I learnt it the hardway that if you setup your own email server, chance are your email will mostly end up in spam/trash folder. So google workspace it is.

    Then I bought a VPS. Because my country began blocking Steam access from “home” users(idk exact reason). Using VPN is 1 solution, but they are expensive, and most of them limits number of clients. Luckily i already had a hand on experience on setup a VPN server on my own network, so setting up vpn server on vps is not that hard.

    Now, about this blog. This blog is using WordPress as you can guess from the template(or from placeholder url that i am still lazy to remove). The whole setup is running from a container on Docker. Quite cool huh ? Using docker means it would be easy to migrate this blog to other machine, also it’s easier to un-done my setup(just remove the container).

    There is also a gitea server on this vps(You can guess its URL lol). Also on docker of course.

    The coolest part is most of the setup is done by Claude. I just gave it what i want, some keywords that i saw on internet(like docker, wordpress, etc) and it will setup for me, quite painless. Claude code is really awesome. Maybe my next post will be about LLM.

    So in summary, this server is currently a VPN server, Git server and this blog. I don’t plan to do anything more with it for now because its hardware is quite limited(only 2 CPU cores and 2 GB ram).

  • My first post

    Hello.
    Today is July 2, 2025, and this is my first post.


    If you take a look around, at this moment (or in the future—I don’t know how lazy I’ll be), things are pretty raw for now. This blog is fresh from the template. There are still sample pages everywhere.
    What am I planning to do with this blog? Not sure. This blog is just my little experiment to get familiar with web technology. I’ve never been a “high-level programmer” guy.


    I don’t intend to write very often. I believe the quickest way to kill a hobby is to force it (or make it your job—trust me). The next post could be tomorrow or next month. I don’t know how well this hobby will stick with me.


    There is no theme for this blog; the posts could be anything: tech, stories, my thoughts, or just cat pictures (anyone who hates cats is my enemy, no exception). The point is, this blog could be my little escape from the mundane aspects of daily life. I don’t want to think too much about it.


    As you can infer from my writing, English is not my native language, so expect a lot of mistakes or weird grammar. But somehow I feel like I can express myself better in English. It could be that I’ve mostly used English throughout the day now, or because I don’t know English well enough to understand some hidden ideas behind words. Ignorance is bliss.
    I think this is long enough. I still feel like I’m too formal—maybe by writing more, I will become more comfortable with writing and be truer to myself.


    Bye, and congratulations to me.