Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BigTreeTech CB2/Pi2 config #6860

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

JohnTheCoolingFan
Copy link
Contributor

@JohnTheCoolingFan JohnTheCoolingFan commented Jul 1, 2024

Description

Added patches and config for BigTreeTech CB2/Pi2

GitHub issue reference:
Jira reference number AR-2332

How Has This Been Tested?

Build and load on BTT Pi 2, test peripherals

So far, from test boots:

  • UART communication
  • Ethernet
  • WiFi - sometimes works
  • Bluetooth
  • NVMe (pcie gen 2.1x1)
  • HDMI
  • Sound on 3.5mm audio jack
  • Microphone via onboard connector
  • CSI
  • DSI
  • SPI and CAN
  • Infrared receiver
  • Onboard eMMC
  • Usb type c OTG mode
  • other peripherals (if I missed any in the list)

Checklist:

Please delete options that are not relevant.

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@github-actions github-actions bot added size/large PR with 250 lines or more Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... labels Jul 1, 2024
@ColorfulRhino
Copy link
Collaborator

ColorfulRhino commented Jul 1, 2024

Not sure which board you used as template for the board config, but you don't need most of this stuff. Try using this as an example:

https://github.com/armbian/build/blob/main/config/boards/nanopi-r5c.csc (minus the asound and extlinux line, use BOOTBRANCH="tag:v2024.07-rc5" and BOOTCONFIG="generic-rk3568_defconfig" it works well for rk3568/rk3566)

Also, you have put your patches into rockchip instead of rockchip64 😉

And to prevent duplication, you could use a symlink for the dts file to point from one to the other if they're exactly the same, so you only have one dts and the other one is just a symlink (example: https://github.com/armbian/build/tree/main/patch/kernel/rockchip-rk3588-collabora/dt)

@rpardini
Copy link
Member

rpardini commented Jul 2, 2024

@JohnTheCoolingFan please pick armsurvivors@779b4ee -- you told me the other day I could drop it, but you seem to have forgotten?

@ColorfulRhino that addresses most of your comments, I think?

@rpardini rpardini added the Work in progress Unfinished / work in progress label Jul 2, 2024
@JohnTheCoolingFan
Copy link
Contributor Author

@JohnTheCoolingFan please pick armsurvivors@779b4ee -- you told me the other day I could drop it, but you seem to have forgotten?

@ColorfulRhino that addresses most of your comments, I think?

I did pick it, just didn't push onto a remote branch and it's not used in this branch. This is subject to change during the development of the PR. Pushed it to btt-cb2-rpardini. I have a number of branches for btt cb2 and cb1 and was organizing them yesterday, deleting unneeded ones. Will have to reevaluate branch this PR currently uses vs others I have.

@rpardini
Copy link
Member

rpardini commented Jul 2, 2024

it's not used in this branch

Yeah, but reviews are costly -- please don't waste our time, it's precious. Thanks.

@JohnTheCoolingFan
Copy link
Contributor Author

Yeah, but reviews are costly -- please don't waste our time, it's precious. Thanks.

When the PR is ready for review, I'll mark it as such. For now - it's a draft.

@rpardini
Copy link
Member

rpardini commented Jul 2, 2024

Well I sent #6874 (also draft) - I don't (or plan to) have the board

@JohnTheCoolingFan
Copy link
Contributor Author

Switched it to the @rpardini config. The built image does boot but there is no hdmi output, no ethernet connection and I still can't get proper input via UART pins. I don't have dedicated usb-to-uart converters yet and have been using a chinese arduino nano clone with a ch340 chip and the MCU reset pin tied to ground. I can get board's output butt can't input anything.

@JohnTheCoolingFan
Copy link
Contributor Author

Noticed that BTT had a custom armbianEnv.txt and there was overlay=hdmi, tried setting this in the image, didn't make the hdmi work.

I'm getting out of ideas. The device tree is same, based on the same kernel, so why is it not giving any output? The config is set to have output on both serial and display. And also Ethernet doesn't work even though it probably uses the same exact driver (based on 6.6 kernel).
Some help would really be appreciated. I can probably safely use an arduino to read serial output but not send until a proper usb-uart adapter comes in.

@JohnTheCoolingFan
Copy link
Contributor Author

Tried vendor's image, a minimal Armbian build. It had a lot of additional device tree overlays, including hdmi, which did get me a working hdmi output, but simply putting overlays=hdmi doesn't enable that output on the armbian build of this commit.
Also, I couldn't get any hardware UART from it even with a dedicated USB to UART adapter bases on a FT232RL chip. It didn't work on the vendor image and didn't work on the PR's commit build, even trying different UARTs and speeds (25000000, 15000000, 1500000, 115200, 9600).

@igorpecovnik
Copy link
Member

but simply putting overlays=hdmi doesn't enable that output on the armbian build of this commit.

What if you put HDMI to device tree?

@JohnTheCoolingFan
Copy link
Contributor Author

Ok, I finally got some progress with getting a tty. I shouldn't have traced down the gpio pins from rk3566 datasheet, the tx/rx pins are the same as in Btt Pi (CB1) or CM4. The pins are not marked as uart in the official manual, which just makes it extremely confusing. I now have a fully functional tty and can debug problems further.

Alright, so now I would like to first set up ethernet so I don't have to use uart as often. In the current config, the board is having problems setting up ethernet:

[   23.648519] rk_gmac-dwmac fe010000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   23.650924] rk_gmac-dwmac fe010000.ethernet eth0: PHY [stmmac-0:00] driver [YT8531 Gigabit Ethernet] (irq=POLL)
[   24.651122] rk_gmac-dwmac fe010000.ethernet: Failed to reset the dma
[   24.651145] rk_gmac-dwmac fe010000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed
[   24.651152] rk_gmac-dwmac fe010000.ethernet eth0: __stmmac_open: Hw setup failed
[   25.189408] rk_gmac-dwmac fe010000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   25.191615] rk_gmac-dwmac fe010000.ethernet eth0: PHY [stmmac-0:00] driver [YT8531 Gigabit Ethernet] (irq=POLL)
[   26.195094] rk_gmac-dwmac fe010000.ethernet: Failed to reset the dma
[   26.195115] rk_gmac-dwmac fe010000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed
[   26.195122] rk_gmac-dwmac fe010000.ethernet eth0: __stmmac_open: Hw setup failed

@JohnTheCoolingFan
Copy link
Contributor Author

Putting the boot log gist here just for the record: https://gist.github.com/JohnTheCoolingFan/5df87cc4b87298d6bc21e046bfcff5f6

@JohnTheCoolingFan
Copy link
Contributor Author

Tried booting with the new changes, and I tried overlays=hdmi (I don't really know what it does but it seems the device tree has hdmi enabled?) on edge (6.10), no HDMI still and no wifi either. Didn't check for bluetooth, Ethernet doesn't work with the same error in kernel log, but both branches boot which is good.
I don't really know how to diagnose this further. @rpardini any ideas?

@warasilapm
Copy link

Hey, just coming here to say I really appreciate the work you're putting into this, @JohnTheCoolingFan. I went looking for a way to compile an image for CB2 myself instead of relying on BTT's image and have been following your efforts for the last month or so. I'm not really familiar with this build process and don't really have much development bandwidth at the moment but if I do in the future I'll let you know. If I could help perform some tests or something less technical please let me know!

@JohnTheCoolingFan
Copy link
Contributor Author

JohnTheCoolingFan commented Aug 16, 2024

Did some device tree adjustments I was hoping would make ethernet work, but no, unfortunately. HDMI still not working, wifi varies from boot to boot. Onboard eMMC works when enabled and the PCIe slot works with an NVMe drive. Didn't test sound and bluetooth.

@JohnTheCoolingFan
Copy link
Contributor Author

Ethernet is working now

@JohnTheCoolingFan
Copy link
Contributor Author

JohnTheCoolingFan commented Aug 23, 2024

The board freezes after about 3 minutes, reset button works but I don't know the cause. Activity LED stops blinking, UART and ssh unresponsive. I've installed the heatsink with self-adhesive thermal tape. It's warm to the touch but not hot. I am using a dedicated Type-c power supply rated at 5V 4A.

@JohnTheCoolingFan
Copy link
Contributor Author

JohnTheCoolingFan commented Aug 23, 2024

Bluetooth seems to work, bluetoothctl recognizes the hardware and can use it, although while scanning to try and connect to my phone it froze again and I decided to stop. I'll mark bluetooth as working for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... size/large PR with 250 lines or more Work in progress Unfinished / work in progress
Development

Successfully merging this pull request may close these issues.

5 participants