Jun's Blog

Output, activities, memo and etc.

Sweep Bling LP: Flash the controller: Sea Picro via QMK before soldering on Fedora 36

Bought a new split keyboard: Sweep Bling LP

In the past article, I wrote my plan to buy a new split keyboard.

Now I bought a new split keyboard, called Sweep Bling LP at Beekeeb - Sweep Bling LP, and I already got it.

Beekeeb's Sweep Bling LP page offers some options. And I chose the options below.

  • Base: 63 USD
  • Controllers: Sea Picro (USB-C, RP2040, 16MB, Black)
  • Key switches: Blue (Liner 20gf) (+27 USD)
  • Kep cap: MBK Legend 40s (White On Gray) (+48 USD)
  • PCB Soldering: I will solder and assemble myself.
  • Place / Case: Black 3D Printed PLA Low Profile (+23 USD)

So, why this product and options? Because it is 34 keys layout. I like it. And the Sweep Bling LP has hot-swappable key switches. I can try less than 34 keys. In the case of the low profile key switch like this keyboard, it's easy to subtract the unused keys. It is just to remove the key switches. And the Sweep is open-source hardware. So, it has a thriving community. The Sea Picro is for a wired cable with QMK. As my Moonlander uses QMK with the company's wrapper tools, I wanted to use QMK as well this time.

I also bought Pinecil V2, the soldering iron at the Pine64 EU shop. I learn how to use QMK and how to solder with this opportunity.

Prepare before soldering.

Checking if the controllers work properly before soldering is a good practice. Thanks to my friend who is guiding me.

Install QMK on Fedora 36

First, this time, as I run the QMK command directly to flash the firmware, I needed to install it. In the case of Moonlander, they have their own tools that are possibly running QMK internally, to flash the firmware.

The QMK is the PyPI (Python) package. The QMK PyPI page is here. This page, QMK Firmware Docs - Prepare Your Build Environment helped.

$ sudo dnf -y install git python3-pip

$ python3 -m pip install --user qmk

$ which qmk
~/.local/bin/qmk

$ qmk --version
1.1.1

Then set up the QMK. The qmk setup command downloads and add settings for that in the qmk setup such as adding remote repository url to encourage the contribution without -H option. But my recommendation is to do git clone before running the qmk setup. If you are familiar with the flow in the GitHub, you don't need such a custom setting for the Git repsitory.

$ cd ~/git/qmk
$ git clone https://github.com/qmk/qmk_firmware.git

You see the message below. It seem the qmk setup installs the RPM packages too.

$ qmk setup --help

$ qmk setup -H $HOME/git/qmk/qmk_firmware
...
⚠ Missing or outdated udev rules for 'atmel-dfu' boards. Run 'sudo cp /home/jaruga/git/qmk/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
...
Ψ Git branch: master
Ψ Repo version: 0.19.12
⚠ The official repository does not seem to be configured as git remote "upstream".
☒ Can't find avr-gcc in your path.
☒ Can't find avrdude in your path.
☒ Can't find dfu-programmer in your path.
☒ Can't find dfu-util in your path.
...
⚠ We do not recommend avr-gcc newer than 8. Downgrading to 8.x is recommended.
...
Ψ QMK is ready to go, but minor problems were found

I saw the config below was created.

$ cat /home/jaruga/.config/qmk/qmk.ini
[user]
qmk_home = /home/jaruga/git/qmk/qmk_firmware

The packages below were installed.

$ rpm -qf /bin/avr-gcc
avr-gcc-11.2.0-1.fc36.x86_64
  => It's newer than avr-gcc version 8. But it's fine.

$ rpm -qf /bin/avrdude
avrdude-6.4-3.fc36.x86_64

$ rpm -qf /bin/dfu-programmer
dfu-programmer-0.7.2-10.fc36.x86_64

$ rpm -qf /bin/dfu-util
dfu-util-0.11-2.fc36.x86_64

Copy the udev rule file manually.

$ ls -l /etc/udev/rules.d/
total 4
-rw-r--r--. 1 root root 1259 Jul 21  2022 50-zsa.rules

$ sudo cp /home/jaruga/git/qmk/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/

$ ls -l /etc/udev/rules.d/
total 8
-rw-r--r--. 1 root root 3806 Feb 18 22:38 50-qmk.rules
-rw-r--r--. 1 root root 1259 Jul 21  2022 50-zsa.rules

The setup of the QMK is all.

Flash the firmware in the controller before soldering

This was a difficult part.

It's possible to flash the firmware in the controller by QMK before soldering. Checking if the controllers work properly before soldering is a good practice. If you find an issue after soldering, you need to disassemble the controllers again. There are 2 controllers this time. So, doing same thing for both controllers.

First, I needed to understand the controllers: Controllers: Sea Picro (USB-C, RP2040, 16MB, Black). It seems the official site is here. It seems my Sea Picro is Sea-Picro RST. And the important part is the Pinout section. The controller's firmware is recognized as a just USB device. However, the firmware is recognized as a mountable disk device in bootloader mode.

joshajohnson.com

As it seems that the controllers were initially already in the bootloader mode. It's important how to change the state of the firmware from normal mode to bootloader mode.

First, in normal mode, when I connected the controller to the laptop via a USB-C cable. I saw the following info.

$ lsusb
...
Bus 003 Device 049: ID 2e8a:0003 Raspberry Pi RP2 Boot
...

Then how to change the normal mode to bootloader mode. See the Pinout picture. On the right side GND and nRST (Reset) pins. The way to short the GND pin with the nRST pin next to the GND pin for a second. I used the tweezer for that. Below is the picture. I actually used a rubber glove just in case.

Short nRST (Reset) and GND for the bootloader mode.

I wrote a blog article in the past. The info is useful in this step.

junaruga.hatenablog.com

After the firmware was changed to the bootloader mode. I saw the following info about RPI-RP2. Because the controller was recognized as a mountable disk device. In the normal mode, the information was not displayed. Note that the disk device was mountable, but not mounted yet.

$ lsblk -r -p -o NAME,TYPE,FSTYPE,UUID,SIZE,LABEL
NAME TYPE FSTYPE UUID SIZE LABEL
/dev/sda disk   128M
/dev/sda1 part vfat 000A-93B7 128M RPI-RP2
...
$ gio mount -l
...
Drive(1): RPI RP2
  Type: GProxyDrive (GProxyVolumeMonitorUDisks2)
  Volume(0): RPI-RP2
    Type: GProxyVolume (GProxyVolumeMonitorUDisks2)

I needed to mount it manually for the qmk flash command to work in a later step.

$ udisksctl mount -b /dev/sda1
Mounted /dev/sda1 at /run/media/jaruga/RPI-RP2

or

Open GUI app nautilus. Clicked the USB drive to mount.

You can see the mounted disk drive.

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
...
/dev/sda1       128M  8.0K  128M   1% /run/media/jaruga/RPI-RP2

Saw the help of flashing the firmware.

$ qmk flash --help

Then I flashed the firmware.

$ qmk flash -c -kb ferris/sweep -km default -e CONVERT_TO=promicro_rp2040
...
Size after:
   text    data     bss     dec     hex filename
      0   35088       0   35088    8910 ferris_sweep_default_promicro_rp2040.uf2

Flashing for bootloader: rp2040
Flashing /run/media/jaruga/RPI-RP2 (RPI-RP2)
Wrote 70656 bytes to /run/media/jaruga/RPI-RP2/NEW.UF2

It seems that the -kb option value needs to be the same with the following directory with the rules.mk.

$ pwd
/home/jaruga/git/qmk/qmk_firmware

$ ls keyboards/ferris/sweep/
config.h  info.json  readme.md  rules.mk  sweep.c  sweep.h

It seems that the -km option value points out to the following directory.

$ ls keyboards/ferris/keymaps/default/
config.h  keymap.json  readme.md

The -e CONVERT_TO=promicro_rp2040 option was written in the controller Sea Picro's website.

As Sea-Picro has the same pinout as the RP2040 Pro Micro, we can use the promicro_rp2040 converter to remap the pins. An example for Chalice is shown below: qmk flash -c -kb chalice -km default -e CONVERT_TO=promicro_rp2040

And the result is now the USB device name was changed as DPB Ferris sweep.

$ lsusb
...
Bus 003 Device 088: ID c2ab:3939 DPB Ferris sweep
...

And the following commands didn't print the info, as it didn't recognize the controller as a mountable device.

$ lsblk -r -p -o NAME,TYPE,FSTYPE,UUID,SIZE,LABEL
$ gio mount -l

OK. That's all for today. I was excited about my experience in the firmware and hardware world.