release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Search | Go
Wiki > Main > FiioM3K

FiiO M3K

Hardware summary

Component Model Notes
SoC X1000E 1.0GHz MIPS XBurst with 64MB of SIP LPDDR RAM
NAND ATO25D1GA-10ED 1Gb SPI SLC NAND Flash
PMU AXP192 I2C PMU, driver is AXP173?
Backlight driver SGM3122 simple PWM LED driver
Touch controller FT6236U I2C
LCD controller likely ST7789S educated guess from Fiio's M3K kernel source
DAC AK4376A I2S
Microphone MSM42A3722H9KR plain MEMS analog mic
USB OVP IC WP3881  
Battery 413372 2-wire with built-in basic protection circuit, 1100mAh

Hardware notes

  • Touchpad backlight
    • Driven by an S8050 (J3Y) and presumably a GPIO.
    • TODO: Which GPIO??
  • About the LCD
  • Audio Codec Notes
    • in-kernel driver is a real mess, but at least we have source code!
    • Powerup pin controlled by GPIO A16, requires a magic ioctl(!) to /dev/ak4376 to toggle
    • Most mixer controls are no-ops, meant for different HW. Only DACL/DACR Playback volume and "Low Mode Switch" are connected to HW. DAC filter also not hooked up.
  • CPU notes
    • CPU supports mips32r2 integer instructions, but other r2 features aren't available -- no shadow register sets, no external interrupt controller mode

Native port status

Feature Working Notes
Audio playback Yes >= 176.4 KHz playback and too much DSP can make the UI unresponsive
Recording NO Not implemented
Display Yes Known bug: very rarely, system might lock up after screen turns on
Buttons/touchpad Yes  
MicroSD Yes  
Battery charging Yes Charging is controlled by hardware
Bootloader Yes Requires manual installation, see below
Dual boot OF NO  
USB Partial Mostly works but it's not 100% stable
Rockbox utility support NO Not implemented

The native FiiO M3K port is currently under active development. It's got a lot of rough edges right now and not all features are implemented, but is generally stable for audio playback.

At present, you need to compile the Rockbox bootloader yourself in order to install the native port. Instructions are provided below.

Bootloader installation instructions

WARNING: There are currently two ports for the Fiio M3K, the native port and the Linux-based port. These instructions are only for the native port, which runs Rockbox directly on the hardware, instead of relying on Fiio's Linux kernel. Be sure you read ALL of the instructions before you attempt installing!

The bootloader is split up into two components: an SPL and the main bootloader. The SPL is a small program which is loaded early in the boot process, and sets up low-level aspects of the hardware. The main bootloader is just a stripped down build of Rockbox which searches for the Rockbox installed on your SD card and boots it.

You will need a native MIPS toolchain to compile. When using rockboxdev.sh to compile the toolchain, pick 'i' to select MIPS.

The SPL and bootloader must be built in separate directories, we'll call them build-spl and build-boot. When running configure, choose 'x' to build the SPL, and 'b' to build the bootloader. Example:

cd path/to/rockbox
mkdir build-spl
cd build-spl
../../tools/configure --target=fiiom3k --type=x
# Replace --type=x above with --type=b when building the bootloader

If all goes well you should have files build-spl/spl.m3k and build-boot/bootloader.m3k. The next step is to compile the bootloader installation tool, called jztool. You will need libusb development libraries installed (eg. for Debian: libusb-dev; Fedora: libusb-devel; Arch: libusb).

cd path/to/rockbox
cd rbutil/jztool
make

Run ./jztool --help to get an overview of the available options. You can find further installation instructions for the FiiO M3K in README.md, or keep reading here.

It is highly recommended to back up your existing bootloader so it can be restored later. The installation process itself is quite safe and should be no more dangerous that a normal firmware update, but not many units have been tested as yet and it is possible to run into unforeseen problems that will leave your device unbootable, although it is almost certainly possible to recover from this state. If you do experience a problem, please let us know!

You have to plug in the M3K in USB boot mode in order to flash the bootloader. The easiest way is to plug a microUSB cable into your M3K, then hold the volume down button while you plug the other end of the cable into your computer. The button light will turn on but the LCD will remain black if you have entered USB boot mode. You can now run jztool.

To access the raw USB device, you will generally have to use 'sudo'. Here's an example of a successful flash:
$ sudo ./jztool --verbose fiiom3k install --spl ../../build-spl/spl.m3k --bootloader ../../build-boot/bootloader.m3k --backup fiio-boot-backup.bin
[ DETAIL] Open USB device a108:1000
[ DETAIL] Setup device for flash access
[ DETAIL] Reading boot image from device
[ DETAIL] Backup original boot image to file: fiio-boot-backup.bin
[ DETAIL] Patching image with new SPL/bootloader
[ DETAIL] Writing patched image to device

Please be aware that after every run of jztool, whether successful or not, you will have to forcibly power off the M3K by holding the power button until the button light turns off. If you want to run jztool again, you must boot again in USB boot mode.

Be sure to keep your backup (fiio-boot-backup.bin above) in a safe place. If you want to restore it, use the following command:
$ sudo ./jztool --verbose fiiom3k restore --spl ../../build-spl/spl.m3k --image fiio-boot-backup.bin
[ DETAIL] Open USB device a108:1000
[ DETAIL] Setup device for flash access

Once the bootloader is installed, you can unzip a normal build of Rockbox to your SD card and boot your new Rockboxed M3K.

Known issues / TODO list

  • Partial LCD updates are actually worse than full-frame updates because DMA can only (easily) transfer full frames, and we need to wait for the last frame to complete before sending a new one. This causes some themes to flicker as different layers are drawn in quick succession with partial updates.

  • Coealescing partial LCD updates in the driver could eliminate most flicker. Using the spare TCU timer IRQ would have less overhead & higher precision than the kernel-based timers. Coealescing would have to be bypassed during a panic, otherwise the LCD would never be updated.

  • Very rarely, the LCD driver might be causing a hang when the screen turns on after being off. This is almost certainly due to bugs in the complicated locking/synchronization design.

  • LCD's continuous DMA mode don't seem to respect the panel FPS even when the vsync signal is turned on. This appears to cause stuttering, which is why the driver uses one-shot DMA transfers.

  • The DAC makes popping noises when changing frequency. It seems to be both digital and analog in nature, but getting rid of the digital signal by shutting off the AIC_CR.ERPL bit doesn't seem to help. Maybe it needs to be ramped down smoothly in software?

  • Playback at 192 KHz with all DSP / EQ settings enabled puts the CPU to almost 100% usage, with frequent UI slowdown and audio underruns. Increasing the size of the PCM mix buffers may help, since there are huge numbers of DMA interrupts at this sample rate.

  • AIC fifo underruns aren't reported reliably. It's probably because the DMA interrupt is hogging the CPU so the underrun bit clears before we can see it.

  • The touchpad sometimes goes wonky on boot and won't respond properly to scrolling or button presses for the first few seconds. There's nothing that can really be done about this except artificially forcing Rockbox to wait longer in the splash screen so you can't see the problem.

  • Scrolling might feel a bit off because the touchpad doesn't report coordinates linearly as it should. In particular the edges of the touchpad seem more sensitive than the middle, so scrolling in the middle of the pad requires a bigger motion than at the edges.

  • USB is buggy when using DMA -- hangs and lockups happen but apparently only in the early stages of connection when endpoints are being enumerated, status getting queried, etc. PIO mode is stable, but transfers are at least 30% slower.

Internal images

PCB images:

PCB_front_s.png PCB_back_s.png

Closeup of the PWM LED controller and the I2S DAC:

SGM3122_s.png AK4376A_s.png

Screen assembly closeup:

TODO: transcribe silkscreen text

screen_assembly_overview_s.png

TODO: transcribe silkscreen text and pinout

touch_controller_closeup_s.png

Datasheets

All datasheet links were archived versions whenever possible.

Disassembly instructions

Disclaimer: everything you do is at your own risk and I cannot be held responsible if you damage your device or overheat the battery and it catches on fire.

Please don't attempt it unless you can afford to damage the device, this is for your reference only. There are no real benefits of disassembling the device (internal photos are already available from me and all the important chips have been identified) unless you want to access the native UART port (which doesn't have an interactive boot console that you can interrupt btw, the loader is not u-boot), and you'll need some E6000 adhesive to glue the screen back if you want to put it together again.

Tools required:
  • Hair dryer
  • LCD screen repair plier tool with removable suction cups
  • E6000 adhesive
  • Precision Philips screwdrivers
  • Plastic pry tool (the triangular type)
  • A thin plastic card
  • Xacto knife
  • Kapton tape

Procedure:
  1. Unscrew a suction cup from your plier tool, firmly adhere it to the upper back side of the device with the E6000 glue, let it sit for at least 14h. Be generous with the glue, you'll be able to cleanly remove them later before they harden completely. This is necessary because the aluminum back doesn't play nice with the suction cup, it slips off before you can exert enough force onto the front glass.
  2. Heat up the front of the device until the aluminum frame is very hot to the touch. Immediately screw the glued suction cup back onto the plier tool, and you should be able to get enough grip to pull the screen off now. You must pull it apart from the LCD side (not the touch controls side) to avoid damaging the ribbon cables.
  3. Detach the two ribbon cable connectors and remove the screen assembly. Beware that the touch controller ribbon cable has a sticky back, carefully peel it off the board with a tweezer. Hit it with a hair dryer if it's hard to remove, that'll hopefully soften the adhesive.
  4. Take your triangular pry tool, use it to push up & warp the upper panel from the inside of the device, there's an aluminum overlay that you'll hopefully be able to separate with your xacto knife (the key here is to cut away the adhesive instead of prying). There will be two screws hidden under that overlay, remove them and you'll be able to side the entire inner tray out from the bottom side.
  5. Peel off the black insulation tape on the board to reveal some test points, including UART. Put on some Kapton tape before you attach the screen to prevent the metal bracket from shorting anything out.
  6. Remove the 6 screws from the plastic tray (one screw is smaller than the rest), and you can take the board out.
  7. Heat up the board again from the front side and use a thin plastic card to slowly separate the battery from the board. The PCB bends pretty easily so be careful NOT to bend it in the process, I find gripping on the PCB on the long sides can reduce bending. After you detach and desolder the battery, the disassembly is now complete.

I Attachment Action Size Date Who Comment
AK4376A_s.pngpng AK4376A_s.png manage 2611.1 K 07 Jul 2020 - 01:33 EdwardBiryukov  
PCB_back_s.pngpng PCB_back_s.png manage 4760.8 K 07 Jul 2020 - 01:32 EdwardBiryukov PCB back
PCB_front_s.pngpng PCB_front_s.png manage 4261.3 K 07 Jul 2020 - 01:32 EdwardBiryukov PCB front
SGM3122_s.pngpng SGM3122_s.png manage 2744.7 K 07 Jul 2020 - 01:33 EdwardBiryukov  
m3k_alsa.txttxt m3k_alsa.txt manage 3.0 K 15 Oct 2020 - 11:55 SolomonPeachy Exported ALSA Mixer controls
nand.binbin nand.bin manage 128.0 K 28 Mar 2021 - 01:19 AidanMacDonald first 128k of NAND flash
screen_assembly_overview_s.pngpng screen_assembly_overview_s.png manage 3248.6 K 07 Jul 2020 - 01:34 EdwardBiryukov  
touch_controller_closeup_s.pngpng touch_controller_closeup_s.png manage 4079.7 K 07 Jul 2020 - 01:34 EdwardBiryukov  
r11 - 22 Apr 2021 - 23:51:00 - AidanMacDonald

Copyright © by the contributing authors.