Jump to content

CSC Armbian for RK3318/RK3328 TV box boards


jock
 Share

Recommended Posts

@markst does not sound very well to me. sp6330 and ap6330 should be the same things, maybe the former is a clone of the latter, but usually they work the same.

 

You posted the photo of this lg642 (which is an unknown chip), rk3318-config tells it is an ap6334 (bcm4334) but armbianEnv.txt has ap6330 overlay enabled. I'm very confused :unsure:

 

Anyway if it is a clone of an ap6334 (or maybe it is a real ap6334 without the metal shield), it could be that the crystal clock is not 26mhz as it usually is for ap6330/ap6334 but 24mhz.

 

In the ap6330 photo I see a 26mhz crystal in the lower right corner; the lg642 is missing such crystal so it is my uneducated guess that uses the main 24mhz crystal, but it is hard to say without having the chance to inspect closely the board and the original firmware.

Link to comment
Share on other sites

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

Here is a google drive with the original firmware. It is Android 11. Thank you for looking at this @jock

 

https://drive.google.com/file/d/18R2nMtjvPvxD18Xf9_bVmweSHnD2Z7os/view?usp=sharing

 

I have a second question about the Multitool. I did an install on a box that I customized and then backed up via the Multitool. I can then put it back on the box using Multitool recover backup. This works fine. But is there a way to put the backup image on an sd card and then boot off the sd card? I tried flashing the backup file with Etcher to another sd but it will not boot.

 

 

20220208_115909xxxx.thumb.jpg.7eed97293183a8d5cfa1122982e3ee94.jpg

 

20220208_120009xxxxx.thumb.jpg.0713dd331aebf7f874e7972bc184c574.jpg

Link to comment
Share on other sites

2 hours ago, markst said:

Here is a google drive with the original firmware. It is Android 11. T

I looked into the firmware you sent. I finally unpacked the vendor.img partition extracting from the "super" partition which is so "cool" nowadays but found no evidence of bcm4334/ap6334 nvram at all, so it is a mistery how it is possible that this phantom LG642 chip disguises as an AP6334 chip and works on that android image. Are you sure that android image makes the wifi work on that board?

 

I also extracted the dtb from the boot partition and it is a perfectly normal dts for a X88 board, so nothing fancy here. Chip type is not specified here neither, so we still don't know what we're dealing with.

 

Maybe posting dmesg log may show something about chip detection and firmware uploading.

 

2 hours ago, markst said:

But is there a way to put the backup image on an sd card and then boot off the sd card? I tried flashing the backup file with Etcher to another sd but it will not boot.

In theory it should work, there is nothing preventing that.

 

 

Link to comment
Share on other sites

32 minutes ago, jock said:

In theory it should work, there is nothing preventing that.

Wouldn't some paths be wrong? Like, the kernel is expected to be in eMMC and not SD card.

Link to comment
Share on other sites

Thanks for looking at that. I did successfully get WIFI to work on that board under Android 11. Can you point me in the right direction to get the dmesg logs

 

 

As for the image on SD it flashed successfully to the card but will not boot. 

Link to comment
Share on other sites

38 minutes ago, curse said:

Wouldn't some paths be wrong? Like, the kernel is expected to be in eMMC and not SD card.

Well it should work anyway, because there is no absolute path or boot device.

Root filesystem is specified as UUID in armbianEnv.txt, so the kernel dynamically looks for such UUID in all the block devices.

 

In fact, for the same reason, you can burn the same armbian pristine image on emmc, sdcard or USB stick and it boots equally well.

 

 

Link to comment
Share on other sites

@markst

 

Well this looks interesting

[   14.015811] kernel: brcmfmac: F1 signature read @0x18000000=0x1601a94e
[   14.042035] kernel: brcmfmac: brcmf_fw_alloc_request: Unknown chip BCM43342/1
[   15.042933] kernel: brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): clkctl 0x50
[   15.072303] kernel: brcmfmac: brcmf_ops_sdio_probe: F2 error, probe failed -19...

 

It seems clear that the kernel driver does not support this specific chip, which appears to be a BCM43342/1 (and not a regular BCM4334)
The problem has been talked about before here with no solution yet.

Link to comment
Share on other sites

@jock I have this wifi driver for x88 pro 10 in working state (link) If you're interested, maybe this could be incorporated into your release somehow? We need to patch Kernel Broadcom Wifi driver to be able to search binary blob BCM43342 /1. And to provide BCM43342/1 binary driver as well. Maybe even x88 BCM43342 bluetooth could be enable? I didn't explore it.

Link to comment
Share on other sites

51 minutes ago, awawa said:

@jock I have this wifi driver for x88 pro 10 in working state (link) If you're interested, maybe this could be incorporated into your release somehow? We need to patch Kernel Broadcom Wifi driver to be able to search binary blob BCM43342 /1. And to provide BCM43342/1 binary driver as well. Maybe even x88 BCM43342 bluetooth could be enable? I didn't explore it.

 

Well, that's really cool you did that awesome tutorial and bcm43342 bring up!

I could surely try to bring the patch in for kernel 5.15 to benefit other users and, if you consent, I would like to link your tutorial in the first page of the thread.

 

About bluetooth, that's a different story and a different driver, not the same brcmfmac used for wifi. The driver is a generic one, hopefully it should be much easier to support and there should be the need to put in /lib/firmware/brcm the right .hcd firmware file only.

 

From @markst dmesg I see this:

[   13.756708] kernel: Bluetooth: hci0: BCM: chip id 83
[   13.757622] kernel: Bluetooth: hci0: BCM: features 0x0f
[   13.759515] kernel: Bluetooth: hci0: BCM43342A
[   13.759565] kernel: Bluetooth: hci0: BCM (001.002.003) build 0000

so the bluetooth driver already detects the BCM43342A chip, but does not find the proper .hcd file, you should find the right .hcd file (usually has the same name as the chip) in the original firmware and put in /lib/firmware/brcm and try again.

Link to comment
Share on other sites

Yes, it would be great :) Of course you can link the tutorial.
Following your advice, I was probably able to locate this bluetooth file (Attached, can't test it because I'm fighting with Tanix TX6 right now ...really bad experience compared to support for rk3318).
You can find binary wifi drivers in my article.
I attach also source of patch that is necessary for the kernel (kernel\drivers\net\wireless\broadcom\brcm80211\brcmfmac\). I tried to keep it as simply as possible avoiding inserting defines in other files.

BCM43342.hcd sdio.c.patch

Link to comment
Share on other sites

i have a question , 

and sorry if it is stupid one.

but is it safe to run from emmc ?

I mean we all know how a sdcard can wear off fast and be not reliable.... what is the status for eMMC ?

 

I move from sdcard to ssh on rpi as much as possible.

should i do the same from eMMC ?
the tvbox usually have less USB port but would it be safer sacrifice a usb bot to connect a external ssd  via usb and boot from there ?
or at least run the ROOTFs from there ?

Link to comment
Share on other sites

1 hour ago, Zippy said:

i have a question , 

and sorry if it is stupid one.

but is it safe to run from emmc ?

I mean we all know how a sdcard can wear off fast and be not reliable.... what is the status for eMMC ?

 

I move from sdcard to ssh on rpi as much as possible.

should i do the same from eMMC ?
the tvbox usually have less USB port but would it be safer sacrifice a usb bot to connect a external ssd  via usb and boot from there ?
or at least run the ROOTFs from there ?

Generally speaking, armbian has some optimizations to reduce wearing when run on flash memories, like large commit times and zram logging.

I can say that it is safe to run armbian from eMMC as much as you can feel safe with an average smartphone, but probably you can be safer because there is no intent in programmed obsolesce in armbian (don't know what the average manufacturer does on smartphones...).

 

Then you have to deal with the eMMC flash memory the average box manufacturer put into their devices, which is a completely different story.

 

Link to comment
Share on other sites

Hi everyone!

 

at first I would like to thank jock for his great work.

 

It's probably kind of dumb questions, but I'll ask it anyway :D Should we use apt-get upgrade for those images? Because, when I did, the armbian seems to be crashing during next boot. It seems that rk3318-box.dst is not in a /boot/dts/rockchip directory after the upgrade, and uboot tries to boot from the mmc0 instead of mmc1. My box is H96 max 4GB/64GB which I bought really cheap due to fact it's bricked and always starts in a maskrom mode. Below is the log from uart : 

ID:0xFFF
In
DDR3
333MHz
Bus Width=32 Col=11 Bank=8 Row=16 CS=1 Die Bus-Width=16 Size=4096MB
ddrconfig:3
OUT

U-Boot SPL 2021.07-armbian (Jan 25 2022 - 12:54:45 +0000)
Trying to boot from MMC1
NOTICE:  BL31: v2.5(release):c1588782-dirty
NOTICE:  BL31: Built : 12:54:38, Jan 25 2022
NOTICE:  BL31:Rockchip release version: v1.2


U-Boot 2021.07-armbian (Jan 25 2022 - 12:54:45 +0000)

Model: Rockchip RK3318 BOX
DRAM:  4 GiB
MMC:   mmc@ff500000: 1, mmc@ff520000: 0, dwmmc@ff5f0000: 3
Loading Environment from MMC... MMC: block number 0x400000 exceeds max(0x4)
*** Warning - !read failed, using default environment

In:    serial@ff130000
Out:   serial@ff130000
Err:   serial@ff130000
Model: Rockchip RK3318 BOX
Net:   eth1: ethernet@ff550000
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1...
Found U-Boot script /boot/boot.scr
3185 bytes read in 5 ms (622.1 KiB/s)
## Executing script at 00500000
Boot script loaded from mmc 1
211 bytes read in 4 ms (50.8 KiB/s)
11502551 bytes read in 505 ms (21.7 MiB/s)
30345728 bytes read in 1321 ms (21.9 MiB/s)
Failed to load '/boot/dtb/rockchip/rk3318-box.dtb'
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
No FDT memory address configured. Please configure
the FDT address via "fdt addr <address>" command.
Aborting!
2698 bytes read in 10 ms (262.7 KiB/s)
Applying kernel provided DT fixup script (rockchip-fixup.scr)
## Executing script at 08000000
Moving Image from 0x2080000 to 0x2200000, end=3f90000
## Loading init Ramdisk from Legacy Image at 06000000 ...
   Image Name:   uInitrd
   Image Type:   AArch64 Linux RAMDisk Image (gzip compressed)
   Data Size:    11502487 Bytes = 11 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
ERROR: Did not find a cmdline Flattened Device Tree
Could not find a valid device tree
SCRIPT FAILED: continuing...
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Scanning disk mmc@ff500000.blk...
Scanning disk mmc@ff520000.blk...
fs_devread read outside partition 1024
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **
Card did not respond to voltage select! : -110
Scanning disk dwmmc@ff5f0000.blk...
Disk dwmmc@ff5f0000.blk not ready
Found 3 disks
No EFI system partition
BootOrder not defined
EFI boot manager: Cannot load any image
Card did not respond to voltage select! : -110
starting USB...
Bus usb@ff5c0000: USB EHCI 1.00
Bus usb@ff5d0000: USB OHCI 1.0
Bus usb@ff580000: USB DWC2
scanning bus usb@ff5c0000 for devices... 1 USB Device(s) found
scanning bus usb@ff5d0000 for devices... 1 USB Device(s) found
scanning bus usb@ff580000 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found

 

The other question I have is : canthe eMMC be used as additional storage while booting from SD card? I've checked and there's no additional mmcblk device in /dev. Is the eMMC configuration is missing in devicetree, or its something related to my board (faulty emmc?).   

 

Link to comment
Share on other sites

@Petroz Hi!

apt upgrade is safe as long as you mark the linux image and kernel headers as hold, because mainline armbian has no knowledge of rk3318-box and thus their packages do not contain necessary things for rk3318. It's all written in the first page in the installation instructions, apt command included.

 

10 hours ago, Petroz said:

The other question I have is : canthe eMMC be used as additional storage while booting from SD card? I've checked and there's no additional mmcblk device in /dev. Is the eMMC configuration is missing in devicetree, or its something related to my board (faulty emmc?).   

Of course, you can use the internal eMMC the way you like.

The missing device is a fault of your board, it is normally available on all boards but many boards also have faulty emmc chips.

dmesg could help.

Link to comment
Share on other sites

@awawa @markst I updated the images and deb packages with latest kernel compilation (5.15.23) and with bcm43342 patch in.

Obviously I can't test it, but if you have the chance to give it a shot and give a fallback it will be appreciated ;)

Link to comment
Share on other sites

4 hours ago, jock said:

@awawa @markst I updated the images and deb packages with latest kernel compilation (5.15.23) and with bcm43342 patch in.

Obviously I can't test it, but if you have the chance to give it a shot and give a fallback it will be appreciated ;)

Any other change @jock, need me to test anything in this new  update ?
obviously i dont have bcm43342 so would not be able to test that 
let me know

Link to comment
Share on other sites

12 hours ago, jock said:

@Petroz Hi!

apt upgrade is safe as long as you mark the linux image and kernel headers as hold, because mainline armbian has no knowledge of rk3318-box and thus their packages do not contain necessary things for rk3318. It's all written in the first page in the installation instructions, apt command included.

yes, is seems it was indeed a dumb question due to fact that the answer was already made on the first post :/ sorry for that, and thanks for pointing it out for me

 

12 hours ago, jock said:

 

Of course, you can use the internal eMMC the way you like.

The missing device is a fault of your board, it is normally available on all boards but many boards also have faulty emmc chips.

dmesg could help.

full dmesg :

https://pastebin.com/QptZ7pR4

 

but I think it's related to the part  

petroz@rk3318-box:~$ dmesg | grep mmc0
[    1.842465] mmc_host mmc0: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
[    1.888076] mmc0: Problem switching card into high-speed mode!
[    1.888184] mmc_host mmc0: Bus speed (slot 0) = 25000000Hz (slot req 25000000Hz, actual 25000000HZ div = 0)
[    1.888368] mmc0: new SDHC card at address 0001
[    1.890533] mmcblk0: mmc0:0001 SD32G 28.9 GiB
petroz@rk3318-box:~$ dmesg | grep mmc1
[    1.828197] mmc_host mmc1: card is non-removable.
[    1.841218] mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
[    1.923119] mmc_host mmc1: Bus speed (slot 0) = 50000000Hz (slot req 50000000Hz, actual 50000000HZ div = 0)
[    1.925505] mmc1: new high speed SDIO card at address 0001
[   10.104635] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac4330-sdio.rockchip,rk3318-box.bin failed with error -2

mmc0 seems to be correctly detected SD card, and mmc1 is probably eMMC, but does it mean that the eMMC was correctly detected? Why it's reporting direct firmware load from mmc1? It's weird because brcmfmac4330 seems to be related to wifi, and not to the eMMC. I've also checked the multitool and it's also not detecting any eMMC module. Although running factory tool in maskrom mode reports firmware flash as successful, but device is still not booting from eMMC and starts in a maskrom mode as usual.

 

I'm not expecting form it to be a full functionality, because it was really cheap, so I was expecting any kind of malfunction, including total brick, so I'm really happy that I managed to run armbian on it. But It would be great to know if eMMC is indeed faulty and dead or is there's still something that can be checked/done.

Link to comment
Share on other sites

From the log:

Quote

MMC0:
[    1.842465] mmc_host mmc0: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
[    1.888076] mmc0: Problem switching card into high-speed mode!
[    1.888184] mmc_host mmc0: Bus speed (slot 0) = 25000000Hz (slot req 25000000Hz, actual 25000000HZ div = 0)
[    1.888368] mmc0: new SDHC card at address 0001
[    1.890533] mmcblk0: mmc0:0001 SD32G 28.9 GiB
[    1.896822]  mmcblk0: p1

MMC1:
[    1.828197] mmc_host mmc1: card is non-removable.
[    1.841218] mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
[    1.923119] mmc_host mmc1: Bus speed (slot 0) = 50000000Hz (slot req 50000000Hz, actual 50000000HZ div = 0)
[    1.925505] mmc1: new high speed SDIO card at address 0001

brcmfmac:
[   10.090740] brcmfmac: F1 signature read @0x18000000=0x16044330
[   10.098620] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4330-sdio for chip BCM4330/4
[   10.104635] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac4330-sdio.rockchip,rk3318-box.bin failed with error -2
[   10.129212] usbcore: registered new interface driver brcmfmac
[   10.416124] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4330-sdio for chip BCM4330/4
[   10.416360] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available
[   10.421033] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4330/4 wl0: Oct 25 2011 19:34:12 version 5.90.125.104

MMC2:
[    1.829785] mmc_host mmc2: card is non-removable.
[    1.842631] mmc_host mmc2: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
[    1.901356] mmc2: card has unknown MMCA version 6
[    1.901408] mmc2: error -22 whilst initialising MMC card
[    1.926449] mmc_host mmc2: Bus speed (slot 0) = 300000Hz (slot req 300000Hz, actual 300000HZ div = 0)
[    1.988817] mmc2: card has unknown MMCA version 6
[    1.988863] mmc2: error -22 whilst initialising MMC card
[    2.015445] mmc_host mmc2: Bus speed (slot 0) = 200000Hz (slot req 200000Hz, actual 200000HZ div = 0)
[    2.077234] mmc2: card has unknown MMCA version 6
[    2.077281] mmc2: error -22 whilst initialising MMC card
[    2.102489] mmc_host mmc2: Bus speed (slot 0) = 100000Hz (slot req 100000Hz, actual 100000HZ div = 0)
[    2.139207] Freeing initrd memory: 11104K
[    2.189187] mmc2: card has unknown MMCA version 6
[    2.189233] mmc2: error -22 whilst initialising MMC card

MMC3:
[    1.845745] mmc_host mmc3: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)

MMC0 = SD-Card

MMC1 = is the WiFi card but i think its not finding the firmware for it.

MMC2 = eMMC but its being probed with very strange clock speed.

MMC3 = not used or its the eMMC.

 

With RK-3228 boxes its not working good at the first boot then the system is loading NAND and eMMC support.

If first config no eMMC and only NAND and rebooting and the config only eMMC support and booting and updating the system its being detected in full speed and working OK.

 

For the WiFi have you loading the full firmware pack ?

The problematic files is in the git https://github.com/armbian/firmware/blob/master/brcm/brcmfmac4330-sdio.rockchip,rk3318-box.txt.

Link to comment
Share on other sites

@Petroz

eMMC is mmc2 device, and from your dmesg I read:

[    1.901356] mmc2: card has unknown MMCA version 6
[    1.901408] mmc2: error -22 whilst initialising MMC card

 

so, for some reason, your eMMC does not behave well. Can't say anything more, I have never seen such error and can absolutely be a faulty eMMC.

Did you run rk3318-config? Maybe setting/unsetting the emmc-pins overlay can change the situation.

 

mmc1 is wifi device attached to SDIO bus, mmc0 is the sdcard which has also has a problem getting into high-speed mode, but at least it works.

It would be nice to have some pictures of the board and maybe the original firmware and or its dtb to understand if there are peculiar differences from other  boards

Link to comment
Share on other sites

7 hours ago, Zippy said:

Any other change @jock, need me to test anything in this new  update ?
obviously i dont have bcm43342 so would not be able to test that 
let me know

No particular major changes. just a minor bump in the kernel version

Link to comment
Share on other sites

@MattWestB ok, you're the second in row (after @Petroz) that are reporting such mmc problems, so probably there is something on your board that needs to be fixed.

 

Photos of the board, dmesg, original firmware or (better) the original dtb are useful.

Link to comment
Share on other sites

12 hours ago, jock said:

@awawa @markst I updated the images and deb packages with latest kernel compilation (5.15.23) and with bcm43342 patch in.

Obviously I can't test it, but if you have the chance to give it a shot and give a fallback it will be appreciated ;)

I tested it and it works! Thank you.

dmesg

Link to comment
Share on other sites

 That's it. I ran rk3318-config after the first boot, but wifi chip wasn't detected properly by the app (despite it already works in the system). After re-running it again now, the bluetooth device is active.

dmesg

Link to comment
Share on other sites

22 minutes ago, awawa said:

 That's it. I ran rk3318-config after the first boot, but wifi chip wasn't detected properly by the app (despite it already works in the system). After re-running it again now, the bluetooth device is active.

dmesg 38.06 kB · 1 download

Yes, x88 pro boards have wifi swapped to "external" controller, so on first run it can't be detected.

First rk3318-config run will set a proper dtb to use the external controller. After reboot, you have to run rk3318-config again so the wifi chip can finally be detected and fully configured (bluetooth included) by rk3318-config.

 

I see from dmesg that the bluetooth driver is still not reading the right firmware file, probably because I missed an "A" in the filename.

Could you please rename /lib/firmware/brcm/BCM43342.hcd to /lib/firmware/brcm/BCM43342A.hcd and try again?

 

edit: the images on your tutorial seems to be broken, I see the thumbnails but can't open the full size images.

Link to comment
Share on other sites

39 minutes ago, jock said:

edit: the images on your tutorial seems to be broken, I see the thumbnails but can't open the full size images.

Thanks, I will reupload it on different hosting soon.
If I change the firmware to BCM.hcd then it works. So at least the firmware is correct.

EDIT: images should work now...privacy setting was set wrong.

dmesg

Link to comment
Share on other sites

 Share

×
×
  • Create New...