CSC Armbian for RK322X TV Boxes


Recommended Posts

Thank you for enlightening me, I managed to overclock my rk3228a to 1.46Ghz stable and it only needed an adjustment to the clock latency. Now there is a massive improvement in performance 1.2Ghz to 1.46Ghz with the memory clocked to 2133mhz and the gpu to 700mhz and it is pretty stable. I can finally play quake 3 very smoothly. Thanks a lot

Link to post
Share on other sites
Donate and support the project!

23 hours ago, Yeoj Henrie Sayadi said:

Thank you for enlightening me, I managed to overclock my rk3228a to 1.46Ghz stable and it only needed an adjustment to the clock latency. Now there is a massive improvement in performance 1.2Ghz to 1.46Ghz with the memory clocked to 2133mhz and the gpu to 700mhz and it is pretty stable. I can finally play quake 3 very smoothly. Thanks a lot

Glad to hear that ;)

I tried running Quake2 on stock frequencies with Mali libraries, it worked but after I while I had issues from Mali kernel driver. It was long ago and also installation was not yet in a stable status.

BTW, I'm interested in your clock latency adjustment, can you describe what you did and what problem it addressed? It is my feeling that there is still something not properly right that causes some boxes to be a bit unstable, so I'm looking for any experience that could increase general stability.

Thank you!

Link to post
Share on other sites

I just changed clock-latency = <0x9c40> to clock-latency = <0xc350> and it made being able to clock to 1464Mhz possible and it is pretty stable. You can see the performance improvements below

Clock Speed           1464Mhz     1200Mhz
CPU Blowfish         9.71             11.80
CPU Fibonacci        2.78             3.40
CPU N-Queens       16.60           18.38
FPU FFT                 11.65           13.83
FPU Ray Tracing     7.90             9.69

lower is better

CPU Z-lib                0.09             0.08

CPU CryptoHash     100.98         81.32

higher is better

 

Clock Speed      750Mhz    400Mhz
glmark2 Score   57             57

how do I remove the fps limit? glmark2 is limited to 60 fps while Quake 3 is limited to 15 even when staring at the floor or when shooting enemies.

Here's the dtb I used https://cdn.discordapp.com/attachments/699217226020028456/732893355738005564/rk322x-box.dtb

Link to post
Share on other sites
7 hours ago, Yeoj Henrie Sayadi said:

how do I remove the fps limit? glmark2 is limited to 60 fps while Quake 3 is limited to 15 even when staring at the floor or when shooting enemies.

It's the vsync, I don't know if it is possible to disable it with the current Mali drivers. 15fps in Quake3 also is a vsync limit (60/4)

Link to post
Share on other sites
11 hours ago, Yeoj Henrie Sayadi said:

Hello, the RAM seems to have become the bottleneck now. No changes in the dtb makes no difference whatsoever. How do I make it so that I can control the ram?

Hello,

memory performance is a bit problematic. The frequency is fixed at boot time to 300 Mhz for DDR2 and 600 Mhz for DDR3 boxes. There are three main reasons:

  1.  there is a constraint against an internal clock running at 1200 Mhz and RAM must be an integer divisor of that frequency (1200/300 = 4, 1200/400 = 3)
  2. the kernel memory controller driver, that does the memory reclocking up to 800 Mhz, needs the proprietary rockchip trust os to work, but since I use an open source trust os (OPTEE) here, it will never work
  3. DRAM chips among boards are different and may have different access timings, so something that works for a box may not work for another one, even if it is configured at the very same frequency. Sometimes the boards are so cheap the manufacturer installs faulty memory banks that are not even able to work at their rated frequency. To reduce the number of non-booting boards, I chose to take the conservative approach, which is also enforced by the limits of the point 1

Changing the dram frequency is not an easy task: you need the right ddrbin (the binary piece of code that initializes the DRAM), recompile u-boot, glue them together with the trust os to produce the idbloader and finally install it at sector 0x40 of the flash/sdcard.

 

This is all done automatically by armbian scripts, so you can read the code to make your way through.

 

BTW, I'm taking in consideration to experiment with the ARM trusted firmware (ATF) and maybe in the future activate the DMC kernel driver to allow reclocking.

 

Link to post
Share on other sites

Hi everyone, 

 

First of all, I would like to thank @jock @fabiobassa and everyone else that have shared their knowledge here. All the information was extremely helpful and clear (the majority of the problems I had was due to lack of attention or experience)

 

I joined this adventure aiming to assemble cheap computers, with some basic resources, for children in poor communities in Brazilian countryside.  Since these TV Boxes are very popular here in Brazil, they seemed to be a nice option for me. After I acquired my box and after some research, I came to find the Armbian project and particularly this forum.

 

I managed to install the stable image "Armbian_20.05.6_Rk322x-box_focal_legacy_4.4.194_desktop"  in the NAND flash internal memory, but now the wifi does not work.

 

I'm a newbie linux user, maybe my mistake is just silly and probably I'll share too much information now, but It's just me trying to be as clear as possible.

 

Board Specifications

-> The TV Box I bought is named "MX9 5G 4K".  His manual has about zero information, but using net, this forum and opening the box, I found some information

-> RAM: DDR3 1 GB  ; ROM: Onboard Flash 8 GB (I guess) ; 4 USB Ports

-> Using the hexdump command (thanks for this tip), I found out that it is a RK3228 board (despite it's written 3229 in the board). But I'm still not sure if it is a RK3228a or RK3228b

uc?export=view&id=1qRRfpFMZh6tm7hguzj6PR

-> When I opened the box, I found out that the wifi chip it's an SV6256P (and this is probably the source of my problems)

 

Symptoms

1) In the desktop, when I click in the wifi icon, I get this (device not ready):

uc?export=view&id=1Ys-OIG4uLj0AOw1my9wvk

 

2) When I try to connect using the "nmtui" command in the terminal (according to armbian documentation), I get this:

uc?export=view&id=1b8u3w45g2-tDHq-XRXGbY

 

3) When I run "armbian-config" and go to Network submodule, I can't find wireless option

uc?export=view&id=1y-c2vTOThAmb0fqmjngGB

 

4) Finally, when I run "dmseg | grep wlan", I get this

uc?export=view&id=1fhsAAvnOQfnoxYOr_Pqt4

 

Actions I already tried

1) I already tried apt-get update / upgrade
2) I remove blacklist file (despite sv6051 was already commented)

3) In rk322x-config, I tried all set of combinations (3228a, b and two leds settings)

 

Questions and final comments

I read the previous messsages here and I realized that @nokirunner also has an SV6251 wifi device and he is also struggling with this. And apparently there is no drive support for this device (that's what I understood).

 

But I read that sometimes the 6051 drive works for this chip, so I just want to make sure that I'm trying this correctly.

 

I also read that @fabiobassa mentioned the original firmware (rk3229_8.1_MX1VR_SSV6256_zhongx_20180925_v002_Spectek.zip) and I'm not sure if I'm using it and I don't know where to find it.

 

That's all

 

Thank you in advance!

Link to post
Share on other sites

@DaviMesquita

first of all let say my appreciation for your effort to bring cheap computers for people who hasn't access to better resources, this does justice to you.

Those boxes are perfect for this purpose and the performances are overall good. Now straight to problems:


 nmtui wants NO arguments.

 

Just NMTUI and you will have a pop up new window
nmtui -connect is a unknown command

Your wifi will NOT work unfortunately. We tried some ideas but the driver is incomplete so no luck.And the driver for 6051 wil NOT work . I can realize it is  important but you have to use wired or with wifi dongle. We are waiting for new kernel release.. maybe we are more lucked.

Last question I didn't understand. Do you want just know where download the rom or do you physically need it ?

Cheers


edit:
https://chinagadgetsreviews.com/download-android-8-1-stock-firmware-for-scishion-model-x-tv-box.html

and choose the amanonaws link

Link to post
Share on other sites

Wifi Issue

Thank you very much, @fabiobassa

 

I just wanted to make sure that I tried everything about this wifi issue. Now I can rest in peace :D

 

I guess I was a little bit unlucky about the hardware I bought. Also, I wasn't aware about the high varienty amongst these TV Boxes. Next time I'll look here before I buy anything and I'll look for a more suitable and commom box (If someone want to suggest a good option, I would appreaciate too).

 

-----------------------------------------------------------

Multimedia - Youtube

Another topic I'd like to bring is about the performance on running youtube videos. I tried to run some videos on youtube, using chromium (I'll try firefox next time) and the performance was really bad, even for low resolution videos. 

 

I also realized that the video players were also slow. Then I tried the turorial below and I got great results when I run the following command:
"mpv --hwdec=rkmpp -vo=gpu --gpu-api=opengl --gpu-context=drm --opengl-es=yes <video_file>"

 

But the performance on youtube is still bad

 

Is there any way to use gpu when I run youtube videos or any other way to improve the perfomance of this task?

 

Thanks!

 

 

Link to post
Share on other sites
14 minutes ago, DaviMesquita said:

I just wanted to make sure that I tried everything about this wifi issue. Now I can rest in peace :D

 

Hi @DaviMesquita, yes with these boxes it is quite random due to all the hardware differences on the "same models". Personally I have found that looking at the various DTB files help (once you have converted them to DTS) and even managed to solve a few small issues for my boxes. 

 

BTW my SSV6051 loads perfectly and works on 2.4Ghz, which as far as I recall is correct since it doesn't support 5Ghz on the CSC RK322x image. You might want to test this one as well just to be sure.

 

image.thumb.png.34210d10f4475ca50f7e0946ca929445.png

 

Here is my mntui output:

image.png.a6a1236f0f08d1ea7311f4dec65e2b7d.png

 

One thing you can try is the DTB file changes, the other I read somewhere is using the Wi-Fi p2p0 since somebody said somewhere they could only get it working on p2p0 but not on wlan0 interface.

 

Regarding your thought for using this in lower income households, perfect, I thought about the same in South Africa. The only issue is getting consistent hardware, and I now believe the only way manufacturing in Taiwan at a slightly higher cost. But with the whole covid think it might actually be worthwhile in our developing countries...

 

Good luck!

Link to post
Share on other sites

@DaviMesquita

For those boxes is really a jungle !!

Those Chinese tend to grab the first avaible cheap chip and put inside so a big variety of possibilities.

@Jock contacted me and maybe now is the moment to " put hands " in this sluttish driver.

 

@Ztrawberry the driver for ssv6051 doesn't suit sv 6x5x this is the problem and that project for a universal image is a nice idea but me and jock and other clever programmers  ( the same man  that bring libreelec to life on those boards @knaerzche ) own so many different boards that  has been reached great maturity  on rk 322x . Mostly bugs are well known ( ssv6x5x among others) and still working on them

Of course support , ideas and suggestions are highly appreciated

Link to post
Share on other sites

As I already wrote, I have a box with a faulty sv6051.
There is also a similar board with rtl8703bs (these boards have two slots for wifi).
I got two rtl8723cs chips (according to scant information from the Internet rtl8703bs and
rtl8723cs pin to pin compatible).
Since Armbian uses the 8723cs driver for rtl8703bs, I hoped that i simply  replace the

chip and there will be happiness. But that did not happen.
The chip is not initialized and is not visible to the system.
After modprobe 8723cs in dmesg

[246133.282423] =======================================================
[246133.282450] ==== Launching Wi-Fi driver! (Powered by Rockchip) ====
[246133.282467] =======================================================
[246133.282487] Realtek 8723CS SDIO WiFi driver (Powered by Rockchip,Ver v5.2.1.7_25082.20171108_COEX20170626-1a00_wifi_hal) init.
[246133.282513] [WLAN_RFKILL]: rockchip_wifi_power: 1
[246133.282533] [WLAN_RFKILL]: rockchip_wifi_power: rfkill-wlan driver has not Successful initialized
[246133.282548] mmc1:mmc host rescan start!
[246133.282561] RTW: module init start
[246133.282576] RTW: rtl8723cs v5.2.1.7_25082.20171108_COEX20170626-1a00_wifi_hal
[246133.282594] RTW: build time: Apr 26 2020 14:01:30
[246133.282623] RTW: rtl8723cs BT-Coex version = COEX20170626-1a00
[246133.282800] [WLAN_RFKILL]: rockchip_wifi_get_oob_irq: Enter
[246133.282830] [WLAN_RFKILL]: rockchip_wifi_get_oob_irq: rfkill-wlan driver has not Successful initialized

I rechecked the soldering and the environment (everything is as on the working board with

8703bs)
It may be that for the 8723cs to work in Armbian, some other manipulations are needed at

the level firmware or drivers?

RTL8703BS.png

Link to post
Share on other sites

@DaviMesquita unfortunately, as @fabiobassa already said, ssv6256p is not yet supported because the driver is missing. The source code is available and we did experimentation with, it also compiles but once I load it, the kernel crashes. We could not get further for an usable interface, so we parked it to work on other tasks. I can definitely do some more experiments to try to get it on, but indeed the driver is so messy it makes the debug an even harder task.

 

A bad thing that makes people do mistakes is the fact that both ssv6051p and ssv6256p share the same vendor and device ID (3030:3030), so you need to open it to understand if the chip is one or the other; nonetheless the ssv6256p has support for 802.11a (the 5 Ghz bands), which is not present at all in ssv6051p and if the board has the first chip you usually see large "5G" letters on the box. rk322x-config also is unable to distinct between the two chips.

 

If you're planning to buy other boxes, I would rather suggest to keep an eye on rk322x boxes with bluetooth: usually they get realtek or ampak (=broadcom) chips which should have better support, even with mainline kernels.

 

About chromium, there may be some tricks to speedup the rendering and the video decoding, but I didn't experiment them yet on the rk322x. We talked about trying to recompile chromium and make experiments which may make things faster, it's on our TODO list.

Link to post
Share on other sites
5 hours ago, Maker39 said:

It may be that for the 8723cs to work in Armbian, some other manipulations are needed at

the level firmware or drivers?

Well, for what I can say the 8703bs worked only using the rtl8723cs driver: not the 8723bs, not the 8723ds, but only the 8723cs one, but never had the chance to try a real rtl8723cs chip.

 

Since you did some kind of chip transplantation :rolleyes: you should first understand if the chip is correctly communicating on the SDIO bus. You can look for dwmmc (SDIO bus should be dwmmc@30010000 device) messages in dmesg, then look into /sys/bus/mmc1 for important informations (like vendor and device id of the chip). Once you're sure the hardware level is ok, then you may work further for software issues.

Link to post
Share on other sites
1 hour ago, Yeoj Henrie Sayadi said:

These boxes are really nice. After 2 days of compiling 0ad (yes it took that long) I need to allocate more vram as I am getting segmentation fault. I have tried many different things but nothing worked. Is it possible to allocate more ram for the gpu? How?

VRAM is allocated on demand, there isn't any option to allocate is statically. Mali OpenGL ES can be very picky, and often results in segmentation fault just because the game does something the libraries dislike.

Link to post
Share on other sites

Thank you again, everyone.

 

@Ztrawberry, if you don't mind, could send me an e-mail so we can keep in touch and share our findings and ideas about these devices. Unfortunately, I'm not allowed to send private messages here.

 

My e-mail is davimesq@gmail.com

 

Best regards,

Link to post
Share on other sites

Hello all, first obviously a BIG thanks to @jock @fabiobassa and everyone else here. Great work!

 

On my device, installing legacy desktop to NAND was totally flawless.  Everything (except WiFi, you'll see why) works out-of-the-box including rebooting, and performance is acceptable if a bit laggy on X11... But I don't mind 'cause I'll switch to a minimal image later, this box will become a multi-service server. I just wanted to toy around with the desktop for a while.

 

I've spent some time reading all of this thread :P and guess what: I have ANOTHER different board lol:

 

Spoiler

88W6f44.jpg

 

LWCf7lj.jpg

 

HUEs19G.jpg

 

 

 

 

 

Yep, that's an ESP8089 chip for WiFi, not supported (yet?). Bummer because I needed that functionality... Can you add the driver for this chip on future images? Naturally I'm willing to help testing/debugging.  I'm no programmer but for now i'll try cloning the repo and see if compiling the driver gets this chip working. 

 

One more thing: I've only tested legacy image, am I right to assume there is no ESP8089 support on mainline image also?

 

Greetings and thank you.

Link to post
Share on other sites

Hello @victroniko, very glad you find our work useful!

 

Well, it looks like there's another wifi chip in the cauldron of rk322x boxes :rolleyes:

Found some informations about the ESP8089 on the linux-sunxi site which points to this other repository that already has some kernel integration and, most of all, the firmware files.

 

I managed to integrate it very easily into rockchip 4.4 kernel, and compiled it into a kernel module: esp8089.ko.gz

 

Now first of all download the three firmware files from the jwrdegoede's repository I linked above and put them in /lib/firmware

 

Copy that file in your box root and then execute:

gzip -d esp8089.ko.gz
mv esp8089.ko /lib/modules/4.4.194-rk322x/kernel/drivers/net/wireless
depmod
modprobe esp8089 config=crystal_26M_en=2

This other repository (it's a fork from al177's) contains a PDF file with some compilation and usage informations from ESP8089 manufacturer you may wish to try in case it does not really work.

It looks like the chip also requires some GPIO juggling to make it work: the original device tree (DTB or resource.img) of the board could be very helpful here. Also dmesg log is always very helpful!

 

Here you can download the kernel headers as a DEB package. You will need to install this in case you want to compile the driver directly on the board. Install it this way:

sudo su
export ARCH=arm
dpkg -i linux-headers-legacy-rk322x_20.08.0-trunk_armhf.deb

 

Link to post
Share on other sites

Well, as I said i'm no programmer :) but I know my way into the firmware world, more or less...

 

I've put the 3 firmware files for ESP8089 where they belong, did what you said and tried to insmod the module, no luck. I can see it loaded ok but no error message, nothing on dmesg, silence. The driver most likely expects the right GPIO parameters to initialize the chip. 

 

So, next was to hunt for the device tree from stock Android. Never did that before (I know there must be an easier way), but after a lot of cursing i've managed to extract DTB succesfully - directly from Multitool's backup of my box: 

 

Spoiler

 

First, on Windows 10: 

  • Uncompress backup with 7-Zip
  • Install binwalk from source (already had Python)
  • Run binwalk on backup, search for 1st "Flattened device tree" entry
  • Annotate offset & size
  • Extract the relevant block with HxD Editor to a .dtb file
  • Put file on a USB drive

0TL2WdQ.png

 

Then on Armbian (can't get device-tree-utils on W10):

  • dtc -I dtb -O dtc -f <mybox_dtb_file> -o <mybox_dts_file>

 

 

 

Success! Here are the following files (can't attach to post, new user liimitation):

  1. Extracted DTB file
  2. Converted DTS, not sure if I did it right because:
  3. Log of dtc command complaining a LOT about DTB file
  4. efuse0 dump - please confirm, I have RK3229 right?

IDK if all this could be automated directly on multitool, but if positive that'll be nifty...

 

Now about the chip, I thiiiink I might be able to make it work with jwrdegoede's instructions, but I saw many errors about vregs and sdio lines and ugghh.. Truth is my workplace called and I was needed urgently there. On a saturday.  Worked all day, can't focus anymore, need sleep bad, zzzz...

 

ps. a little gift as thanks, a speedier Firefox on the MXQ box! ;) https://github.com/The-foxPEP-Project/foxPEP (works everywhere, in fact I've used it from long ago on my vintage PowerPC Macs).

Edited by victroniko
typos
Link to post
Share on other sites

@victroniko Great job indeed, extracting the device tree "like cavemen" made me laugh :) There are other ways, but all of them are not easier and still requires some steps.

 

From the logs you provided I can see from dmesg that the chip itself is not recognized at all:

Spoiler

paolo@raziel:~/rk3229/esp8086 dtb victroniko$ egrep 'mmc1|30010000' dmesg.txt
[    3.719868] dwmmc_rockchip 30010000.dwmmc: num-slots property not found, assuming 1 slot is available
[    3.719977] dwmmc_rockchip 30010000.dwmmc: IDMAC supports 32-bit address mode.
[    3.720117] dwmmc_rockchip 30010000.dwmmc: Using internal DMA controller.
[    3.720138] dwmmc_rockchip 30010000.dwmmc: Version ID is 270a
[    3.720213] dwmmc_rockchip 30010000.dwmmc: DW MMC controller at irq 46,32 bit host data width,256 deep fifo
[    3.720287] dwmmc_rockchip 30010000.dwmmc: No vmmc regulator found
[    3.720301] dwmmc_rockchip 30010000.dwmmc: No vqmmc regulator found
[    3.720324] dwmmc_rockchip 30010000.dwmmc: GPIO lookup for consumer wp
[    3.720336] dwmmc_rockchip 30010000.dwmmc: using device tree for GPIO lookup
[    3.720351] of_get_named_gpiod_flags: can't parse 'wp-gpios' property of node '/dwmmc@30010000[0]'
[    3.720360] of_get_named_gpiod_flags: can't parse 'wp-gpio' property of node '/dwmmc@30010000[0]'
[    3.720370] dwmmc_rockchip 30010000.dwmmc: using lookup tables for GPIO lookup
[    3.720380] dwmmc_rockchip 30010000.dwmmc: lookup for GPIO wp failed
[    3.720478] dwmmc_rockchip 30010000.dwmmc: allocated mmc-pwrseq
[    3.731916] mmc_host mmc1: Bus speed (slot 0) = 2343750Hz (slot req 400000Hz, actual 390625HZ div = 3)
[    3.744618] dwmmc_rockchip 30010000.dwmmc: 1 slots initialized
[    4.098145] mmc_host mmc1: Bus speed (slot 0) = 2343750Hz (slot req 300000Hz, actual 292968HZ div = 4)
[    4.150250] mmc_host mmc1: Bus speed (slot 0) = 2343750Hz (slot req 200000Hz, actual 195312HZ div = 6)
[    4.202331] mmc_host mmc1: Bus speed (slot 0) = 2343750Hz (slot req 100000Hz, actual 97656HZ div = 12)

This above is an extract of your dmesg. dwmmc@30010000 is the MMC controller (in the SoC) and the SDIO chip (the ESP8089) is attached to it. The controller works ok, but the chip is not recognized: as you can see from the last 5 lines, the kernel tries to detect something on that bus lowering the frequency 4 times, then gives up.

 

This instead is a box of mine where the chip is correctly detected:

Spoiler

root@rk322x-box:/sys/class# dmesg | egrep 'mmc1|30010000'
[    3.789785] dwmmc_rockchip 30010000.dwmmc: num-slots property not found, assuming 1 slot is available
[    3.789891] dwmmc_rockchip 30010000.dwmmc: IDMAC supports 32-bit address mode.
[    3.790045] dwmmc_rockchip 30010000.dwmmc: Using internal DMA controller.
[    3.790072] dwmmc_rockchip 30010000.dwmmc: Version ID is 270a
[    3.790154] dwmmc_rockchip 30010000.dwmmc: DW MMC controller at irq 46,32 bit host data width,256 deep fifo
[    3.790232] dwmmc_rockchip 30010000.dwmmc: No vmmc regulator found
[    3.790244] dwmmc_rockchip 30010000.dwmmc: No vqmmc regulator found
[    3.790266] dwmmc_rockchip 30010000.dwmmc: GPIO lookup for consumer wp
[    3.790276] dwmmc_rockchip 30010000.dwmmc: using device tree for GPIO lookup
[    3.790291] of_get_named_gpiod_flags: can't parse 'wp-gpios' property of node '/dwmmc@30010000[0]'
[    3.790303] of_get_named_gpiod_flags: can't parse 'wp-gpio' property of node '/dwmmc@30010000[0]'
[    3.790311] dwmmc_rockchip 30010000.dwmmc: using lookup tables for GPIO lookup
[    3.790321] dwmmc_rockchip 30010000.dwmmc: lookup for GPIO wp failed
[    3.790556] dwmmc_rockchip 30010000.dwmmc: allocated mmc-pwrseq
[    3.803434] mmc_host mmc1: Bus speed (slot 0) = 976562Hz (slot req 400000Hz, actual 244140HZ div = 2)
[    3.816143] dwmmc_rockchip 30010000.dwmmc: 1 slots initialized
[    3.863585] mmc_host mmc1: Bus speed (slot 0) = 50000000Hz (slot req 50000000Hz, actual 50000000HZ div = 0)
[    3.866293] mmc1: new high speed SDIO card at address 0001

You can see that there is just one detection attempt at 400KHz, then the frequency is pushed up at 50MHz and the SDIO "card" is finally detected.

 

Now this is the first problem at all, so we need to let the kernel detect the chip first, otherwise we don't get far. Looking in the device tree you provided, I found a couple of things that may be important. One, which maybe is the most important, is this:

Spoiler

wireless-wlan {
        compatible = "wlan-platdata";
        wifi_chip_type = "esp8089";
        sdio_vref = <0x708>;
        WIFI,poweren_gpio = <0x7b 0x1b 0x00>;
        WIFI,host_wake_irq = <0x74 0x1c 0x00>;
        status = "okay";
    };

tells us that the GPIO that give power to the chip is "0x7b 0x1b", which translates to human readable to the active low pin #27 of gpio bank #2. The SoCs have usually several banks of GPIO pins (RK322x have 4) and each bank has several GPIO pins itself (each RK322x bank has 32) attached to the various peripherals and leds. The pin #27 of the gpio bank #2 is attached to the Wifi chip power on/off switch.

 

Comparing this with the device tree supplied with armbian, I can see that the pin which is usually connected to the Wifi power switch is the #26, so probably we need to adjust this to properly power the chip.

 

I crafted a device tree overlay which can be useful: rk322x-wlan-esp8089.dtbo

Put this dtbo file in /boot/dtb/overlay directory, then edit /boot/armbianEnv.txt and append wlan-esp8089 to the overlays line, then reboot and look if dmesg is showing the "new high speed SDIO card" string.

 

Once there, you may try again to modprobe (there are differences between insmod and modprobe, you can consult the manpages for that) the esp8089 kernel driver and see what happens!

 

 

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

wow compliments for the idea of extracting the dtb via binwalk, a bit long but a ingenious idea !!

 

Thanks @fabiobassa... just wanted to see if this could be automated in a script w/no need of any specific Rockchip tool, for an idea I have...

 

 

18 hours ago, jock said:

Once there, you may try again to modprobe (there are differences between insmod and modprobe, you can consult the manpages for that) the esp8089 kernel driver and see what happens!

 

Sorry, last post I meant modprobe not insmod...

 

Almost there! :) with your DTB overlay I got this:

 

Spoiler

victor@rk322x-victor:~$ dmesg | egrep 'mmc'
[    3.694076] dwmmc_rockchip 30000000.dwmmc: IDMAC supports 32-bit address mode.
[    3.694273] dwmmc_rockchip 30000000.dwmmc: Using internal DMA controller.
[    3.694299] dwmmc_rockchip 30000000.dwmmc: Version ID is 270a
[    3.694418] dwmmc_rockchip 30000000.dwmmc: DW MMC controller at irq 45,32 bit host data width,256 deep fifo
[    3.694503] dwmmc_rockchip 30000000.dwmmc: No vmmc regulator found
[    3.694515] dwmmc_rockchip 30000000.dwmmc: No vqmmc regulator found
[    3.694545] dwmmc_rockchip 30000000.dwmmc: GPIO lookup for consumer cd
[    3.694554] dwmmc_rockchip 30000000.dwmmc: using device tree for GPIO lookup
[    3.694596] of_get_named_gpiod_flags: parsed 'cd-gpios' property of node '/dwmmc@30000000[0]' - status (0)
[    3.694664] dwmmc_rockchip 30000000.dwmmc: Got CD GPIO
[    3.694674] dwmmc_rockchip 30000000.dwmmc: GPIO lookup for consumer wp
[    3.694684] dwmmc_rockchip 30000000.dwmmc: using device tree for GPIO lookup
[    3.694696] of_get_named_gpiod_flags: can't parse 'wp-gpios' property of node '/dwmmc@30000000[0]'
[    3.694708] of_get_named_gpiod_flags: can't parse 'wp-gpio' property of node '/dwmmc@30000000[0]'
[    3.694716] dwmmc_rockchip 30000000.dwmmc: using lookup tables for GPIO lookup
[    3.694728] dwmmc_rockchip 30000000.dwmmc: lookup for GPIO wp failed
[    3.707606] mmc_host mmc0: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
[    3.720712] dwmmc_rockchip 30000000.dwmmc: 1 slots initialized
[    3.721214] dwmmc_rockchip 30010000.dwmmc: num-slots property not found, assuming 1 slot is available
[    3.721322] dwmmc_rockchip 30010000.dwmmc: IDMAC supports 32-bit address mode.
[    3.721466] dwmmc_rockchip 30010000.dwmmc: Using internal DMA controller.
[    3.721488] dwmmc_rockchip 30010000.dwmmc: Version ID is 270a
[    3.721562] dwmmc_rockchip 30010000.dwmmc: DW MMC controller at irq 46,32 bit host data width,256 deep fifo
[    3.721661] dwmmc_rockchip 30010000.dwmmc: No vmmc regulator found
[    3.721675] dwmmc_rockchip 30010000.dwmmc: No vqmmc regulator found
[    3.721700] dwmmc_rockchip 30010000.dwmmc: GPIO lookup for consumer wp
[    3.721708] dwmmc_rockchip 30010000.dwmmc: using device tree for GPIO lookup
[    3.721723] of_get_named_gpiod_flags: can't parse 'wp-gpios' property of node '/dwmmc@30010000[0]'
[    3.721736] of_get_named_gpiod_flags: can't parse 'wp-gpio' property of node '/dwmmc@30010000[0]'
[    3.721745] dwmmc_rockchip 30010000.dwmmc: using lookup tables for GPIO lookup
[    3.721754] dwmmc_rockchip 30010000.dwmmc: lookup for GPIO wp failed
[    3.721857] dwmmc_rockchip 30010000.dwmmc: allocated mmc-pwrseq
[    3.733285] mmc_host mmc1: Bus speed (slot 0) = 2343750Hz (slot req 400000Hz, actual 390625HZ div = 3)
[    3.746043] dwmmc_rockchip 30010000.dwmmc: 1 slots initialized
[    4.098666] mmc1: queuing unknown CIS tuple 0x01 (3 bytes)
[    4.106308] mmc1: queuing unknown CIS tuple 0x1a (5 bytes)
[    4.109548] mmc1: queuing unknown CIS tuple 0x1b (8 bytes)
[    4.110757] mmc_host mmc1: Bus speed (slot 0) = 50000000Hz (slot req 50000000Hz, actual 50000000HZ div = 0)
[    4.112938] mmc1: queuing unknown CIS tuple 0x80 (1 bytes)
[    4.113063] mmc1: queuing unknown CIS tuple 0x81 (1 bytes)
[    4.113191] mmc1: queuing unknown CIS tuple 0x82 (1 bytes)
[    4.113265] mmc1: new high speed SDIO card at address 0001
victor@rk322x-victor:~$ 

 

No idea what those "queuing unknown CIS tuple" errors mean... Then after sudo modprobe esp8089 config=crystal_26M_en=2:

 

Spoiler

victor@rk322x-victor:~$ dmesg
.
.
.
[  404.951204] IPv6: ADDRCONF(NETDEV_UP): p2p0: link is not ready
[  404.954909] IPv6: ADDRCONF(NETDEV_UP): p2p0: link is not ready
[  405.021791] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[  405.166880] IPv6: ADDRCONF(NETDEV_UP): p2p0: link is not ready
victor@rk322x-victor:~$

 

With this, NetworkManager finally got 2 new interfaces: p2p0 with 'device not ready' and wlan0 with 'disconnected'. But still no networks showing up...

 

Fiddling with things I noted you told me to put fimware files in /lib/firmware, and esp8089.ko on /lib/modules/4.4.194-rk322x/kernel/drivers/net/wireless. But on these folders most files go into their own subfolders... So I tried creating new ones: moved esp8089.ko to /lib/modules/4.4.194-rk322x/kernel/drivers/net/wireless/esp8089, and all eagle_fw*.bin to /lib/firmware/esp8089. Unloaded the module, then ran depmod and tried again.

 

This is what happened (once):

 

Spoiler

GaYVRkC.png

 

Still can't connect to any AP because of wrong interface, as I understand p2p0 is for WiFi Direct.

 

I tried rebooting and noticed that esp8089 module now loads automatically at startup, but shows 'device not ready' for both interfaces on NM. Could it be because it loads without the config=crystal_26M_en=2 parameters? Anyway, trying to rmmod then modprobe with them crashes the OS (even mouse cursor freezes) so for now, I can't reproduce the above. Because I'm an Armbian noob and don't know how to set module parameters on boot :P

 

01:14am here, time for sleep... This one-post-a-day limit is getting annoying LOL.

Edited by victroniko
more typos sigh...
Link to post
Share on other sites

@victroniko

I see promising results, very well! ;)

 

"queuing unknown CIS tuple" are not really errors, you can safely ignore them.

For what I know, p2p0 and wlan0 interfaces appears with most of these android-derived wifi drivers.

I have some boards with ssv6051 wifi chip and I have to connect using p2p0 interface because wlan0 always crashes kernel, don't know really why, I never spent time into.

 

About the autoloading of the esp8089 module at startup, you can create a file in /etc/modprobe.d/esp8089.conf and put this content into:

options esp8089 crystal_26M_en=2

so when the module is autoloaded, it is also given the appropriate module parameter.

 

As another hint, to test the firmwares and things avoid the Network Manager. It is slow and has latency, and does not always reacts immediately. Use the command line tools to scan the networks, for example (always use sudo, or do it as superadmin, otherwise you get cached data):

sudo iwlist wlan0 scan

You may also scan the p2p0 interface and see what changes. Usually you won't get more than 10-12 access points in the list.

 

I could not find any evidence in the source code that the files should be placed in esp8089 subdirectory, so I'm not totally convinced about the firmware placement in /lib/firmware/esp8089. Double check that this is really what the kernel module wants: loading the kernel module and doing a successful scan should be enough. Every kernel module developer decides where the files are put, some wants their own subdirectory, some others don't. dmesg should tell you if the firmware was in the right position or not, always read its output very carefully!

 

Once you get sane and predictable results with iwlist, you may proceed to use the Network Manager to connect to a network. From the command line you can also use the handy nmtui tool

 

Always reboot between tests, even though I read that rmmod (prefer modprobe -r to unload a module, anyway) crashes the kernel and freezes the system, so there is no other chance :)

 

Good luck!

 

Link to post
Share on other sites

Last night I wiped NAND and installed Focal minimal-legacy image, also without a hitch :thumbup:. But armbian-config does not come by default. No biggie, just install manually and problem solved... Then I wanted to install a minimal desktop via armbian-config, and realized the option is not even there: It only offers to install full XFCE desktop+extras.

 

So what I did was to install LXDE by hand (plus few goodies: lxtask, pasystray, network-manager-gnome etc). Overall the system feels faster, and with @jock's media script/bundle  & @nokirunner 's tip about glamor, it's almost silky-smooth now. The only hitch was that lightdm refused to start at all, so I just installed lxdm, enabled autologin in the config and called it a day.

 

But that's just regular Armbian stuff... I'm at work now, when I return home i'll try my luck again with ESP8089.

 

 

On 7/27/2020 at 2:46 AM, fabiobassa said:

@victroniko

But I putted here a tool for extracting pieces from androd tool may be it was not clear.

you can use this imgRePackerRK_106.zip
 

imgRePackerRK_106.zip 176.25 kB · 2 downloads

 

Yep saw it, added to my arsenal of RK tools ;) thank you!

 

On 7/27/2020 at 7:59 AM, jock said:

About the autoloading of the esp8089 module at startup, you can create a file in /etc/modprobe.d/esp8089.conf and put this content into:


options esp8089 crystal_26M_en=2

so when the module is autoloaded, it is also given the appropriate module parameter.

 

Okay, will do that.

 

On 7/27/2020 at 7:59 AM, jock said:

As another hint, to test the firmwares and things avoid the Network Manager. It is slow and has latency, and does not always reacts immediately. Use the command line tools to scan the networks, for example (always use sudo, or do it as superadmin, otherwise you get cached data):


sudo iwlist wlan0 scan

You may also scan the p2p0 interface and see what changes. Usually you won't get more than 10-12 access points in the list.

 

Noted, thank you. I was vaguely suspecting NM's behaviour was strange, and also completely forgot about nmtui & iwlist. Spoiled by the GUI haha... I'll do this later too.

 

 

On 7/27/2020 at 7:59 AM, jock said:

I could not find any evidence in the source code that the files should be placed in esp8089 subdirectory, so I'm not totally convinced about the firmware placement in /lib/firmware/esp8089. Double check that this is really what the kernel module wants: loading the kernel module and doing a successful scan should be enough. Every kernel module developer decides where the files are put, some wants their own subdirectory, some others don't. dmesg should tell you if the firmware was in the right position or not, always read its output very carefully!

 

Once you get sane and predictable results with iwlist, you may proceed to use the Network Manager to connect to a network. From the command line you can also use the handy nmtui tool

 

Always reboot between tests, even though I read that rmmod (prefer modprobe -r to unload a module, anyway) crashes the kernel and freezes the system, so there is no other chance :)

 

Good luck!

 

I was also confused, but it just worked :huh: need to test again on this fresh install though. Also the esp8089.ko driver you compiled for me doesn't print anything to the kernel log at all. So it's difficult to debug if it loaded correctly, or complains about firmware error/mismatch/etc...

 

Thanks again!

Link to post
Share on other sites