12 12
jock

CSC Armbian for RK322X TV Boxes

Recommended Posts

Armbian is a community driven open source project. Do you like to contribute your code?
(edited)

I followed the instructions to install to eMMC and everything worked as expected. The problem is that now the box can't boot my LibreELEC sd. Any ideas ?

Edited by jaum20

Share this post


Link to post
Share on other sites

Good news, expecially for @nokirunner and @DaviMesquita

 

Finally we managed to make the ssv6x5x driver work on the ssv6256p chipset and it turns out the it is also working pretty well. I removed most of the logging messages it was spamming on the dmesg log, now it is much more silent and it is ok this way. Teaming with @fabiobassa we optimized performances quite a bit, so expect ~60 Mbit/s at least on optimal setups. It works on both 2.4Ghz and 5Ghz bands.

 

The driver will be included in the armbian images soon, but in the meantime anyone can test it.

  • Download ssv6x5x.koand put it into /lib/modules/$(uname -r)/kernel/drivers/net/wireless
  • Download ssv6x5x-wifi.cfgand put it into /lib/firmware
  • Download ssv6x5x-sw.bin and put it into /lib/firmware
  • Run depmod -a
  • Add blacklist ssv6051 in /etc/modprobe.d/blacklist-rk322x-box.conf (ssv6051 and ssv6x5x kernel modules clashes, we need to blacklist ssv6051 for the other to work)
  • Reboot!

 

Any testing report is appreciated!

 

Share this post


Link to post
Share on other sites
21 hours ago, jaum20 said:

I followed the instructions to install to eMMC and everything worked as expected. The problem is that now the box can't boot my LibreELEC sd. Any ideas ?

Normally everything which is in the SD card has priority, but if you don't give details it is very difficult to have ideas

Share this post


Link to post
Share on other sites
2 hours ago, jock said:

Normally everything which is in the SD card has priority, but if you don't give details it is very difficult to have ideas

What information do you need?

My board us "R3229Q _V8.0". I was using LibreELEC-RK322x.arm-9.2-devel-20200427213119-b7186bc-rk3228a-mxq4kpro.img.gz flawlessly on a 4g Toshiba sd. I downloaded the image Armbian_20.05.6_Rk322x-box_focal_legacy_4.4.194_desktop.img.xz and followed the instructions of the first post for install on eMMC. I used a 32gb Samsung SD. Everything succeeded with no problems

When I connect the board to the power with the LibreELEC sd inserted it doesn't boot anymore. The blue led is on but no output from HDMI.

If I remove the sd, Armbian boots form internal storage with not problem.

Share this post


Link to post
Share on other sites
2 hours ago, jaum20 said:

What information do you need?

My board us "R3229Q _V8.0". I was using LibreELEC-RK322x.arm-9.2-devel-20200427213119-b7186bc-rk3228a-mxq4kpro.img.gz flawlessly on a 4g Toshiba sd. I downloaded the image Armbian_20.05.6_Rk322x-box_focal_legacy_4.4.194_desktop.img.xz and followed the instructions of the first post for install on eMMC. I used a 32gb Samsung SD. Everything succeeded with no problems

When I connect the board to the power with the LibreELEC sd inserted it doesn't boot anymore. The blue led is on but no output from HDMI.

If I remove the sd, Armbian boots form internal storage with not problem.

Ok much better, but at the moment I have no idea this is happening.

The libreelec boot is somehow engaged because the behaviour changes if you leave the sdcard into, but the reason why it hangs is not clear to me yet.

I will try to replicate soon on a board of mine

 

edit: @jaum20 problem solved! Long story short: substitute the file rk3228a-box-mxq4kpro.dtb in the root of the libreelec sdcard with the one attached here. Important: if you're going to update/upgrade LibreELEC, you will need to replace again this file. This is a "problem" I will likely ask to @knaerzche if it can be solved somehow.

 

Detailed answer for experts: the device tree with the legacy kernel is missing the property arm,cpu-registers-not-fw-configured in the timer section. It is needed on armbian but it is not needed on Libreelec because armbian has OPTEE as trust os (which requires the property), instead Libreelec uses the proprietary u-boot and trust os (which does the timer initialization by itself).

rk3228a-box-mxq4kpro.dtb

Share this post


Link to post
Share on other sites
(edited)

Status report on ESP8089: it works! :) ... well, kinda.

 

I stumbled on this PDF from Espressif that leaded me on the right path:

 

Quote

crystal_26M_en:

Shows the crystal frequency supported by the SoC. Currently, it supports the following three kinds of crystals:

    0: 40MHz crystal

    1: 26MHz crystal

    2: 24MHz crystal

Default value: 0

DESC: After opening wifi search AP, check if the crystal is matched with the value.

 

While this document is WAY outdated, most of parameters are still valid. I opened my box again and found a 40Mhz crystal behind the chip. Still, modprobing the driver without parameters (assuming default value) did NOT work. I had to explicitly define crystal_26M_en=0, then it worked perfectly.

 

Why 'kinda'? because it works only on manual load:

 

  • Blacklist esp8089.ko --> modprobe esp8089 config=crystal_26M_en=0 --> p2p0 'not ready' & wlan0 working OK, can connect to any AP.
  • Let Armbian load the module at boot --> wlan0 'not ready' & p2p0 scanning but not connecting to any AP -- auth timeout.

 

Clearly this chip won't work with p2p0 like others. Looking at udev load process, I've found some hints to exchange interfaces by driver load-order, but nothing about a single driver exposing 2 different interfaces. There is something on Armbian boot process that reverses them (for the worse) and I don't know what it is.

 

---

 

On another note: Latest update broke @jock's media framework... for some reason apt decided that xserver-org-video-armsoc now depends on xserver-org-video-armsoc-exynos :mellow: and if one forces the update, X11 breaks. If it happens to someone else, you can fix like this:

 

  • Manual remove of both packages
  • Manual install of xserver-org-video-armsoc from the framework's folder
  • dpkg-reconfigure xserver-xorg lightdm
  • apt-mark hold xserver-org-video-armsoc (marks package as non-upgradeable - placeholder fix for now)
  • ??
  • Profit!
Edited by victroniko

Share this post


Link to post
Share on other sites

@victroniko

Glad to hear progress! I'm sorry I pointed you to use crystal_26M_en=2, but that was because all the rk322x boxes I have seen use a 24Mhz crystal, so I thought the same was for yours. I first checked on the pictures you provided, but the crystal was totally unreadable.

 

If you created /etc/modprobe.d/esp8089.conf file (as I suggested you in this other post), remove it. Also unblacklist the esp8089 module and reboot.

From what I see from source code, the 40Mhz crystal is the default when no options are passed to the kernel module.

 

I prepared this other kernel module: esp8089.nop2p.ko  I blindly changed a couple of source code lines to avoid the p2p0 interface creation. I don't know if this works, but you may give it a chance. Overwrite the existing esp8089.ko with this one and reboot to see if it has any effect...

 

For the issue about the media framework, I'll take a look into it...

 

Share this post


Link to post
Share on other sites
6 hours ago, jock said:

@victroniko

Glad to hear progress! I'm sorry I pointed you to use crystal_26M_en=2, but that was because all the rk322x boxes I have seen use a 24Mhz crystal, so I thought the same was for yours. I first checked on the pictures you provided, but the crystal was totally unreadable.

 

If you created /etc/modprobe.d/esp8089.conf file (as I suggested you in this other post), remove it. Also unblacklist the esp8089 module and reboot.

From what I see from source code, the 40Mhz crystal is the default when no options are passed to the kernel module.

 

I prepared this other kernel module: esp8089.nop2p.ko  I blindly changed a couple of source code lines to avoid the p2p0 interface creation. I don't know if this works, but you may give it a chance. Overwrite the existing esp8089.ko with this one and reboot to see if it has any effect...

 

For the issue about the media framework, I'll take a look into it...

 

 

No problem! Better to find & understand why things don't work, than receiving spoonfed solutions :) although I might've been doing a bit of that...

 

About /etc/modprobe.d/esp8089.conf - already gone, first tests were done on 20.05.6, after the wipe I mentioned earlier i'm on 20.08.0 now. What I do find strange, is that relying on default setting does not work. Passing the crystal_26M_en=0 parameter did the trick, on this board at least... Every test was with an inmediate power off-on cycle instead of a reboot, to discard possible quirks from the already initialized (firmware loaded) ESP8089 chip.

 

Before heading to work, I left the box cloning the repo and downloading packages required for compilation. I'll try your module (thanks!) but even if it works, I also want to look at the code and try compile for myself too. 

 

 

offtopic. I said I don't know C/C++, that's true... But I did some things in VB6 many years ago, it's not as if I saw modern code and felt totally lost.. And my day-job is electronics so I understand quite a bit how microcontrollers work :P

 

Share this post


Link to post
Share on other sites
On 8/2/2020 at 6:18 PM, jock said:

Good news, expecially for @nokirunner and @DaviMesquita

 

Finally we managed to make the ssv6x5x driver work on the ssv6256p chipset and it turns out the it is also working pretty well. I removed most of the logging messages it was spamming on the dmesg log, now it is much more silent and it is ok this way. Teaming with @fabiobassa we optimized performances quite a bit, so expect ~60 Mbit/s at least on optimal setups. It works on both 2.4Ghz and 5Ghz bands.

 

The driver will be included in the armbian images soon, but in the meantime anyone can test it.

  • Download ssv6x5x.koand put it into /lib/modules/$(uname -r)/drivers/net/wireless
  • Download ssv6x5x-wifi.cfgand put it into /lib/firmware
  • Download ssv6x5x-sw.bin and put it into /lib/firmware
  • Run depmod -a
  • Add blacklist ssv6051 in /etc/modprobe.d/blacklist-rk322x-box.conf (ssv6051 and ssv6x5x kernel modules clashes, we need to blacklist ssv6051 for the other to work)
  • Reboot!

 

Any testing report is appreciated!

 

good job guys, I felt that it would only be a matter of time for you to screw these drivers.
I'm going to test them right now.

Share this post


Link to post
Share on other sites
On 8/2/2020 at 9:48 PM, jock said:

Good news, expecially for @nokirunner and @DaviMesquita

 

Finally we managed to make the ssv6x5x driver work on the ssv6256p chipset and it turns out the it is also working pretty well. I removed most of the logging messages it was spamming on the dmesg log, now it is much more silent and it is ok this way. Teaming with @fabiobassa we optimized performances quite a bit, so expect ~60 Mbit/s at least on optimal setups. It works on both 2.4Ghz and 5Ghz bands.

 

The driver will be included in the armbian images soon, but in the meantime anyone can test it.

  • Download ssv6x5x.koand put it into /lib/modules/$(uname -r)/kernel/drivers/net/wireless
  • Download ssv6x5x-wifi.cfgand put it into /lib/firmware
  • Download ssv6x5x-sw.bin and put it into /lib/firmware
  • Run depmod -a
  • Add blacklist ssv6051 in /etc/modprobe.d/blacklist-rk322x-box.conf (ssv6051 and ssv6x5x kernel modules clashes, we need to blacklist ssv6051 for the other to work)
  • Reboot!

 

Any testing report is appreciated!

 

 

Just wondering if this will also work on ARMv8 64 bit boards? Probably not, but if there is a similar solution for this on other boards it would be great!

 

-R

 

Share this post


Link to post
Share on other sites
On 8/3/2020 at 7:17 PM, victroniko said:

About /etc/modprobe.d/esp8089.conf - already gone, first tests were done on 20.05.6, after the wipe I mentioned earlier i'm on 20.08.0 now. What I do find strange, is that relying on default setting does not work. Passing the crystal_26M_en=0 parameter did the trick, on this board at least... Every test was with an inmediate power off-on cycle instead of a reboot, to discard possible quirks from the already initialized (firmware loaded) ESP8089 chip.

Ok, that's interesting, you can then to put options esp8089 crystal_26M_en=0 in /etc/modprobe.d/esp8089.conf to see if it works like being modprobed manually. I'll definitely add this conf file in the final distribution.

 

On 8/3/2020 at 7:17 PM, victroniko said:

offtopic. I said I don't know C/C++, that's true... But I did some things in VB6 many years ago, it's not as if I saw modern code and felt totally lost.. And my day-job is electronics so I understand quite a bit how microcontrollers work 

Doing some research about the es8089, it turns out that it is nothing different than an esp8266 with less pins and interfaces. esp8266 is a very cheap and flexible microcontroller that is pretty assimilated as "the arduino with wifi". Some people attached the esp8266 modules to sdio pins of raspberry pi zero to gain wifi and this esp8089 driver module is the software part to make it work: https://hackaday.com/2016/04/21/usb-less-wifi-for-the-pi-zero/

 

15 hours ago, Rajesh said:

Just wondering if this will also work on ARMv8 64 bit boards? Probably not, but if there is a similar solution for this on other boards it would be great!

Usually kernel driver source code is happy to compile on both 32 and 64 bit modes without any modification, so there good chances it will!

Share this post


Link to post
Share on other sites
2 hours ago, jock said:

Ok, that's interesting, you can then to put options esp8089 crystal_26M_en=0 in /etc/modprobe.d/esp8089.conf to see if it works like being modprobed manually. I'll definitely add this conf file in the final distribution.

 

Doing some research about the es8089, it turns out that it is nothing different than an esp8266 with less pins and interfaces. esp8266 is a very cheap and flexible microcontroller that is pretty assimilated as "the arduino with wifi". Some people attached the esp8266 modules to sdio pins of raspberry pi zero to gain wifi and this esp8089 driver module is the software part to make it work: https://hackaday.com/2016/04/21/usb-less-wifi-for-the-pi-zero/

 

Usually kernel driver source code is happy to compile on both 32 and 64 bit modes without any modification, so there good chances it will!

 

Can you point me to the location of source code for the driver files you have uploaded?

 

Thanks you.

-R

Share this post


Link to post
Share on other sites

@jock and @fabiobassa

 

You are awesome! I only had time to try the new wifi driver now, and it worked like magic, very smoothly!

 

I tried both 2.4G and 5G and both worked fine, with a nice speed!

 

Thank you very much again!

Share this post


Link to post
Share on other sites

Okay, I know this isn't the right place to ask and probabily the moderators will remove this but I can't find it anywhere else and really need to ask. Can someone who have the "TV Box MXQ Pro 4k 5G" board R3229Q_V8.0 2019.05.30 wifi ssv6256p upload a multitool backup of the android firmware and share the link? I broke mine tryng to update the supersu and now I can't use android anymore.

 

Thank you in advance and sorry for any inconvenience

Share this post


Link to post
Share on other sites
11 hours ago, fabiobassa said:

 

Thank you but didn't work. Scishion is 2GB Ram and my box is only 1gb. I have already tried so many firmwares with no lucky. Also, I don't have A-A USB cable, so I can only try single img files through rockchip's SD Firmware Tool; that's why I was asking for a backup file, so I can use multitool to restore it.

 

P.S. Why I can only post once a day in this forum?

Share this post


Link to post
Share on other sites

I don't know if there is a limitation in reading less ram due wrong dtb.

Sure if you have 2 giga and dtb is for 1giga it will read only 1g but I am not aware of the opposite .

Sure @jock can be more precise on this.

My shishion is 16 giga/1giga ssv6x5x and that firmware is ok on it

Sorry no whole dump but a male male usb would definitely help you in reprogramming or if you still have original partitions ( boot trust resources etc etc ) you can unpack the firmware as DD it from Linux. But if your nand or emmc is erased I don't know a procedure for dding unless a whole dump

 

The limitation about one post is because you are new on here I guess

 

Would you post some photos of board for helping in recognizing it 

Share this post


Link to post
Share on other sites
13 hours ago, fabiobassa said:

I don't know if there is a limitation in reading less ram due wrong dtb.

Sure if you have 2 giga and dtb is for 1giga it will read only 1g but I am not aware of the opposite .

Sure @jock can be more precise on this.

My shishion is 16 giga/1giga ssv6x5x and that firmware is ok on it

Sorry no whole dump but a male male usb would definitely help you in reprogramming or if you still have original partitions ( boot trust resources etc etc ) you can unpack the firmware as DD it from Linux. But if your nand or emmc is erased I don't know a procedure for dding unless a whole dump

 

The limitation about one post is because you are new on here I guess

 

Would you post some photos of board for helping in recognizing it 

Here are some photos of the board. It is 8 giga/1 giga.

 

I have the flash dump I made using multitool. Do you mean I can unpack and substitute the "broken" img, pack it back and then write the single image back in the emmc using multitool?

Share this post


Link to post
Share on other sites
34 minutes ago, fabiobassa said:

I have seen quite all kind of boards 

https://ibb.co/1m81xth

and if you have the whole dump you can restore it with @jock multitool with a simple dd I guess

The problem my dump was made with the system broken already

Share this post


Link to post
Share on other sites

@jaum20 
oh, SMH , I missed the point that the dump itself is corrupted

Well this is a chicken egg problem. Try this:
unpack the firmware I send you (rk3229_8.1_MX1VR_SSV6256_zhongx_20180925_v002_Spectek.zip) with imgRePackerRK_106.zip you can find some post earlier

You will obtain even recovery.img and  system.img . Try to dd those parts on the board

Just a test not sure if will work

Share this post


Link to post
Share on other sites

When do you say dd the .imgs, do you mean to connect the board to a Linux pc and use the dd command?

Share this post


Link to post
Share on other sites
On 8/9/2020 at 10:18 PM, jaum20 said:

When do you say dd the .imgs, do you mean to connect the board to a Linux pc and use the dd command?

You can use the multitool to dd image files directly on the device: it has a fully functional bash shell to do such kind of maintenance tasks. Nonetheless you need to do know what you are doing.

Maybe you can burn the "bad" backup you made and then burn the rootfs from the image @fabiobassa provided. You need to do some juggling with the original image, but if you are able to do so you can try.

 

Your board is a new revision of the r329q family. In alternative you may have more luck tryingr other images for boards which are older r329q revisions (v2.0, v3.0, v7.0, ...)

Share this post


Link to post
Share on other sites
6 hours ago, nokirunner said:

@jockI would like to ask you something, are the images updated with all recent fixes? I mean drivers for wifi, 3d acceleration, etc ..

Not yet, I will do that soon, maybe in a couple of days or so

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
12 12