Rockbox Technical Forums

Rockbox Development => New Ports => Topic started by: chocovy on July 23, 2019, 05:04:46 AM

Title: Fiio M3k
Post by: chocovy on July 23, 2019, 05:04:46 AM
Gonna start a thread for the fiio m3k (not m3)

So far this is what I was able to gather on what's inside the player.

SoC: Ingenic X1000e
OS: Custom (linux-based)
DAC: AKM AK4376A
Power management IC: AXP192
Screen: 2.0 inch IPS TFT 240×320

Until I can figure out how I can disassemble the unit safely the pcb scans have to wait I guess...
Can't really help out on the software side of things as I'm only familiar with C++.

This is where the firmware updater (and other firmware versions of the player) is located
http://www.fiio.me/forum.php?mod=viewthread&tid=43627&extra=page=1

will update this thread on further findings
Title: Re: Fiio M3k
Post by: XVortex on August 18, 2019, 05:15:03 AM
I think it's possible

It’s coming...,
(http://xvtx.ru/rockbox/photos/m3k_rockbox_sm.png)
Title: Fiio M3K
Post by: Bilgus on August 29, 2019, 06:54:28 PM
Fiio M3K New Port Thread

Fiio M3K General Discussion
See: http://forums.rockbox.org/index.php/topic,52952.0.html
Title: Re: Fiio M3k Rockbox Port
Post by: XVortex on September 01, 2019, 12:10:54 PM
Here we go!
Rockbox for the FiiO M3K is available on my site:
http://xvtx.ru/rockbox/download.htm (http://xvtx.ru/rockbox/download.htm)

- Based on the stock FW v1.3.0 (which has also been optimized for speed and memory usage).
- It is flashed like a regular firmware (...and rolls back also).
- Almost everything works, but minor bugs will be fixed over time.

Enjoy!
(and please consider a donation for me or/and rb team if You'd like it).

P.S. source code will available later, when all settle a bit.
Title: Re: Fiio M3k
Post by: amtmart on September 03, 2019, 02:41:23 AM
Awesome work! How does one go about installing this on the player? What bugs have you noticed?
Title: Re: Fiio M3k
Post by: XVortex on September 03, 2019, 05:19:27 AM
You should install it as regular update: https://www.fiio.com/newsinfo/82055.html
There are several minor issues, they will be fixed in the next version. Nothing serious.
Title: Re: Fiio M3k
Post by: amtmart on September 04, 2019, 02:51:12 PM
I got it installed and its working pretty great, gotta say i absolutely love rockbox. only 2 errors so far, both errors on bus (one said 10 i believe and the other 11), first one happened when i tried to open my library before scanning the database, the second happened when listening to music and going through the plugins menu. Hope this helps!

Edit: also just noticed there doesnt seem to be a way to lock the screen with the physical screen lock button
Title: Re: Fiio M3k
Post by: Njones on September 04, 2019, 06:55:04 PM
Depends on which theme. Cabbie has the lock feature. Hold on /off button for 3 seconds to lock or unlock. Updated version available now through link in Rockbox general discussion forum.
Title: Re: Fiio M3k
Post by: amtmart on September 10, 2019, 01:17:58 PM
So I've used it for a few days now and here's the bugs I've encountered.

The worst is that I can no longer boot into the stock OS, it just freezes up after I select fiio music.
It also is completely off on the battery level, it'll be at 0 for a while but stay on, or say 30 then jump to 17 when I plug it in.
It also seems to have a problem keeping setting changes.
Also still experiencing crashes when loading large lists in file view.
Title: Re: Fiio M3k
Post by: snejdy on September 10, 2019, 01:34:59 PM
Hi, thanks for the port - good job.
I found one bug, however.  The left-right balance does not work for me. Volume in both headphones is turned down instead of just one side.
I would also like to ask if it is possible to make the volume control work even when the keys are locked.
Thanks for the reply.
Title: Re: Fiio M3k Rockbox Port
Post by: XVortex on September 11, 2019, 12:28:48 AM
The left-right balance does not work for me.
Will be fixed in the next version.
Title: Re: Fiio M3k
Post by: Bilgus on September 11, 2019, 01:32:17 AM
If the device has a physical lock button we don't put code for the soft lock stuff which allows keys to be pressed while locked
However it is possible to add it http://forums.rockbox.org/index.php/topic,52539.0.html
Title: Re: Fiio M3k Rockbox Port
Post by: jjjameson on September 13, 2019, 12:53:08 AM
The left-right balance does not work for me.
Will be fixed in the next version.

Just letting you know that the most recent version of Rockbox on your site for the M3K is basically unusable, as it doesn’t let you change the volume and instead defaults to just very very loud. Just letting you know.
Title: Re: Fiio M3k
Post by: snejdy on September 27, 2019, 07:56:12 AM
Just an update, im returning the m3k in favor of the fiio m6. this rockbox release constantly freezes my device at different menus, as well as destroying the amazing battery life. i also couldnt get it to boot back into stock fiio software while rockbox is installed. all in all its not worth the trouble, if you have a lot of music avoid the m3k, if you like a working m3k avoid the releases as of this post.


m3k works with this port without any problems, no freezing for me... Only the channel balance does not work...
Title: Re: Fiio M3k
Post by: Nelke on September 27, 2019, 08:13:49 AM
Hi,

my M3K works well with rockbox, thanks XVortex. :) I can boot into the stock player, freezes are only in some plugins but i don't need these.  With Rockbox I have a battery time of about 18-20 hours. Maybe, the runtime was a bit longer with the fiio player.

Before the update I had formatted a sd card in the M3K. Firmware version was 1.3.0. I don't know if it important.

The only problem I have, fast forward/rewind doesn't work in v1.3.0_5bbc553-190915.
That's why I went back to v1.3.0_70b135b-190913.
Title: Re: Fiio M3k
Post by: Njones on September 30, 2019, 09:58:33 AM
I Updated the M3k firmware to 1.4.3 and now I can't get rockbox to work?
Title: Re: Fiio M3k
Post by: swap on October 18, 2019, 06:55:34 AM
Thanks, Great Port.

I have a question.

Fiio m3k Rockbox provide USB support?

Im new en Rocbox and not found howto transfer file usb.

Thanks
Title: Re: Fiio M3k
Post by: diegopau on February 16, 2020, 01:51:05 PM
Hi XVortex,

Are there any plans to further update the firmware for the M3k?

I posted a few issues and suggestions in these messages
http://forums.rockbox.org/index.php/topic,52952.msg245026.html#msg245026
http://forums.rockbox.org/index.php/topic,52952.msg245080.html#msg245080

I would love to know if you plan to address any of those in the future.

Thanks again for bringing Rockbox to this player.
Title: Re: Fiio M3k
Post by: bbame on March 05, 2020, 10:22:13 AM
I was excited to find a rockbox port for my brand new Fiio M3k.  The stock firmware lacks features I've become used to on my old (now dead) SanDisk Clip+ which ran rockbox.  So first of all, thanks very much for doing this!!!

I do have one question, though.  Fast Forward and Rewind don't work - pressing/holding the buttons just makes the screen flash rapidly - and I was wondering if there was something I could do to fix it.  Maybe revert to an earlier version or play with the settings somehow?  Since I listen to a lot of audio books and podcasts and often find myself rewinding/relistening, or fast fowarding past boring parts (or advertising), lack of FF/RW is a big deal for me.

I found other reports of FF/RW not working on this forum - someone suggested changing FF/RW Accel to "Very fast", which I did, but it had no effect.  For now I have changed "skip length" from "skip track" to "30s", but that's really irritating when I'm listening to music and want to skip a song/track.

Any advice?

Specifics: Fiio M3K, originally with stock firmware 1.4.3, now with the latest M3K rockbox version (also 1.4.3).
Title: Re: Fiio M3k Rockbox Port
Post by: speachy on April 15, 2020, 10:18:13 PM
Here we go!
Rockbox for the FiiO M3K is available on my site:
http://xvtx.ru/rockbox/download.htm (http://xvtx.ru/rockbox/download.htm)

P.S. source code will available later, when all settle a bit.

It's been well over six months since you posted that initial version; Have things settled sufficiently for you to toss the source code our way?  I'd love to get this integrated into the mainline.
Title: Re: Fiio M3k
Post by: whiskerc on April 29, 2020, 11:46:28 AM
Two quick questions for anyone using Rockbox on the M3k.

- Can the dual boot screen be bypassed or set to be very short?
- Would you recommend this player and Rockbox port?

I am a longtime (many year) user of Rockbox on the Clip+, but like many others would like to get a replacement ready for when the Clip+ is no more. 

Long live Rockbox :)
Title: Re: Fiio M3k
Post by: speachy on April 29, 2020, 12:01:45 PM
- Can the dual boot screen be bypassed or set to be very short?
- Would you recommend this player and Rockbox port?

Given that the source code for the m3k port has not been publicly released, the answer to both question is, unfortunately, no.
Title: Re: Fiio M3k
Post by: sohnemann on May 12, 2020, 03:43:42 AM
@XVortex

Is there any timeline on when the source will be available?
Would love to contribute to this port.  :)

Cheers
sohnemann
Title: Re: Fiio M3k
Post by: efqw on May 13, 2020, 04:59:24 PM
UPDATE: I have wiki access now, and I'll be moving important bits from my posts to the wiki page soon. Internal pictures have already been uploaded, along with links to datasheets for every single chip found in this device and disassembly instructions.
https://www.rockbox.org/wiki/FiioM3K (https://www.rockbox.org/wiki/FiioM3K)

First of all, it seems like xvortex somehow has access to FiiO's firmware signing keys? The firmware is a zip archive containing around 66 1MB chunks (kernel and rootfs), and every single part is individually signed with apksign!!! The recovery partition is what verifies (I have not tested unsigned/self-signed chunks yet) the individual chunks and writes them to the internal SPI NAND. You can decompress all of the individual parts, concatenate all the rootfs segments together, and you'll have a regular UBI image to play with.

FiiO was accidentally being incredibly helpful here by not stripping the main player binary in the stock fw (xvortex stripped them to make more room for rockbox), so I managed to get a reliable serial console on xvortex's firmware without having to open up the device. You can save this script in your MicroSD and launch it from xvortex's bootloader menu to get a serial console over USB. I've spent a few hours looking at fiio's main player program with Ghidra a while ago, it loads these modules if you connect the device to USB without a MicroSD card inserted (presumably for writing serial numbers). The main player binary immediately hangs up/unloads the kernel modules if you send something into the serial connection, so I assume we won't get a proper shell from that. Luckily busybox was compiled with getty :D

Code: [Select]
#!/bin/ash
insmod /lib/modules/3.10.14/kernel/driver/staging/dwc2/dwc2.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/libcomposite.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/u_serial.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/usb_f_serial.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/usb_f_acm.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/g_serial.ko
getty /dev/ttyGS0 115200



Some thoughts:

1. FiiO's buildroot is based on Ingenic's Halley2 buildroot BSP. The Halley2 BSP kernel, u-boot, buildroot and other misc files can be obtained from their FTP server. Please try to mirror it if you can, ingenic has a habit of silently removing files from their FTP server: ftp://198.13.102.99/ingenic_support/X1000_X1000E_X1500/01_SW/00_Board-Level_Consolidation_Version/Kernel3.10.14_X1000_New_Version/08_ingenic-linux-kernel3.10.14-x1000-v9.0-20191212/ingenic-linux-kernel3.10.14-x1000-v9.0-20191212.tar.bz2 (http://ftp://198.13.102.99/ingenic_support/X1000_X1000E_X1500/01_SW/00_Board-Level_Consolidation_Version/Kernel3.10.14_X1000_New_Version/08_ingenic-linux-kernel3.10.14-x1000-v9.0-20191212/ingenic-linux-kernel3.10.14-x1000-v9.0-20191212.tar.bz2)

2. Regardless of whether xvortex ends up releasing the source (I certainly hope they do), we need a soulution for generating update packages that doesn't involve FiiO's signing keys. Getting a signed intermediary package would be interesting, and then perhaps we can patch the recovery to disable signature verification?

3. My attempts on opening this device non-destructively have not been successful because it was glued shut. Applying heat doesn't seem to do much good as the screen still can't be pulled off with a suction cup clamp. Without access to the PCB (native UART), I won't be able to easily recover the device if something goes wrong with the recovery partition, so I can't tinker with the recovery for now.


Finally, here is some system info. Let me know if you have any questions.

Code: [Select]
/proc/mtd:
dev:    size   erasesize  name
mtd0: 00020000 00020000 "uboot"
mtd1: 00400000 00020000 "kernel"
mtd2: 00500000 00020000 "recovery"
mtd3: 05000000 00020000 "rootfs"
mtd4: 026e0000 00020000 "data"

/proc/version:
Linux version 3.10.14-g60d92e8-dirty (fiio64@ubuntu) (gcc version 4.7.2 (Ingenic 2016.11) ) #3 PREEMPT Fri Sep 27 11:46:20 CST 2019

/proc/cpuinfo:
system type : halley2_v10
machine : Unknown
processor : 0
cpu model : Ingenic Xburst V4.15  FPU V0.0
BogoMIPS : 1001.88
wait instruction : yes
microsecond timers : no
tlb_entries : 32
extra interrupt vector : yes
hardware watchpoint : yes, count: 1, address/irw mask: [0x0fff]
isa : mips32r1
ASEs implemented :
shadow register sets : 1
kscratch registers : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available

Hardware : halley2
Serial : 00000000 00000000 00000000 00000000

/proc/meminfo:
MemTotal:          58140 kB
MemFree:           43032 kB
Buffers:             476 kB
Cached:             2944 kB
SwapCached:            0 kB
Active:             2940 kB
Inactive:           1500 kB
Active(anon):       1024 kB
Inactive(anon):        4 kB
Active(file):       1916 kB
Inactive(file):     1496 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 8 kB
Writeback:             0 kB
AnonPages:          1024 kB
Mapped:             1308 kB
Shmem:                 8 kB
Slab:               3444 kB
SReclaimable:       1060 kB
SUnreclaim:         2384 kB
KernelStack:         352 kB
PageTables:          156 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:       29068 kB
Committed_AS:      35264 kB
VmallocTotal:    1048372 kB
VmallocUsed:        2096 kB
VmallocChunk:    1045868 kB


/proc/mount_points:
rootfs on / type rootfs (rw)
ubi0:rootfs on / type ubifs (rw,relatime)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /dev type tmpfs (rw,relatime,size=10240k)
tmpfs on /tmp type tmpfs (rw,relatime,size=10240k)
mdev on /dev type tmpfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=600,ptmxmode=000)
tmpfs on /dev/shm type tmpfs (rw,relatime,size=5120k)
ubi1_0 on /data type ubifs (rw,relatime)
/dev/mmcblk0p1 on /mnt type vfat (rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=936,iocharset=utf8,shortname=mixed,errors=remount-ro)


/proc/cmdline:
mem=64M@0x0 no_console_suspend console=ttyS2,115200n8 lpj=5009408 ip=off  init=/linuxrc ubi.mtd=3 root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs rw loglevel=8

/etc/os-release:
NAME=Buildroot
VERSION=2014.05-00055-g03a0bb5
ID=buildroot
VERSION_ID=2014.05
PRETTY_NAME="Buildroot 2014.05"
Title: Re: Fiio M3k
Post by: speachy on May 13, 2020, 06:40:43 PM
First of all, it seems like xvortex somehow has access to FiiO's firmware signing keys? The firmware is a zip archive containing around 66 1MB chunks (kernel and rootfs), and every single part is individually signed with apksign!!! The recovery partition is what verifies (I have not tested unsigned/self-signed chunks yet) the individual chunks and writes them to the internal SPI NAND. You can decompress all of the individual parts, concatenate all the rootfs segments together, and you'll have a regular UBI image to play with.

This comes as a suprise; none of the other hiby-based players I've seen require signed firmware images.

2. Regardless of whether xvortex ends up releasing the source (I certainly hope they do), we need a soulution for generating update packages that doesn't involve FiiO's signing keys. Getting a signed intermediary package would be interesting, and then perhaps we can patch the recovery to disable signature verification?

This package generation mechanism already exists, but it relies on tooling that is Linux-specific (and also requires superuser permissions).  That said, once a suitably-patched package is generated, we can use that to generate binary patches that can be distributed from download.rockbox.org and automagically applied using rbutil.
Title: Re: Fiio M3k
Post by: efqw on May 14, 2020, 07:55:34 PM
Some updates that I forgot to mention in my last post:

1. The main player application is aggressively logging to /data/userfs/app.log. I'm really concerned about this wearing out my NAND, so I deleted it and made a symlink to /dev/null  :D

2. ubinfo:
Code: [Select]
# ubinfo /dev/ubi0
ubi0
Volumes count:                           1
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     640 (81264640 bytes, 77.5 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       0
Count of reserved physical eraseblocks:  20
Current maximum erase counter value:     15
Minimum input/output unit size:          2048 bytes
Character device major/minor:            250:0
Present volumes:                         0
# ubinfo /dev/ubi1
ubi1
Volumes count:                           1
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     311 (39489536 bytes, 37.7 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       0
Count of reserved physical eraseblocks:  3
Current maximum erase counter value:     11
Minimum input/output unit size:          2048 bytes
Character device major/minor:            249:0
Present volumes:                         0

3. It's possible that FiiO simply used some stock test keys to sign the packages, but the keys in ingenic-linux-kernel3.10.14-x1000-v9.0-20191212.tar.bz2 don't match. Maybe they have different test keys in older releases?
Title: Re: Fiio M3k
Post by: diegopau on May 20, 2020, 03:40:54 AM
Quote
The main player application is aggressively logging to /data/userfs/app.log. I'm really concerned about this wearing out my NAND, so I deleted it and made a symlink to /dev/null

Hi, now that you explained this I am concerned too. Would you mind posting some details about how I could do this myself?
Title: Re: Fiio M3k
Post by: efqw on May 25, 2020, 04:18:06 PM
Code: [Select]
rm /data/userfs/app.log
ln -s /dev/null /data/userfs/app.log
;)
Title: Re: Fiio M3k
Post by: diegopau on May 26, 2020, 04:14:50 AM
Sorry, I am a complete noob at this. I never started a serial console before so that's where I am stuck:

On the M3K:

1. I created a file named "serial_connection.sh" with the script:

Code: [Select]
#!/bin/ash
insmod /lib/modules/3.10.14/kernel/driver/staging/dwc2/dwc2.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/libcomposite.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/u_serial.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/usb_f_serial.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/usb_f_acm.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/g_serial.ko
getty /dev/ttyGS0 115200

2. I placed the file in the root folder of the MicroSD.
3. Now with the M3K connected through USB and the MicroSD inside the M3K I turn it on and on the boot menu I go to TOOLS -> Run script. I select "serial_connection.sh" and I see a message "Running serial_connectio" that lasts around 5 seconds, then it's back to the boot menu.

On the computer I tried installing termite for windows https://www.compuphase.com/software_termite.htm and with the following settings: https://dl.dropboxusercontent.com/s/g2tr7ezcjxnjz7i/vivaldi_7Zpj9Vw9SW.png
I don't have more options than COM1.

It doesn't work and I don't know what else to try.
Title: Re: Fiio M3k
Post by: efqw on May 29, 2020, 11:17:53 AM
You'll be able to see a new serial port pop up on your computer after you launch the script, and the script is blocking, which means it won't quit unless you actually hang up in the serial terminal. I've never tried this in windows, maybe you could use a Linux vm?
Title: Re: Fiio M3k
Post by: diegopau on May 30, 2020, 02:15:51 PM
Done! thank you! I had to use
Code: [Select]
getty /dev/ttyS0 115200instead of
Code: [Select]
getty /dev/ttyGS0 115200
Title: Re: Fiio M3k
Post by: daps on June 20, 2020, 03:42:39 PM
Seems like the Fiio M3 Pro is the new hot budget player. Anyone messing around with it or is it similar to the M3k?
Title: Re: Fiio M3k
Post by: darkcity on June 21, 2020, 05:50:21 AM
It is similar to the M3k

https://www.fiio.com/m3pro_comparisons

It uses the same SoC, Ingenic X1000E, so hopefully rockboxable.

It has a larger touch sensitive screen. Battery life isn't as good.
Title: Re: Fiio M3k
Post by: efqw on July 15, 2020, 02:09:21 AM
Seems like the Fiio M3 Pro is the new hot budget player. Anyone messing around with it or is it similar to the M3k?

The hardware setup should be sufficiently similar to the M3K, but this is a full touchscreen device. While it is indeed more aesthetically pleasing, I don't think it'll work as well with rockbox as the M3K would.
Title: Re: Fiio M3k Rockbox Port
Post by: LuismaSP89 on August 05, 2020, 11:54:54 AM
The left-right balance does not work for me.
Will be fixed in the next version.

Hi  @Xvortex, do you know when you're going to release the next update? Like other users, the forward/rewind buttons doesn't work, and it's a shame since rockbox works with great performance on the M3K, but can't be used normally because of this bug. Also I can't change the track with the "next/previous" button if the loop option is selected for 1 track.

Thank you for taking your time developing this rockbox for M3K  ;)
Title: Re: Fiio M3k
Post by: ZoRG172 on September 03, 2020, 03:58:45 PM
Is there any way to make sure that the blocking blocks only the touch buttons, and the mechanical buttons continue to work as in the native firmware?

upd
I understand correctly that without the author of the port XVortex softlock cannot be installed in any way?
From this post https://forums.rockbox.org/index.php?topic=51589.0
I'm willing to pay for this function: Softlock Options: Disable Touch (Blocks touch screen buttons like the original (only for touch devices) and for fixing the rewind, but the author does not respond  :'(
As there is a device, it’s useless for me, I’ll have to sell it.
Title: Re: Fiio M3k
Post by: speachy on September 28, 2020, 09:50:12 PM
FYI, over the weekend I received the M3K sources from xvortex.

It's probably going to take a week or two but I'm working on getting the patch sliced into more mergable/reviewable chunks.
Title: Re: Fiio M3k
Post by: chinchin on September 29, 2020, 04:02:47 AM
That's great news. Thanks so much to you both.
Title: Re: Fiio M3k
Post by: fossphile on October 01, 2020, 12:26:42 AM
+1 great news to read. Will be very happy to see skip bug fixed :D.
Title: Re: Fiio M3k
Post by: speachy on October 01, 2020, 07:52:46 AM
+1 great news to read. Will be very happy to see skip bug fixed :D.

For my reference, what exactly is this "skip bug" and how would one go about recreating it?    (Basically, is it something unique to the m3k, or is it shared with other devices?)
Title: Re: Fiio M3k
Post by: Thew on October 03, 2020, 03:05:20 AM
I think “fossphile” is referring to the fact that the two screen buttons for track skipping forward and back don’t work in “vortex's” second Rockbox version. They also don’t work for continuous fast-forward and rewind. They both work correctly in “vortex’s” first Rockbox download.
Title: Re: Fiio M3k
Post by: Summer Element on October 03, 2020, 07:17:28 AM
I was excited to find a rockbox port for my brand new Fiio M3k.  The stock firmware lacks features I've become used to on my old (now dead) SanDisk Clip+ which ran rockbox.  So first of all, thanks very much for doing this!!!

I do have one question, though.  Fast Forward and Rewind don't work - pressing/holding the buttons just makes the screen flash rapidly - and I was wondering if there was something I could do to fix it.  Maybe revert to an earlier version or play with the settings somehow?  Since I listen to a lot of audio books and podcasts and often find myself rewinding/relistening, or fast fowarding past boring parts (or advertising), lack of FF/RW is a big deal for me.

I found other reports of FF/RW not working on this forum - someone suggested changing FF/RW Accel to "Very fast", which I did, but it had no effect.  For now I have changed "skip length" from "skip track" to "30s", but that's really irritating when I'm listening to music and want to skip a song/track.

Any advice?

Specifics: Fiio M3K, originally with stock firmware 1.4.3, now with the latest M3K rockbox version (also 1.4.3).

Actually, it can be fixed by changing some setting. Turn to setting-playback settings-fast_forward/rewind and change the step. My M3k has been okay now after that.  ;)
Title: Re: Fiio M3k
Post by: lubatur on October 03, 2020, 08:39:19 AM
Turning to: setting > playback settings > fast_forward/rewind didn't work quite well for me, but:
installing Vortex's firmware M3K_v1.3.0_eef591e-190901.zip, found here: http://xvtx.ru/rockbox/download.htm (http://xvtx.ru/rockbox/download.htm) > FiiO M3K > All versions, FF/RW works as usual.
Thanks to member bbame for finding out/testing and informing.
Title: Re: Fiio M3k
Post by: Njones on October 03, 2020, 01:18:15 PM
How  do you add additional themes to this update?
Title: Re: Fiio M3k
Post by: speachy on October 03, 2020, 01:20:00 PM
With regards to the seek problem, I found and fixed the underlying problem in the vortex code dump -- it was a "Fix" for the LCD not getting shut off properly, but it had some nasty side effects on all of the hosted targets too.

the m3k-specific stuff is close to being mergeable but we need to be able to patch a new bootloader/launcher into the m3k flash image before it'll be of any use to anyone.

Title: Re: Fiio M3k
Post by: speachy on October 04, 2020, 07:59:49 PM
Good news:  The code is finally cleaned up to the point where the m3k binary and bootloader compile cleanly, and it's only a few to-dos away from being ready to merge:

   https://gerrit.rockbox.org/r/#/c/2804/

The bad news is that this code remains completely untested.  We do not yet have the technical ability to generate the patched firmware update image that is necessary to install our bootloader/launcher.  Figuring that out (in a way that can be scripted) is next.
Title: Re: Fiio M3k
Post by: Thew on October 05, 2020, 03:35:06 PM
I’d just like to add my appreciation of your efforts. I have two M3Ks, one of which I’ve Rockboxed with Xvortex’s first version. I particular enjoy creating my own custom User Interface and the initial promise of Rockbox on the M3K is very good. If things work out OK perhaps I’ll end with Rockbox on both my players.
Title: Re: Fiio M3k
Post by: speachy on October 09, 2020, 09:15:49 PM
The port code has landed in the main rockbox repo, and builds are now being generated by the build farm.

Again, this can *not* be deployed on top of an existing xVortex port.  Please do not attempt to do so.

I have not started to work on inserting our loader/launcher into an existing (stock) firmware image.  I do not know how long that will take.
Title: Re: Fiio M3k
Post by: fossphile on October 09, 2020, 10:00:35 PM
yay! brill news. looking forward to installing it on my m3k  :D :D :D
Title: Re: Fiio M3k
Post by: fossphile on October 09, 2020, 10:04:06 PM
With regards to the seek problem, I found and fixed the underlying problem in the vortex code dump -- it was a "Fix" for the LCD not getting shut off properly, but it had some nasty side effects on all of the hosted targets too.

the m3k-specific stuff is close to being mergeable but we need to be able to patch a new bootloader/launcher into the m3k flash image before it'll be of any use to anyone.

YAY!!!!  :D :D :D :D ;D :D :D :D :D that bug has been so annoying!
Title: Re: Fiio M3k
Post by: fossphile on October 09, 2020, 10:07:26 PM
I think “fossphile” is referring to the fact that the two screen buttons for track skipping forward and back don’t work in “vortex's” second Rockbox version. They also don’t work for continuous fast-forward and rewind. They both work correctly in “vortex’s” first Rockbox download.

it was fast forward/backward. i was annoyed at the compromise of losing skip back/forth in order to tap to skip x sec instead of hold down for fast forward/rewind.
Thank you for mentioning my woe.  :)
Title: Re: Fiio M3k
Post by: diegopau on October 10, 2020, 04:50:59 PM
This is great news! quite exciting, I am using the M3K heavily and it is great device even with the existing firmware limitations. Thank you speachy for working on this.

Some suggestions that I already posted in a different thread. I know it is too early, I just wanted to leave them documented since this is where the development is being reported.

- While playing any audio file, in the "While Playing" screen, there are no actions assigned to the touchpad (scrolling up / down), I think it would be a great feature to control the volumen up/down there by swipping up/down the touchpad button. That way we don't need to use the hardware buttons to control volume as long as we are seeing that screen.  even better if it is customizable, some people might prefer brightness up/down, right now there is no action assigned to scroll up/down the touchpad during playback.
- It would be good to remove the problem that efqw explained about how the firmware is constantly logging to a file and maybe wearing out the NAND.
- Is it possible to setup the M3K so it just starts directly to Rockbox without any countdown and just with a single click on the power button (instead of long press)? that's how the clip zip is setup by default: quick click to power button runs Rockbox, power button + volume down button runs Sansa firmware. This makes it quick to turn it on and it is also more gentle on the power button, it will last longer.
- Currently there doesn't seem to be a way to stop the playback, the playback can be paused, but not stopped. I think this is important for the power saving options. So if for example in the clip zip I used to be able to tap in a button that will create a bookmark and stop the playback, and if there is a automated power off setting for 5 minutes of standby, then in 5 minutes the device is off. In the M3K if I am listening to an audiobook and I can only pause the playback and then the automatic stand by power off setting is never triggered.
- It is currently a bit difficult to reach the screen that allows you to select the playback speed, i use it to slowdown a bit audiobooks. I mean this one https://www.dropbox.com/s/jnl5ddplhm6w0p7/IMG_20191112_203959.jpg?dl=0, in the clip zip I accessed it by long pressing the pause/play button, I can't find any button that takes me there in the Fiio M3K, but I did see that there is a way to access it by navigating quite a bit.


Issues that I had
- I have a big file (a long audiobook) that plays perfectly on the Sansa Clip Zip with Rockbox, and also in the Fiio M3K when using Fiio firmware. It doesn't however play when using Rockbox in Fiio M3K, it doesn't do anything. Are there any logs that I can attach? where can I find them? The file properties can be seen here https://www.dropbox.com/s/rh5u0227297uf3q/SMPlayer%20-%20File%20properties%202019-11-12%2020.38.28.png?dl=0, I can share it with you in private if that helps.
- The problems with transferring files through USB, in general this doesn't seem to work. Not a big deal to me, I just transfer them directly to the sd card.
Title: Re: Fiio M3k
Post by: speachy on October 10, 2020, 05:37:29 PM
Some suggestions that I already posted in a different thread. I know it is too early, I just wanted to leave them documented since this is where the development is being reported.

It is _far_ too early to talk about feature/bugrequests, especially versus an unofficial build/fork.

I can only promise you that when the "official" binaries are finally installable, they will present a different set of bugs than what you're used to.
Title: Re: Fiio M3k
Post by: fossphile on October 12, 2020, 12:56:53 PM
I can only promise you that when the "official" binaries are finally installable, they will present a different set of bugs than what you're used to.
Sounds like a improvement :)
Title: Re: Fiio M3k
Post by: bahus on October 21, 2020, 11:59:36 AM
Would be cool to have option to replace volume buttons with next/prev actions and move volume control to touch slider (so making control very similar to iriver h10). I believe it would make it conveniently controlled from the pocket.
Title: Re: Fiio M3k
Post by: alexs on November 07, 2020, 07:41:41 PM
This package generation mechanism already exists, but it relies on tooling that is Linux-specific (and also requires superuser permissions).  That said, once a suitably-patched package is generated, we can use that to generate binary patches that can be distributed from download.rockbox.org and automagically applied using rbutil.

No idea what's the current status here, so just in case, I think I have a way (or one more way) of installing pretty much anything on this device now. There's nothing really Linux-specific about it, but it does involve a valid original M3K.fw. It is however very easy to patch out once discovered, assuming anyone at FiiO cares.

This comes as a suprise; none of the other hiby-based players I've seen require signed firmware images.

Shanling M0 uses the same kind of signed update packages. With the same exact public key for signature checks.

1. The main player application is aggressively logging to /data/userfs/app.log.

A bit of trivia. Navigate to Settings -> About, and press the pause button TWELVE times. The player will copy app.log to the SD card, along with the kernel log. If there's a file named "fiio_linux_app_debug_cmd" in the root directory of the SD card, it will also attempt to capture and copy core dumps of the player application.
Title: Re: Fiio M3k
Post by: speachy on November 08, 2020, 09:51:55 AM
Shanling M0 uses the same kind of signed update packages. With the same exact public key for signature checks.

In other words, it's probably the default Ingenic signing key, probably hiding somewhere in the bowels of their SDK sources...
Title: Re: Fiio M3k
Post by: whiskerc on November 24, 2020, 08:28:26 AM
Just checked in and discovered that progress is being made on the M3K port.  This is excellent news.  Thank you!

When it comes to the point where you are looking for testers, I would be more than happy to help in any way possible.   I have an M3K currently running xvortex M3K_v1.4.3_e99db03-191013.
Title: Re: Fiio M3k
Post by: bahus on November 29, 2020, 03:55:46 PM
when the "official" binaries are finally installable, they will present a different set of bugs than what you're used to.

Why there is no daily builds for this target?
I got that's it's not automatically installable - but isn't it the case for other targets like Xuelin?


I think I have a way (or one more way) of installing pretty much anything on this device now. There's nothing really Linux-specific about it, but it does involve a valid original M3K.fw. It is however very easy to patch out once discovered, assuming anyone at FiiO cares.
If I understand correctly there is some way that can be used for manual installation.
So daily builds might be useful if alexs shares his manual installation method..
Title: Re: Fiio M3k
Post by: saratoga on November 29, 2020, 06:03:31 PM
https://build.rockbox.org/data/rockbox-fiiom3k.zip
Title: Re: Fiio M3k
Post by: Njones on November 29, 2020, 08:05:03 PM
Do you load the zip file or do you unzip it first? Also do you delete the previous rockbox file first?
Title: Re: Fiio M3k
Post by: Njones on November 29, 2020, 08:21:17 PM
Nevermind updated rockbox through tools. The problem that no matter which theme I use it only fills about 1/4 of the screen.
Title: Re: Fiio M3k
Post by: speachy on November 29, 2020, 08:36:04 PM
It seems I need to repeat myself:

The port code has landed in the main rockbox repo, and builds are now being generated by the build farm.

Again, this can *not* be deployed on top of an existing xVortex port.  Please do not attempt to do so.
Title: Re: Fiio M3k
Post by: Njones on November 29, 2020, 08:45:54 PM
Does that mean Delete the previous version and then install this latest one or is this one not ready yet. Please Bear with me , I'm a 69 year old non tech savvy music lover who has used rockbox on several sansa players and the agptek Rocker.
Title: Re: Fiio M3k
Post by: vitt13 on November 30, 2020, 05:30:55 AM
1. FiiO's buildroot is based on Ingenic's Halley2 buildroot BSP. The Halley2 BSP kernel, u-boot, buildroot and other misc files can be obtained from their FTP server. Please try to mirror it if you can, ingenic has a habit of silently removing files from their FTP server: ftp://198.13.102.99/ingenic_support/X1000_X1000E_X1500/01_SW/00_Board-Level_Consolidation_Version/Kernel3.10.14_X1000_New_Version/08_ingenic-linux-kernel3.10.14-x1000-v9.0-20191212/ingenic-linux-kernel3.10.14-x1000-v9.0-20191212.tar.bz2 (http://ftp://198.13.102.99/ingenic_support/X1000_X1000E_X1500/01_SW/00_Board-Level_Consolidation_Version/Kernel3.10.14_X1000_New_Version/08_ingenic-linux-kernel3.10.14-x1000-v9.0-20191212/ingenic-linux-kernel3.10.14-x1000-v9.0-20191212.tar.bz2)
Removed... But I found the tutorial and the link on that archive http://www.ingenic.com.cn/?newsshow/tp/228/id/775.html (http://www.ingenic.com.cn/?newsshow/tp/228/id/775.html). It's on Baidu net disk.
Title: Re: Fiio M3k
Post by: alexs on November 30, 2020, 07:57:58 AM
The tool I used for getting shell access / injecting files into the rootfs. Base64 ZIP. Instructions inside.

Best I can tell, this trick should also work on M3 Pro, I have one ordered and I'll try it once it arrives.
But it's 2020 so that might be next week or next year.

Also I got my test device into the USB boot mode and it works great! but I cannot boot the system like that yet.
Title: Re: Fiio M3k
Post by: alexs on November 30, 2020, 08:26:30 AM
Removed... But I found the tutorial and the link on that archive http://www.ingenic.com.cn/?newsshow/tp/228/id/775.html (http://www.ingenic.com.cn/?newsshow/tp/228/id/775.html). It's on Baidu net disk.

The kernel itself is here: https://github.com/FiiOapp/FiiO_Kernel_M3K
They did not even bother renaminig halley2 files, so arch/mips/xburst/soc-x1000/chip-x1000/halley2 is in fact M3K.
The docs for the SoC are also easily available on Github.

Getting the rest of the SDK from Baidu would be nice though.
Title: Re: Fiio M3k
Post by: bahus on November 30, 2020, 08:33:15 AM
Base64 ZIP. Instructions inside.

Well.. That's doesn't look as simple instruction for windows user... Just in case attaching decoded txt directly to zip (just remove .txt extension from downloaded file)..
Title: Re: Fiio M3k
Post by: vitt13 on November 30, 2020, 09:50:44 AM
The tool I used for getting shell access / injecting files into the rootfs. ... Also I got my test device into the USB boot mode and it works great! but I cannot boot the system like that yet.
Nice! It would be great to steal raw content (with dd tool?) as is all the partitions to be able re-flash (be able recover) with the factory tool "USB cloner v2.5.0". We have only bootloader, kernel image and system ubi image extracted from M3K.fw.
I mean the tool I found here under "burning tools" http://www.ingenic.com.cn/en/?product/id/9/lm/4.html
Just found that Chinese page has the newest tools http://www.ingenic.com.cn/?product/id/9/lm/3.html
Someone have to find out what config we need to use with M3K.
Title: Re: Fiio M3k
Post by: alexs on November 30, 2020, 10:22:03 AM
Well.. That's doesn't look as simple instruction for windows user... Just in case attaching decoded txt directly to zip (just remove .txt extension from downloaded file)..

The only idea of a simple solution for Windows (or Mac) users I can come up with right now is to provide them with a pre-modified M3K.fw. So somebody would build Rockbox, prepare the files and put them up for download. All that on a Linux host of course. The Window users would need to transfer a couple of files onto an SD card and boot the device with the button pressed.
Title: Re: Fiio M3k
Post by: alexs on November 30, 2020, 10:33:12 AM
We have only bootloader, kernel image and system ubi image extracted from M3K.fw.

There are two more partitions there: recovery, which we also have, and userdata which doesn't containt anything important.
Keep in mind rootfs and userdata are both ubi partitions, so dd'ing them is not the best idea.

Quote
Someone have to find out what config we need to use with M3K.

One of the -sfc-nand- options. There's no NOR flash there and this device is not configured to boot from MMC.

That tool will only work with the device in bootrom / USB boot mode. There are two ways to get there: wiping the bootloader (which is what I did on my device) or soldering one of the bootconfig resistors (which should be possible but requires opening the case). Unmodified device running stock firmware will not respond to those requests.

You don't need their Windows tool either. There's a Linux package called ingenic-boot which has the tools to do all of that I think. It's for earlier Ingenic chips but it did not take much for me to make it work with x1000. It's also very simple on the Linux side, because fundamentally all it does is uploading raw code into device's RAM and letting it run there.
Title: Re: Fiio M3k
Post by: bahus on November 30, 2020, 10:46:04 AM
So somebody would build Rockbox

Well this part is already done - daily fiio m3k builds available here: https://build.rockbox.org/data/rockbox-fiiom3k.zip
Title: Re: Fiio M3k
Post by: vitt13 on November 30, 2020, 10:52:50 AM
alexs, Thank you for clarifying.
You don't need their Windows tool either.
Just a note: they also provide Linux tool.
Title: Re: Fiio M3k
Post by: vitt13 on November 30, 2020, 11:15:34 AM
alexs, I thought it should have a trick action to get fastboot mode and then use "Clone tool".
I found there is a set of action for Ingenic XBurst M200S based smart watch https://forum.xda-developers.com/smartwatch/other-smartwatches/amazfit-boot-fastboot-directly-t3546829 and how recovery it with Ingenic Clone tool https://forum.xda-developers.com/smartwatch/amazfit/tutorial-ingenic-cloner-tool-aamzfit-t3908237
but as you say it's not possible for M3K...
Title: Re: Fiio M3k
Post by: speachy on November 30, 2020, 11:39:11 AM
Well this part is already done - daily fiio m3k builds available here: https://build.rockbox.org/data/rockbox-fiiom3k.zip

That's actually updated on every commit; there are no "daily" build snapshots kept for the M3K.

But while there is a rockbox build, the necessary platform integration (ie the rockbox loader application, system scripts, etc) remains to be done.  And there's a lot of work to be done on that front -- While the loader is written, it has seen no meaningful testing, and worse yet, the m3k's underlying Linux kernel and base OS is a real hacky mess, with stuff we take for granted on every other platform simply not working. As an example of this, custom userspace code needs to be written to *shut down* the player because the kernel doesn't have the correct stuff hooked up to be able to use the standard Linux APIs that have been around for literally decades.
Title: Re: Fiio M3k
Post by: alexs on November 30, 2020, 12:15:35 PM
Well it turned out to be quite easy, although I wouldn't call Rockbox usable at this point.

Tool attached. Put the modified M3K.fw together with rockbox-fiiom3k.zip on an SD card and update the player.
The modified M3K.fw can be reused as long as .rockbox/rockbox.m3k path in the zip remains the same.

Edit: "No Rockbox directory, installation incomplete". Well that would explain things.

Edit 2: DON'T USE this script it is wrong, see below.
Title: Re: Fiio M3k
Post by: bahus on November 30, 2020, 12:59:50 PM
Well it turned out to be quite easy, although I wouldn't call Rockbox usable at this point.

Are you saying it's less usable than builds provided by XVortex? https://mega.nz/folder/0wckiIIZ#o_-7wp3aT_ob-EoxsteNqw/folder/EpVAQQ7K (M3K_v1.3.0_eef591e-190901.zip is less buggy than latest)

Can you share modified M3K.fw (using google drive or some free file sharing services like https://gofile.io/ or https://mega.nz)
Title: Re: Fiio M3k
Post by: alexs on November 30, 2020, 01:07:42 PM
Nah, I got it playing and it looks much better now.

This build wants the .rockbox directory to be on the SD card. Not in the internal rootfs where I tried to put it initially.
Title: Re: Fiio M3k
Post by: alexs on November 30, 2020, 01:32:59 PM
Ok so if the idea was to keep Rockbox completely on the SD, I can see how that could work, but I'll need some time to think how to set it up in way that would make any sense. SD cards are removable and hot-pluggable on this device.
Title: Re: Fiio M3k
Post by: bahus on November 30, 2020, 01:44:14 PM
I'll need some time to think how to set it up in way that would make any sense. SD cards are removable and hot-pluggable on this device.

That's also true for all recent Chinese targets (all xDuoo and Aigo ports, Agptek Rocker, ...) where internal memory is not exposed. All of them load rockbox from external SD - that makes rockbox update pretty easy... So I see nothing to worry about it...
Title: Re: Fiio M3k
Post by: speachy on November 30, 2020, 01:47:21 PM
Ok so if the idea was to keep Rockbox completely on the SD, I can see how that could work, but I'll need some time to think how to set it up in way that would make any sense. SD cards are removable and hot-pluggable on this device.

General approach:

1) updated rockbox launcher copied to onboard flash, and startup script modified to launch it.
2) mdev rules updated to auto mount/unmount filesystems upon hotplug.
3) fix bugs as they come up.


As an example of what we care about with (1) and (2), see https://git.rockbox.org/cgit/rockbox.git/tree/tools/hiby_patcher.pl starting around line 137.

EDIT:   The stuff targeting the m3k specifically starts on line 229.  It is _very_ incomplete.
Title: Re: Fiio M3k
Post by: alexs on November 30, 2020, 03:00:50 PM
alexs, I thought it should have a trick action to get fastboot mode and then use "Clone tool".

It might be implemented in the recovery tool. I poked around a lot with Ghidra there, but it's a pretty large piece of code and I wasn't looking for input related things. It does seem to have some input handling code even though it doesn't appear interactive at all. You might be on to something here. Or it might be just some stray code from their GUI library. Either way, it will likely take some time to find out.

I can tell for sure that the 2nd stage bootloader (x-loader) does not support fastboot, and cannot re-activate the bootrom USB mode. The only choice it makes is between the main kernel and the recovery kernel. The USB mode I was talking about is not fastboot either, it's Ingenic specific and it's much simpler than fastboot. I assumed Ingenic tools would use it over fastboot, but now that I think of it, the recovery tool was probably developed by Ingenic as well, so who knows.
Title: Re: Fiio M3k
Post by: alexs on November 30, 2020, 04:25:09 PM
Updated scripts. Should properly run rockbox from SD by copying the loader to internal storage.

Booting without SD card in the slot = USB console.
Booting with SD but no .rockbox there = FiiO player.
Booting with SD and .rockbox is there = RockBox.

Modified M3K.fw: https://gofile.io/d/giokMw

Do not forget to unpack rockbox-fiiom3k.zip onto the SD, there are no Rockbox parts in that M3K.fw.
Title: Re: Fiio M3k
Post by: bahus on November 30, 2020, 05:12:08 PM
Should properly run rockbox from SD by copying to loader to internal storage.
Cool! Thanks! I gave a quick look... Noticed issues: Shutdown doesn't work properly - button backlight is on after shutdown (need to keep power button pressed longer - backlight will be off too) ; USB storage mode doesn't work - only charges on USB insertion...
Title: Re: Fiio M3k
Post by: whiskerc on December 01, 2020, 10:42:26 AM
>Updated scripts. Should properly run rockbox from SD by copying to loader to internal storage.

Yes, clear instructions.  The M3K starts up right to Rockbox when the SD card is loaded.  Will wait to do more testing but wanted to pass on the news that it does work on another M3K.
Title: Re: Fiio M3k
Post by: vitt13 on December 01, 2020, 12:38:01 PM
It might be implemented in the recovery tool.
I've just found the IRC https://www.rockbox.org/irc/log-20200706 messages from efqw_

Quote
With Ingenic's USB Cloner tool, the entire flash can be overwritten without disassembling the device. I have already tried erasing the entire NAND and flashing back my own NAND dumps and it worked perfectly fine.

From what I can see, it loads a ~6kB u-boot SPL into the memory which does memory initialization, and then loads a pre-built u-boot binary, and this is what interacts with the cloner device from now on.

So we can replace the bootloader with u-boot or even re-partition the NAND in theory, but I'm not sure if that's worth the effort to be honest.
Unfortunately there is no detail how he got own NAND dumps.

But I still have not complete understanding how efqw_ did that. I read the X1000/E DS and flow chart shows that USB boot takes part after fail with SFC boot and MSC1 (not presented in FiiO M3K obviously) boot. It seems like SFC boot fails with presented USB connections, or he found magical button pressing set, other than
Quote
Darn it. I was trying to find the boot select pins on the FiiO M3K, and looks like I won't be able to find it unless I pull the SoC off.

boot_sel[0] (PB28) is tied to Volume Down, which is nice I guess

What I wanted was PB29, which is not defined in the source unfortunately. I could make it boot from mmc if I pull down PB29.
Title: Re: Fiio M3k
Post by: alexs on December 01, 2020, 01:26:51 PM
From what I can see, it loads a ~6kB u-boot SPL into the memory which does memory initialization

Oh ok so this what I was messing with. It can only be done if the device is in the USB boot mode. Then it would allow you to upload the SPL.

Quote
boot_sel[0] (PB28) is tied to Volume Down, which is nice I guess

OMFG I'm an idiot. Bingo! That's all you need to flash the device. No need for my unzip hack. No need for Ghidra.
It might take some work to get u-boot working and/or write something custom but it's a clear and straighforward task now.

Power the device down, then plug it into a USB host while holding vol-down button.
It will light up the buttons and enumerate as Ingenic x1000. That's the USB boot mode.

Code: [Select]
[3114458.858415] usb 1-3: new high-speed USB device number 86 using xhci_hcd
[3114459.000769] usb 1-3: New USB device found, idVendor=a108, idProduct=1000, bcdDevice= 1.00
[3114459.000775] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[3114459.000778] usb 1-3: Product: X\x10
[3114459.000781] usb 1-3: Manufacturer: Ingenic

Just for reference, I got to this mode by wiping the header of the NAND bootloader from Linux.
If the header is invalid, SFC boot always fails, so it proceeds to the next option which is USB.

Edit: and I was trying hold-button-power-up with each button! But apparently messed up somewhere.
Title: Re: Fiio M3k
Post by: alexs on December 01, 2020, 01:47:42 PM
Quote
What I wanted was PB29, which is not defined in the source unfortunately. I could make it boot from mmc if I pull down PB29.

Really no need for this by the way. An SPL/TPL capable of loading the next stage from SD card would be enough.

Ingenic x-loader seems to support MMC boot by the way. So it might be really easy.
u-boot is another option, although I don't think this device needs u-boot.
Title: Re: Fiio M3k
Post by: vitt13 on December 03, 2020, 02:55:25 PM
That's all you need to flash the device. No need for my unzip hack. No need for Ghidra.
It might take some work to get u-boot working and/or write something custom but it's a clear and straighforward task now.
It's clear for me now, thanks.

So, generally, running M3K port has to be close to AGPTEK Rocker port (X1000 based), right?
Let me elaborate a bit to clarify situation (please refer to https://www.rockbox.org/wiki/AgptekRocker for additional info). Agptek first loads tiny bit of binary code (SPL) into cold cache which main role is to configure PLL (aka clocks) and RAM controller. Then it loads bootloader (uboot) into ram and passes control to it. Uboot loads linux kernel either from mtd2 or mtd3 (normal kernel or recovery kernel) and passes control to linux. If it is normal boot, kernel mounts UBIFS rootfs from mtd4, if it is recovery boot, kernel loads rootfs from concatenated to itself image. Kernel (both normal and recovery) calls init process (the parent of all processes). Init runs startup scripts to run various services and finally runs hiby player binary which presents GUI for the user.

Now after this lengthy introduction - we patch normal rootfs to call rockbox bootloader binary instead of hiby player binary. So from the technical point of view we DO NOT patch bootloader (uboot) and we do not touch recovery image. This makes all process pretty safe.

And another difference is how OF file is packed.
Quote from: efqw_
efqw_   This device is very similar to the AGPTEK ROCKER in terms of hardware spec (no radio, X1000E instead of X1000, different I2S DAC, same PMU, I2C touch controls instead of a D-PAD).
efqw_   Additionally, this device is using X-Loader instead of U-Boot, and system updates are performed with a recovery partition instead.
efqw_   Firmware packages are split into ~1MB chunks and signed individually with apksign, and then zipped together along with a manifest file.
efqw_   This setup is drastically different from the hiby stuff, where the .upt file is an ISO9660 volume and the blobs are not signed.
So, XVortex has the signature cert. from FiiO Tech.Support but we have not. alexs, your unzip hack is genius and quite useful to have access on system console.

I hope my a bit off-topic messages about possible repairing/recovering are not such distracting from main target.
Title: Re: Fiio M3k
Post by: bahus on December 06, 2020, 10:51:05 AM
Hm... And only now I've noticed that XVortex also provided a way to update rockbox right from boot menu. Go to Tools -> Update rockbox (and script copies .rockbox folder from SD card to internal player storage).

Compared to XVortex latest build has following flaws (no matter how it's been installed via alexs firmware or via Tools):
1) XVortex standard theme is better adjusted (bigger fonts, playing track info in lists etc)
2) Strange shutdown behavior. In latest build you need to press shutdown button way longer. It looks like it's now two stage shutdown (first screen then backlight)
3) It looks like there is power drain when player is shut down by Idle power off or Sleep timer. Noticed few times that after full charge it's been almost dead next day when it's been shut down by idle power off after only few minutes of real use.
Title: Re: Fiio M3k
Post by: speachy on December 06, 2020, 11:07:28 AM
2) Strange shutdown behavior. In latest build you need to press shutdown button way longer. It looks like it's now two stage shutdown (first screen then backlight)
3) It looks like there is power drain when player is shut down by Idle power off or Sleep timer. Noticed few times that after full charge it's been almost dead next day when it's been shut down by idle power off after only few minutes of real use.

These are the same; the player is not getting shut down at all via software (due to the broken-ass kernel), and continuing to hold the power button eventually trips the hardware-level poweroff.

Title: Re: Fiio M3k
Post by: vitt13 on December 06, 2020, 02:11:14 PM
Do we need libSDL (generally) to use rockbox port on M3K? I see that lib was discussed in IRC, but the lib file missed in M3K OF and it presents in AGPTEK Rockr OF.
If it needs, can we bring libSDL-1.2.so.0 from Shanling M2s OF (same X1000/E) since that firmware contains many of the same lib files (in binary comparison) as M3K OF?
Title: Re: Fiio M3k
Post by: vitt13 on December 08, 2020, 01:36:53 PM
the m3k's underlying Linux kernel and base OS is a real hacky mess
I'm not a good programmer but (even for such inexperienced in Linux kernel stuff programming person like me), Fiio's AK4376 driver seems like that developer just rewrote AXP173 driver (why?) with similar realizing all that i2c communication stuffs.
https://github.com/FiiOapp/FiiO_Kernel_M3K/blob/master/sound/soc/ingenic/ocodec/ak4376.c
BTW, same picture is here (that probably is "new" version since M5 was released later and has AK4377 DAC)
https://github.com/FiiOapp/FiiO_Kernel_M5/blob/master/sound/soc/ingenic/ocodec/ak4376.c
Why did programmer not rewrote existing GPL driver from AK? It obviously exists  :-X
https://github.com/rcstar6696/android_kernel_huawei_hi3660/blob/master/drivers/huawei_platform/audio/ak4376/ak4376.c
https://github.com/LG-SD4XX/android_kernel_lge_cv1/blob/master/sound/soc/codecs/ak4376.c

---
I've just found signing tools, splitting scripts and keys in latest Ingenic's SDK ingenic-linux-kernel3.10.14-x1000-v9.0-20191212.tar.bz2 (1.49GB)
in \development\tools\ota and \ota-nand
splitting script
Title: Re: Fiio M3k
Post by: vitt13 on December 22, 2020, 12:39:59 PM
I've just got Ingenic cloner tool with suitable configs for M3K and M5 devices from FiiO's Tech.Support. The archive with tool is also contains original firmware parts (i.e. x-boot, recovery, xImage, system and data). The config is not such different that I suggested, but at least now I have complete and safe way to recover M3K. BTW, new OF has been released and new devices come with 1.4.5 OF onboard.

There is also the way to get log files form OF: just go to "System Settings"->"About M3", and quick press the hardware Play/Pause ⏯ button in the left side for several (13 for me) times until 'copy log done' notification appearing on the screen.

Then you'll find 'm3klog' folder in the root of the microSD card.
Here is mine just for reference
Title: Re: Fiio M3k
Post by: vitt13 on December 22, 2020, 02:39:54 PM
Here is the config (remove *.txt extension) for Ingenic cloner tool v2.5.0 for M3K/M5 devices.
I was worried about [nand] section, blindly making my own config. But it never mind now here is the original one.
Title: Re: Fiio M3k
Post by: vitt13 on January 03, 2021, 03:54:41 PM
If someone else is looking for X1000 PM, here is it https://raw.githubusercontent.com/xyfabc/my_books/master/X1000_PM_20160113.pdf
(btw was on ftp).
Title: Re: Fiio M3k
Post by: alexs on January 04, 2021, 04:15:57 AM
Also available here: https://github.com/JaminCheung/x-loader/tree/master/documents/cpu

That's the bootloader source, and there's some other Ingenic stuff there as well.
Title: Re: Fiio M3k
Post by: vitt13 on January 17, 2021, 05:20:39 PM
Also available here: https://github.com/JaminCheung/x-loader/tree/master/documents/cpu

That's the bootloader source, and there's some other Ingenic stuff there as well.
Nice. There's also ota tool and keys to build/re-build M3K.fw.
I successfully unpacked M3K.fw on parts (xImage, system.ubi, x-loader-pad-with-sleep-lib.bin) and then rebuild M3K.fw with the same signed numbers of updateNNN.zip.
Here is my dirty windows standalone package I built with PyInstaller https://github.com/VitToCode/linux-recovery-ota/releases/tag/1.0
but Linux users directed to JaminCheung original repo.
Title: Re: Fiio M3k
Post by: speachy on January 18, 2021, 10:59:45 PM
I just finished a little poking around the 1.4.5 m3k update, trying to get an idea what was actually changed.

1) there's an updated kernel build (no idea what actually changed, as the sources they've released (in 2018-12) don't seem to correspond to any of the binary builds.
2) Startup script recreates /data partition if it's busted  (responsible for the "welcome screen" hang)
3) New player binary

I doubt any of the general platform jankiness has been fixed.
Title: Re: Fiio M3k
Post by: ZoRG172 on January 21, 2021, 11:31:10 AM
Does this mean that dev builds of Rockbox for M3K we will not see in the near future?
Title: Re: Fiio M3k
Post by: FroggestSpirit on January 25, 2021, 09:32:57 PM
I looked into building the kernel from the FiioApp github, but I wasn't able to (I think it requires a gcc 5 or lower for mipsel). I downloaded the newest version of buildroot from the official github, and was able to build this sucessfully. I believe they recently added Ingenic Xburst (X1000) in the kernel. I'm not really sure what to do with the generated images though, otherwise I was going to try injecting the newly built kernel.
Title: Re: Fiio M3k
Post by: vitt13 on January 26, 2021, 01:24:24 AM
I looked into building the kernel from the FiioApp github, but I wasn't able to (I think it requires a gcc 5 or lower for mipsel).
Look at M5 kernel source https://github.com/FiiOapp/FiiO_Kernel_M5 and compare it with M3K. M5 sources is almost complete but just missing *.S files. And correct ak4376 driver is also there (https://github.com/FiiOapp/FiiO_Kernel_M5/tree/master/sound/soc/ingenic/ocodec). Just recover needed *.S files and can build the M5 kernel. I use prebuilded mips-gcc472-glibc216 toolchain from Ingenic (also on github).
I started with it I thought it might be helpful to rebuild recovery image (xImage with glued ramdisk) with patched 'recovery' (fw update) utility to pass through the unsigned update archives. Since we found on github the correct pair of signing keys from Ingenic developer, now we can build M3K.fw like genuine ones. BTW M5 original firmware built with the different private key but same public key and I'm trying to work around bypass the signature check on M5 device for my friend.
Title: Re: Fiio M3k
Post by: FroggestSpirit on January 27, 2021, 10:35:36 PM
Here's what I got so far to build the kernel:
Download the Halley2 dev stuff here: ftp://grids.be/../mirror/ftp.ingenic.cn/DevSupport/Platform/Halley2/
There's some instructions here: http://www.ingenic.com.cn/en/?newsshow/tp/228/id/108.html
Instead of using "make halley_linux_defconfig" I attached a copy of the .config file that can be used for building the kernel (Mostly from the M5 repo, but modified) rename it to .config

Build the u-boot in the platform/u-boot folder with "make halley_uImage_spinor"
copy "platform/u-boot/tools/mkimage" to the bin folder of the mips cross compiler, and rename it to "mips-linux-gnu-mkimage"
build the kernel in the platform/kernel folder with "make uImage"

I didn't test this yet, but it will build a uImage.
Keep in mind this does not include the AK4376 driver, so that will need to be adapted

EDIT: I wasn't able to get this to boot with the USBFlasher, but if anyone tries, make sure to have a backup handy first. All my attempts bricked it, so I needed to restore from a backup
Title: Re: Fiio M3k
Post by: vitt13 on January 28, 2021, 06:38:00 AM
Here's what I got so far to build the kernel:
...
EDIT: I wasn't able to get this to boot with the USBFlasher, but if anyone tries, make sure to have a backup handy first. All my attempts bricked it, so I needed to restore from a backup
You're going the wrong way.
Here the kernel build environment I recreated from FiiO M5 kernel sources https://github.com/VitToCode/FiiO_Kernel_M5
you just need that and the toolchain.
Rebuilded xImage and recovery has been flashed and tested on M5 device. BTW I use x-loader from original firmware.
Note: if you going to flash only specific partition (i.e. xImage) make sure you uncheck "All erase" setting on SFC tab USB Cloner Tools's.
If you are looking for latest Ingenic Halley2 kernel source, you can find it here http://www.ingenic.com.cn/en/?product/id/9/lm/4.html
Just scroll down to 'Downloads'. Latest version is 'ingenic-linux-kernel3.10.14-x1000-v9.0-20191212.tar.bz2'
Title: Re: Fiio M3k
Post by: FroggestSpirit on January 31, 2021, 02:19:17 PM
Thank you for pointing me in the right direction. I created a repo with a working M3K kernel build, which built off of your repo (thank you!).
This one should be all self contained, the toolchain is included, and all that should need to be done (assuming you have the needed dependancies), is to run build.sh (I did testing in x64 Linux)
https://github.com/froggestspirit/FiiO_M3K_Kernel
I removed a few things from the build that shouldn't be needed, like other archetectures and wireless stuff. From my tests, the kernel worked as normal while using XVortex's rockbox build, although there were a couple SD card issues on the OFW, though I'm not sure if that was user error.
Title: Re: Fiio M3k
Post by: Richie325 on February 09, 2021, 11:05:26 AM
I have been using rockbox on this device for over 2 weeks now. I noticed that the voice in the right earphone is a bit distorted and the left earphone is clear(If you change the balance and listen to only one side you will notice it). I tried different headphones and earphones as well. This issue is not present when i boot to the stock OS.
Title: Re: Fiio M3k
Post by: FroggestSpirit on February 09, 2021, 06:08:30 PM
I've updated the kernel on my github for anyone interested.
https://github.com/froggestspirit/FiiO_M3K_Kernel/releases/tag/v1.01
As I mentioned, I don't know if I'll be working too much more on the kernel itself, but the code is there if anyone wants to pick it up.
Title: Re: Fiio M3k
Post by: Thew on February 10, 2021, 02:59:11 PM
I have been using rockbox on this device for over 2 weeks now. I noticed that the voice in the right earphone is a bit distorted and the left earphone is clear(If you change the balance and listen to only one side you will notice it). I tried different headphones and earphones as well. This issue is not present when i boot to the stock OS.

I've tried many different files and listened very carefully as you suggest but I can't hear any distortion on my Rockboxed M3K.
Title: Re: Fiio M3k
Post by: diegopau on February 12, 2021, 10:13:23 AM
I've updated the kernel on my github for anyone interested.
https://github.com/froggestspirit/FiiO_M3K_Kernel/releases/tag/v1.01
As I mentioned, I don't know if I'll be working too much more on the kernel itself, but the code is there if anyone wants to pick it up.

In this post https://forums.rockbox.org/index.php/topic,52917.msg246172.html#msg246172 efqw explained that "The main player application is aggressively logging to /data/userfs/app.log. I'm really concerned about this wearing out my NAND", is that fixed in that new version of the kernel?
Title: Re: Fiio M3k
Post by: vitt13 on February 12, 2021, 11:22:35 AM
"The main player application is aggressively logging to /data/userfs/app.log. I'm really concerned about this wearing out my NAND", is that fixed in that new version of the kernel?
It's not kernel issue, it's stock player application issue. It relates to firmware (rootfs image) modifications but not to kernel or rockbox.
Title: Re: Fiio M3k
Post by: heyspencerb on February 28, 2021, 04:12:02 PM
I followed alexs's instructions and installed the newest version. The bug of not being able to scroll up on the search input is still the same.

The problem is only being able to move down, left and right, so that if you miss your letter you have to scroll all the way around to it in order to pick it again. Is there any fix to this? Thanks
Title: Re: Fiio M3k
Post by: heyspencerb on February 28, 2021, 04:35:17 PM
Wow, Ok! I should have listened to the warnings in this thread! Gonna post my experience here so others know not to install this version yet.

I have been using the Vortex version for a few weeks and it works great except for some minor bugs like scrubbing through songs and not being able to scroll up while typing text. I wanted to see how the development was going so I followed this thread and installed the latest version of RockBox, that was a mistake!

The current version has a fix for the scrubbing issue, but the search issue is still there, and is honestly worse because now the letters are all on one page and very tiny.

But most of all, this version auto logs you into Rockbox without any option of going to the Fiio version, and the ability to access the device from a computer is totally broken. I don't have an SD card reader so this means I have literally no way to add new music, get to the USB DAC or fix this in any way until I get a reader. I can't go back to the other version because I can't remove the Rockbox files from the SD because file access is broken.

Thanks everyone for working on this, definitely my fault for installing unfinished software, but to people wondering if they should install this, don't do it yet! For now, the Vortex version is in a much better state as it actually lets you go back to the official firmware without an SD card reader. Good luck everyone!
Title: Re: Fiio M3k
Post by: speachy on February 28, 2021, 07:36:38 PM
Wow, Ok! I should have listened to the warnings in this thread! Gonna post my experience here so others know not to install this version yet.

There's a reason it's listed as "unusable" on the main rockbox web page.

(Or more accurately, _many_ reasons...)
Title: Re: Fiio M3k
Post by: heyspencerb on February 28, 2021, 08:52:01 PM
At least it motivated me to try compiling this myself. Gonna see if I can fix up the search menu bug and reorganize the letters in a better way, seeing as the search isn't case sensitive so I really only need one set of the letters.

So far I've changed the calculator labels to say "D I D  T H I S  W O R K" so I have a long way to go lol
Title: Re: Fiio M3k
Post by: heyspencerb on March 01, 2021, 09:21:37 PM
Hey!

I solved the bug of not being able to scroll up in text entry on the Fiio M3K! Someone literally just forgot to add the code to enable "ACTION_KBD_UP".

The problem was totally fixed for me if I add this line:
Code: [Select]
    { ACTION_KBD_UP,          BUTTON_UP,                        BUTTON_NONE },
    { ACTION_KBD_UP,          BUTTON_UP|BUTTON_REPEAT,          BUTTON_NONE },

Before line 100 in the file apps/keymaps/keymap-fiiom3klinux.c

Can someone check my work? I'm not set up to submit code yet, this is my first time ever working on an open source project. Let me know if this looks good and also fixes it for other people!
Title: Re: Fiio M3k
Post by: speachy on March 01, 2021, 09:28:06 PM
That looks good!

If you'd like to take this all the way thorough and submit a patch, you can do that via the bug tracker or through gerrit directly (see https://www.rockbox.org/wiki/UsingGit for how to set it up)  Otherwise I'll be happy to do it for you.

(We will need your legal name to accept a patch, FYI)
Title: Re: Fiio M3k
Post by: heyspencerb on March 01, 2021, 10:03:02 PM
Awesome! If possible I'd love to submit it! It would be my first accepted code.

I followed the guide for submitting and added my ssh key but when I ran the test I got this error:

Permission denied (publickey)
Title: Re: Fiio M3k
Post by: heyspencerb on March 01, 2021, 10:47:53 PM
Fixed the issue! Just submitted for review, thanks!

https://gerrit.rockbox.org/r/c/rockbox/+/3147

Here is the link to the change if you'd be willing to review it!
Title: Re: Fiio M3k
Post by: gperius on March 05, 2021, 08:55:16 PM
Hi, can I flash the 1.4.3 firmware if I'm running 1.4.5? That means can I downgrade?
Title: Re: Fiio M3k
Post by: KarlJ on March 05, 2021, 09:15:13 PM
Hi, can I flash the 1.4.3 firmware if I'm running 1.4.5? That means can I downgrade?
yep ,you can downgrade to any version if u want to
Title: Re: Fiio M3k
Post by: gperius on March 05, 2021, 09:41:54 PM
yep ,you can downgrade to any version if u want to
So I can remove rockbox completely if I want or anything goes wrong by installing the original fw?
Title: Re: Fiio M3k
Post by: Thew on March 06, 2021, 05:30:38 AM
So I can remove rockbox completely if I want or anything goes wrong by installing the original fw?

Yes, I've done it several times with no problems.
Title: Re: Fiio M3k
Post by: JosephM on March 09, 2021, 01:04:16 PM
Seems like the Fiio M3 Pro is the new hot budget player. Anyone messing around with it or is it similar to the M3k?

I just got one and have started messing around with it. There does seem to be one advantage to it: you can trivially get a connection over Android Debug Bridge (even though it's not Android). If you put a file named M3Pro20200418.bin in the root of the micro sd card, it adds an extra tools menu in settings. Once you do that you can put it in USB DAC mode, plug it into your computer, swipe from the left side of the screen to exit DAC mode, go to settings, go to the new tools option, select the 3rd option, then press the option labeled ADB.  Then it shows up on your computer as a Nexus 4, and you've got a root shell. Any changes you make to the system persist across reboots.
Title: Re: Fiio M3k
Post by: RockBoxNewB on March 12, 2021, 05:30:43 PM
Hi everyone!
First of all, thanks to all of you for your helpful insights. I bought myself a FiiO M3K simply because I found out there is a Rockbox port for it. Of course, I am aware that it is still experimental, but curiosity got the better of me.
I've got a simple, possibly stupid, question: How do you revert to an earlier version of the XVorteX rockbox port? I installed the latest one based on 1.4.3, but wanted to try out 1.3.0. I extracted the ZIP for it, placed the .fw file on the root of my SD, selected "Tools" - "Update Rockbox" - but nothing changed, it still boots up the M3K_v1.4.3_e99db03-191013. What am I doing wrong?

Thanks a lot in advance!
Title: Re: Fiio M3k
Post by: Thew on March 13, 2021, 03:46:35 AM
You need to load the old file as you would any Firmware ie: booting up with the Volume + power button. The older version of Rockbox is included in the older Firmware. It doesn't load as an update.
Title: Re: Fiio M3k
Post by: RockBoxNewB on March 13, 2021, 10:42:05 AM
You need to load the old file as you would any Firmware ie: booting up with the Volume + power button. The older version of Rockbox is included in the older Firmware. It doesn't load as an update.

That did the trick, thanks a ton! I already feared I killed my M3K because I created a bootloop by trying to update - but the Vol + and Power combination saved the day and allowed me to roll back. Amazing!
Title: Re: Fiio M3k
Post by: DJKZ on March 24, 2021, 10:59:12 PM
Hi All ,
Been Rockbox'n for a few years now .
have sucessfully installed on Sansa Fuze V2 ,,
Sansa c200 , and iPod nano 2nd Gen .
Was all pretty easy using rockbox directions .
On the FiiO M3K , ( May purchase one soon )
1 - Must you update to the NEWEST firmware
on the M3K first , before installing RockBox ?
2 - Is there a certain firmware number that
works the best ?
( asking because with all my previous install's on
my players ,,, they had said what firmware version
the unit should be using )
Thanks to ALL for any info .
.... update ....
I see when reading post from XVortex from 9/1/2019 ,,
the install was based on FW v1.3.0   .
Has recent owners of the M3K's installed Rockbox
with this firmware ,,,,, or If a M3K is purchased now
( being almost 2 years from XVortex post ) is the player
now shipped with a newer firmware installed ? ,,,, and
if so ,,,,, will the Rockbox install still work ?
Thanks again .
Title: Re: Fiio M3k
Post by: Thew on March 25, 2021, 04:15:49 AM
It doesn’t matter what version of the the firmware is installed on the M3K as it is replaced by a special version that includes Rockbox. XVortex’s last update loads Firmware 1.4.3. There is no version of XVortex’s update that includes the latest original firmware (1.4.5) but the differences are very small. After the update can choose at start-up whether to boot Rockbox (e99db03-191013) or the Fiio OS (1.4.3 VTX).
Title: Re: Fiio M3k
Post by: Richie325 on March 26, 2021, 05:50:53 AM
Can the fix for scrolling up while typing to search a file in the search section be added to Vortex's rockbox build?
Title: Re: Fiio M3k
Post by: Bilgus on March 29, 2021, 02:43:00 PM
We will not be fixing problems in others unofficial builds

Thanks
Title: Re: Fiio M3k
Post by: heyspencerb on March 30, 2021, 03:02:39 PM
Can the fix for scrolling up while typing to search a file in the search section be added to Vortex's rockbox build?

I actually have a solution to this! Can't believe I didn't try this earlier, but you can use Vortex's M3K.fw file and the most current version of Rockbox at the same time. This way you get most of the best of both worlds, you can switch easily between RockBox and the official firmware, and you get all of the fixes from the most recent version of RockBox.

If you want this to work you need to follow these exact steps. This is the only way I have gotten this to work.

1. Go to this link: https://www.dropbox.com/s/vuqcaf1ssk4j1ee/Files.zip?dl=0
 and download the zip file I uploaded there. I am posting a dropbox link because its too big to upload here, let me know if thats not the best way to do this.

2. Un-zip the file. You might only see one file, called M3K.fw, but there is actually two files, the M3K.fw and a hidden directory called '.rockbox'. To see it, on Mac press Cmd+Shift+[.]  and on Ubuntu press control+h I have no idea how to see it on windows, but if you can't see it you can always extract the zip directly to the right location in step 4.

3. Take your sd card you have formatted with the Fiio M3K and plug it into your computer

4. Drag or directly extract both the provided M3k.fw and the .rockbox directory into the home directory on the sd card, so not in any folders. Make sure the files are out of the 'Files' folder I sent them in, they need to be in the home directory on the sd. If you left the official M3K.fw file on the SD, you will need to replace it with the one I provided.

5. Put the SD back in your M3K while its turned off, and press and hold the 'power button' + 'volume up' until the firmware update starts.

6. once the update is done if things went properly, you should get a screen which will offer you either log in to Rockbox, the Fiio firmware, or a settings menu and there will be a countdown. Quickly navigate to the settings menu and enter it. If you miss the timing and log in to either of the other options, restart the device and be sure to go to the settings menu this time. Once in the setting menu, click on "Update Rockbox". This should then go to a screen which says 'Running update.sh ' for a few minutes, then it will say 'Done: 1'.

7. Finally, at this point you can restart the device and you should have the correct version of Rockbox, and the option of switching to the Fiio firmware as well.

If you later want to update the Rockbox version to a new version, you need to do all the same steps but replace the .rockbox file I gave you with the new one you want to use.
Important! in order to update the rockbox, you still need to go through steps 5 and 6! For some reason, you need to do the 'power button' + 'volume up' in order to update the RockBox version too!!

Finally, here are my necessary warnings:
This version of RockBox fixes some bugs in the Vortex version, like seeking, scrolling up, using the top button as a lock button and a few other things, but it introduces a bunch of new issues too!

Some of the bugs this version has that Vortex's does not have:
We do not yet know how to fully turn the device, so right now if you "shut down" in rockbox mode the keypad stays on and the device rapidly loses battery. The only fix to this is to hold the power down for about 8 seconds to trigger the hardware power off whenever you want to turn it off.

I don't personally like how the text entry is laid out in this version with super tiny letters, so I am personally working on a much better entry system. Let me know if you want me to share that version too.

So, if you want to try this, understand that it is still under development and to solve some issues, some other issues are created.
If you want to go back to the standard firmware permanently, delete the M3K.fw file, and the .rockbox directory, remembering that it is a hidden directory so it might not actually be deleted properly if you can't see it, then download the official version on the Fiio site and follow step 5.

Pease give me feedback on this process and let me know if it doesn't work for others, I will try and respond as best as I can. Also, If im breaking rules, let me know
Title: Re: Fiio M3k
Post by: Thew on March 31, 2021, 06:12:41 AM
Can the fix for scrolling up while typing to search a file in the search section be added to Vortex's rockbox build?

Pease give me feedback on this process and let me know if it doesn't work for others, I will try and respond as best as I can. Also, If im breaking rules, let me know

I did try your amended version of Rockbox but swapped back to the version I had before. My main problem was that I couldn’t get my own custom Theme to work (I don’t use or need the search function).

I’m pleased with my Theme and the 18-DejaVuSans.fnt provides a much improved look and readability for me at least.

https://i.postimg.cc/jSTrVBCh/M3K.jpg
Title: Re: Fiio M3k
Post by: ZoRG172 on March 31, 2021, 12:45:50 PM
heyspencerb
I flashed it according to your instructions. Everything worked out! Now the rewind is working, what was most annoying in the vortex port. The player has been idle since summer, so thank you very much!

But there is a problem with the Advanced Key lock function. The device perceives the mechanical play key and the touch key as one and responds to both. Therefore, only the volume buttons can actually be left unlocked. In addition, the player turns on the backlight when you touch any touch button, even if you turn off the lock messages.

I have seen the "Disable Touch" feature in the Advanced Key lock settings on other players, but this version does not. Can this be returned? Or change it in the Advanced Key lock settings so that the signals from the sensor module are completely ignored when the lock is active?
possible to somehow change in the smart blocking settings so that the signals from the sensor module are completely ignored when the blocking is active?
Title: Re: Fiio M3k
Post by: heyspencerb on March 31, 2021, 02:12:30 PM
heyspencerb
But there is a problem with the Advanced Key lock function. The device perceives the mechanical play key and the touch key as one and responds to both. Therefore, only the volume buttons can actually be left unlocked. In addition, the player turns on the backlight when you touch any touch button, even if you turn off the lock messages.

I'm glad it worked out for you! As for the other points, Huh! I had never actually seen the 'Advanced Key Lock' setting before, thats really helpful, learn something new every day. To your point about the center button and side button both being counted as the same, this is a frustration I have for the whole program. I personally think that side button should always be play/pause the same way the volume buttons always maintain the whole function. I am close to hacking this function into my own personal branch, but a proper solution with this as an option in the settings would take more work and time. And the backlight turning on isn't so much a bug as a feature that maybe not everyone likes. I personally like being able to click any button in order to see what's playing currently without changing anything. but this should be made as a setting that can be changed because I can see how not everyone would like that and you should be able to change that.
 
Long story short, to both the Key Lock problem and the backlight problem, see my warning at the end of the last message; this is software that is under constant revision so to fix some bugs, you have to accept new ones. The only way I've found to get it "perfect" is to start compiling it yourself and hacking together the changes you want on your personal branch. If thats not for you, my recommendation is file a bug report on the left side of the site and myself or others might get around to it soon if we also think it's a big deal. I'll say that I personally have been thinking of looking at the center button/side button annoyance so that has a decent chance of getting worked on soon.

EDIT:
I found the issue of why that menu option is gone, and I will test it and hopefully submit a pull request with it tomorrow!
Title: Re: Fiio M3k
Post by: ZoRG172 on March 31, 2021, 03:51:39 PM
To your point about the center button and side button both being counted as the same, this is a frustration I have for the whole program. I personally think that side button should always be play/pause the same way the volume buttons always maintain the whole function. I am close to hacking this function into my own personal branch, but a proper solution with this as an option in the settings would take more work and time.

This functionality is already in the rockbox and it works, you can only block the touch buttons. It's just that this build does not have a menu item: "Disable Touch
Blocks touch screen buttons like the original (only for touch devices) "
Which would solve the problem of the play button.

(http://forums.rockbox.org/index.php?action=dlattach;topic=51589.0;attach=7029;image)

If you activate Advanced Key lock in the settings and select so that the volume buttons are not locked, variables appear in config.cfg:

No Screen Lock For Selected Actions: on
Selective Screen Lock Actions: 545

It may well be that it is enough just to add the required variable to the config to activate Disable Touch, but I don’t know where to look.

I found this thread on this matter https://forums.rockbox.org/index.php?topic=51589.0
Title: Re: Fiio M3k
Post by: heyspencerb on March 31, 2021, 10:49:22 PM
This functionality is already in the rockbox and it works, you can only block the touch buttons.

Awesome! For my part, I was talking more generally about being able to always use the side button as play/pause and the middle as the selector. So far, I found this in the file 'keymap-fiiom3klinux.c'
Code: [Select]
static const struct button_mapping button_context_standard[] = {
    { ACTION_STD_PREV,        BUTTON_UP,                        BUTTON_NONE },
    { ACTION_STD_PREV,        BUTTON_PREV,                      BUTTON_NONE },
    { ACTION_STD_PREVREPEAT,  BUTTON_PREV|BUTTON_REPEAT,        BUTTON_NONE },
    { ACTION_STD_NEXT,        BUTTON_DOWN,                      BUTTON_NONE },
    { ACTION_STD_NEXT,        BUTTON_NEXT,                      BUTTON_NONE },
    { ACTION_STD_NEXTREPEAT,  BUTTON_NEXT|BUTTON_REPEAT,        BUTTON_NONE },
    { ACTION_STD_CONTEXT,     BUTTON_PLAY|BUTTON_REPEAT,        BUTTON_PLAY },
    { ACTION_STD_CANCEL,      BUTTON_HOME|BUTTON_REL,           BUTTON_HOME },
    { ACTION_STD_OK,          BUTTON_PLAY|BUTTON_REL,           BUTTON_PLAY },
    { ACTION_STD_MENU,        BUTTON_OPTION|BUTTON_REL,         BUTTON_OPTION },

    LAST_ITEM_IN_LIST
}; /* button_context_standard */

Along with other context base key bindings. I think if I went through and just changed BUTTON_PLAY to be the play action in all the context arrays it would get the change I want, but that is definitely not a long term solution and is a hacked fix. I might double check that this feature doesn't already exist then see how hard it is to add a new settings feature and maybe make it so that the buttons action in each context could be set or chosen? That way you could really customize the hell out of your buttons. But, thats definitely not a small project lol. But basically a settings tab that then lists each context, then you can choose which button you want to change and then change what that button should do maybe...
Title: Re: Fiio M3k
Post by: heyspencerb on March 31, 2021, 11:14:31 PM
It may well be that it is enough just to add the required variable to the config to activate Disable Touch, but I don’t know where to look.

I think I found it! And this might actually be a pretty simple and fun bug fix! Here is the code that either shows or doesn't show that menu item, its on line 80 of settings_menu.c

Code: [Select]
static int selectivesoftlock_set_mask(void* param)
{
    (void)param;
int mask = global_settings.bt_selective_softlock_actions_mask;
            struct s_mask_items maskitems[]={
                                       {ID2P(LANG_VOLUME)     , SEL_ACTION_VOL},
                                       {ID2P(LANG_ACTION_PLAY), SEL_ACTION_PLAY},
                                       {ID2P(LANG_ACTION_SEEK), SEL_ACTION_SEEK},
                                       {ID2P(LANG_ACTION_SKIP), SEL_ACTION_SKIP},
 #ifdef HAVE_BACKLIGHT
                            {ID2P(LANG_ACTION_AUTOLOCK_ON), SEL_ACTION_AUTOLOCK},
 #endif
 #if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
                        {ID2P(LANG_ACTION_DISABLE_TOUCH) , SEL_ACTION_NOTOUCH},
 #endif
                         {ID2P(LANG_ACTION_DISABLE_NOTIFY), SEL_ACTION_NONOTIFY}
                                            };

            mask = mask_select(mask, ID2P(LANG_SOFTLOCK_SELECTIVE)
                               , maskitems,ARRAYLEN(maskitems));

            if (mask == SEL_ACTION_NONE)
                global_settings.bt_selective_softlock_actions = false;
            else if (global_settings.bt_selective_softlock_actions_mask != mask)
                global_settings.bt_selective_softlock_actions = true;

            global_settings.bt_selective_softlock_actions_mask = mask;

    return true;
}

It looks like someone chose not to consider the front menu buttons on the M3K to be HAVE_TOUCHPAD, so those menu items aren't defined. I can take a look through and try and add that in, which should hopefully open those options up!

EDIT:
Found the file where I need to add#define HAVE_TOUCHPAD to enable this, but I don't have time tonight to do it, test it, and then submit the pull request but I will try and do it in the morning if everything works out
Title: Re: Fiio M3k
Post by: speachy on April 01, 2021, 07:54:32 AM
Found the file where I need to add#define HAVE_TOUCHPAD to enable this, but I don't have time tonight to do it, test it, and then submit the pull request but I will try and do it in the morning if everything works out

It's more complicated than adding HAVE_TOUCHPAD.  But this should do the trick:

https://gerrit.rockbox.org/r/c/rockbox/+/3270

Title: Re: Fiio M3k
Post by: heyspencerb on April 01, 2021, 09:55:49 AM
Awesome! I'll pull it and test it! And ZoRG172, once its merged in the new .rockbox file should be here:  https://build.rockbox.org/data/rockbox-fiiom3klinux.zip, use it in place of the one I provided but follow the same steps as before.

Edit:
Corrected the link because I have no idea what I'm talking about
Title: Re: Fiio M3k
Post by: speachy on April 01, 2021, 10:11:07 AM
Awesome! I'll pull it and test it! And ZoRG172, once its merged in the new .rockbox file should be here: https://build.rockbox.org/data/rockbox-fiiom3k.zip, use it in place of the one I provided but follow the same steps as before.

No, that is the wrong link.  This is the correct one: https://build.rockbox.org/data/rockbox-fiiom3klinux.zip

There are now two M3K ports, neither is really considered usable -- the Linux-based one based on the xvortex code dump (running on top of the extremely buggy FiiO linux platform) and a new native bare-metal port that is where all of the ongoing development effort is focused.  Once the latter is considered usable (it currently lacks such niceties like USB and dual-boot capabilities) the linux-based port will most likely be nuked from orbit.
Title: Re: Fiio M3k
Post by: heyspencerb on April 01, 2021, 11:13:08 AM
Does the new bare-metal port use the same config files as the linux one? For instance, I rebased but I still only see fiiom3klinux.h under the config directory and nothing for the new version. Are they going to share these files until the linux one is killed, then the names will be changed? Or am I just missing the bare-metal versions.
I'm mostly wondering if some of the same issues that have been fixed on the linux version (ie.  the scrolling up issues and such) will need to be fixed again on the new version, or if the fixes will be carried over?
Title: Re: Fiio M3k
Post by: speachy on April 01, 2021, 11:21:16 AM
Nope, there is nothing shared between those two ports.

(and firmware/export/config/fiiom3k.h landed back into the repo on March 28th -- are you sure you're tracking the master branch?)

Title: Re: Fiio M3k
Post by: heyspencerb on April 01, 2021, 11:38:56 AM
I'll double check to make sure, it might explain a lot if I'm not. Side note, when running ./rockboxdev.sh what is the target arch for the bare-metal port? Is it mips or mips-linux? Thanks

Edit:
Found fiiom3k.h in firmware/export/config/, I think my VS code hadn't updated the file list when I pulled.
Title: Re: Fiio M3k
Post by: heyspencerb on April 01, 2021, 01:49:01 PM
Figured it out! Followed the install instructions and got the bare-metal version working. But yeah those instructions are definitely not beginner friendly.

This version runs much faster than the other one though, it boots fast and the database build is a lot better and faster. Though the build definitely has some issues to get started on. The slide to scroll seems to only work in some places, and in others you need to tap to scroll, among other things. I'll look through the bug reports and submit a few as I find more issues.
Title: Re: Fiio M3k
Post by: ZoRG172 on April 01, 2021, 03:01:10 PM
Awesome! I'll pull it and test it! And ZoRG172, once its merged in the new .rockbox file should be here:  https://build.rockbox.org/data/rockbox-fiiom3klinux.zip, use it in place of the one I provided but follow the same steps as before.

Edit:
Corrected the link because I have no idea what I'm talking about
I flashed build from the link, but the menu item did not appear. How do you know or where to track when changes are made?
Title: Re: Fiio M3k
Post by: heyspencerb on April 01, 2021, 08:14:11 PM
I flashed build from the link, but the menu item did not appear. How do you know or where to track when changes are made?

if you look at the link he sent, this change hasn't been reviewed yet.
https://gerrit.rockbox.org/r/c/rockbox/+/3270

 Typically simple changes like this get accepted within a day or two. More generally, if you are really interested in what features are coming up you can go to this link and see what other changes have been submitted but not reviewed yet. It should give you an idea of just how often changes happen in the code base, though most of the changes are specific to other platforms and won't effect you.

https://gerrit.rockbox.org/r/q/status:open
Title: Re: Fiio M3k
Post by: speachy on April 01, 2021, 08:35:20 PM
if you look at the link he sent, this change hasn't been reviewed yet.
https://gerrit.rockbox.org/r/c/rockbox/+/3270

The reason this isn't committed is that I don't know that it works properly.  That's not something I can determine on my own.

(Basically I don't know if I'm disabling the correct input device when the touchpad is "locked" -- 50/50 chance I got it right.  Assuming the rest of the changes are correct, which isn't a given)

Title: Re: Fiio M3k
Post by: ZoRG172 on April 02, 2021, 03:41:49 PM
if you look at the link he sent, this change hasn't been reviewed yet.
https://gerrit.rockbox.org/r/c/rockbox/+/3270

The reason this isn't committed is that I don't know that it works properly.  That's not something I can determine on my own.

(Basically I don't know if I'm disabling the correct input device when the touchpad is "locked" -- 50/50 chance I got it right.  Assuming the rest of the changes are correct, which isn't a given)
Send me a test build and I'll check if it works as expected.
Title: Re: Fiio M3k
Post by: amachronic on April 02, 2021, 03:51:18 PM
Hello, developer of the new M3K port here. Thought I'd chime in since somebody was enterprising enough to try the new native port already!

heyspencerb, I'm glad to hear you got it running. If you find any bugs -- especially major ones -- please do report them on the tracker, I can use all the help I can get with testing. The issue you described with the scrollbar is a known problem (for me), especially in the plugins -- the keymaps are a mess, some places only accept scrollbar and some places only accept tapping, but for the most part it should be simple to fix.

I'm actively working on streamlining the bootloader install but it will be Linux-only for a bit. Hopefully I should be able to get that done this weekend.
Title: Re: Fiio M3k
Post by: dconrad on April 02, 2021, 10:04:30 PM
I tried to follow the m3k native install instructions and managed to not only get my unit to a non-working state, but I can't boot over USB anymore. Any chance of help?

I successfully booted over USB, dumped the bootloader (presumably successfully), patched it (probably unsuccessfully?), booted over USB again, installed it, and now I just get a single keypad blink, and that's all the life it shows.

Attempting to boot over USB now gives the output:

Code: [Select]
# ./usbboot -v -c x1000 -1 ../../build-spl/spl.m3k --wait 1 -2 ../../build/rockbox.bin
Opening USB device a108:1000
Issue SET_DATA_ADDRESS 0xf4001000
Transfer 8632 bytes from host to device
Issue PROGRAM_START1 0xf4001800
Wait 1 seconds
Issue SET_DATA_ADDRESS 0x80004000
Request SET_DATA_ADDRESS failed: -7

If I boot without the SD card in place, I do get the screen to light up and say "No SD card present", so the bootloader is there in some capacity, I think.

If you wouldn't mind helping me out that would be great! I can get on IRC if that's the easiest way.
Title: Re: Fiio M3k
Post by: Thew on April 03, 2021, 04:10:18 AM
I tried to follow the m3k native install instructions and managed to not only get my unit to a non-working state, but I can't boot over USB anymore. Any chance of help?

Have you tried over flashing with the original Fiio Firmware? i.e. having the Fiio Firmware on the SD Card and starting up with the “on” key plus “Volume+” key.
Title: Re: Fiio M3k
Post by: amachronic on April 03, 2021, 08:42:07 AM
dconrad, the good news is if the bootloader can display "No SD Card", the flash should be okay. If you can send me the original and patched NAND dumps then I can double check them for you.

Apologies that I didn't mention this on the wiki  :-[, but if the machine hangs you need to hold the power button for AT LEAST 15-20 seconds to be sure you've forced a power off. It can still be powered on even if all the lights are off. If the device feels warm then let it cool down for 10-15 minutes before you try USB boot again. That might just fix the problem -- I ran into this a few times during development, but it was quite rare for me.

If "cooling down" doesn't help, you could try another SD card in case Rockbox doesn't like yours. Or assuming your original NAND dump is good, you can pull the SPL out of it and see if the original firmware boots:

Code: [Select]
dd if=boot.dump of=xloader.bin bs=1024 count=12
./usbboot -v -c x1000 -1 xloader.bin

(NB. if you're not using the XVortex build you will have to pull out the USB immediately when the backlight comes on or Fiio's player will just go straight to the charging screen.)

Let me know what happens after trying all of this. I'll be on IRC today, in case you're still having problems we can debug it further.

If you really want to, you can get into the recovery by holding "Volume Up" while booting xloader.bin, but there's a chance it'll make the problem worse. So I wouldn't advise it unless you're desperate.
Title: Re: Fiio M3k
Post by: dconrad on April 03, 2021, 10:07:59 AM
Thanks a bunch for the stuff to try!

I had already figured that the power button needs to be held for a long time in order to fully power it off - no change if I hold it for a full 20 seconds, so that's probably not it. As long as the keypad lights up when I plug in the USB cord while holding volume down, I figure that I got it completely powered down.

I've tried a card that works in my other rockbox device, and got the same results, so that's probably not it either.

The good news: booting the original firmware over USB kind of works! It shows the "Welcome!" screen, then the battery charging icon, then goes dead, with none of the buttons responding.

One thing I ran into early on, I discovered that the three builds you need to do (normal, bootloader, spl) need to be in their own build directories (I did rockbox/build, rockbox/build-bl, rockbox/build-xpl), is that how it's supposed to work?

I think I'm going to attempt to load the original firmware back onto it so I can have a fresh go at it, we'll see how that goes. - Putting M3K.fw on the card and booting with Vol+ held just leads to a blinking keypad. I'm not sure if it's boot cycling or actually doing something underneath. Probably the former.

I'll attach my original boot.dump and boot.install if you could peek at them. - here (https://dconrad.neocities.org/assorted_files/Archive.zip)
Title: Re: Fiio M3k
Post by: JimZipCode on April 04, 2021, 12:31:50 PM
... the linux-based port will most likely be nuked from orbit.

It's the only way to be sure.   :)
Title: Re: Fiio M3k
Post by: heyspencerb on April 04, 2021, 05:59:32 PM
Hello, developer of the new M3K port here. Thought I'd chime in since somebody was enterprising enough to try the new native port already!

Hello! First of all, amazing work! The new port is so much faster to boot, run and create databases, and it actually properly shuts the unit off so the amazing battery life is back! As far as bugs, the only catastrophic ones I've found are some of the plugins causing a hard crash and segmentation fault, but I'll go through each and submit bug reports as I see which ones work and which don't. Though the worst offenders of seg faults are the games which is definitely not top priority, as fun as it would be to run DOOM on it.

Is the bare metal port working in the simulator yet? I'd love to try out some new ideas with key mapping and such, but currently I am just making a change and loading it on hardware as the test which is a pain.
Title: Re: Fiio M3k
Post by: amachronic on April 04, 2021, 07:11:21 PM
Is the bare metal port working in the simulator yet?

It should work now, a fix for the keys in the simulator was committed yesterday.
Title: Re: Fiio M3k
Post by: dconrad on April 05, 2021, 08:49:44 PM
Well, I got brave (or dumb, your call) and tried again since I had moved up to FiiO version 1.4.5 while recovering the first time, and got the same result of an unresponsive player. So I'm either not doing something correctly or something is different with my player/environment. At least recovery this time was pretty easy.
Title: Re: Fiio M3k
Post by: amachronic on April 06, 2021, 10:18:14 AM
I realized why you're not able to boot Rockbox over USB once you flash it... the SPL will see that the bootloader is flashed and try to load it, it'll never return to the hardware boot ROM and the USB command will time out. That's my bad, sorry for the confusion.

It seems unlikely you somehow compiled it wrong if you managed to load Rockbox, flash the bootloader, and see error messages from the bootloader. So it's probably a hardware initialization problem.

Could you try flashing the bootloader again, and boot Rockbox normally with this patch applied: https://gerrit.rockbox.org/r/c/rockbox/+/3290 (https://gerrit.rockbox.org/r/c/rockbox/+/3290)? If the bootloader is managing to load Rockbox at all, you should see the backlight light up. Let me know what happens.
Title: Re: Fiio M3k
Post by: dconrad on April 06, 2021, 10:05:46 PM
I tried that patch - it's not turning on the backlight at all. So this would indicate the bootloader can't even load Rockbox for some reason?

Edit: I did try both FAT16 and FAT32, no difference.

Edit 2: I could try it again tomorrow just to be sure.
Title: Re: Fiio M3k
Post by: dconrad on April 07, 2021, 08:31:53 AM
Ok, I'm trying again now that I can be fully focused (work went long yesterday...)

And just because I always believed it's important to show your work:

Code: [Select]
sudo diskutil eraseDisk FAT32 M3K MBRFormat /dev/disk2
Code: [Select]
# ./usbboot -v -c x1000 -1 ../../build-spl/spl.m3k --wait 1 -2 ../../build-m3k/rockbox.bin
Code: [Select]
$ ./nand_patcher.py boot.dump ../../build-bl/bootloader.m3k ../../build-spl/spl.m3k boot.installThe result is SPL size 8632, Boot size 77704
   Result is a single keypad flash, and the backlight never comes on. If I remove the SD card and try to boot, I do get "No SD card present", so the bootloader is definitely installed.
Title: Re: Fiio M3k
Post by: amachronic on April 07, 2021, 03:28:59 PM
Thank you for the detailed post, dconrad. You're doing everything right, so no issue there. I discovered a simple bug in the bootloader today, which might be causing the hang.

Can you try again when you have the opportunity? Do a build with just this bugfix applied to master (https://gerrit.rockbox.org/r/c/rockbox/+/3301 (https://gerrit.rockbox.org/r/c/rockbox/+/3301)). It might already be merged by the time you get around to it, and fingers crossed it will solve your problem.

In case you're still getting a hang, flash a build with the new version of https://gerrit.rockbox.org/r/c/rockbox/+/3290 (https://gerrit.rockbox.org/r/c/rockbox/+/3290) and we'll go from there. Make sure you apply it on top of the bootloader bugfix.
Title: Re: Fiio M3k
Post by: dconrad on April 07, 2021, 08:21:54 PM
Thank you for the detailed post, dconrad. You're doing everything right, so no issue there. I discovered a simple bug in the bootloader today, which might be causing the hang.

Can you try again when you have the opportunity? Do a build with just this bugfix applied to master (https://gerrit.rockbox.org/r/c/rockbox/+/3301 (https://gerrit.rockbox.org/r/c/rockbox/+/3301)). It might already be merged by the time you get around to it, and fingers crossed it will solve your problem.

In case you're still getting a hang, flash a build with the new version of https://gerrit.rockbox.org/r/c/rockbox/+/3290 (https://gerrit.rockbox.org/r/c/rockbox/+/3290) and we'll go from there. Make sure you apply it on top of the bootloader bugfix.

Thanks a bunch for keeping going with this issue! #3301 has already been merged into master at this point, so I just did git pull --rebase to get the latest changes. Unfortunately it didn't have any effect on the behavior, I still get a single flash of the keypad and that's it.

However! I cherry-picked #3290 on top of current master, which at the time of writing is at commit 1b82ebc6e, "Fix: Directory stream not closed in Shortcuts menu". The result is it gets to Loading firmware... and sits like that forever.
Title: Re: Fiio M3k
Post by: amachronic on April 08, 2021, 06:18:43 AM
Okay... that's a little unexpected, but I guess it confirms my original suspicion that the filesystem is somehow to blame.

I understand you're using Mac. I don't have access to a Mac, so I cannot test myself, but I suspect that it must format the filesystem differently and this triggers a bug in the M3K's SD driver. Can you try reformatting the SD card using Linux or Windows, and flash a clean build of Rockbox from master? If that makes it magically boot, then we've found the problem.

You also mentioned you've got another Rockbox device where the SD card works -- what model is it? native or hosted port?

I'll have a think about how to debug further and upload another version of g#3290 later today.
Title: Re: Fiio M3k
Post by: dconrad on April 08, 2021, 08:42:28 AM
Yeah I can do that. I'm using my linux box to build rockbox, but my laptop makes it easy to make the filesystem so I was just doing that. I'll have to go download gparted I think.

By the way, is FAT32 necessary, or is FAT16 ok? I had to do some runaround to get it to do FAT32.

Edit: my other rockbox device is an Eros Q (well, a Hifi Walker H2). Unfortunately it has an audio bug that makes it unusable for me at the moment, but it reads SD cards just fine.
Title: Re: Fiio M3k
Post by: amachronic on April 08, 2021, 11:21:08 AM
The weird thing here is, if you managed to get a flash dump, the SD driver must work in Rockbox, even with the Mac formatting... the bootloader uses the same code so not sure why it is having trouble loading the firmware. I updated g#3290 with extra logging anyway so we can figure out which part of the firmware load hangs, before delving into the SD driver guts.

It could be that the machine is powering up too fast and your card draws too much current. It seems somewhat unlikely, but I chose the power-up delay pretty close to the minimum that worked in order to keep the boot time down. I've extended it to 500ms in g#3290.

Your comment about fat32 runaround made me think: Are you using an old SDSC card, <= 2 GB? 2 GB is the max size for fat16, I think, which might explain why the formatter tries to force it on you.
Title: Re: Fiio M3k
Post by: dconrad on April 08, 2021, 08:31:53 PM
It is indeed just an old 2 gig card, I pulled it out of the small handful I have. Is the bootloader explicitly expecting Fat32?

My plan right now is to try updated g#3290 and see what happens, then reformat the card with gparted if it still doesn't work. I did git reset --hard origin/master, git pull --rebase, and then cherrypicked g#3290 on top of the most recent master (c77cd7027f35, lua print_table add ability to draw a line separator)

So with the updated debugging bootloader and the card formatted as FAT32 from macos, I'm getting:

Code: [Select]
Booting...
Loading firmware...
Open: /.rockbox/rockbox.m3k
file size = 685012
try to read checksum
Read: 685004 @ 800811C4
Verify checksum
Success

But it doesn't actually boot, it just sits there. I'll try formatting it with linux and reinstall the same debugging bootloader and build of rockbox. --> exact same result, down to the counts and address.

I'll try the big card out of my main mp3 player, a modern(ish) 64 gig Sandisk, that I actually bought at a store (wow!), haha usually I just kind of end up with these cards somehow. I'mnNot going to reinstall the bootloader, I'll just plop .rockbox on there and see what happens. --> exact same result again.

What on earth could this be? It's probably some dumb thing, but...

Looks like it's hanging when trying to close the file??
Title: Re: Fiio M3k
Post by: amachronic on April 08, 2021, 09:19:31 PM
That's strange. I'm turning in for the night but this has got me stumped. I've been unable to reproduce despite testing all these g#3290 revisions locally, they boot fine for me. The SD card is probably a red herring.

Could you upload all the *.elf *.m3k and *.map files from your rockbox, bootloader, and SPL builds (be careful since the SPL elf and map files are also called 'bootloader' due to a deficiency in the build system, you need to rename them first). Let me know the commit they're built from, and I'll flash the same binaries tomorrow on my M3K and see what happens. Many thanks for your patience with all the testing!

Btw the bootloader should not care about FAT32 vs FAT16, it uses standard Rockbox filesystem code which is supposed to handle both.
Title: Re: Fiio M3k
Post by: dconrad on April 08, 2021, 09:44:43 PM
Try here (https://dconrad.neocities.org/assorted_files/m3k_binaries.zip)

I kind of wonder if I have the wrong compiler version somehow, or if it's due to the fact that I also have the cross-compiler built for the Hifiwalker H2, which I understand is different because it's a hosted target. I've built loads of working rockbox builds for that, but never a bootloader.

Man, I've been using my neocities account more for transferring files than actually making a website lately...
Title: Re: Fiio M3k
Post by: dconrad on April 08, 2021, 11:41:50 PM
... maybe a silly question, but should I be running "make" or "make -j"? I got started playing with the eros q which apparently is supposed to be built with "make -j", so that's what I've been doing...
Title: Re: Fiio M3k
Post by: speachy on April 09, 2021, 11:33:40 AM
'-j' refers to the number of parallel jobs Make should try to execute at the same time.  '-j2' means two jobs in parallel, '-j4' is 4, etc.  '-j1' is the same as not specifying the argument at all.  Now '-j' with no number is a special case, it actually means 'no limit', and is rarely a good idea.

Usually it's recommended that you'd use a number of jobs no greater than the number of threads your system can run simultaneously.  Under linux, this is reported by running 'nproc'. 
Title: Re: Fiio M3k
Post by: amachronic on April 09, 2021, 11:45:31 AM
dconrad, I flashed your build and it booted just fine... ??? must be hardware issues. I'll do another version of g#3290.
Title: Re: Fiio M3k
Post by: dconrad on April 09, 2021, 12:12:30 PM
Now '-j' with no number is a special case, it actually means 'no limit', and is rarely a good idea.

So does that mean that this page (https://www.rockbox.org/wiki/LinuxSimpleGuideToCompiling) is incorrect then? It specifically says to use "make -j" unless on a really old machine - which I suppose mine could be, depending on your definition of old.
Title: Re: Fiio M3k
Post by: whiskerc on April 09, 2021, 03:42:06 PM
Just wanted to weigh in and say that today I was able to successfully follow the instructions on the wiki page, compile and install.  The M3K boots directly to Rockbox.   Very exciting to see how much work has been done.

I haven't done any testing yet, but will be monitoring this thread and am available to check things as needed.


Title: Re: Fiio M3k
Post by: whiskerc on April 09, 2021, 06:30:09 PM
Thew, would you be willing to share your theme? 
Title: Re: Fiio M3k
Post by: amachronic on April 09, 2021, 07:46:21 PM
dconrad, I pushed another update to g#3290. This one is more complicated and I included instructions in the commit message. If anything's unclear then please ask. If you have the time and inclination this weekend, we could get on IRC and maybe figure this out faster.
Title: Re: Fiio M3k
Post by: dconrad on April 09, 2021, 08:57:27 PM
dconrad, I pushed another update to g#3290. This one is more complicated and I included instructions in the commit message. If anything's unclear then please ask. If you have the time and inclination this weekend, we could get on IRC and maybe figure this out faster.

Sure thing. I can get on IRC whatever time works for you this weekend, I'm in US Central time. Probably tomorrow mid/late morning?

I think I get the gist of your instructions, I might just take video of it so I can go scroll through it again.

I'll try the patch right now, on top of commit 13dbcab6c, "erosq: When mucking with the clickwheel, ensure we keep the screen awake!"

Looks like it's the simplest (well, simplest for me to report) option, t simply stops counting. We end up with:

Code: [Select]
Passed close()
load_firmware: ret=683948
load_firmware: exit
Jumping...

ipr0:00000000 ipr1:00000000
irq epc:8000FF28
t = 15130638

What's interesting is that it now can actually get to the "Jumping" printout, whereas before it couldn't?

ELFs: here (https://dconrad.neocities.org/assorted_files/m3k_elfs_4-9.zip)
Just for fun: youtube vid: here (https://youtu.be/sVXpSuGfvJk)
Title: Re: Fiio M3k
Post by: amachronic on April 10, 2021, 07:09:23 AM
Looks like you're running into a bug due to some hardware/SD card/filesystem differences and it happens to overwrite memory/stack that is critical to the boot. Trashing memory etc can happen in the background but not cause an obvious problem if whatever gets trashed is not used, until code changes cause the memory layout to change and suddenly something important is overwritten.

I'll be on IRC in the next hour or so, we'll have to try a bunch of builds until we can find out what is being corrupted.
Title: Re: Fiio M3k
Post by: amachronic on April 10, 2021, 05:41:48 PM
dconrad, I've updated g#3290 again; compile SPL, bootloader, and Rockbox from that and unzip Rockbox to the SD card. Boot by running bootloader.bin over USB. If we're lucky you should see the logo and get a blinking keypad.

Unfortunately I feel we haven't solved much, despite making some progress in narrowing down a point of failure. We still don't know why the bootloader was hanging on 'Load firmware...' before and we didn't find any memory corruption. The HW being picky about getting re-initialized twice without proper shutdown in between might be a thing, but it wouldn't really explain the prior behavior of the bootloader.

One thing you can try, is to cherry pick patchset 21 of g#3290, and dump 2 other functions in the same way you checked system_init earlier today. I forgot that clk_set_ccr_mux and clk_set_ccr_div are not inlined into system_init so there is still a possibility that one of those two functions got corrupted. (Since patchset 16 didn't flash lights and patchset 17 did, we know that those two are the only functions that need checking.)

You can get the disassembly listing using mipsel-elf-objdump -D rockbox.elf. (That is, the objdump from the toolchain you use to compile for the M3K). Search for <clk_set_ccr_mux>: and <clk_set_ccr_div>: to find the listings of those functions, and then edit bootloader/fiiom3k.c, changing the address in the code below to the address of the function you're going to dump:
Code: [Select]
    /* On line 111... */
    uint32_t* addr = (uint32_t*)(loadbuffer + (0x8007f3d0/*<< change this */ - 0x80004000));
    while(1) {
        lcd_fillrect(0, LCD_HEIGHT - 48, LCD_WIDTH, 12);
    ....

In patchset 21, the address on screen will match the assembly listing, so it's a bit easier to work with. If you are motivated enough to try this, let me know if you spot any corruption.

Now I'm sorry to say this, but -- things are getting out of hand with the level of debugging we're getting to, and I have to give up on you for now. I'm going to focus on polishing up the bootloader installation, get dual boot working, and improve debuggability of the early boot. Those 3 things should have a positive impact on any potential HW problems. There are some other random bugs I am aware of, which if I track down and fix might "accidentally" end up fixing the root cause of the problem you're suffering. At a minimum, it will be easier to localize problems, without going through the trouble of these hacky patches. (As you've seen, it literally takes dozens of edit-compile-test cycles doing it the hacky way...)

A bit longer term, when the Rockbox USB driver is working for this device, I should be able to implement a GDB stub on the machine -- then we can use GDB to make debugging way faster & easier. But let's hope it won't be necessary.

So good luck with this round of testing, and thanks for your excellent cooperation! I'll post again when there's something worthwhile to test with.
Title: Re: Fiio M3k
Post by: dconrad on April 11, 2021, 11:42:50 AM
Thanks amachronic, I'll give all that a shot and see what I can find out. I didn't get a chance to try actually using the device yesterday to see if it would do something weird, we had some washing machine issues I had to deal with all afternoon. I'll get to that soon though! I totally understand moving on to actual improvements - at least we know where the issue might be now, if not what it is.
Title: Re: Fiio M3k
Post by: KatsuoHana on April 16, 2021, 02:02:41 PM
Any further progress on a native port? I've seem to ran into the same problem as dconrad, havcing my player only light up touch buttons once after flashing the freshly-built rockbox.
Surprisingly, after replacing rockbox on SD card with one build with patchset 3290, it boots and flashes light just fine, even without doing anything to bootloader and/or SPL. If I revert all changes to apps/main.c from that patchset, it manages to boot into the system that is somewhat usable (touchpad is a bit unresponsive and even MP3 playback stutters). With that, I think I should be able to revert to stock bootloader and flash the Linux-based version, but it interprets touchpad button and play button as the same one, which makes it either unusable in jeans pocket, or uncontrollable without unlocking keys every time you want to pause the track.
Title: Re: Fiio M3k
Post by: amachronic on April 16, 2021, 04:30:16 PM
Hi, KatsuoHana, I am still working on the M3K. Thanks for trying out g3290 and taking the initiative... did you use the latest patchset 22? IIRC, the main change there is the PLL/system clock initialization. I've got some changes locally which do the same thing in a better way, but I need to clean them up a bit before I push it out. I'll try to get that done this weekend, judging by your testing it should fix the hang on boot.

I am not surprised that things don't work well on g3290 because it has a lot of slowdown due to the debug code I added. Hopefully a proper build with fixes included will work smoother for you.

Play/pause on the WPS is indeed mapped to both the touchpad and physical button. Keymaps are currently not ideal right now, but the button problem you described is more the fault of Rockbox's default settings. This is not fixable by keymaps, or at the driver/firmware level without introducing other gotchas.

If you enable "Advanced Key lock" (aka. softlock) and turn on Autolock On, Always Autolock, Exempt Volume, Exempt Play, and Disable Touch in the submenu, then you get something approximating normal screen locking -- the touchpad turns off when locked, and you can still play/pause and control the volume.

IMO, the way to go is improving softlock and making it more consistent, then enabling it by default on the M3K. I'm sure other touch-enabled players would benefit from this too.
Title: Re: Fiio M3k
Post by: KatsuoHana on April 17, 2021, 02:44:15 AM
Hi, KatsuoHana, I am still working on the M3K. Thanks for trying out g3290 and taking the initiative... did you use the latest patchset 22? IIRC, the main change there is the PLL/system clock initialization. I've got some changes locally which do the same thing in a better way, but I need to clean them up a bit before I push it out. I'll try to get that done this weekend, judging by your testing it should fix the hang on boot.
Yeah, I've fully merged the g3290, including the patchset 22. As I mentioned before, it boots fine if you remove the debug DIE() function in main.c.
If you enable "Advanced Key lock" (aka. softlock) and turn on Autolock On, Always Autolock, Exempt Volume, Exempt Play, and Disable Touch in the submenu, then you get something approximating normal screen locking -- the touchpad turns off when locked, and you can still play/pause and control the volume.
I think I've already tried that on Linux-based build, and it still does not block touchpad button. For now I only exempted volume controls, so I have to unlock the keys every time I want to pause playback.
Title: Re: Fiio M3k
Post by: amachronic on April 17, 2021, 07:59:38 AM
I think I've already tried that on Linux-based build, and it still does not block touchpad button
The hosted port was lacking the proper code to filter out the touchpad afaik; it definitely works properly on the native port.

From what you've reported, https://gerrit.rockbox.org/r/c/rockbox/+/3334 (https://gerrit.rockbox.org/r/c/rockbox/+/3334) should fix the boot hang that you and dconrad are getting. Try re-flashing again after that's merged. NB, it'll break the usbboot method of loading Rockbox, so you will need jztool from https://gerrit.rockbox.org/r/c/rockbox/+/3326 (https://gerrit.rockbox.org/r/c/rockbox/+/3326) to do the install.
Title: Re: Fiio M3k
Post by: KatsuoHana on April 17, 2021, 11:25:57 AM
From what you've reported, https://gerrit.rockbox.org/r/c/rockbox/+/3334 (https://gerrit.rockbox.org/r/c/rockbox/+/3334) should fix the boot hang that you and dconrad are getting. Try re-flashing again after that's merged. NB, it'll break the usbboot method of loading Rockbox, so you will need jztool from https://gerrit.rockbox.org/r/c/rockbox/+/3326 (https://gerrit.rockbox.org/r/c/rockbox/+/3326) to do the install.
Alright, I'll try to flash it again after it stabilizes and gets merged. Thank you for your hard work.
Title: Re: Fiio M3k
Post by: KatsuoHana on April 18, 2021, 02:56:53 AM
Now that it's merged, I've tried it, and it seems to work fine. Tested it out for a few minutes (listened to some MP3s, played Boomshine), haven't noticed any severe bugs. Sadly, it doesn't boot from exFAT-formatted card, saying it's unable to mount the filesystem; I had to explicitly format my card in FAT32. Other than that nitpick, great job.
Title: Re: Fiio M3k
Post by: saratoga on April 18, 2021, 10:17:40 AM
exFAT is definitely not supported, so no surprise there.
Title: Re: Fiio M3k
Post by: dconrad on April 18, 2021, 11:28:22 AM
amachronic, great news! The changes you pushed fixed my issue! I went through and used jztool and it just kind of worked. I guess there's no way to know exactly what it was (not worth the effort to drill down and find out), but presumably it was the clock init change?
Title: Re: Fiio M3k
Post by: amachronic on April 18, 2021, 01:09:50 PM
Alright, glad it's working for everyone now ;D. My guess is the clock setup was the problem -- perhaps some units are not 100% stable with the current configuration.
Title: Re: Fiio M3k
Post by: KatsuoHana on April 22, 2021, 09:20:21 AM
Tested out the updated bootloader, installing it with jztool over the older one works fine, and I like that you don't need to reboot the player after inserting card if you turned it on without it. Rockbox itself works fine as well, no crashes or bugs detected during few days of usage. How long until the port gets moved from unusable to unstable?
Title: Re: Fiio M3k
Post by: amachronic on April 22, 2021, 11:53:08 AM
I simply haven't considered moving the M3K port to unstable yet, although it's very much usable in my opinion. The only concrete thing missing is a binary release of the bootloader and jztool, according to the wiki (https://www.rockbox.org/wiki/TargetClassifications (https://www.rockbox.org/wiki/TargetClassifications)). I suppose it will encourage more much-needed testing if Rockbox is easy to install, so I'll definitely ask about getting the port moved up to unstable.
Title: Re: Fiio M3k
Post by: heyspencerb on April 25, 2021, 10:20:20 PM
Hey! Checking back in because I hadn't updated my bare-metal version in about three weeks, amazing job guys! I can't believe you got USB multimedia working so soon! That's a huge help, even for dev work too! What do the different USB Keyboard Modes mean? The multimedia/Presentation/Browser?

Also, the new bootloader is great! But I do think the new instructions are even less beginner friendly than the last one.

Couple things, in this line:
../../tools/configure --target=fiiom3k --type=x

there is one too many ../ It should only be
../tools/configure --target=fiiom3k --type=x

Also, right after that the tutorial says:
"If all goes well you should have files build-spl/spl.m3k and build-boot/bootloader.m3k."

but doesn't say that you need to run 'make' in both of these directories first. Then at the end, it doesn't tell people how to 'make' rockbox the normal way in order to get your new .rockbox folder.

I know these are super obvious steps to people experienced with linux and with rockbox specifically but any beginner just trying to follow along is gonna get scary looking error messages if they try and follow the steps exactly and they don't know they have to run make, or don't know what the ../ stands for and why it says the file they are looking for doesn't exist. I just wanted to make sure so that people don't keep posting in this thread for tech support when they try and get stuck.

But, great job to all the devs! Super excited about all the new features!!
Title: Re: Fiio M3k
Post by: amachronic on April 26, 2021, 08:50:42 AM
Quote
Also, the new bootloader is great! But I do think the new instructions are even less beginner friendly than the last one.
Thanks for pointing out the mistakes! I'll definitely fix those.

In any event, the M3K native port has now been moved to unstable so there's daily builds available to download. I'm planning on providing a binary build of the bootloader so people don't have to go through the trouble of compiling anything, and encourage more people to install Rockbox on the M3K.

I would've released the current bootloader, but speachy pointed out to me that having separate SPL and bootloader might cause confusion down the road especially if someone mixes up the files from two different builds. Plus, it's not very user friendly. Probably for the best anyway -- I'm taking the opportunity to do some much-needed reorganization and smooth over the install process.
Title: Re: Fiio M3k
Post by: KarlJ on April 28, 2021, 02:53:27 AM
Can I flash my M3k with my Mac? it's work with Big Sur
Title: Re: Fiio M3k
Post by: amachronic on April 28, 2021, 10:23:20 AM
Can I flash my M3k with my Mac? it's work with Big Sur
In theory jztool should work on Mac. But, I don't have a Mac, so I haven't tested it myself. It should compile without a hitch but you'll have to edit the makefile and point it at the libusb library and headers.
Title: Re: Fiio M3k
Post by: KarlJ on April 28, 2021, 07:11:53 PM
Can I flash my M3k with my Mac? it's work with Big Sur
In theory jztool should work on Mac. But, I don't have a Mac, so I haven't tested it myself. It should compile without a hitch but you'll have to edit the makefile and point it at the libusb library and headers.
I download the libusb and copy to the folder include ,but when I compile jztool ,system reminds me endian.h is missing,I don't know how to fix it.
Title: Re: Fiio M3k
Post by: amachronic on April 29, 2021, 08:49:18 AM
Okay, I'll fix the endian.h issue -- that's something I've been meaning to do anyway since it's a problem for Windows too.

Also, make sure you compile libusb. It isn't enough to just drop it in the include folder. Rather than compile it yourself, it looks easier to install with homebrew:
Code: [Select]
brew install libusb
I think I figured out which include/library paths to use for homebrew stuff so I'll add those to the Makefile. I'll probably get this done later today, you can try again then and let me know if you have success or more problems.
Title: Re: Fiio M3k
Post by: speakn2pabst on April 30, 2021, 10:36:33 PM
Hi all.   :) First post, new user.    ;)   

Just wanted to drop a thank you.  I followed the build instructions (on Manjaro/Arch Linux) and have a new native Rockbox build on my M3K.  Still checking it out but seems to function great.  Thanks for the continued work.   ;D
Title: Re: Fiio M3k
Post by: FroggestSpirit on May 03, 2021, 05:47:15 PM
Nice progress here! With USB mode, does that mean it will allow you to play audio over USB, like in a car stereo with a USB port? It'd be nice to ditch the AUX cord, since you cant skip tracks with it.
Title: Re: Fiio M3k
Post by: amachronic on May 03, 2021, 06:14:50 PM
Nice progress here! With USB mode, does that mean it will allow you to play audio over USB, like in a car stereo with a USB port? It'd be nice to ditch the AUX cord, since you cant skip tracks with it.

Sorry, Rockbox doesn't have a USB DAC mode. Or do you mean outputting audio from Rockbox over USB, for playback on another device? (That's not supported either.)
Title: Re: Fiio M3k
Post by: speachy on May 03, 2021, 08:34:36 PM
Nice progress here! With USB mode, does that mean it will allow you to play audio over USB, like in a car stereo with a USB port? It'd be nice to ditch the AUX cord, since you cant skip tracks with it.

AFAIK there is only one "audio over USB" standard that a typical car headunit implements, and that is tied up in the proprietary Apple IAP quagmire.  Even if we were to implement it, we'd have to pretend to be an iPod for it to work, and Apple has historically reacted _very_ unfavourably to such things.

(Android Auto, and possibly modern CarPlay, transfers audio via bluetooth)

Title: Re: Fiio M3k
Post by: FroggestSpirit on May 04, 2021, 05:43:09 PM
Ahh, I never knew that was more of an apple thing. Not sure if it's known, but the GBS plugin doesn't appear to work on the dev build. NES, SNES, Genesis all work, but GBS is generally silent. I got some of the noise channel to play, so I think it's something with the emulation, rather than the buffer or something.
Title: Re: Fiio M3k
Post by: stridechicken on May 09, 2021, 08:06:45 AM
I've managed to install the bare-metal version of Rockbox on my M3K and I'm loving it, thanks everyone for your work. One problem I can't understand though, the lock option works great while music is playing. But it seems that if the device is locked and then the album finishes playback, it is then not possible to unlock, so I have to restart. Is there another way to unlock that I have missed? Why is this happening?
Title: Re: Fiio M3k
Post by: johnb on May 09, 2021, 09:05:45 AM
I managed to compile SPL, bootloader and jztool under WSL2 (as I mentioned on IRC, too). Unfortunately, jztool won't do the installation within WSL2 as the usb device doesn't show.

Can anyone help out and compile jztool for Windows?

Cheers
johnb
Title: Re: Fiio M3k
Post by: amachronic on May 09, 2021, 09:45:27 AM
...
The lock screen issue definitely sounds like a bug, maybe a keymap problem. Thanks for bringing it to my attention! I'll check it out.

...
I got sidetracked and forgot about it, but I intended to mention on IRC that you should try using msys2 to build jztool: https://www.msys2.org (https://www.msys2.org)

Their homepage shows you how to set it up and install a native mingw-w64 toolchain. The last time I did any development on Windows using MinGW, msys/mingw was primitive and a pain to set up. It seems things have improved and they've got a package manager now -- I don't think it should be any harder to use than WSL. If they also provide builds of libusb then hopefully everything should be plug and play! just build from the msys2 shell.

Apologies that I can't be of any more help. I simply haven't gotten around to spinning up a Windows VM myself... since other bootloader stuff is taking up my time... but I do intend to provide jztool binaries for Windows & Linux in the not-too-distant future.
Title: Re: Fiio M3k
Post by: bluebrother on May 09, 2021, 11:16:32 AM
I got sidetracked and forgot about it, but I intended to mention on IRC that you should try using msys2 to build jztool:

You can easily build it using mxe on a Linux machine. Would expect mxe to run in wsl2 as well, but I've never tried.

Generally, you shouldn't need msys -- for Rockbox Utility I spent quite some time (years ago :) ) to get rid of all msys dependencies, you only need MinGW -- and in case of jztool you'd also need libusb. Not sure if that comes prepackaged for MinGW, and if not how hard it would be to build that for Windows (so you might need msys for building that though.)
Title: Re: Fiio M3k
Post by: g.orlandini on May 10, 2021, 02:18:42 AM
First of all, great job, I installed this beta version 2 weeks ago and it works quite well, no big issues.

Minor issues:
- Charging is very slow (around 0,1 A), not a big problem (Every now and then I can wait few hours for a complete charge)
- font size in some pages (Battery view in debug menu) is really small (I need a big magnifier to read!), it should be (at least) double that size for comfortable reading. Is there any option in the menu settings to increase the size ?

Do you advice to reinstall a new bootloader with your improvement "X1000: simplify NAND driver" ? At the moment the bootloader I've installed is working well.

Thanks for your work
Title: Re: Fiio M3k
Post by: amachronic on May 10, 2021, 08:13:11 AM
- Charging is very slow (around 0,1 A), not a big problem (Every now and then I can wait few hours for a complete charge)
Hmm, I thought I had fixed that issue... It's caused by Rockbox thinking there is a USB host (like a PC) although there is none. As a workaround you can set General Settings > System > Battery > Charge During USB connection to Force, it should force the full 500 mA charge rate. I'm not sure why Rockbox is getting confused but I'll look into it when I have the time.

- font size in some pages (Battery view in debug menu) is really small (I need a big magnifier to read!), it should be (at least) double that size for comfortable reading. Is there any option in the menu settings to increase the size ?
Nope, it's hardcoded in the build. I will increase it at some point, I already did that in the bootloader because it was so hard to read. I have to rearrange some debug screens first since they'd become unreadable with a larger font.

Do you advice to reinstall a new bootloader with your improvement "X1000: simplify NAND driver" ? At the moment the bootloader I've installed is working well.
It's not necessary.
Title: Re: Fiio M3k
Post by: 7o9 on May 12, 2021, 02:40:08 PM
Nice job on the new bootloader, amachronic.

Took me two attempts to realize I had to actually install the bootloader from the menu after running jztool.

The boot menu looks very good and it works very well.

Thanks for all your work on this port, it is great to have RockBox on this device.

I know you wrote that you are not looking to do other ports but I am holding out hope that all this work for the FiiO M3K will open doors for a port to the Shanling Q1 (and perhaps even M0).
Title: Re: Fiio M3k
Post by: amachronic on May 12, 2021, 05:09:35 PM
I know you wrote that you are not looking to do other ports but I am holding out hope that all this work for the FiiO M3K will open doors for a port to the Shanling Q1 (and perhaps even M0).

IIRC the Q1 and M0 are nearly identical, except for the buttons and screen I think they have the exact same hardware. Once one is done I think porting to the other should be trivial.

Come to think of it I should create a wiki page for the Q1... I did unpack the firmware at one point and found out you can execute scripts on the stock FW.
Title: Re: Fiio M3k
Post by: bahus on May 14, 2021, 07:11:58 AM
amachronic

Original firmware when in locked state allows to change tracks by long pressing volume buttons. That's not very consistent but quite convenient feature.

I wonder how to make rockbox more usable in pocket and/or locked state. How about making shortcuts with play + volume buttons act as prev/next and ff/rw buttons (So play + short press Vol-  acts as  previous track, play + long press of Vol- acts as rewind, ... ) Looks like convenient one hand shortcuts. Is it feasible?
Title: Re: Fiio M3k
Post by: amachronic on May 14, 2021, 10:41:10 AM
@bahus: I did try the play+volume button mapping on a local build, but I found it a bit tricky to use in practice. It also displaces the WPS hotkey mapping (= long press of play) so it'd create inconsistency with the main keymap. (Not that I find the hotkey very useful.)

But, I don't think the hotkey can do anything useful if the screen is locked, so if the Play+Volume buttons act as skip/seek when the screen is locked and keep the current behavior when unlocked, we can have the best of both worlds.
Title: Re: Fiio M3k
Post by: bahus on May 14, 2021, 12:02:55 PM
I found it a bit tricky to use in practice.
Ideally you should be able to execute multiple actions using volume buttons keeping play button pressed. So if you need to skip multiple tracks - it's enough to press once play button and then press Vol+ multiple times keeping play button pressed.

It also displaces the WPS hotkey mapping
Yes. Long Play button press shouldn't be mapped at all to make it work nicely.  Can't this WPS hotkey be remapped for long press on some touch button (or some other combinations like play button double press, or play + short power press)?


if the Play+Volume buttons act as skip/seek when the screen is locked and keep the current behavior when unlocked, we can have the best of both worlds.
This will work for me too -  it's indeed required mostly for operating with locked screen. I just thought that global implementation would be easy.
Title: Re: Fiio M3k
Post by: 7o9 on May 15, 2021, 02:11:49 AM
Those are some very elaborate and specific ways to control the player.

Please demonstrate how to do those while the device is in your pocket!

I have been having an issue with the device not responding to any buttons except power off after turning on button lock, not even unlocking the buttons again. Trying to reproduce the exact steps but so far I failed to do so. I think it happened when button lock was enabled and the player reached the end of the playlist.
Title: Re: Fiio M3k
Post by: bahus on May 15, 2021, 02:29:14 AM
Those are some very elaborate and specific ways to control the player.
Please demonstrate how to do those while the device is in your pocket!
I have no problem with pressing play button with my middle finger  and Vol+/Vol- with my index finger simultaneously.  If you don't like it or can't do it - it shouldn't affect you in any way. And that's  just my suggestions. What's yours?


Title: Re: Fiio M3k
Post by: amachronic on May 15, 2021, 06:28:59 AM
I have been having an issue with the device not responding to any buttons except power off after turning on button lock, not even unlocking the buttons again. Trying to reproduce the exact steps but so far I failed to do so. I think it happened when button lock was enabled and the player reached the end of the playlist.
You're right that it's specifically due to reaching the end of the playlist -- another user reported this some days ago and I was able to replicate it on the simulator. Will be fixed by https://gerrit.rockbox.org/r/c/rockbox/+/3229 (https://gerrit.rockbox.org/r/c/rockbox/+/3229).

bahus: I did get the button mapping working as you described, it applies only when the screen is locked. So, difficult or not it's at least possible to skip and even seek in tracks without unlocking the player. (EDIT: it's not yet merged)

I do find it hard to skip backward using the key combo because the buttons are packed so close together. Ultimately I'd like to allow for customizable key bindings but that's quite a ways off due to the amount of effort involved.
Title: Re: Fiio M3k
Post by: bahus on May 15, 2021, 07:42:59 AM
I did get the button mapping working as you described

Awesome! Thanks. Are you planning to publish pre-built  files required for installing rockbox?
Title: Re: Fiio M3k
Post by: bahus on May 15, 2021, 12:49:07 PM
Oh files detected :) https://download.rockbox.org/bootloader/fiio/

Be aware installation doesn't work with Zadig WinUsb driver (at least on my Windows 10 machine):
jztool.exe -v fiiom3k load bootloader.m3k
[  ERROR] libusb_open: Operation not supported or unimplemented on this platform

Zadig libusbk driver needs to be installed instead of WinUSB.
So rockbox is successfully installed on Windows. Cool! Thanks for your work and quick response!


Title: Re: Fiio M3k
Post by: amachronic on May 15, 2021, 01:20:19 PM
Be aware installation doesn't work with Zadig WinUsb driver
...
Zadig libusbk driver needs to be installed instead of WinUSB.
Well that's weird. I tested on a fresh Windows 10 VM under Virtualbox and it worked with WinUSB...
Which version of Windows are you using?

(That was pretty fast by the way!  ;))
Title: Re: Fiio M3k
Post by: 7o9 on May 15, 2021, 01:33:55 PM
Those are some very elaborate and specific ways to control the player.
Please demonstrate how to do those while the device is in your pocket!
I have no problem with pressing play button with my middle finger  and Vol+/Vol- with my index finger simultaneously.  If you don't like it or can't do it - it shouldn't affect you in any way. And that's  just my suggestions. What's yours?

Calm down, I was just responding to your original "I wonder how to make rockbox more usable in pocket ...". If this helps you, best of luck with it.

I am still getting used to the keymap of the M3K. It has some things that take a little getting used to, only having used RockBox on a long line of various Sansa's before.
Title: Re: Fiio M3k
Post by: bahus on May 15, 2021, 01:37:48 PM
Which version of Windows are you using?
Windows 10 Pro (Version 2004, OS Build 19041.985)

First feedback: Can you please map prev/next touch buttons in lists as simple move up/down actions (with accelerations on long press) and maybe also play button as enter (as in OF). To me it's very inconvenient to use scroll (it has weird responsiveness) - it would really be great to have ability navigating folders and menus without it.
Title: Re: Fiio M3k
Post by: 7o9 on May 15, 2021, 01:56:49 PM
You can tap the top and bottom of the slide strip for up and down.
Title: Re: Fiio M3k
Post by: bahus on May 15, 2021, 02:01:09 PM
You can tap the top and bottom of the slide strip for up and down.
Yeah I got it. But it's not stable for me. It mostly works but sometime it acts as enter. So I would really like to avoid using scroll at all if possible.
Title: Re: Fiio M3k
Post by: 7o9 on May 15, 2021, 02:47:35 PM
Would be nice if the top and bottom regions were a bit bigger. I hit the 'enter' region often too.

Will try to modify the keymap to see if it makes any difference.

Thing is that you are drawn to click on the top/bottom of the elipse thing but the touchstrip extends above and below that.
Title: Re: Fiio M3k
Post by: amachronic on May 15, 2021, 05:16:17 PM
The touchpad doesn't work well because it isn't physically wired properly, and/or the controller firmware is massively broken. The right 1/3rd of the screen reports two fixed values (for the back and right arrow "buttons") and the left 2/3rds is highly nonlinear which makes the scrollbar a bit janky. By nonlinear I mean this -- If the pad is linear then 1pt = 1mm (for example) no matter where your finger is or what direction you move. But with a nonlinear pad 1pt reported by the pad could be 1mm, or 2mm in another place or 0.1mm at some other point on the screen. And this varies independently in each axis so the problem is compounded. In fact, the pad supports 2-point multitouch, but very unreliably, and only in the left 2/3rds. The touchpad on this device is absolutely TERRIBLE, in fact.

I can easily add an option to change the size of the touch zones, which could be used to make the up/down zones easier to press, but I suspect the issue is simply that the center of the touch is detected poorly -- your finger is very large compared to one "pixel" on the touchpad, and the firmware must calculate the center point based on a huge number of physical inputs from the pad. With bad firmware / bad pad the reported values will also be bad, and it's impossible to fix since it's all hardcoded and hardwired.

Sorry for the long winded rant, but I hope it's explains why the M3K's touchpad sucks.
Title: Re: Fiio M3k
Post by: 7o9 on May 16, 2021, 02:06:36 AM
... long winded rant ...

It was no criticism of your work at all, the touchpad is easily the worst part of the M3K hardware.

It is light, fast, sounds quite good and can still be purchased for a reasonable price. I bought mine after I saw you did your RockBox port, so thanks again for that!

The touchpad of the M3K is also kind of why I mentioned hope for a Shanling Q1/M0 version before. Quite similar platform but those devices feel so much more 'premium' already just by holding them.

Luckily I spend much more time listening to music than fondling the touchpad and once you get somewhat used to it, it is quite bareable.
Title: Re: Fiio M3k
Post by: daps on May 17, 2021, 10:32:49 PM
The touchpad doesn't work well because it isn't physically wired properly, and/or the controller firmware is massively broken. The right 1/3rd of the screen reports two fixed values (for the back and right arrow "buttons") and the left 2/3rds is highly nonlinear which makes the scrollbar a bit janky. By nonlinear I mean this -- If the pad is linear then 1pt = 1mm (for example) no matter where your finger is or what direction you move. But with a nonlinear pad 1pt reported by the pad could be 1mm, or 2mm in another place or 0.1mm at some other point on the screen. And this varies independently in each axis so the problem is compounded. In fact, the pad supports 2-point multitouch, but very unreliably, and only in the left 2/3rds. The touchpad on this device is absolutely TERRIBLE, in fact.

I can easily add an option to change the size of the touch zones, which could be used to make the up/down zones easier to press, but I suspect the issue is simply that the center of the touch is detected poorly -- your finger is very large compared to one "pixel" on the touchpad, and the firmware must calculate the center point based on a huge number of physical inputs from the pad. With bad firmware / bad pad the reported values will also be bad, and it's impossible to fix since it's all hardcoded and hardwired.

Sorry for the long winded rant, but I hope it's explains why the M3K's touchpad sucks.

Isn't the M3K identical to the M3 Pro except the M3 Pro has a touchscreen? Would that make it a good option for a port?
Title: Re: Fiio M3k
Post by: 7o9 on May 18, 2021, 12:56:33 AM
Isn't the M3K identical to the M3 Pro except the M3 Pro has a touchscreen? Would that make it a good option for a port?

M3 Pro has the same SoC but a different DAC (ES9218P). The firmware might be similar to the M3K though which would be helpful.

That ES9218P is used by various other players with the same Ingenic X1000E SoC (Hidizs AP80Pro, Shanling Q1/M0 and others).
Title: Re: Fiio M3k
Post by: darkstarcumberland on May 27, 2021, 10:43:20 PM
Hi all,

I have been using this software on my FiiO M3K and love it. I often switch back and forth between Rockbox (for music playback) & the FiiO Firmware (for using the USB DAC feature). I did this every day for many months with no problem.

Suddenly I have an issue where I cannot switch back to the FiiO Firmware. On the SELECT PLAYER screen, when I choose "FIIO MUSIC," the unit freezes, the countdown freezes, the screen stays on indefinitely until I hold the power button. Rockbox can be loaded as normal, but FiiO Firmware cannot.

I have wiped my SD card, reinstalled the default FiiO firmware, reinstalled Rockbox, multiple times, still this issue occurs.

I can use the FiiO firmware if it is the only thing installed on the device.
Once I install Rockbox, FiiO firmware crashes when attempting to launch. Rockbox loads fine.

I think a similar issue has been discussed in this thread but I can't easily follow the technical discussion.

I have not used the "bootloader.m3k" software because I only have access to Mac and I understand it is not possible with a Mac. I do not really understand what that software would do.

I am using the version of the software found here: http://xvtx.ru/rockbox/download.htm
As far as I can tell there are no new versions in the past several months?
Most recent version 1.4.3, date added: 10/13/2019

If anyone has a solution to this I would welcome it.

Thank you for the work on this great software
Title: Re: Fiio M3k
Post by: amachronic on May 28, 2021, 08:49:11 AM
@darkstarcumberland I think the issue you're having is that some directory has gone missing. Ran into this a few times myself, although I'm not sure why it happens. I don't remember which directory it is, something like /data/userfs but I'm not sure, I'll have to check on my end. Maybe someone else can say? It's easily fixed by running a script from the xvortex 'bootloader'.

If you know how to start getty on the USB serial port, you can get a shell on the M3K and start the Fiio player manually. It will throw some error and you can find out the missing path that way.

For the record XVortex's port isn't really supported -- us rockbox devs have no control over it. Something like it got added to the 'official' Rockbox repository a while back and it's called the "FiiO M3K Linux" port nowadays, although I have never used that version and can't say if it even works. The bootloader.m3k stuff is for the native port which doesn't have dual boot or USB DAC capabilities -- at least not yet -- so I guess switching is not a good idea for you anyway.
Title: Re: Fiio M3k
Post by: g.orlandini on May 29, 2021, 03:11:21 AM
- Charging is very slow (around 0,1 A), not a big problem (Every now and then I can wait few hours for a complete charge)
Hmm, I thought I had fixed that issue... It's caused by Rockbox thinking there is a USB host (like a PC) although there is none. As a workaround you can set General Settings > System > Battery > Charge During USB connection to Force, it should force the full 500 mA charge rate. I'm not sure why Rockbox is getting confused but I'll look into it when I have the time.

- font size in some pages (Battery view in debug menu) is really small (I need a big magnifier to read!), it should be (at least) double that size for comfortable reading. Is there any option in the menu settings to increase the size ?
Nope, it's hardcoded in the build. I will increase it at some point, I already did that in the bootloader because it was so hard to read. I have to rearrange some debug screens first since they'd become unreadable with a larger font.

Do you advice to reinstall a new bootloader with your improvement "X1000: simplify NAND driver" ? At the moment the bootloader I've installed is working well.
It's not necessary.

I confirm that with your workaround (General Settings > System > Battery > Charge During USB connection to Force) charging is @ 450mA (much better than 100 mA).

Any chance for implement recording ? There's a useful plugin/application (Pitch_detector) for musical instruments tuning that needs it.

So far no big issues in this beta version. Great job
Title: Re: Fiio M3k
Post by: amachronic on May 29, 2021, 03:59:22 AM
g.orlandini, in fact I'm planning on doing recording soon. And thanks for reminding me about that USB charging issue, I really need to get to the bottom of that.
Title: Re: Fiio M3k
Post by: g.orlandini on May 30, 2021, 02:26:20 AM
It was a (very) minor issue charging @100 mA, but now with your simple workaround charging @450 mA is really OK.
It would be nice to implement recording.

Great job
Title: Re: Fiio M3k
Post by: darkstarcumberland on May 31, 2021, 11:32:25 AM
@darkstarcumberland I think the issue you're having is that some directory has gone missing. Ran into this a few times myself, although I'm not sure why it happens. I don't remember which directory it is, something like /data/userfs but I'm not sure, I'll have to check on my end. Maybe someone else can say? It's easily fixed by running a script from the xvortex 'bootloader'.

If you know how to start getty on the USB serial port, you can get a shell on the M3K and start the Fiio player manually. It will throw some error and you can find out the missing path that way.

For the record XVortex's port isn't really supported -- us rockbox devs have no control over it. Something like it got added to the 'official' Rockbox repository a while back and it's called the "FiiO M3K Linux" port nowadays, although I have never used that version and can't say if it even works. The bootloader.m3k stuff is for the native port which doesn't have dual boot or USB DAC capabilities -- at least not yet -- so I guess switching is not a good idea for you anyway.

Thank you for the info and solutions. Clearly I am not a dev  ;D But trying to follow along the best I can. I see there are "daily builds" that folks are using, but I suppose since I only have access to a Mac system right now, I cannot set that up.

In any case it's no big deal, I have two possible "solutions" that work for me.
1. Use the M3K for Rockbox only and use a different piece of hardware for my DAC.
2. Get a second micro SD card, keep the Rockbox installer on one card and the Fiio Firmware installer on the other card, and "update" the device each time I need to switch.

I think option 1 is less complicated ;-)

Thanks again to everyone working on this, appreciate this open source option even when things go a little wrong.
Title: Re: Fiio M3k
Post by: amachronic on May 31, 2021, 06:58:40 PM
Sorry, I almost forgot about you @darkstarcumberland...

Code: [Select]
#!/bin/ash
rm -rf /data/userfs
mkdir /data/userfs

Copy and paste the code into a file called fix_fiio_fs.sh (the exact name is not important that's just my example). Put that script on the root of your SD card and run the script from the tools menu. Hopefully that will fix your problem.

Regarding Mac and the native port, I expect that the installer jztool will work fine. The problem is that I can't test it because I don't own a Mac. I need someone who does to compile jztool on Mac and see if it works.
Title: Re: Fiio M3k
Post by: heyspencerb on May 31, 2021, 08:20:21 PM
Hey! So I have been frustrated by how tiny the text is in the search menu on the M3K so I hacked together a fix which looks like this:

https://imgur.com/a/Efasvsa

However this fix is hacky and has some bugs, can you look at my merge request and try out my version? I'm hoping something like this could be added in a better way. It will bring you back to the center of the search menu after each letter to make typing faster, and the letters are organized such that the most commonly used letters are the closest to the center.
Here is the merge request:
https://gerrit.rockbox.org/r/c/rockbox/+/3447

The bug I haven't fixed yet is that when you start typing the first five letters or so appear off to the left side of the screen. Also, make sure you have all of the fonts installed as you need them for this to work. Let me know what you think of the idea, and how this could be implemented in a better way.
Title: Re: Fiio M3k
Post by: amachronic on June 01, 2021, 04:31:40 AM
Cool. I like that the text entry area isn't taking up half the screen like it normally does.

A suggestion: did you try defining a custom keyboard layout and loading it? There's been support for that for an age, I just don't think it's that well documented. You simply create a file with the .kbd extension and put the characters in like so...

Code: [Select]
RY
QSF
JIM
.. etc ..

then you can select the .kbd file in the file browser on Rockbox to load it. There is even a setting for it and it seems to remember your last loaded keyboard & apply it at boot, as long as you drop it in the /.rockbox directory. But it seems there are some missing features, eg. you cannot define multiple pages like the standard keyboard has.

I don't think the font size can be changed right now, but there could be a setting for that. The auto-recentering is a neat idea -- it could also be a setting, although it might appear useless or frustrating at first glance because it won't work well on the "standard" layout.

PS. The tiny text problem is that the 'system font' is 8px. I tried upping it to 16px Terminus to match the bootloader, but it broke the status bar, most of the debug screens, and maybe other stuff. I'm not sure how to fix some of those issues tbh. Anyone else annoyed by the tiny font is welcome to try.
Title: Re: Fiio M3k
Post by: heyspencerb on June 01, 2021, 10:44:42 AM
I'm glad you like the idea!

I definitely see what you mean when you say that recentering wouldn't be for every keyboard layout, as it would drive me crazy on the current layout.

As for font choice, I think the proper way to fix this would be to have the font for the keyboard match the chosen font. Right now it doesn't but I think this would be pretty easy by setting
Code: [Select]
pm->curfont = ;equal to whatever font the system is using currently. If you have all of the fonts downloaded I had success by using pm->curfont = 10; I think. You can look at the list and see what font matches to what number with some experimentation I think.

In order to get the letters in the search box to not overlap I had to increase pm->text_w to 11, but this caused the issue of the first letters starting off the screen. If you don't set pm->text_w, or if you set it to pm->text_w = 6 then the text stays on screen but then each new letter overlaps the lasts so its impossible to read what your writing out.

I will try writing my keyboard layout as a .kbd file, but another thing I have in my personal repo is that the first time you pick a letter the keyboard is laid out based on the most common First letters in English, and then it switches the keyboard to be based on the most common letters in general after that. This feature isn't the most important but do you think it would be a good addition as well?

Cool. I like that the text entry area isn't taking up half the screen like it normally does.
I got the text entry to be only the bottom part by changing pm->main_y = 300; this moves the text entry to the bottom of the screen, otherwise it would be covering up the keyboard. The best way for this would likely be to find what 1/8 of the screen size would be or so, set pm->keyboard_margin to be that size, then do some math to make sure that pm->main_y is set so the text entry is still at the bottom.
Title: Re: Fiio M3k
Post by: amachronic on June 01, 2021, 02:14:28 PM
I will try writing my keyboard layout as a .kbd file, but another thing I have in my personal repo is that the first time you pick a letter the keyboard is laid out based on the most common First letters in English, and then it switches the keyboard to be based on the most common letters in general after that. This feature isn't the most important but do you think it would be a good addition as well?

I suspect you'd have to type a lot before that kind of tweak saves time, versus the initial confusion of getting used to it, especially if using the keyboard only occasionally. I doubt it's widely useful enough to be worth including. Personally I've never seen a software keyboard do this -- I fall into the "confused occasional user" category ;)
Title: Re: Fiio M3k
Post by: GSV3MiaC on June 03, 2021, 01:07:54 PM
Late to the party .. my M3K just arrived (probably be obsolete next week, already hard to find) and I am wondering if/when we will have an 'easily installable' RB version (i.e. one which doesn't require a degree in CS, and three levels of firmware fiddles). Is there any sort of forecast - is that even a feasible goal? Coming from the ClipZip world, I was looking for a simple solution for my old age!

Meantime I guess I can use the Vortex port, although that seems no longer updated, and I think maybe USB/PC connection doesn't work unless you revert to original Firmware?
Title: Re: Fiio M3k
Post by: dconrad on June 03, 2021, 01:29:25 PM
Late to the party .. my M3K just arrived (probably be obsolete next week, already hard to find) and I am wondering if/when we will have an 'easily installable' RB version (i.e. one which doesn't require a degree in CS, and three levels of firmware fiddles). Is there any sort of forecast - is that even a feasible goal? Coming from the ClipZip world, I was looking for a simple solution for my old age!

Meantime I guess I can use the Vortex port, although that seems no longer updated, and I think maybe USB/PC connection doesn't work unless you revert to original Firmware?

Hi GSV3MiaC -

It's not quite "click one button" easy yet, but I assume you saw the new installation instructions (https://forums.rockbox.org/index.php/topic,53858)? It's quite a bit better process than it used to be.
Title: Re: Fiio M3k
Post by: GSV3MiaC on June 03, 2021, 02:38:58 PM
Yes I saw that ... if this is 'quite a bit better' I guess the previous version was truly horrific! :)

I guess I will just have to screw up my courage, dust off my PC, and see whether I can actually follow that far enough to boot RB. First I need a new TF card or two.
Title: Re: Fiio M3k
Post by: amachronic on June 03, 2021, 04:08:09 PM
Yes I saw that ... if this is 'quite a bit better' I guess the previous version was truly horrific! :)

I guess I will just have to screw up my courage, dust off my PC, and see whether I can actually follow that far enough to boot RB. First I need a new TF card or two.

It used to be terrible!

It's now just a one-liner on the command line, more or less. I know the command line is a discouragement to some people, and I wanted to add support into the Rockbox utility but it seems this method of installation is at odds with how it normally works, so I kind of gave up. And making it work without manually running Zadig first is another major annoyance.

Speaking of the new instructions it looks like I totally forgot to announce them properly here...  :(  I was meaning to do that.

Anyway, good luck! If you have any issues feel free to contact me, I'm happy to help.
Title: Re: Fiio M3k
Post by: amachronic on June 06, 2021, 07:25:16 AM
I'm happy to announce we have a working version of jztool for Mac! You can now easily install Rockbox on the M3K from your Mac. Many thanks to dconrad for doing the testing. Instructions and download links can be found at the installation thread (https://forums.rockbox.org/index.php/topic,53858.0.html).
Title: Re: Fiio M3k
Post by: darkstarcumberland on June 07, 2021, 08:00:13 AM
Very cool! I will give it a try when I get some moments to fiddle with it. Right now everything is working "fine enough" and I have some hours of new music to listen to on the device before I start playing with the firmware again ;-)  Cheers
Title: Re: Fiio M3k
Post by: bahus on June 10, 2021, 12:48:48 AM
Anyone else annoyed by the tiny font is welcome to try.

Is it possible to extract XVortex .rockbox folder from his images? He seems to made a bunch of changes to standard theme and bigger font is one of them. Would be cool to have it on native port too.
Title: Re: Fiio M3k
Post by: amachronic on June 10, 2021, 04:34:07 AM
IIRC XVortex is using the Xhibition theme ported to 240x320. You could contact XVortex and ask if he'd release the theme.

The theme can also be grabbed from the M3K.fw package, but you need a Linux box to extract it. M3K.fw is just a zip file. Inside are more zip files named update001.zip, etc. Unzip all of them, and you will see files like system.ubi_001. Use cat system.ubi_* > system.ubi to combine these into a single file. I uploaded a script to the Shanling Q1's wiki page called ubi_extract.sh (https://www.rockbox.org/wiki/pub/Main/ShanlingQ1Port/ubi_extract.sh) which you can run to convert the UBI image to a tarball. You need mtd-utils and the nandsim, ubi, and ubifs kernel modules installed in order to run that script.

Alternatively you could install the XVortex firmware and use a script to copy the .rockbox folder from the internal NAND to the SD card. I don't know offhand where it's located though.
Title: Re: Fiio M3k
Post by: janssea2 on June 10, 2021, 07:53:00 AM
For the moment I use Rockbox from XVortex. Can I overwrite this with jztool?
Title: Re: Fiio M3k
Post by: bahus on June 10, 2021, 07:59:31 AM
For the moment I use Rockbox from XVortex. Can I overwrite this with jztool?
It worked for me. I installed it right over XVortex build. Only I had to install libusbk instead of suggested winusb zadig driver. Not sure if it's somehow related or just a some glitch on my system.
Title: Re: Fiio M3k
Post by: vitt13 on June 10, 2021, 08:10:46 AM
Is it possible to extract XVortex .rockbox folder from his images? He seems to made a bunch of changes to standard theme and bigger font is one of them.
zip archive of extracted /ubifs-root/usr/rockbox content form XVortex's firmware
https://www.mediafire.com/file/c7yl5ruftwiwckf/rockbox.zip/file size 16.19MB
Probably you can grab 'fonts', 'themes' and 'wps' folders with included files from the archive.
I use 'ubireader_extract_files' tool from https://github.com/jrspruitt/ubi_reader
Title: Re: Fiio M3k
Post by: vitt13 on June 10, 2021, 08:36:15 AM
Windows users can use the 'kitchen' https://www.mediafire.com/file/gyau3tsje1kwcz7/Firmware_Kitchen_fiio_m3k_m5.zip/file 6.86MB
What this 'kitchen' does:

- extract parts (partitions) from original firmware file format M3K.fw to use the parts with 'USB Cloner Tool' or to modify/customise the parts
- extract/create UBIFS images i.e. 'system.ubi' and 'data.ubi'

How to:
To extract parts from OTA firmware (M3K.fw) you need to place the M3K.fw file to 'in' folder and run the batch file unpack_M3K_to_parts.bat.
The 'out' folder is output directory for extracted parts i.e. x-loader-pad-with-sleep-lib.bin, xImage, system.ubi, and data.ubi (if presents).

To extract the content of UBIFS image 'system.ubi' or 'data.ubi' you need to presence of the file 'system.ubi' or 'data.ubi' in the directory 'out'
Then run the batch file unpack_system.ubi.bat or unpack_data.ubi.bat
You will get the new folder 'unpacked_system' or 'unpacked_data' with extracted UBI image's content and service file 'perms.txt'.

Attention: this 'kitchen' cannot build back M3K.fw file from the parts.
Use mkotapackage https://github.com/VitToCode/linux-recovery-ota/releases/tag/1.0 to build back the M3K.fw
Title: Re: Fiio M3k
Post by: bahus on June 10, 2021, 08:39:14 AM
Thank you vitt13! Bunch of useful tools indeed.
Title: Re: Fiio M3k
Post by: amachronic on June 10, 2021, 08:56:38 AM
Use mkotapackage https://github.com/VitToCode/linux-recovery-ota/releases/tag/1.0 to build back the M3K.fw

Did you get a hold of the signing keys? ie. will a patched image be flashed by the stock recovery?
Title: Re: Fiio M3k
Post by: vitt13 on June 10, 2021, 09:35:26 AM
Did you get a hold of the signing keys? ie. will a patched image be flashed by the stock recovery?
Yes. I used to post it https://forums.rockbox.org/index.php/topic,52917.msg247653.html#msg247653
M3K.fw is signed with testkey.pk8/testkey.x509.pem signing keys luckily found on this repo https://github.com/YuanhuanLiang/X1000/tree/master/external/recovery/resource/security
Using these keys I got exactly the same files updateNNN.zip, i.e. binary the same. Only last stage, packing M3K.fw from those archives was different, but original M3K.fw file looks like simple uncompressed and unsigned zip archive.
Title: Re: Fiio M3k
Post by: amachronic on June 10, 2021, 02:11:20 PM
Wish I had actually paid attention the forum thread back then... I was told the key was unknown.

This would greatly simplify installation for end users, just dump a patched FW file on the SD card and use the stock recovery. All I'd need to do is get dual boot working in the Rockbox SPL, so the OF recovery is accessible once Rockbox is installed.
Title: Re: Fiio M3k
Post by: Julian67 on June 10, 2021, 03:54:04 PM
Wish I had actually paid attention the forum thread back then... I was told the key was unknown.

This would greatly simplify installation for end users, just dump a patched FW file on the SD card and use the stock recovery. All I'd need to do is get dual boot working in the Rockbox SPL, so the OF recovery is accessible once Rockbox is installed.

Dual boot would be great.  I just bought my M3K, receiving it yesterday.  The original firmware is actually nicely usable.  Gapless works perfectly with albums of flacs, a real deal breaker for me.  But only Rockbox has the perfection of Auto-Change Directory with the option of using random *and* constraining the auto-change.  This is a triumph of civilisation :-)  So I installed Rockbox and it is really impressive on this device.  I've been using iRiver H140 with SSD for years and the M3K seems to be the first time I feel I've found something as good, perhaps better in most ways, which can also handle files of different bit-depth and sample rate with ease.  And the M3K doesn't hiss with low impedance IEMs so that is a big improvement.  The one feature that I'd like to use in the original firmware is the ability to work as a USB DAC.  It would occasionally be very useful.  The experience of installing Rockbox onto this target has been very good.  While Fiio's UI is decent enough, I've been reminded that Rockbox's UI and options are so absolutely focused on the user, so mature and refined (the UI not us users!), that it really serves as an advertisement for what is possible when people collaborate.

Many thanks amachronic for moving this device from a maybe/if only curiosity to a genuine daily driver.

And if anyone is not aware, the M3K is now discontinued.  Here in UK you can no longer find it new on amazon or advancedmp3players or any of the usual Fiio retailers.  But there are retailers on aliexpress who still have stock.  These players are vanishing from retail though.  My first aliexpress purchase was refunded as the vendor actually ran out of product, but the next one had the device at my door in 8 days, so I'm happy.  But if you want one, now is the time.
Title: Re: Fiio M3k
Post by: dconrad on June 10, 2021, 04:43:17 PM
If dual-boot is going to happen, any chance it could be done while preserving the lightning-fast boot time? I love the fact that the device is on within 5 seconds (3 of which are holding the button down!).
Title: Re: Fiio M3k
Post by: amachronic on June 10, 2021, 04:59:23 PM
There won't be any change to the rockbox boot time. It's already doing everything else needed for dual boot, what's missing is the final hardware fiddling before jumping to Linux. I've been looking over the x-loader source (found it from vitt13's stuff, thanks!) and it seems I'm not missing much.
Title: Re: Fiio M3k
Post by: vitt13 on June 10, 2021, 05:21:45 PM
the x-loader source (found it from vitt13's stuff,
Yeah, I found two repos
https://github.com/JaminCheung/x-loader
https://github.com/YuanhuanLiang/X1000/tree/master/bootloader/x-loader
The second one looks newer.
Title: Re: Fiio M3k
Post by: mario69 on June 14, 2021, 06:38:40 AM
i dont understand if this version of rockbox:
http://xvtx.ru/rockbox/download.htm
it's the same version I can download from Rockbox Development Builds
thanks
Title: Re: Fiio M3k
Post by: amachronic on June 14, 2021, 08:29:37 AM
The XVortex version is an "unofficial" 3rd party build. It's also not being updated anymore, as far as I know. The development builds on rockbox.org are for the native M3K port. You can find installation instructions for it here (https://forums.rockbox.org/index.php/topic,53858.0.html).
Title: Re: Fiio M3k
Post by: mario69 on June 14, 2021, 10:14:43 AM
thank you! to switch from XVortex to rockbox how do i do? do i have to uninstall xvortex? or is there a particular procedure?
Title: Re: Fiio M3k
Post by: amachronic on June 14, 2021, 01:27:47 PM
You can install over top of the XVortex firmware, or any other FiiO firmware version. The native port of Rockbox doesn't depend on or interact with the original firmware whatsoever.
Title: Re: Fiio M3k
Post by: amachronic on June 14, 2021, 06:16:57 PM
Dual booting the original FiiO firmware with Rockbox is now supported. Download links for the updated bootloader are at the installation thread (https://forums.rockbox.org/index.php/topic,53858.0.html) as usual.

I'm sure everyone who likes the USB DAC feature will appreciate this.
Title: Re: Fiio M3k
Post by: 7o9 on June 15, 2021, 01:23:38 AM
Great job, it works very well.

Remarkable to see how long it takes the original firmware to get to the main menu. I cannot imagine I will be in the OF often, but it is great to have the option.

Also the tapping on the top/bottom of the middle part of the touchpad in Rockbox to go up/down is something I immediately miss in the OF. The scrolling in the OF is really annoying.
Title: Re: Fiio M3k
Post by: KatsuoHana on June 15, 2021, 04:03:02 AM
Very nice! Though I'd also add an option to boot original FW to recovery menu.
Title: Re: Fiio M3k
Post by: mario69 on June 15, 2021, 08:55:11 AM
when there will be the stable version must you follow the procedure described in the Official FiiO M3K Native installation instructions page? or will it be like the one you do for the sansa clip player? that is much simpler, thanks
Title: Re: Fiio M3k
Post by: Julian67 on June 15, 2021, 09:30:46 AM
Dual booting the original FiiO firmware with Rockbox is now supported. Download links for the updated bootloader are at the installation thread (https://forums.rockbox.org/index.php/topic,53858.0.html) as usual.

I'm sure everyone who likes the USB DAC feature will appreciate this.

Works perfectly, thank you very much.
Title: Re: Fiio M3k
Post by: amachronic on June 15, 2021, 11:01:12 AM
when there will be the stable version must you follow the procedure described in the Official FiiO M3K Native installation instructions page? or will it be like the one you do for the sansa clip player? that is much simpler, thanks
Once the M3K is officially stable, you will be able to install it through the Rockbox utility. In fact, I think the need for manual bootloader installation is pretty much the only reason the M3K port is classified as "unstable."

Unfortunately, the installation method for the M3K is substantially different from other Rockbox players and will require a fair amount of effort to implement, so if you're waiting for an easy install with the Rockbox utility, you may be in for a bit of a long wait.
Title: Re: Fiio M3k
Post by: bahus on June 15, 2021, 11:49:52 AM
I guess providing latest "M3K.fw" firmware with rockbox bootloader incorporated would also count as "simpler way" to install rockbox.

Title: Re: Fiio M3k
Post by: saratoga on June 15, 2021, 01:35:02 PM
Dual booting the original FiiO firmware with Rockbox is now supported. Download links for the updated bootloader are at the installation thread (https://forums.rockbox.org/index.php/topic,53858.0.html) as usual.

I'm sure everyone who likes the USB DAC feature will appreciate this.

FWIW, we usually strongly discourage putting installation instructions in the forums since it is a lot easier for people to find the M3K wiki which is linked from the front page of Rockbox.org.  Once things are worked out, someone should put the instructions in the wiki (and eventually the manual).

Title: Re: Fiio M3k
Post by: amachronic on June 15, 2021, 02:04:49 PM
FWIW, we usually strongly discourage putting installation instructions in the forums since it is a lot easier for people to find the M3K wiki which is linked from the front page of Rockbox.org.  Once things are worked out, someone should put the instructions in the wiki (and eventually the manual).
Ah, my bad. What you're saying makes sense. The instructions were originally in the wiki, but since the bootloader binary release I moved the instructions to the forum... I assumed that was what the "Manual installation" forum was for, but I see now it seems to be intended for questions relating to manual installation.
Title: Re: Fiio M3k
Post by: vitt13 on June 15, 2021, 04:04:18 PM
Dual booting the original FiiO firmware with Rockbox is now supported.
Thank you for your incredible work.
Am I right that dual boot bootloader replaces 'Vol Up and Power' combination that originally uses to run OF recovery (update OF from microSD).
So do we need to save and take in safe original bootloader dump to be able one day reflash crashed OF?
Is it possible to add menu item in rockbox recovery that runs original recovery (update OF from microSD)? It's stupid, yes, because it can replace rockbox bootloader and then we'll need to flash rockbox bootloader again.
So, if we'll have M3K.fw with rockbox bootloader we need a way to run update from M3K.fw after.
Title: Re: Fiio M3k
Post by: mario69 on June 15, 2021, 04:52:06 PM
i try to install rockbox but i receive this error message:
[  ERROR] libusb_open: Operation not supported or unimplemented on this platform

i follow your procedure:
First, download the Rockbox bootloader bootloader.m3k and the installation utility jztool for your platform. You will need to refer to the bootloader file later on the command line so it's recommended to put both files in the same folder.
Next, connect the M3K in USB boot mode: plug in one end of the USB cable, and then plug in the other end while holding down the Volume Down button. If you did it correctly then the button light will turn on and the LCD will remain off. Since the USB boot mode is very low level, you might not see any indication on your computer that a USB device was plugged in.

Windows users should now follow the USB driver installation instructions below, before running jztool.

To load the Rockbox bootloader, open a terminal / command prompt in the folder where you downloaded jztool and run the command below. If you have put bootloader.m3k in different folder, you will have to adjust the path accordingly.

Windows:
Code: [Select]
jztool.exe fiiom3k load bootloader.m3k

what am I doing wrong?
thanks
Title: Re: Fiio M3k
Post by: amachronic on June 15, 2021, 05:42:43 PM
Am I right that dual boot bootloader replaces 'Vol Up and Power' combination that originally uses to run OF recovery (update OF from microSD).
...Is it possible to add menu item in rockbox recovery that runs original recovery...
The OF recovery can be accessed by holding Play+VolUp and Power. (Not the easiest combo, I know.) And yes, it erases the rockbox bootloader. The recovery menu doesn't have an option to boot the OF or OF recovery because of some technical issues with the current implementation. Hopefully I can fix that in the future.

So, if we'll have M3K.fw with rockbox bootloader we need a way to run update from M3K.fw after.
I see patching M3K.fw as a temporary stopgap to ease installation until the M3K is supported by the Rockbox utility. I'm not a big fan of this idea for the long term:
Title: Re: Fiio M3k
Post by: amachronic on June 15, 2021, 05:43:48 PM
i try to install rockbox but i receive this error message:
[  ERROR] libusb_open: Operation not supported or unimplemented on this platform

Did you install the USB drivers with Zadig?
Title: Re: Fiio M3k
Post by: vitt13 on June 15, 2021, 06:54:41 PM
The OF recovery can be accessed by holding Play+VolUp and Power. (Not the easiest combo, I know.)
My bad, I did not read the instructions carefully. Thank you!

I see patching M3K.fw as a temporary stopgap to ease installation until the M3K is supported by the Rockbox utility. I'm not a big fan of this idea for the long term:
Actually it's not patching the whole M3K.fw, it's actually creating new one with public tools. But using only single part (bootloader) is not acceptable for OF 'recovery' app. Technically packing tools allow to create config with only particular parts to update, but 'recovery' app on the player side is not accept them. I need to place and pack all three parts (i.e. dumped bootloader, kernel and system parts too) to new M3K.fw or at least bootloader and system image. And it works.
I.e.
using only bootloader gave me 'update failed'
'bootloader + kernel' gives me freeze on progress bar 'Updating... 8%'
'bootloader + system' gave me successfully update and installed bootloader in result.
'bootloader + kernel + system' gave me successfully update and installed bootloader in result.
Title: Re: Fiio M3k
Post by: amachronic on June 15, 2021, 07:17:41 PM
'bootloader + kernel + system' gave me successfully update and installed bootloader in result.
What if you make the kernel and system parts zero length? Might it be satisfied with that?
(let's just hope there's not an off-by-one error which erases the first 128k of those partitions ;) )
Title: Re: Fiio M3k
Post by: vitt13 on June 16, 2021, 06:24:01 AM
What if you make the kernel and system parts zero length? Might it be satisfied with that?
(let's just hope there's not an off-by-one error which erases the first 128k of those partitions ;) )
No, it looks like it has some verification that do not allow to flash corrupted UBIFS image. Even if I use raw image, or truncated image, it accepts either valid full-sized mtd3 partition image in 'normal' (raw) update mode or valid ubifs image in 'ubifs' update mode.
Here is the source of the 'recovery' application that looks like 'demo' functional https://github.com/JaminCheung/linux-recovery/tree/master/client/recovery
FiiO's 'recovery' application has no logging (as I remember) and has more verification.
---
Here is the resulted original firmware with 'dual boot' bootloader.
https://www.mediafire.com/folder/p2l3a22u3d7kk/M3K_fw_1.4.5_dualboot_rb

updated with multiboot feature (https://forums.rockbox.org/index.php/topic,53858.msg250226.html#msg250226)
https://www.mediafire.com/folder/fcc89bmjdnubs/new_bootloader
Title: Re: Fiio M3k
Post by: vitt13 on June 17, 2021, 03:03:38 PM
Is it possible to extract XVortex .rockbox folder from his images? He seems to made a bunch of changes to standard theme and bigger font is one of them.
Xhibition theme, credits to XVortex. https://www.mediafire.com/file/txji2isj04wmcm3/xhibition.zip/file
Pay attention: I included config.cfg for example. Make sure you don't replace your own.
Add the string to config manually, if you use customized config
Code: [Select]
font: /.rockbox/fonts/20-Terminus-Bold.fnt
wps: /.rockbox/wps/xhibition.wps
sbs: /.rockbox/wps/xhibition.sbs
backdrop: /.rockbox/backdrops/xhibition2.bmp
Title: Re: Fiio M3k
Post by: bahus on June 18, 2021, 05:29:15 AM
Xhibition theme, credits to XVortex.

Yeah thanks. I've been able to extract it myself from rockbox archive you posted earlier. But TBH I ended up with some different theme (I just didn't realize that we already have so many themes for this device (https://themes.rockbox.org/index.php?target=fiiom3k))
Title: Re: Fiio M3k
Post by: bahus on June 18, 2021, 05:46:44 AM
amachronic
There was (it's broken now (https://forums.rockbox.org/index.php/topic,51844.msg247984.html#msg247984)) useful feature for sansa players - ability to store .rockbox folder in some subfolder(like rbclipzip/.rockbox or rbm3k/.rockbox):
https://forums.rockbox.org/index.php/topic,51844.msg247984.html#msg247984

In short you can specify subfolder name in player specific file (rockbox_main.[PlayerName] like rockbox_main.clipzip)

I find it super useful because it allows you to prepare single "bootable" SD card for different players. Can you implement(or fix and enable) this feature also for m3k(and other x1000 ports)?
Title: Re: Fiio M3k
Post by: amachronic on June 18, 2021, 07:48:33 AM
I was looking into that "multiboot" stuff last night for other reasons, guess that explains why that feature didn't appear to do anything... Thanks for the tip. I'll see if I can get it working, it sounds very useful.
Title: Re: Fiio M3k
Post by: mario69 on July 14, 2021, 09:25:32 AM
I would like to change the sd card and put a larger one, in the previous sd I downloaded rockbox and everything worked correctly, while, always following the same procedure with the new sd card, it keeps telling me error loading rockbox. If I put the old sd back everything works. there is a different procedure to follow? thanks
Title: Re: Fiio M3k
Post by: Julian67 on July 14, 2021, 10:16:03 AM
I would like to change the sd card and put a larger one, in the previous sd I downloaded rockbox and everything worked correctly, while, always following the same procedure with the new sd card, it keeps telling me error loading rockbox. If I put the old sd back everything works. there is a different procedure to follow? thanks

It sounds to me that as you are using a larger microSDXC card it is probably formatted to exFAT instead of FAT32.  exFAT is the usual file system on cards over 32GB capacity but Rockbox doesn't support it.  You can format the card to FAT32 and start over.
Title: Re: Fiio M3k
Post by: mario69 on July 15, 2021, 03:25:53 AM
thanks could you suggest to me a free,best if portable,application for make a fat32 format?
thanks
Title: Re: Fiio M3k
Post by: bahus on July 15, 2021, 03:29:07 AM
could you suggest to me a free,best if portable,application for make a fat32 format?
http://ridgecrop.co.uk/index.htm?guiformat.htm
Title: Re: Fiio M3k
Post by: mario69 on July 15, 2021, 04:00:15 AM
thanks i try this sw.
now I have loaded rockbox on fiio but I get the following error message on the fiio itself:
LB refill handler at 0x0005e641 (0x8) could you help me? thank you
Title: Re: Fiio M3k
Post by: mario69 on July 15, 2021, 04:15:19 AM
and when i try to put a music in fiio with windows i receive the message in attachment...
Title: Re: Fiio M3k
Post by: mario69 on July 15, 2021, 06:58:49 AM
I found that I had to put the.rockbox folder from the old sd on the new sd.Unfortunately, I can't load the music files from windows because it tells me the directory does not exist.
i dont understand...
Title: Re: Fiio M3k
Post by: amachronic on July 15, 2021, 02:06:14 PM
I found that I had to put the.rockbox folder from the old sd on the new sd.Unfortunately, I can't load the music files from windows because it tells me the directory does not exist.
i dont understand...
My guess: either the tool you used to create the filesystem was utterly broken, or perhaps your SD card is a fake. Have you used this card before in another device?

if not you can try reformatting it with NTFS or exFAT and filling it up. If it still gets corrupted then the problem is most likely the SD card. (Fake cards pretend to be bigger than they actually are so if you write enough data to them, they will lose data or get corrupted.)

If the card is definitely okay then perhaps you should try another tool to create the FAT32 filesystem.
Title: Re: Fiio M3k
Post by: mario69 on July 16, 2021, 03:02:15 AM
Thanks, the sd card is fine as I have tested it on another mp3 player and it works (sansa clip) also I only uploaded 200 mb of files. In my opinion the problem is related to the fact that I have already uploaded the files to the fiio bootloader.m3k and jztool with the old sd and then I inserted the new sd card by loading the old .rockbox file, taken from the old sd card.I did so because by downloading the .rockbox file from the page of rockbox and loading it on the new sd card, it did not work.Could this be the way to understand the error?
I try two kind of software for make a fat32 format.
Title: Re: Fiio M3k
Post by: 7o9 on July 16, 2021, 03:54:36 AM
You only have to do the bootloader once for your device, but you need to copy Rockbox itself (thr .rockbox directory) to each card you want to use. The bootloader is stored on the device, Rockbox on the sd card. It does not hurt to do the bootloader multiple times though, it will just have no effect.

The fact that Rockbox starts means the bootloader works, the sd card is FAT/FAT32 amd the .rockbox directory exists.

Your music files do not have to be inside the .rockbox directory. You can create any directory on the sd card (i.e. Music) and put your files in there.

I guess Windows says .rockbox does not exist because it starts with . and those might be hidden by default.
Title: Re: Fiio M3k
Post by: mario69 on July 16, 2021, 06:42:40 AM
thanks
when i try to put a music files in the fiio i read the following error message:
"the file ... is too large for the target file system"
 any idea about th error?
Title: Re: Fiio M3k
Post by: mario69 on July 16, 2021, 06:49:43 AM
while if i put in the sd card the music files not via fiio but normally via pc its all ok...
Title: Re: Fiio M3k
Post by: amachronic on July 16, 2021, 08:10:27 AM
Thanks, the sd card is fine as I have tested it on another mp3 player and it works (sansa clip) also I only uploaded 200 mb of files.
...
I try two kind of software for make a fat32 format.
Okay, that was a bit of a long shot anyway. Another question about the card: how big is it, and what brand?

In my opinion the problem is related to the fact that I have already uploaded the files to the fiio bootloader.m3k and jztool with the old sd and then I inserted the new sd card by loading the old .rockbox file, taken from the old sd card.I did so because by downloading the .rockbox file from the page of rockbox and loading it on the new sd card, it did not work.Could this be the way to understand the error?
Regarding the bootloader 7o9 is correct -- it is written to the Fiio's internal flash, it's not linked to the SD card.

If I understand correctly, the old .rockbox boots on your new SD card, but the latest development version does not? That would be a bug.

Can you give me your bootloader version? It is printed along the bottom of the screen in the recovery menu -- you can get to it by holding Volume Up + Power, or just by booting without an SD card plugged in. It looks like this:
Code: [Select]
4c60bc9e68-210714
\--------/ \----/
    |         |
revision    date

The latest bootloader version is 95408f2117-210614. If you are using an older version, which will have an older date, you might be hitting a bug that exists on your unit and updating the bootloader might help. Download the latest bootloader.m3k (https://download.rockbox.org/bootloader/fiio/m3k/bootloader.m3k), drop it on an SD card and use the "Install/update bootloader" option on the recovery menu.

Once you have the latest bootloader, try again with the development build (not the old .rockbox).

thanks
when i try to put a music files in the fiio i read the following error message:
"the file ... is too large for the target file system"
 any idea about th error?
FAT32 has a 2GB file size limit. But if you're only using small files, then this might be another Rockbox bug.

while if i put in the sd card the music files not via fiio but normally via pc its all ok...
Do you mean transferring files over USB with Rockbox is corrupting your files? Possibly another bug. USB might not be totally stable and I don't use it much myself, so I would advise using an SD card reader or booting into the original firmware to transfer over USB (the OF is also nearly twice the speed of Rockbox).

I can look into the Rockbox bugs if you can trigger the problem on the latest development build. Just make sure to report what you did to trigger the bug and give me the Rockbox version, and if you get any panic screen, let me know what it says (take a picture of it or type it out).
Title: Re: Fiio M3k
Post by: mario69 on July 16, 2021, 08:55:27 AM
Thanks, the sd card is fine as I have tested it on another mp3 player and it works (sansa clip) also I only uploaded 200 mb of files.
...
I try two kind of software for make a fat32 format.
Okay, that was a bit of a long shot anyway. Another question about the card: how big is it, and what brand?

It’s huawei 256 gb

Quote from: mario69 on Today at 03:02:15 AM
In my opinion the problem is related to the fact that I have already uploaded the files to the fiio bootloader.m3k and jztool with the old sd and then I inserted the new sd card by loading the old .rockbox file, taken from the old sd card.I did so because by downloading the .rockbox file from the page of rockbox and loading it on the new sd card, it did not work.Could this be the way to understand the error?
Regarding the bootloader 7o9 is correct -- it is written to the Fiio's internal flash, it's not linked to the SD card.

If I understand correctly, the old .rockbox boots on your new SD card, but the latest development version does not? That would be a bug.

Yes maybe it is

Can you give me your bootloader version? It is printed along the bottom of the screen in the recovery menu -- you can get to it by holding Volume Up + Power, or just by booting without an SD card plugged in. It looks like this:
Code: [Select]
4c60bc9e68-210714
\--------/ \----/
    |         |
revision    date

Its 954808f2117-210614 the latest

The latest bootloader version is 95408f2117-210614. If you are using an older version, which will have an older date, you might be hitting a bug that exists on your unit and updating the bootloader might help. Download the latest bootloader.m3k, drop it on an SD card and use the "Install/update bootloader" option on the recovery menu.

Once you have the latest bootloader, try again with the development build (not the old .rockbox).

Quote from: mario69 on Today at 06:42:40 AM
thanks
when i try to put a music files in the fiio i read the following error message:
"the file ... is too large for the target file system"
 any idea about th error?
FAT32 has a 2GB file size limit. But if you're only using small files, then this might be another Rockbox bug.
up to now i used a 128 gb sd card and it works perfectly. i don't understand this limitation you are talking about. even before it was formatted in fat32



Quote from: mario69 on Today at 06:49:43 AM
while if i put in the sd card the music files not via fiio but normally via pc its all ok...
Do you mean transferring files over USB with Rockbox is corrupting your files? Possibly another bug. USB might not be totally stable and I don't use it much myself, so I would advise using an SD card reader or booting into the original firmware to transfer over USB (the OF is also nearly twice the speed of Rockbox).

I can look into the Rockbox bugs if you can trigger the problem on the latest development build. Just make sure to report what you did to trigger the bug and give me the Rockbox version, and if you get any panic screen, let me know what it says (take a picture of it or type it out).

please note that I have never correctly deleted the firmware from http://xvtx.ru/rockbox/download.htm on the player
could this be the problem?

Title: Re: Fiio M3k
Post by: Julian67 on July 16, 2021, 09:31:07 AM
please note that I have never correctly deleted the firmware from http://xvtx.ru/rockbox/download.htm on the player
could this be the problem?


Yes.
Title: Re: Fiio M3k
Post by: mario69 on July 16, 2021, 09:34:03 AM
how can i delete it and start over?
maybe starting from the original fiio firmware not rockbox
very thanks
Title: Re: Fiio M3k
Post by: amachronic on July 16, 2021, 10:13:18 AM
please note that I have never correctly deleted the firmware from http://xvtx.ru/rockbox/download.htm on the player
could this be the problem?


Yes.
No. Native rockbox doesn't care what original firmware is installed because it doesn't use the flash, except for a tiny area that is the same across all firmware versions. Including the XVortex version.

If you do want to reflash the Fiio firmware for your own peace of mind, put the Fiio M3K.fw on the SD card and hold Play+Volume Up+Power to trigger the original firmware's update. To reinstall Rockbox you can follow the install instructions again. However, I don't think this will fix your problem because you already have the latest bootloader.

If you try booting the Rockbox development build, what error message do you get?
Title: Re: Fiio M3k
Post by: mario69 on July 16, 2021, 11:26:28 AM
I have no error messages. my problem is that I see rockbox loaded on the fiio correctly but when I go to import the music files I get this error: "the file ... is too large for the target file system". redo everything with another sd to understand if the problem is related to the sd card itself or to the procedure, then I will let you know, thank you all!
Title: Re: Fiio M3k
Post by: mario69 on July 16, 2021, 01:22:45 PM
I inserted an 8gb sd card formatting it in fat32 and everything works fine. So the problem is that a 256gb sd card cannot be used because the software that was suggested to me to format in fat32 does not work and windows 10 does not support fat32 format for 256gb. If anyone knows another method to format the 256gb sd card in fat32 is welcome, otherwise if anyone knows other solutions ... Thanks
Title: Re: Fiio M3k
Post by: mario69 on July 17, 2021, 07:36:44 AM
Has anyone on the rockbox fiio used a 256gb or larger sd card? It seems strange
Title: Re: Fiio M3k
Post by: Frankenpod on July 17, 2021, 08:17:38 AM
Which software are you using for formatting?

AOMEII works for me.

Also - maybe this is rather obvious, but I assume you are formatting the card using a card-reader, not while it's in the player?  And that the card-reader itself supports cards >128gb?
Title: Re: Fiio M3k
Post by: amachronic on July 17, 2021, 08:25:32 AM
I inserted an 8gb sd card formatting it in fat32 and everything works fine. So the problem is that a 256gb sd card cannot be used because the software that was suggested to me to format in fat32 does not work and windows 10 does not support fat32 format for 256gb. If anyone knows another method to format the 256gb sd card in fat32 is welcome, otherwise if anyone knows other solutions ... Thanks
The Fiio firmware can format SD cards if you go to System Settings > Format. That might be worth trying if you haven't done so already. I'm successfully using a 256GB SanDisk card in the M3K without issues, but I format my SD cards from Linux.

I don't understand why you'd have this error: "the file ... is too large for the target file system". Normally that means you're trying to copy a large file which is bigger than 2 gigabytes. Just to be clear I do not mean the combined size of all the files, I mean one single file which is bigger than 2 GB.

Does this problem only happen when using USB from Rockbox? Does it still happen if you use USB under the original Fiio firmware, or if you use a USB card reader directly with your computer?
Title: Re: Fiio M3k
Post by: whiskerc on July 17, 2021, 08:59:10 AM
@mario69, I had a problem originally with a Sandisk 256GB SD card until I discovered that it had been formatted to EXFAT.  Since formatting it to FAT32 (under linux) it has worked perfectly well.

You might want to try the Windows freeware SD card formatting tool offered by https://www.sdcard.org/downloads/formatter/  That should clear up if the problem is the card itself or the formatting.  I've never used this tool personally, but it seems to be legit.
Title: Re: Fiio M3k
Post by: Duceboia on July 18, 2021, 07:20:00 AM
I start rockbox via jztool bootloader, all OK (playing music, navigation of folders, settings) when I shutdown M3K and restart with power button, the player boots in OF (Every Time). Where is my fault?
Title: Re: Fiio M3k
Post by: 7o9 on July 18, 2021, 07:24:20 AM
You need to install the bootloader on the M3K too.

Copy the bootloader to the sd card, run the bootloader following the instructions and install the bootloader to the device.
Title: Re: Fiio M3k
Post by: vitt13 on July 18, 2021, 08:28:44 AM
I start rockbox via jztool bootloader, all OK (playing music, navigation of folders, settings) when I shutdown M3K and restart with power button, the player boots in OF (Every Time). Where is my fault?
Also you can try to install bootloader doing update with this firmware file https://forums.rockbox.org/index.php/topic,52917.msg248796.html#msg248796
Title: Re: Fiio M3k
Post by: Duceboia on July 18, 2021, 06:29:28 PM
Thanks 7o9 & vitt13 for pointing me in the right direction.
Works like a charm.
Title: Re: Fiio M3k
Post by: mario69 on July 20, 2021, 03:34:07 AM
I inserted an 8gb sd card formatting it in fat32 and everything works fine. So the problem is that a 256gb sd card cannot be used because the software that was suggested to me to format in fat32 does not work and windows 10 does not support fat32 format for 256gb. If anyone knows another method to format the 256gb sd card in fat32 is welcome, otherwise if anyone knows other solutions ... Thanks
The Fiio firmware can format SD cards if you go to System Settings > Format. That might be worth trying if you haven't done so already. I'm successfully using a 256GB SanDisk card in the M3K without issues, but I format my SD cards from Linux.

I don't understand why you'd have this error: "the file ... is too large for the target file system". Normally that means you're trying to copy a large file which is bigger than 2 gigabytes. Just to be clear I do not mean the combined size of all the files, I mean one single file which is bigger than 2 GB.

Does this problem only happen when using USB from Rockbox? Does it still happen if you use USB under the original Fiio firmware, or if you use a USB card reader directly with your computer?


the situation at the moment is as follows: i have correctly formatted the sd in fat32 i inserted the card in a sansa clip and everything works correctly. while if i transfer files by connecting the fiio player via usb, compare the error message: insert a disk in the 'usb drive. I assume that the player starts rockbox correctly and does not give me error messages. If I transfer the files by attaching the sd card directly to the computer, it does  work correctly.
Title: Re: Fiio M3k
Post by: amachronic on July 20, 2021, 05:50:36 PM
while if i transfer files by connecting the fiio player via usb, compare the error message: insert a disk in the 'usb drive
It sounds like the problem is definitely due to USB handling in Rockbox. Just to confirm, does USB file transfer work correctly under the original FiiO firmware?

The error message you're getting is a bit suspicious. I can't say for certain but you may be hitting a known issue where the USB connection is detected but doesn't finish setting up properly. I don't know the cause of this problem so I can't say if/when it will be fixed... sorry.

As a workaround, you can always boot into the original firmware to use USB, or just use an external card reader.
Title: Re: Fiio M3k
Post by: astrolabe on July 25, 2021, 11:45:41 AM
I've been working on porting jztool to JavaScript using WebUSB, so that the bootloader can be installed from a web browser. As a bonus, this should allow installation from Windows without having to deal with drivers, as well as from ChromeOS and Android devices.

I still need to polish up the port (JavaScript is not my main language), but it seems to work reliably for me. It shouldn't be hard to add support for other players as jztool does.

Hopefully this proves helpful!
Title: Re: Fiio M3k
Post by: amachronic on July 27, 2021, 04:33:59 PM
I've been working on porting jztool to JavaScript using WebUSB, so that the bootloader can be installed from a web browser. As a bonus, this should allow installation from Windows without having to deal with drivers, as well as from ChromeOS and Android devices.

I still need to polish up the port (JavaScript is not my main language), but it seems to work reliably for me. It shouldn't be hard to add support for other players as jztool does.

Hopefully this proves helpful!
Nice work! It's definitely a welcome addition and it sounds interesting, support for more platforms is always nice. I'm looking forward to seeing it. Although it appears WebUSB is effectively limited to Chrome & its derivatives.
Title: Re: Fiio M3k
Post by: astrolabe on August 02, 2021, 04:02:01 AM
jztool.js 0.1

Enough polishing, here's an initial version to play around with, with support with the M3K (tested) and the Q1 (untested). Extract the attached archive (.bin extension added to allow uploading here) to a local webserver along with bootloader.m3k and/or bootloader.q1, then it should Just Work.

Please use at your own risk!

Note for Linux users: You'll almost certainly have to add a udev rule so your user can access the USB device. For instance:
Code: [Select]
SUBSYSTEM=="usb", ATTR{idVendor}=="a108", ATTR{idProduct}=="1000", MODE="0664", GROUP="plugdev"Then make sure your user is in the plugdev group.
Title: Re: Fiio M3k
Post by: tjhoward180 on August 15, 2021, 02:34:41 PM
Was installing an older version of Rockbox for my M3k (the one that matched with 1.3.0), and for some reason, I can't get Windows to recognize the SD card anymore.

I've tried:
- Booting it into Rockbox, and using the Volume Down + plugging in the USB
- Booting into the OF, and turning the USB mode into Storage

Any ideas? A little freaked out that I may have bricked my M3K from being able to read the SD card altogether.
Title: Re: Fiio M3k
Post by: amachronic on August 15, 2021, 03:12:10 PM
tjhoward180,
See if you can read the SD card by another means -- using a USB adapter, card reader slot, phone, etc. If you can browse the fileystem from Rockbox, that shows the M3K has no issues reading the SD card. If the problem only shows up with USB connection, try using another USB cable and see if it's just a bad cable issue.

By the way, I'm not sure what you mean by a "version to match 1.3.0." Unless you are talking about the XVortex builds? Those are pretty outdated, in case you didn't know we have an officially supported native port now.
Title: Re: Fiio M3k
Post by: tjhoward180 on August 15, 2021, 04:25:33 PM
Ah! So, to get things back in a stable place again, I did use an external reader to put an older firmware on - once that was installed, Windows was able to read the SD card.

Also, I didn't know there was an official port @amachronic! Thanks for informing this dummy. I've been in this forum a bunch, and hadn't realized it. I'll try the native port out now.
Title: Re: Fiio M3k
Post by: GSV3MiaC on August 17, 2021, 06:15:38 AM
I'm running the native version from a few weeks back, but when I went to start the player today I got a 'committing database 1/9' message, and then the player turned off. Tried again and once it got as far as 2/9, but no further. Plugging into Win10 I get a device not recocnized / failed message. Suggestions for debugging welcome. I suppose the battery could be well down, but I can't boot far enough to see.
Title: Re: Fiio M3k
Post by: amachronic on August 17, 2021, 08:32:47 AM
Sounds like the database is in a bad state and you need to delete it -- delete all the database*.tcd files in the .rockbox folder. If you need to connect over USB you can either boot the OF (hold Play while booting) or use the Rockbox bootloader's USB mode (hold Volume Up and select USB mode from the menu).

I've run into database corruption and panics a few times, mostly due to playing music while the database is updating. I imagine these problems would occur on other ports but I haven't looked into it. My own workaround is simple: just never update the database. (and make sure auto-update is off; it should be by default.)
Title: Click on volume change at specific level
Post by: Julian67 on August 23, 2021, 04:44:05 PM
I notice that when I change volume between -32 and -32.5 dB I hear a click.  Not at other levels.  It's fairly quiet and I suspect it might often pass unnoticed with louder music but it is readily apparent in quieter or simpler passages.  Is it the DAC moving to/from low power to full power?  In Rockbox settings I have the DAC power mode set to "High performance" and the roll off set to the default "sharp", in the general settings the Frequency is set to "Automatic".  I'm not using any EQ, dithering or other sound altering settings.

I have noticed this with all firmware versions I tried.  I'm on the latest one today.  I suspect it's a hardware thing and I'm not complaining!  But I am curious.  If it's a software thing then I guess it deserves a fix but basically I'm wondering what it is?
Title: Re: Fiio M3k
Post by: amachronic on August 24, 2021, 09:25:41 AM
Thanks for bringing it to my attention. The click might be due to hardware, but it's only getting triggered due to software -- the M3K has a very limited hardware volume range so I tried to make the most of it. At -32 dB the DAC's digital & analog volume controls are at their minimums so normally we'd need to use software volume to go lower. But the DAC's digital mixer has a divide by 2 mode which halves each sample, which is approximately a -6 dB volume adjustment. So at -32.5 dB, the divide by 2 mode is enabled and the digital volume is boosted up by +5.5 dB to compensate (the digital volume is still negative at -6.5 dB so there's no clipping involved).

The click is probably caused by one of two things:
Either way the fix is simply not abusing the digital mixer for volume control, and start using software volume at -32 dB instead of -38 dB. I don't think losing the extra -6 dB hardware range from the mixer is a big deal if it fixes the clicking.
Title: Re: Fiio M3k
Post by: Julian67 on August 24, 2021, 10:46:44 AM
Thanks for the info, much appreciated.
Title: Re: Fiio M3k
Post by: Julian67 on August 26, 2021, 02:43:53 PM
You fixed the click already! I tried today's firmware. No click!  8)

I'm trying to imagine FiiO responding to enquiries and bug reports like this.  Brain overheating.  Smoke from ears.
Title: Re: Fiio M3k
Post by: amachronic on August 26, 2021, 03:29:15 PM
Umm.. no. I haven't even gotten around to reproducing it myself yet!
Title: Re: Fiio M3k
Post by: Julian67 on August 27, 2021, 02:20:36 AM
I saw your reply & checked again. It is still there. Yesterday I was using earphones with higher impedance and much less sensitivity & I couldn't hear it. This morning I went back to my usual earphones with extremely low impedance and high sensitivity...... *click*  ::)

Anyway, I discovered a workaround  ;D
Title: Re: Fiio M3k
Post by: GSV3MiaC on September 01, 2021, 07:07:29 AM
Sounds like the database is in a bad state and you need to delete it -- delete all the database*.tcd files in the .rockbox folder. If you need to connect over USB you can either boot the OF (hold Play while booting) or use the Rockbox bootloader's USB mode (hold Volume Up and select USB mode from the menu).

I've run into database corruption and panics a few times, mostly due to playing music while the database is updating. I imagine these problems would occur on other ports but I haven't looked into it. My own workaround is simple: just never update the database. (and make sure auto-update is off; it should be by default.)

Ah, the problem was actually the device was totally discharged after not being used for a couple of weeks. I guess RB doesn't completely shut it down. The database update completed OK once I got it charged - for some reason even plugging it in to a 2A charger didn't supply enough power fast enough to allow RB to complete the DB updates. Is the 'drains battery while supposedly off' a known problem?
Title: Re: Fiio M3k
Post by: braewoods on September 01, 2021, 11:57:44 AM
Rockbox generally shuts down fully if that is possible but it can only do so much. The hardware may have a higher standby current draw that Rockbox can do nothing about. Some ports have far better offline battery life due to these differences.
Title: Re: Fiio M3k
Post by: SteveDave on September 01, 2021, 12:32:10 PM
Ah, the problem was actually the device was totally discharged after not being used for a couple of weeks. I guess RB doesn't completely shut it down. The database update completed OK once I got it charged - for some reason even plugging it in to a 2A charger didn't supply enough power fast enough to allow RB to complete the DB updates. Is the 'drains battery while supposedly off' a known problem?

Amachronic posted previously about only charging at .1 amp.
"As a workaround you can set General Settings > System > Battery > Charge During USB connection to Force, it should force the full 500 mA charge rate."

Just to rule it out have you tried turning off the LCD timeout temporarily to make sure the device is actually powering off?
Title: Re: Fiio M3k
Post by: cereal_killer on September 01, 2021, 03:56:54 PM
I have some suggestions for the button layout. The Sansa Fuze+ has a similar touchpad and physical button combo, so I used this player as an inspiration. I had a look into writing patches, but this is way above my head, so I post my ideas here:


Any thoughts?
Title: Re: Fiio M3k
Post by: amachronic on September 02, 2021, 12:38:47 PM
Ah, the problem was actually the device was totally discharged after not being used for a couple of weeks. I guess RB doesn't completely shut it down. The database update completed OK once I got it charged - for some reason even plugging it in to a 2A charger didn't supply enough power fast enough to allow RB to complete the DB updates. Is the 'drains battery while supposedly off' a known problem?
AFAIK the only standby current is 27 uA from the power management IC (axp192), plus whatever the RTC draws. Shutdown will force all other power supplies off. As long as RB sends the shutdown request to the axp192 the hardware should really be off.

Somebody already beat me to it and mentioned that 100 mA charging bug. The M3K can draw around 200 mA if maxed out, but I reviewed the code and axp192 datasheet, and I'm setting the limit on the charging current only, ie. how much the power IC will give to the battery. It should still draw additional power needed by the platform, on top of that 100 mA limit. So it shouldn't be a case of not supplying enough power to keep running.

(*facepalm* because that stupid bug still exists and now I see I didn't even limit the current properly.)

The only simple explanation I can think of is that RB noticed the battery was low but did not recognize that it was charging (for some reason), and decided to shut down forcibly. The power thread tries to ask nicely for a shutdown, but if the main thread does not respond quickly enough, it will force a shutdown and you won't get to see the usual battery low warning (I think). This is pure speculation, but I'd guess the database commit blocks the main thread so it can't respond in time.
Title: Re: Fiio M3k
Post by: amachronic on October 16, 2021, 05:36:29 PM
Hi all. It's been a while since I've made any major user visible improvements, but I've got one to announce today. Tomorrow's daily build will bring improved USB performance and reliability to the M3K (and Q1 / ErosQ native ports). The performance isn't yet on par with the OF, but I'm hoping to close that gap with an improved USB storage driver (based on the UASP protocol).

Also, there was a bug in the low-level timer setup code which I fixed. This shouldn't be a noticeable change, except for slightly shorter boot times, but it's possible some units might experience issues (possibly intermittently or at random). If anybody does start seeing buggy behavior after today's build I'd appreciate if they can report it, since it will likely be caused by this timer bugfix and only need a quick patch to fix.
Title: Re: Fiio M3k
Post by: 7o9 on October 17, 2021, 09:13:15 AM
amachronic, after upgrading the M3k to the build with your USB changes (rockbox-fiiom3k-20211017.zip), it shows the message 'Battery empty! RECHARGE!' immediately after start and shuts down.

The device charge, it runs the OF fine and shows a full battery icon.

Going back to the previous daily build (rockbox-fiiom3k-20211016.zip) makes it work fine.

This problem does not happen on the Shanling Q1 (rockbox-shanlingq1-20211017.zip) which boots fine.
Title: Re: Fiio M3k
Post by: lubatur on October 17, 2021, 11:17:08 AM
Here too: rockbox-fiiom3k-20211017.zip > it shows the message 'Battery empty! RECHARGE!' immediately after start and shuts down, but battery is full charged.
Starting  rockbox over bootloader or bootmenue is ok.
Title: Re: Fiio M3k
Post by: amachronic on October 18, 2021, 06:13:44 AM
lubatur, 7o9 sounds like it's getting a false battery reading after boot, so could you test these builds, reboot a few times with each of them and let me know the first one that works reliably?
Each build adds a delay of 20ms, 40ms, etc. to the boot so we're just trying to find the shortest delay that gets past the initial flaky voltage readings. In theory 80ms should be guaranteed to work but I added a 160ms build just in case. For some reason my unit is working fine with the now-current 5ms delay... I guess I just got lucky.

Thanks for the help!
Title: Re: Fiio M3k
Post by: 7o9 on October 18, 2021, 10:53:40 AM
20ms en 40ms do not work. 80ms works. did not test 160ms.
Title: Re: Fiio M3k
Post by: lubatur on October 18, 2021, 02:13:52 PM
20ms and 40ms don't work.
80ms and 160ms work.
And amachronic thank you for your work!
Title: Re: Fiio M3k
Post by: amachronic on October 18, 2021, 04:53:17 PM
Thanks! 80ms patch is now merged and should make it into tonight's daily build.
Title: Re: Fiio M3k
Post by: Julian67 on October 18, 2021, 05:20:05 PM
On my device the 80ms build didn't work, nor did the daily build rockbox-fiiom3k-20211018.zip.  The 160ms build works fine.
Title: Re: Fiio M3k
Post by: amachronic on October 18, 2021, 06:31:28 PM
Julian67 I've pushed a 200ms build and as of now the dev build should be fixed. You'll have to wait for 20211019 if using the daily build. If anyone is still experiencing this issue with the latest dev build, here's another build to try -- let me know if it fixes it.

400ms build - https://drive.google.com/file/d/10SSqteHAQbOuF6_OUyNHpbL6FCD_kBy-/view?usp=sharing (https://drive.google.com/file/d/10SSqteHAQbOuF6_OUyNHpbL6FCD_kBy-/view?usp=sharing)
Title: Re: Fiio M3k
Post by: Julian67 on October 19, 2021, 11:43:31 AM
Daily build of 19th works fine, thanks.
Title: Re: Fiio M3k
Post by: vitt13 on October 19, 2021, 03:33:21 PM
What happened with menu voicing? It sounds very glitchy like stereotypical robot. But it plays phrase 'invalid voice' clearly (right after player starts) if I use old (incompatible) voice file.
Title: Re: Fiio M3k
Post by: amachronic on October 21, 2021, 10:43:02 AM
What happened with menu voicing? It sounds very glitchy like stereotypical robot. But it plays phrase 'invalid voice' clearly (right after player starts) if I use old (incompatible) voice file.
I tested a build & voice file (en-us) from 2021-10-15 and one from 2021-10-21, both of them sound the same, low quality and robotic. So it should be unrelated to my recent changes. The RB servers were migrated to a VPS instance recently, so perhaps whatever voice was being used before is missing from the VPS? I don't use voice so I have no clue what it originally sounded like.
Title: Re: Fiio M3k
Post by: diegopau on October 22, 2021, 08:19:03 AM
I finally decided to migrate from the Vortex build to the new native builds.

Took me initially a few minutes to get used to the new button mapping, which is quite different, but I am not happier than with the previous button configuration. Other than that works great, no bugs, really happy with it. Thank you @amachronic and all other contributors for your work on this. Without RockBox it would be much harder for me to sleep at nights, i use it all the time for audiobook and podcasts at night.

Suggestion: I noticed than the touch buttons up and down (top and bottom of the touch bar) are not assigned to anything in the WPS, what do you think of assigning them to volume + and volume -? i know it is redundant, but using touch buttons prevents wearing the physical buttons too much, the volume buttons are the first thing that stopped failing in my Sansa Clip Zip. Or if there is a way for me to select a function for those 2 buttons while in WPS tweaking some config files please let me know :)

Thanks again.
Title: Re: Fiio M3k
Post by: chris_s on October 22, 2021, 12:21:16 PM
Really amazing job, amachronic! As for the discussion about keymaps (@cereal_killer and @diegopau), here's what works well for me. My main expectations/requirements were (iirc):



I left the Repeat-AB-Start/End button mapping and pretty much everything else unchanged at the moment. If anyone's interested in seeing the keymap, I can put it up on Gerrit. It only requires pretty minor adjustments compared to the current one though..
Title: Re: Fiio M3k
Post by: 7o9 on October 22, 2021, 01:18:13 PM
Please put it on Gerrit, chris_s, I would like to try that. It looks good.
Title: Re: Fiio M3k
Post by: chris_s on October 22, 2021, 01:31:28 PM
Please put it on Gerrit, chris_s, I would like to try that. It looks good.
Here you go: https://gerrit.rockbox.org/r/c/rockbox/+/3918
Title: Re: Fiio M3k
Post by: chris_s on October 22, 2021, 01:45:45 PM
You may want to also enable the "Screen Scrolls Out of View" option to truly take advantage of horizontal scrolling by long-pressing on the buttons in the upper corners. While it feels pretty weird at first, the ability soon becomes indispensable, in my experience at least.

https://download.rockbox.org/daily/manual/rockbox-fiiom3k/rockbox-buildch8.html#x11-1400008.4
Title: Re: Fiio M3k
Post by: amachronic on October 22, 2021, 08:14:20 PM
Really amazing job, amachronic! As for the discussion about keymaps (@cereal_killer and @diegopau), here's what works well for me. My main expectations/requirements were (iirc):

  • Be able to stop playback by long pressing the power button from anywhere
  • Get back to WPS by pressing Play/Pause
  • Be able to scroll menus to the left/right to quickly see longer text strings that get cut off (not supported by the current keymap)
  • See current playlist from WPS with single button press
  • And be able to change volume by touch
  • Return to browser from WPS with single button press
  • Consistent activation of context menu in WPS/tree context


I left the Repeat-AB-Start/End button mapping and pretty much everything else unchanged at the moment. If anyone's interested in seeing the keymap, I can put it up on Gerrit. It only requires pretty minor adjustments compared to the current one though..

Your keymap looks pretty good to me, it's a bit more polished and thoughtful than what I spewed out. (Nice graphics, by the way!) I'll play with it a bit more over the weekend, but in all likelihood I'll merge it.
Title: Re: Fiio M3k
Post by: chris_s on October 23, 2021, 06:39:41 AM
Really amazing job, amachronic! As for the discussion about keymaps (@cereal_killer and @diegopau), here's what works well for me. My main expectations/requirements were (iirc):

  • Be able to stop playback by long pressing the power button from anywhere
  • Get back to WPS by pressing Play/Pause
  • Be able to scroll menus to the left/right to quickly see longer text strings that get cut off (not supported by the current keymap)
  • See current playlist from WPS with single button press
  • And be able to change volume by touch
  • Return to browser from WPS with single button press
  • Consistent activation of context menu in WPS/tree context


I left the Repeat-AB-Start/End button mapping and pretty much everything else unchanged at the moment. If anyone's interested in seeing the keymap, I can put it up on Gerrit. It only requires pretty minor adjustments compared to the current one though..

Your keymap looks pretty good to me, it's a bit more polished and thoughtful than what I spewed out. (Nice graphics, by the way!) I'll play with it a bit more over the weekend, but in all likelihood I'll merge it.
awesome – one additional change that I had forgotten might be useful  and would also enhance consistency, is to be able to directly return  to the main menu from the browser using long-press on the menu button (just like you can from the WPS), specifically when you're at the leftmost scroll position and aren't already in the process of performing a horizontal scroll action. That would require this line to be added to button_context_tree_scroll_lr:

Code: [Select]
{ ACTION_TREE_ROOT_INIT,    BUTTON_LEFT|BUTTON_REPEAT,  BUTTON_LEFT }
but also needs  line 757  (https://github.com/Rockbox/rockbox/blob/36d319b084b7082f85196464959d0b9287967d6a/apps/gui/list.c#L757)in apps/gui/list.c to be changed to:
Code: [Select]
*actionptr = ACTION_STD_MENU;
My understanding is such that the latter should be changed anyway to make the code work like it is described in the comment above it (since only the menu action seems to skip to root), but I could be wrong.
Title: Re: Fiio M3k
Post by: 7o9 on November 08, 2021, 02:03:54 PM
thanks for these changes, chris_s.

the only thing i have not gotten used to yet is the 'view playlist' from them wps. i have been using that as play/pause since the start and now miss that. over time, i am sure i will adjust.
Title: Re: Fiio M3k
Post by: diegopau on November 08, 2021, 04:18:53 PM
I love all the new key assignations, thanks!!!. I also had a bit of trouble to adjust to not be able to pause/play with a tap in the touchbar but I understand why is done that way, it is the only possible quick access to the playlist with this new assignation.

Is anybody able to get the voice working? I have "voice menus" enabled, i have .talk files everywhere and "spell" set for the "voice filenames" settings. When I was in the old Vortex build it was working but I can't get it to work in this new native ones, maybe something changed in how it should be setup.
Title: Re: Fiio M3k
Post by: chris_s on November 09, 2021, 09:27:56 AM
In theory, you could simply not have any button assigned to 'View Playlist'. You'd still be able to access the functionality, by pressing either the WPS hotkey or using the context menu.

That's actually how it's handled by the iPod's current keymap (Select button returns you to browser and WPS hotkey is assigned to a Select+Play button combo. Not sure that's preferable though (I, at least, have modified my iPod's keymap to be able to press the Select button to display the current playlist in the WPS context and press the Menu button to return to the browser or a previous menu).
Title: Re: Fiio M3k
Post by: diegopau on November 09, 2021, 10:46:11 AM
I don't know if this is possible, but if the touchbar can have different assignations for sliding up/down and tapping up / tapping down, that would give us 2 extra buttons to assign.

Currently you can change volume by either tapping in the top/bottom area of the touchbar or sliding your finger up/down. I think it would be enough with sliding up/down for the volume, so you could use the tap gesture for other things (accessing the playlist for instance) and then restore the tap in the center for the pause/play which could be nice so you can do pausing with a touch button..

But as I said, it is pretty good at it is, just a possibility.
Title: Re: Fiio M3k
Post by: amachronic on November 09, 2021, 03:39:42 PM
I don't know if this is possible, but if the touchbar can have different assignations for sliding up/down and tapping up / tapping down, that would give us 2 extra buttons to assign.
It is possible.
Title: Re: Fiio M3k
Post by: Sakura90 on November 10, 2021, 07:00:54 PM
Hi

Just installed Rockbox on my M3K. Amazing, next to the simplistic bare-bones OFs you have to suffer with DAPs this thing is magical. Now I can have proper scrolling, configurable as you please. I listen to classical which tends to have very long track names and the OF scrolled at 1px per second, useless. Had to guess for half my tracks. I haven't used Rockbox actively since the Fuze almost a decade ago. How time flies. Thanks to everyone making Rockbox possible :D

So far so good, no bugs, everything works. Except the screen turning off when locking (press power button to lock the buttons). Iirc the default was the screen turning off when locked but it's not the case here. I looked in the manual and suppousdly there's an option for that. 8.4 Display -> LCD Settings. (https://download.rockbox.org/daily/manual/rockbox-fiiom3k/rockbox-buildch8.html#x11-1410008.4)

Quote
Backlight on Hold.
    This setting controls the behavior of the backlight when the Hold switch is toggled. If set to Normal the backlight will behave as usual. If set to Off the backlight will be turned off immediately when the Hold switch is engaged and if set to On the backlight will be turned on and stay on while the Hold switch is engaged.

That option is simply missing from the M3K display menu. The power button just locks the buttons and you have to wait for the screen timeout to turn it off. And long pressing power turns the system off. Any ideas?
Title: Re: Fiio M3k
Post by: amachronic on November 11, 2021, 09:43:50 AM
(...) Except the screen turning off when locking (press power button to lock the buttons). Iirc the default was the screen turning off when locked but it's not the case here. I looked in the manual and suppousdly there's an option for that. 8.4 Display -> LCD Settings. (https://download.rockbox.org/daily/manual/rockbox-fiiom3k/rockbox-buildch8.html#x11-1410008.4)
Quote
Backlight on Hold. (...)
That option is simply missing from the M3K display menu. The power button just locks the buttons and you have to wait for the screen timeout to turn it off. And long pressing power turns the system off. Any ideas?

I do think that behavior (turning screen off right away) is better but the M3K doesn't have a hold switch, it has a software lock aka. "softlock."  Unfortunately it doesn't work the same way a hold switch does. I had a notion to make it work more like the hold switch but wasn't motivated enough and the code was too confusing. You might want to open a feature request on the bug tracker, just so it doesn't get totally forgotten.

Also, that option shouldn't be in the manual since it's only for devices with a physical hold switch.
Title: Re: Fiio M3k
Post by: Sakura90 on November 11, 2021, 01:10:30 PM
I do think that behavior (turning screen off right away) is better but the M3K doesn't have a hold switch, it has a software lock aka. "softlock."  Unfortunately it doesn't work the same way a hold switch does. I had a notion to make it work more like the hold switch but wasn't motivated enough and the code was too confusing. You might want to open a feature request on the bug tracker, just so it doesn't get totally forgotten.

Also, that option shouldn't be in the manual since it's only for devices with a physical hold switch.
Interesting. I guess it makes sense from a developer point of view, a switch holding position on/off versus tracking button presses. But from a usability point of view they are essentially the same. In one put the switch to on and buttons lock and screen turns off, switch to off and both go back on. In the other you can have the same behavior with two button presses (just as the OF). I remember old Nokia phones (in the Symbian era) had a hold switch. Then Android came around and it used a button for lock. But both had the same functionality. I haven't seen a hold switch in devices, phones or DAPs, for a long time. It's all buttons now (for better or worse)

I'll open a feature request. Seems like something others might find useful too.
Title: Re: Fiio M3k
Post by: diegopau on November 18, 2021, 04:24:35 AM
Hi,

I noticed the following behavior related to the "Default Sleep Timer Duration" setting. This might not be M3k related, but for Rockbox in general, I don't know.

I created a shortcut for that setting. So now I can change it from:
A - Shortcuts => Default Sleep Timer Duration
B - Settings => General Settings => Startup/Shutdown => Default Sleep Timer Duration.

Now, in the case that the timer is already running: If I change the duration from location A, then the change doesn't have effect immediately, i have to stop the timer and start it again. If I change the duration from location B then it applies instantly, so for instance if the timer was running for 30 minutes and now I set the value for 1 hour it will immediately start counting down from 1 hour.
I find this strange so I think it might be considered a bug. Also it is useful if the change is immediate, because I can't add a shortcut to start/stop the timer.
Title: Re: Fiio M3k
Post by: chris_s on November 18, 2021, 06:29:47 AM
Hi,

I noticed the following behavior related to the "Default Sleep Timer Duration" setting. This might not be M3k related, but for Rockbox in general, I don't know.

I created a shortcut for that setting. So now I can change it from:
A - Shortcuts => Default Sleep Timer Duration
B - Settings => General Settings => Startup/Shutdown => Default Sleep Timer Duration.

Now, in the case that the timer is already running: If I change the duration from location A, then the change doesn't have effect immediately, i have to stop the timer and start it again. If I change the duration from location B then it applies instantly, so for instance if the timer was running for 30 minutes and now I set the value for 1 hour it will immediately start counting down from 1 hour.
I find this strange so I think it might be considered a bug. Also it is useful if the change is immediate, because I can't add a shortcut to start/stop the timer.
I think that isn't M3K-specific but still might be considered a bug or at least an inconsistency. By the way, in case you aren't aware, it is possible to manually add entries to the Shortcuts file that look like this if you want to start/stop the timer directly from the Shortcuts Menu:

Code: [Select]
[shortcut]
type: time
data: sleep 10
name: Sleep in 10

[shortcut]
type: time
data: sleep 20
name: Sleep in 20

[shortcut]
type: time
data: sleep 0
name: Disable Sleep Timer
Title: Re: Fiio M3k
Post by: diegopau on November 18, 2021, 07:15:24 AM
I reported the issue here https://www.rockbox.org/tracker/task/13319

But the trick that chris_s explained it not just awesome but also solves the issue for me. When switching between times in this way it does take effect immediately. Thanks!!
Title: Re: Fiio M3k
Post by: 7o9 on November 21, 2021, 01:05:27 AM
One inconsistency with the new keymap is on the yes/no screen: It says 'play' for yes, but that is the old 'play' which was the center of the scroll strip.

That 'button' is still fine, but the prompt text no longer matches the behaviour.

Places to reproduce are for instance deleting a file or initilaizing the database.
Title: Re: Fiio M3k
Post by: vitt13 on November 21, 2021, 05:04:17 AM
Is it expectable behavior do not play flac 9600Hz 24bit in native port? Original firmware does play that file.
Title: Re: Fiio M3k
Post by: Julian67 on November 21, 2021, 11:04:03 AM
I have flac files of 24 bit depth with sample rates of 48kHz, 88.2kHz, 96kHz, 192kHz.  All play fine on my Fiio M3k with Rockbox.  You might find that embedded cover art is causing a problem.  Sometimes an image file in the same folder as the audio file can prevent playback too.  Maybe check this by removing any images from file and folder and trying again.  If the file now plays then you can convert the image file to one that Rockbox can render, and restore it to metadata/folder/both.
Title: Re: Fiio M3k
Post by: amachronic on November 21, 2021, 11:28:12 AM
Is it expectable behavior do not play flac 9600Hz 24bit in native port? Original firmware does play that file.
It is supported but it won't play back at 24 bit depth (Rockbox will downsample it to 16 bit before playback). If cover art isn't the problem it could be a metadata parser or codec bug.
Title: Re: Fiio M3k
Post by: vitt13 on November 22, 2021, 02:22:19 AM
Julian67, amachronic, thank you for your help. It was file's issue.
I removed cover art and metadata but it didn't help. Then I checked the file with 'FLAC Frontend' tool and it reported 'no errors found'. So, finally I re-encoded the file with that tool it has helped.
Title: Re: Fiio M3k
Post by: benettonb1 on December 02, 2021, 05:36:28 AM
Awesome work! How does one go about installing this on the player?

Moderator Edit: Removed spam links.

Title: Re: Fiio M3k
Post by: amachronic on December 02, 2021, 08:09:26 AM
Instructions here (https://forums.rockbox.org/index.php/topic,53858.0.html). If you have any trouble just ask.
Title: Re: Fiio M3k
Post by: aa666 on January 09, 2022, 07:01:25 AM
Hi!
isn't DAC power settings swapped?
second waveform corresponds to "Save battery" option, but it looks noticeably cleaner, then "high performance" one

//nevermind, looks like it's correct
Title: Re: Fiio M3k
Post by: amachronic on January 09, 2022, 08:39:09 AM
I double checked the DAC code and datasheet (https://web.archive.org/web/20190301092001/https://www.akm.com/akm/en/file/datasheet/AK4376AECB.pdf) and the DAC should be configured correctly in Rockbox. Except it should be powering down the HP amp channels when changing the power mode setting, but isn't. I'll fix that, but I doubt it's the culprit since the DAC is powered up in high-performance mode by default.

If you're right the datasheet is screwed up -- the meaning of the LPMODE bit is reversed and should be 1 for high performance instead of 0. If this is true, the power consumption of the DAC should be higher in 'battery saver' mode - hopefully it's enough of a change to make a difference on a battery bench run, but it'll take me a while to test that.

Forgive me if this should be obvious, but why is the RMS voltage 1.16 V on your scope? it's roughly double the rated RMS of the DAC.


EDIT: if you made a mistake then no worries.
Title: Re: Fiio M3k
Post by: aa666 on January 09, 2022, 12:46:48 PM
no mistakes
waveform looks cleaner in power save mode, and i have no idea why
but power consumption is less!
as for 1.16Vrms -
in datasheet: -1.5 dBFS, RL = 16Ω, HPG = +2 dB, THD+N < -20 dB | - 60 - mW
60mW at 16Ohm - that is 0.98Vrms, and i had no load
(those waveform were taken at volume level +2.5dB, at +3.0dB there are visible distortions already)
Title: Re: Fiio M3k
Post by: amachronic on January 09, 2022, 02:56:01 PM
no mistakes
waveform looks cleaner in power save mode, and i have no idea why
but power consumption is less!

It did occur to me that maybe 'high performance' just pumps more power through the amp and this ends up creating more noise. If you pay close attention to the SNRs on the datasheet for high power and low power mode, they seem to be trying to cheat by using the noise gate in some way - which detects all zero input to reduce noise when audio isn't being played. The SNR and output noise claimed is significantly worse when the noise gate is disabled. I can't see why it would have an effect like that on 'normal' audio; you need many milliseconds of zero samples to trigger it. Maybe the designers are just trying to artificially inflate the DAC's specs using unrealistic tests.

Do you get such bad noise in high performance mode if you reduce the amp gain? Also - you should use a volume in the range -20 to +6 dB which is a multiple of 2 dB to avoid using digital volume controls, since the amp gain goes in 2 dB steps. +2.5 dB volume translates to +4 dB on the amp with -1.5 dB digital gain.

Quote
as for 1.16Vrms -
in datasheet: -1.5 dBFS, RL = 16Ω, HPG = +2 dB, THD+N < -20 dB | - 60 - mW
60mW at 16Ohm - that is 0.98Vrms, and i had no load
(those waveform were taken at volume level +2.5dB, at +3.0dB there are visible distortions already)
Oh yeah, the datasheet is at 32 ohms so that makes sense.
Title: Re: Fiio M3k
Post by: Julian67 on January 10, 2022, 01:29:46 PM
I think it's the case that in low power mode the DAC always operates at 44.1kHz and 16-bits but in high power mode it will not resample or truncate bits when dealing with "hi-res" audio.  But as Rockbox does everything in 16-bits it makes sense to only use low power mode.  The high power mode only seems to make sense for the original firmware.  I'd never thought about this before seeing the recent posts but after looking at the pdf for the AK4376 DAC it does seem to make sense to forget about the high power mode for Rockbox and go for the extra battery life instead.   I've been using my M3K in high power mode for months until today, and the battery life was already phenomenally good.  If it gets even better I won't complain.
Title: Re: Fiio M3k
Post by: sourex on January 15, 2022, 05:16:05 PM
Hey,
i need some help pls @vitt13

I played the m3k file from you on a fat32 formatted SD card and then flashed it.
When the player starts it says: Error loading Rockbox. File not found. I then end up in the recovery menu.

The following error messages appear in the recovery menu: Install Bootloader Error: -1102
 But the worst thing is that I can no longer get into the flash menu. Can you help me please ??
Title: Re: Fiio M3k
Post by: vitt13 on January 16, 2022, 01:30:02 AM
When the player starts it says: Error loading Rockbox. File not found. I then end up in the recovery menu.
Do you have .rockbox folder with extracted content from daily build on your SD card?
Flashing modified M3K.fw is just bootloader replacement, you also have to do that step: "Simply unzip a Rockbox build https://download.rockbox.org/daily/fiiom3k/rockbox-fiiom3k.zip to your SD card".
Title: Re: Fiio M3k
Post by: 7o9 on January 16, 2022, 03:25:18 AM
Having to actually extract a copy of Rockbox seems almost like an afterthought in the installation instructions in the first post of the installation thread.

More emphasis on needing FAT32 (and how to achieve that) and having to extract a copy of a development build of Rockbox (and where to get that) besides installing the bootloader could help.
Title: Re: Fiio M3k
Post by: amachronic on January 16, 2022, 07:18:17 AM
Hey,
i need some help pls @vitt13

I played the m3k file from you on a fat32 formatted SD card and then flashed it.
When the player starts it says: Error loading Rockbox. File not found. I then end up in the recovery menu.

The following error messages appear in the recovery menu: Install Bootloader Error: -1102
 But the worst thing is that I can no longer get into the flash menu. Can you help me please ??

vitt13 is right. You need to extract the rockbox zip onto your SD card. The patched M3K.fw installs the bootloader, so there is no need to install it again from the recovery menu (although doing so doesn't hurt). Sorry for not explaining things more clearly.

The error message just means "bootloader.m3k" could not be found on the SD card so the installation did not continue. It's nothing to worry about.

You can get back into the recovery menu by holding Volume Up when booting.
Title: Re: Fiio M3k
Post by: sourex on January 16, 2022, 12:26:45 PM
sorry for the beginner's mistake, but I hadn't read that anywhere.
I thought so, but wanted to be sure.
@amachronic
Don't apologize because I missed something somewhere. Great job guys!

thx for help !
Title: Re: Fiio M3k
Post by: saratoga on January 28, 2022, 12:34:34 PM
no mistakes
waveform looks cleaner in power save mode, and i have no idea why
but power consumption is less!
as for 1.16Vrms -
in datasheet: -1.5 dBFS, RL = 16Ω, HPG = +2 dB, THD+N < -20 dB | - 60 - mW
60mW at 16Ohm - that is 0.98Vrms, and i had no load
(those waveform were taken at volume level +2.5dB, at +3.0dB there are visible distortions already)

If the high power mode is distorting at positive dB and giving nearly the same peak output voltage then possibly the voltage rails are not high enough to use the setting. Does it work in the stock firmware?

Regarding the note in the manual, the high power mode is for low sensitivity headphones, not necessarily high impedance. Usually they correlate but not always, e.g. lots of 300 ohm headphones that are very loud at <1 Vrms. But if the measurements here are accurate, the RMS out is nearly the same and the mode probably doesn't actually help sensitivity either. I think either see if it can be fixed or else disable it.
Title: Re: Fiio M3k
Post by: amachronic on January 29, 2022, 03:11:53 PM
If the high power mode is distorting at positive dB and giving nearly the same peak output voltage then possibly the voltage rails are not high enough to use the setting. Does it work in the stock firmware?
The high & low power modes are supposed to supply the same output voltage & power. So the peak output voltage would presumably be the same. High mode is just supposed to have better noise performance, and supports >192 KHz sample rates.

It would be interesting to see if the stock firmware behaves any differently, though I don't recall when it decides to use high mode. It's not hooked up to any GUI setting.

Quote
Regarding the note in the manual, the high power mode is for low sensitivity headphones, not necessarily high impedance. Usually they correlate but not always, e.g. lots of 300 ohm headphones that are very loud at <1 Vrms. But if the measurements here are accurate, the RMS out is nearly the same and the mode probably doesn't actually help sensitivity either. I think either see if it can be fixed or else disable it.
The 1V/2V RMS part is for the Q1, not the M3K. You're right that sensitivity and impedance are both important, which the manual should probably mention.
Title: Re: Fiio M3k
Post by: projeKct on January 30, 2022, 11:15:29 PM
Hi,

Simple question here: I have Rockbox 75524a7eec-211002 installed on my M3K. How can I access the context menu from the WPS?

I thought it was by long-pressing the middle/select button, but it does nothing. ???

Thanks in advance!
Title: Re: Fiio M3k
Post by: 7o9 on February 01, 2022, 01:09:59 AM
In my more current version (220118) long-pressing the center of the touchpad still brings up the context menu from the WPS.
Title: Re: Fiio M3k
Post by: projeKct on February 01, 2022, 06:29:25 AM
Thanks! I updated to 20220201 and now it works!  :)
Title: Re: Fiio M3k
Post by: fprockboxer on February 02, 2022, 09:43:31 PM
Hello all,

i tried to compile the UI Simulator based on the Fiio M3k for windows, but as a complete novice with that stuff i was not able to build an executable version.

On rasher.dk there is unfortunately no current UI Simulator version based on the Fiio M3k to find.

I wanted to ask if someone here with a working compiling system could provide an executable windows version of the UI Simulator, if it is not too much trouble to build one?

Thanks in advance.
Title: Re: Fiio M3k
Post by: Thew on March 08, 2022, 07:15:02 AM
It’s probably unlikely that anyone else made the same mistake as me but just in case:
I have two M3Ks one running XVortex’s now unsupported Rockbox port. The other is up-to-date with the new supported version.
I did a basic custom UI for XVortex M3K which I was happy with so when I got the second M3K I tried to instal it but it always failed to work.
It took me some time to realise that having the new Rockbox folder on the SD Card was the problem as all the directory links to the fonts, graphics and WPS etc were broken in my old files. Correcting them to point to the correct directories on the SD Card cured the problem.
Title: Re: Fiio M3k
Post by: Thew on March 14, 2022, 01:14:26 PM
I tried the latest build and noticed that embedded Album Art no longer appeared. JEPGs saved as cover.jpg or folder.jpg still worked OK. I reverted to the previous build with the same files and everything worked again with no problems.
Title: Re: Fiio M3k
Post by: dconrad on March 14, 2022, 03:16:37 PM
I wonder if you might have "Album Art" from this somewhat recent change set to "Prefer Image File": https://gerrit.rockbox.org/r/c/rockbox/+/3973 (https://gerrit.rockbox.org/r/c/rockbox/+/3973)

If you want to try changing the value of that option in the newer build, it's under Settings -> Playback Settings -> Album Art, options are Off, Prefer Embedded, and Prefer Image File.
Title: Re: Fiio M3k
Post by: Thew on March 14, 2022, 03:31:03 PM
I did try the options in the "Album Art" setting but it didn't solve the problem.
Title: Re: Fiio M3k
Post by: Bilgus on March 14, 2022, 05:42:01 PM
This should be fixed in the latest build

I had the tag position off by 6 in my latest patches to the parser

Thanks for the report!
Title: Re: Fiio M3k
Post by: Thew on March 14, 2022, 06:13:02 PM
Thank you so much! I really appreciate all the work that's been done on this project. The almost instant start-up and the ease of use and all the settings available have made a big difference to this player.
Title: Re: Fiio M3k
Post by: aa666 on April 04, 2022, 09:11:24 AM
"panic" on any file (or folder) if i try to delete it, cancel, and try to delete it again.
Title: Re: Fiio M3k
Post by: vitt13 on May 16, 2022, 02:53:14 PM
I posted link (https://forums.rockbox.org/index.php/topic,52917.msg248796.html#msg248796) to M3K.fw with multiboot (https://forums.rockbox.org/index.php/topic,53858.msg250226.html#msg250226) feature https://forums.rockbox.org/index.php/topic,52917.msg248796.html#msg248796
Title: Re: Fiio M3k
Post by: stridechicken on May 21, 2022, 07:00:08 AM
I have been trying to find the option to enable the scrobbler.log feature for use with last.fm. Has this been dropped? I can't see reference to it in the M3K manual and if I go to Settings > Playback Settings it isn't there, although the scrobbling page is still on the Rockbox website. I remember I used to use it but I don't remember if that was on the XVortex version of Rockbox.
Title: Re: Fiio M3k
Post by: Bilgus on May 21, 2022, 08:57:50 AM
https://forums.rockbox.org/index.php/topic,54165.0.html
Title: Re: Fiio M3k
Post by: stridechicken on May 22, 2022, 06:07:13 PM
Thank you! I've got it all set up now.
Title: Re: Fiio M3k
Post by: Bluecap on May 29, 2022, 02:17:14 PM
Is there any way to skip songs with the hardware buttons like on the original firmware?
Title: Re: Fiio M3k
Post by: baka_toroi on November 05, 2022, 07:28:49 PM
Hi guys. Any news about this?
Has discussion moved to a different thread?
Title: Re: Fiio M3k
Post by: 7o9 on November 06, 2022, 11:42:42 AM
There is a key remap plugin that might do what you want:

https://forums.rockbox.org/index.php?topic=54131.0
Title: Re: Fiio M3k
Post by: g.orlandini on January 20, 2023, 07:39:31 AM
Hi all,

in a different thread (https://forums.rockbox.org/index.php/topic,54417.msg251622.html#msg251622) I was asking how to lower charging settings for my Sansa Clip+ and I'm wondering if it's possible to do the same with Fiio M3k.

I'm not sure how to change charging voltage and I prefer to ask Aidan and other expert about this.

For what I know (I'm not an expert at all) limiting voltage @4.1 V would extend quite a lot battery life with only a small decrease in total battery capacity.

Thanks
Title: Re: Fiio M3k
Post by: bagel on May 10, 2023, 06:49:48 AM
Hi, first of all thanks for the amazing port.

I am facing trouble in skipping tracks on wps while the device is locked. Basically I want the original firmware's feature of skipping track on long pressing the volume buttons while the screen is locked.
I have tried the play+vol button combination and keyremap plugin, but every time I get the same "buttons locked" message. Please guide me on how to enable this feature. I'm using the latest bootlader [bf3e67204c-20220402] and fdf661606c-230509 dev build.

Thanks!

edit - I was able to get it working by turning on advanced key lock and selecting "exempt skip" in settings -> general settings -> system
Title: Re: Fiio M3k
Post by: vitt13 on May 24, 2023, 09:08:33 AM
I've got few measurements for digital filters and DAC power mode illustrations.
Test signal is local file generated in REW software. 4kHz square signal, 192k sample rate, PCM24.
High performance mode:
* Sharp filter
(https://i.ibb.co/d68smR4/4k-Hz-192k-PCM24-high-perf-Sharp.png) (https://i.ibb.co/q9TLJvY/4k-Hz-192k-PCM24-high-perf-Sharp.png)
* Slow filter
(https://i.ibb.co/C1y0Mh6/4k-Hz-192k-PCM24-high-perf-Slow.png) (https://i.ibb.co/f1W0n49/4k-Hz-192k-PCM24-high-perf-Slow.png)
* Short-Sharp filter
(https://i.ibb.co/x7nBtv1/4k-Hz-192k-PCM24-high-perf-Short-Sharp.png) (https://i.ibb.co/kSLwsn4/4k-Hz-192k-PCM24-high-perf-Short-Sharp.png)
* Short-Slow filter
(https://i.ibb.co/qWrJ7Sg/4k-Hz-192k-PCM24-high-perf-Short-Slow.png) (https://i.ibb.co/fnxDqgN/4k-Hz-192k-PCM24-high-perf-Short-Slow.png)

Power save mode
* Sharp filter
(https://i.ibb.co/kQGjgGn/4k-Hz-192k-PCM24-power-save-Sharp.png) (https://i.ibb.co/hDgbRg5/4k-Hz-192k-PCM24-power-save-Sharp.png)
* Slow filter
(https://i.ibb.co/zFCvMqv/4k-Hz-192k-PCM24-power-save-Slow.png) (https://i.ibb.co/bFY90c9/4k-Hz-192k-PCM24-power-save-Slow.png)
* Short-Sharp filter
(https://i.ibb.co/PmS4W02/4k-Hz-192k-PCM24-power-save-Short-Sharp.png) (https://i.ibb.co/mDxtygn/4k-Hz-192k-PCM24-power-save-Short-Sharp.png)
* Short-Slow filter
(https://i.ibb.co/pjVNdZn/4k-Hz-192k-PCM24-power-save-Short-Slow.png) (https://i.ibb.co/CKC4QvW/4k-Hz-192k-PCM24-power-save-Short-Slow.png)

Playing the same file on original firmware
(https://i.ibb.co/nP4qN5p/4k-Hz-192k-looks-like-Sharp.png) (https://i.ibb.co/FHckLjp/4k-Hz-192k-looks-like-Sharp.png)
Title: Re: Fiio M3k
Post by: Julian67 on June 01, 2023, 09:10:06 PM
Rockbox resamples everything to 44100Hz.  On some players you can toggle this to 48000Hz.  So a comparison between Rockbox and original firmware might not be so useful if the audio file is 192000 Hz. But anyway, it looks like the original firmware defaults to the same as Rockbox:  sharp.  No surprise there.  All the filters look like they work as described.  The battery life is good on Rockbox that the powersave mode is not needed on the M3K.  I guess if I used my M3K only for audiobooks or lectures and other speech I might choose powersave mode, but for music the default (no powersave, sharp filter) appears to be ideal.  But it is nice to see the graphs, and informative, so thank you.
Title: Re: Fiio M3k
Post by: speachy on June 02, 2023, 07:05:02 AM
Rockbox resamples everything to 44100Hz.  On some players you can toggle this to 48000Hz.  So a comparison between Rockbox and original firmware might not be so useful if the audio file is 192000 Hz.

Actually, Rockbox will only resample if the hardware cannot handle the "native" sample rate for a given file.  I know this because I'm the one who implemented it. 
So on hardware that can go up to 192KHz, we can play back 192KHz files, albeit at 16-bit only since we don't have support for 24/32-bit audio in the core.

(That said, the choice of playback freq and any resampling is up to the invididual codecs, so it's certainly possible some or many of them have their own rules/heuristics)
Title: Re: Fiio M3k
Post by: Julian67 on June 02, 2023, 12:04:45 PM
Thanks for the correct info. Would the bit truncation make much of a difference to those filter graphs?  To me they all look as you'd expect for each filter type.
Title: Re: Fiio M3k
Post by: Julian67 on June 05, 2023, 08:29:37 PM
Rockbox resamples everything to 44100Hz.  On some players you can toggle this to 48000Hz.  So a comparison between Rockbox and original firmware might not be so useful if the audio file is 192000 Hz.

Actually, Rockbox will only resample if the hardware cannot handle the "native" sample rate for a given file.  I know this because I'm the one who implemented it. 
So on hardware that can go up to 192KHz, we can play back 192KHz files, albeit at 16-bit only since we don't have support for 24/32-bit audio in the core.

(That said, the choice of playback freq and any resampling is up to the invididual codecs, so it's certainly possible some or many of them have their own rules/heuristics)

I there any possibility that Rockbox core could ever support 24/32-bit audio?
Title: Re: Fiio M3k
Post by: speachy on June 05, 2023, 09:14:39 PM
I there any possibility that Rockbox core could ever support 24/32-bit audio?

Possibility?  Of course.  But it's not terribly likely at the moment; only a handful of the players have hardware that supports it, and need to implement in a way that doesn't bloat things for 16-bit-only players, and there's not exactly a lot of folks contributing code.  Or contributing much of anything, really.

Title: Re: Fiio M3k
Post by: Julian67 on June 06, 2023, 12:05:16 AM
I there any possibility that Rockbox core could ever support 24/32-bit audio?

Possibility?  Of course.  But it's not terribly likely at the moment; only a handful of the players have hardware that supports it, and need to implement in a way that doesn't bloat things for 16-bit-only players, and there's not exactly a lot of folks contributing code.  Or contributing much of anything, really.

I'm just asking because I have no idea:  Would a change from 16-bit to 24 or 32-bit be a huge upheaval?  Would it be impossible to do without dropping support for 16-bit players? Technical query, not a feature request!
Title: Re: Fiio M3k
Post by: cereal_killer on June 08, 2023, 05:14:06 PM
I've got few measurements for digital filters and DAC power mode illustrations.
Test signal is local file generated in REW software. 4kHz square signal, 192k sample rate, PCM24.

I am curious what the interpretation of these graphs is.
Title: Re: Fiio M3k
Post by: speachy on June 11, 2023, 12:47:46 PM
I'm just asking because I have no idea:  Would a change from 16-bit to 24 or 32-bit be a huge upheaval?  Would it be impossible to do without dropping support for 16-bit players? Technical query, not a feature request!

At minimum, we'd need to make the audio path variable-width at compile time, so 16-bit only devices don't incur any performance penalty.

A basic question is if we want to unconditionally use 24/32-bit audio on platform that support it, or switch back and forth at runtime.  Switching makes everything a lot more complicated, with multiple code paths and new APIs.

Meanwhile. Our DSP/EQ/effect engine doesn't support >16bit.  Additionally, we'd have to implement 16-24bit conversion for the various codecs/plugins that don't support >16bit audio (that said some of our targets only support 24/32-bit audio so that's already implemented, just not in a generic manner)
Title: Re: Fiio M3k
Post by: Julian67 on June 13, 2023, 05:40:14 AM
I'm just asking because I have no idea:  Would a change from 16-bit to 24 or 32-bit be a huge upheaval?  Would it be impossible to do without dropping support for 16-bit players? Technical query, not a feature request!

At minimum....

Thank you for a really comprehensive answer.  Appreciated.
Title: Re: Fiio M3k
Post by: mario69 on June 25, 2023, 04:16:25 AM
good morning, I have a problem, my fiio m3k player after two years of excellent functioning with rockbox, I get a message like this:panic -updating size on empty dir entry 4 (and also others Number) Simeone have a solution?thanks
Title: Re: Fiio M3k
Post by: Richie325 on November 21, 2023, 04:56:50 PM
Hi All, can someone please repost Vortex's build here! I want to install it again and check a couple of things
Title: Re: Fiio M3k
Post by: vitt13 on November 22, 2023, 02:32:29 AM
please repost Vortex's build here
I have only triple boot firmware with XVortex build, OF and native RB bootloader. It's outdated and can revert your latest RB bootloader version. To boot in XVrortex build just use Vol+ and Power.
https://www.mediafire.com/folder/8voqo1pdm6k3o/M3K_fw_XVortex_1.4.3_dualboot_native_rb
---
Found his original build (*.fw) and extracted Rockbox build (taken from *.fw)
https://www.mediafire.com/folder/izr547zpatrcx/Vortex-Rockbox
---
The theme from his build posted here https://forums.rockbox.org/index.php/topic,52917.msg248809.html#msg248809
Title: Re: Fiio M3k
Post by: alex64 on December 29, 2023, 02:06:36 PM
Hello! In the DAC settings, there is save battery and sharp fiter. But it seems to discharge faster than on the official firmware. Is it possible to reduce the discharge somehow?
Title: Re: Fiio M3k
Post by: amachronic on December 29, 2023, 04:41:43 PM
I don't use the official firmware, so... I only have general advice. The DAC power setting has a marginal effect on battery life. I haven't measured it, but going by the datasheet it's roughly a 2 mA difference between "high" and "low" power. At any rate it's small enough to not be very noticeable. The backlight and button light can consume a lot of power, so you can try reducing the brightness.

The codec you use will also affect battery life. Eg. Opus is CPU-intensive and will consume more power, but lossless codecs can also do that because they keep the SD card busy more often.

You can check the debug menu to see how much power you're actually using: View HW info > Power stats. I_dchg is the battery discharge current.
Title: Re: Fiio M3k
Post by: alex64 on December 30, 2023, 02:03:27 AM
Thank you for the answer.
Title: Re: Fiio M3k
Post by: alex64 on January 05, 2024, 02:25:40 PM
In rockbox, the player charges very slowly. And when you turn on the charge numbers can jump. At first, for example 93, after a few seconds 76. Why is that?