Jump to content

Armbian running on RK3229 Respeaker Core (not a TV-Box, but RK322x)


k0m37

Recommended Posts

Hi,

 

I have build my own RK322x - Armbian Kernel (legacy) for RK3229 Respeaker, because the standard armbian configuration for rk322x doesnt boot (kernel pancic). 

The respeaker isnt a TV Box, but a smart speaker device from seeed studios https://wiki.seeedstudio.com/ReSpeaker_Core_v2.0/

 

Thats why I'm using the patches from respeaker source builder https://github.com/respeaker/source_builder 

 

Armbian boots now successfully from sd card.

 

I've got 2 problems and maybe somebody can help me with this.

 

1) Wifi

The Respeaker uses ap6212. It needs a proprietary firmware, which armbian holds in /lib/firmware. But my Armbian looks at fw_path /system/etc/firmware. I can create this path and copy the files and the WiFi works as a charm.

How can I change fw_path to look at /lib/firmware ?

 

2) eMMC

The Respeaker hast eMMC but rk322x-config doesnt work. The apply of the DT-Overlay fails with FDT_ERR...

 

Fdisk is not able to detect eMMC. It only shows the SD Card.

Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mmcblk0: 7.4 GiB, 7948206080 bytes, 15523840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x011b4255

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1       8192 15213343 15205152  7.3G 83 Linux


Disk /dev/zram0: 50 MiB, 52428800 bytes, 12800 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/zram1: 492.1 MiB, 516022272 bytes, 125982 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

rk322x-config shows that the device has an emmc installed

 

ls /sys/bus/mmc/devices
mmc0:aaaa  mmc2:0001

Dmesg Output shows that mmc0 is the sd card

dmesg | grep mmc0
[    3.260577] mmc_host mmc0: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
[    3.333986] mmc_host mmc0: Bus speed (slot 0) = 50000000Hz (slot req 50000000Hz, actual 50000000HZ div = 0)
[    3.334051] mmc0: new high speed SDHC card at address aaaa
[    3.334981] mmcblk0: mmc0:aaaa SL08G 7.40 GiB 

I think mmc2 should be the emmc

dmesg | grep mmc2
[    3.462880] mmc_host mmc2: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
[    3.510254] mmc2: queuing unknown CIS tuple 0x80 (2 bytes)
[    3.511795] mmc2: queuing unknown CIS tuple 0x80 (3 bytes)
[    3.513450] mmc2: queuing unknown CIS tuple 0x80 (3 bytes)
[    3.517128] mmc2: queuing unknown CIS tuple 0x80 (7 bytes)
[    3.520998] mmc2: queuing unknown CIS tuple 0x81 (9 bytes)
[    3.604473] mmc_host mmc2: Bus speed (slot 0) = 12000000Hz (slot req 50000000Hz, actual 12000000HZ div = 0)
[    3.607253] mmc2: new high speed SDIO card at address 0001
[   19.224027] mmc2:mmc host rescan start!
[   26.981169] mmc_host mmc2: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
[   26.998028] mmc_host mmc2: Bus speed (slot 0) = 100000Hz (slot req 100000Hz, actual 100000HZ div = 0)
[   27.048192] mmc2: queuing unknown CIS tuple 0x80 (2 bytes)
[   27.054114] mmc2: queuing unknown CIS tuple 0x80 (3 bytes)
[   27.060013] mmc2: queuing unknown CIS tuple 0x80 (3 bytes)
[   27.070657] mmc2: queuing unknown CIS tuple 0x80 (7 bytes)
[   27.084298] mmc2: queuing unknown CIS tuple 0x81 (9 bytes)
[   27.420690] mmc_host mmc2: Bus speed (slot 0) = 12000000Hz (slot req 50000000Hz, actual 12000000HZ div = 0)

How can I enable the emmc ?

 

Maybe I should post this in a developer forum ? 

 

Thanks !

 

--------- PS ------------

I forgot, shure I've changed fdfile=rk322x-box.dtb to fdtfile=rk3229-respeaker-v2.dtb in /boot/armbianEnv.txt.

 

u-boot output  https://pastebin.com/embed_js/2WPkRsMM

 

dmesg output https://pastebin.com/embed_js/Xmd17q7C

Edited by k0m37
attached u-boot & dmesg output
Link to comment
Share on other sites

Hello,

 

very glad to hear about a real rk322x board ;)

ReSpeaker board was actually what gave most of the traction in the initial phase thanks to their documentation, studied mostly by @fabiobassa

 

Anyway let's get on the tracks. I don't have a board like yours but will try to help.

First of all to make life easier, always provide u-boot and dmesg logs.

 

Now the Respeaker board is somewhat different from a regular tvbox and for this reason rk322x-config is useless for you.

 

If you applied the respeaker patches, you should have a file rk3229-respeaker-v2.dtb in /boot/dtb.

If so, change the line fdfile=rk322x-box.dtb to fdtfile=rk3229-respeaker-v2.dtb in /boot/armbianEnv.txt and reboot the machine.

 

This is essential to let the kernel know what is the hardware of the respeaker board. Without this, it will be much harder getting farther.

 

Looking at the snippet you provided, the mmc2 device is not the internal eMMC, but the SDIO Wifi chip. It looks to me also that it does not get configured right in your current setup. Using the respeaker device tree may definitely help here!

 

The ap6212 firmware is already there in /lib/firmware/brcm/ap6212, and the kernel module able to drive the wifi chip is brcmfmac.

brcmfmac is a bit "stupid" about firmware directory, because it won't look in ap6212 directory, but will just look in /lib/firmware/brcm, so probably you may want to copy the content of ap6212 into its brcm parent and then try with modprobe brcmfmac to see what happens.

But all of this can work only when the SDIO bus is working correctly, ie: you need the proper device tree in place.

Link to comment
Share on other sites

Thank you for support. As suggested I'm using the rk3229-respeaker-v2.dtb in armbianEnv.txt. I also try to disable the rk322x overlay option in armbianEnv.txt. But with no success. I also trying to use the dtb-file from the original seeed Studio ReSpeaker image, but this doesn't boot. 

 

From u-boot commandline I can access the emmc.

 

I think it has something to do with the device tree file, but I can't figure it out. In the patch I didn't see anything mmc related. Could this be the reason? How should the dt-source look like ?

 

I have added the u-boot & dmesg logs to the first post.

 

Link to comment
Share on other sites

2 hours ago, k0m37 said:

From u-boot commandline I can access the emmc.

That's good, u-boot is using my "generic" device tree which is embedded into u-boot itself. At least we know the emmc is working with a basic configuration.

 

2 hours ago, k0m37 said:

I think it has something to do with the device tree file, but I can't figure it out. In the patch I didn't see anything mmc related. Could this be the reason? How should the dt-source look like ?

 

I have added the u-boot & dmesg logs to the first post.

Thanks for the logs, I think the problem is related to this one:

[    3.771361] dwmmc_rockchip 30020000.dwmmc: All phases bad!
[    3.771367] mmc1: tuning execution failed
[    3.771382] mmc1: error -5 whilst initialising MMC card

which may be related to pin initialization or most probably to eMMC DDR mode. U-boot does not use eMMC in DDR mode.

I didn't spot any mmc-ddr strings in the ReSpeaker patches. I can take a look to the compiled device tree if you attach it here, but in the meantime you can decompile it, find the dwmmc@30020000 node and comment all the properties starting with pinctrl-names, pinctrl-0, mmc-ddr-1_8v and rockchip,default-sample-phase. Recompile it back and try again.

Link to comment
Share on other sites

I have done, what you suggested.  In the dts file there are no such properties, like pinctrl-names etc.

        dwmmc@30020000 {
                compatible = "rockchip,rk3228-dw-mshc\0rockchip,rk3288-dw-mshc";
                reg = < 0x30020000 0x4000 >;
                interrupts = < 0x00 0x0e 0x04 >;
                clock-frequency = < 0x23c3460 >;
                clock-freq-min-max = < 0x61a80 0x23c3460 >;
                clocks = < 0x02 0x1cb 0x02 0x47 0x02 0x75 0x02 0x79 >;
                clock-names = "biu\0ciu\0ciu-drive\0ciu-sample";
                bus-width = < 0x08 >;
                num-slots = < 0x01 >;
                fifo-depth = < 0x100 >;
                status = "okay";
                broken-cd;
                cap-mmc-highspeed;
                mmc-hs200-1_8v;
                supports-emmc;
                disable-wp;
                non-removable;
                phandle = < 0xa3 >;
        };

I have uploaded the dtb file here : https://gofile.io/d/v11tZM

 

BTW: I compared the dwcmmc@3002000 section from decompiled dtb from my build with the decompiled dtb from the Seeed respeaker Image (Debian stretch from 2018). In this file I have found such properties. But if I add these properties to my build, there is unfortunately no success (no /dev/mmcblk1...) , but other dmesg output mmc1 (the same as mmc2)

 

        dwmmc@30020000 {
                compatible = "rockchip,rk3228-dw-mshc", "rockchip,rk3288-dw-mshc";
                reg = <0x30020000 0x4000>;
                interrupts = <0x0 0xe 0x4>;
                clock-frequency = <0x23c3460>;
                clock-freq-min-max = <0x61a80 0x23c3460>;
                clocks = <0x2 0x1cb 0x2 0x47 0x2 0x75 0x2 0x79>;
                clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
                bus-width = <0x8>;
                default-sample-phase = <0x9e>;
                num-slots = <0x1>;
                fifo-depth = <0x100>;
                pinctrl-names = "default";
                pinctrl-0 = <0x5b 0x5c 0x5d>;
                status = "okay";
                max-frequency = <0x2faf080>;
                broken-cd;
                cap-mmc-highspeed;
                sd-uhs-sdr50;
                supports-emmc;
                disable-wp;
                non-removable;

Dmesg | grep mmc1

[    3.381864] mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
[    3.431772] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[    3.433339] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    3.435046] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    3.437982] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[    3.442249] mmc1: queuing unknown CIS tuple 0x81 (9 bytes)
[    3.526045] mmc_host mmc1: Bus speed (slot 0) = 12000000Hz (slot req 50000000Hz, actual 12000000HZ div = 0)
[    3.529090] mmc1: new high speed SDIO card at address 0001
[   13.435049] mmc1:mmc host rescan start!
[   24.212716] mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
[   24.229547] mmc_host mmc1: Bus speed (slot 0) = 100000Hz (slot req 100000Hz, actual 100000HZ div = 0)
[   24.279878] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[   24.285840] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[   24.291941] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[   24.302877] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[   24.316226] mmc1: queuing unknown CIS tuple 0x81 (9 bytes)
[   24.651093] mmc_host mmc1: Bus speed (slot 0) = 12000000Hz (slot req 50000000Hz, actual 12000000HZ div = 0)

 

Here is the full output from dmesg https://gofile.io/d/s7BJiD

 

 

Edited by k0m37
update dmesg output
Link to comment
Share on other sites

Dealing with decompiled device trees is a bit tricky and copy&paste if often a bad idea.

In your particular case, copying the pin controller entries you are linking the mmc controller to the USB physical-level chip, which is something you definitely may not want to do :rolleyes:

 

I rearranged a bit the node:

  • fixed the pinctrl to point to the right ones
  • removed the mmc-hs200 property: this can be harmful in case the PMIC is not configured correctly
  • added the default-sample-phase property, I guess it is safe since it comes from the manufacturer
  • added sd-uhs-sdr50 property, which should not be there since it should affect only sd cards and sdio, but who knowns...

 

Try this one and tell me if it works.

 

 

rk3229-respeaker-v2-armbian-rev2.dtb

Link to comment
Share on other sites

Now it works...

[    3.249919] mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
[    3.289591] mmc_host mmc1: Bus speed (slot 0) = 12000000Hz (slot req 50000000Hz, actual 12000000HZ div = 0)
[    3.291661] mmc1: new high speed MMC card at address 0001
[    3.292447] mmcblk1: mmc1:0001 M62704 3.53 GiB 
[    3.292832] mmcblk1boot0: mmc1:0001 M62704 partition 1 2.00 MiB
[    3.293205] mmcblk1boot1: mmc1:0001 M62704 partition 2 2.00 MiB
[    3.293550] mmcblk1rpmb: mmc1:0001 M62704 partition 3 512 KiB

Many thanks for your support!

Link to comment
Share on other sites

11 hours ago, k0m37 said:

Now it works...


[    3.249919] mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
[    3.289591] mmc_host mmc1: Bus speed (slot 0) = 12000000Hz (slot req 50000000Hz, actual 12000000HZ div = 0)
[    3.291661] mmc1: new high speed MMC card at address 0001
[    3.292447] mmcblk1: mmc1:0001 M62704 3.53 GiB 
[    3.292832] mmcblk1boot0: mmc1:0001 M62704 partition 1 2.00 MiB
[    3.293205] mmcblk1boot1: mmc1:0001 M62704 partition 2 2.00 MiB
[    3.293550] mmcblk1rpmb: mmc1:0001 M62704 partition 3 512 KiB

Many thanks for your support!

You're welcome ;)

Link to comment
Share on other sites

  • Werner locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines