Banana Pi BPI-R2 OPENWRT 19.07 Image

Nice @frank-w, thanks for the attention! This is not my main device either at work or home, so I’m just trying to figure it out and maybe help others who face the same issue.

I agree with you, gmac0 should be able to forward this traffic without issues, and it looks to me as if it does not have a performance issue. So, here’s what wireshark at the Windows desktop told me.

  1. Apparently the packets are NOT arriving out of order
  2. Every once in a while (about 10 times per second) a random packet gets lost (wasn’t dropped in windows) so TCP will start doing some SACKs and after the 3rd time Activate fast retransmission.

OK, so I decided to investigate even further, as it looked like the packets were dropping before arriving at the test desktop.

Got TCPDUMP on Openwrt to see what was happening and made a double wireshark: One running on BPI-R2 LAN bridge (Openwrt br-lan) and another one on Win10 Desktop, during the same iperf test.

Here’s how that went: BPI-R2 TcpDump - All packets right and in order

Win10 Wireshark - Random packets don’t arrive

As you can see on both images, the Segment with ACK 261341:

  1. arrived OK from PFsense on the WAN port;
  2. Was forwarded to LAN Bridge (I was capturing br-lan on BPI-R2);
  3. Got captured being sent normally to Desktop (192.168.1.206)
  4. Never arrived to Desktop, prompting a series of 3-Selective ACKS and a fast retransmission a few packets later.
  • Disabled the br-Lan Bridge and connected directly to eth0 LAN, same results;
  • Cable problem is discarded (NanoPi R2S with the setup, cable and connected to the same desktop works fine)

Still no luck trying to figure it out.

Do you use routing? Can you make sure wan and lans having different mac address? They inherite from gmac0 so they are same at boottime. It should not disturb because wan and lan are different segments and routing is layer3,but just to test this…how about cpu-load/interrupts while routing from wan to lan?

hey @frank-w! Yes, I do use simple routing and per ifconfig WAN and LAN have different MAC Addresses…

Continuing troubleshooting I seem to find something interesting (finally!): Everytime I run Iperf and it gets retransmissions (every scenario, except BPI-R2 to PFsense, using reverse) two counters on ethtool will increase on eth0 interface:

  • p06_RxCrcErr
  • p06_RxIngressDrop

The same errors DO NOT appear on mdio bus ports (wan, lan0, etc), only on eth0 (frame engine)

The Crc error usually indicates a Layer1 problem, so probably Cable, NIC or Driver? But the cable is the same I use with NanoPI R2s with no errors.

Creation of correct sd-card is tricky. I wasted some hours today for this job. You have to chain preloader, u-boot, kernel (so far simple) and rootfs together in the image. I failed at calculation of offset for the rootfs. At least I could change a lexa2 sdcard image to emmc and successfully write to mmc.

After I found mmc related options in make menuconfig, I could successfully write to mmcblk0. So far so good, but Openwrt 19.07.3 cannot boot because I don´t know how to chain the image…

hey @gotthard.anger the support on 19.07.3 is indeed very tricky.

I suggest you build from Openwrt master or use the snapshot images - just note that they don’t have Web-GUI Luci by default , as master has some improvements were made by a lot of good people like @frank-w and @dwmw2 and a few others.

A small guide on Installing Snapshot Master Openwrt to BPI-R2 EMMC would be:

  1. Go to https://downloads.openwrt.org/snapshots/targets/mediatek/mt7623/
  2. Download 3 files: a) bpi_bananapi-r2-scatter.txt , b) bpi_bananapi-r2-squashfs-img.gz and c) bpi_bananapi-r2-preloader.bin
  3. Follow the instructions on scatter.txt (1st link above), GUnzip the IMG file to burn it to e-MMC. You’re going to need a usb OTG cable and the SP Flash Tool.

If you did everything correctly it will boot from e-MMC with Openwrt defaults. HDMI and Wifi don’t work yet, but the rest works fine, except for the weird speed issues I’m seeing (see posts above).

Regards,

Rod

Where does otg work? I tried getting otg working with additional drivers in linux 5.4,but can’t get it working

Flashing does also work if booted from sdcard by using dd in running system (writing the image not copy running system). For emmc hw-partitions have to be set (mmc partconf in uboot or with mmc-utils from linux) and preloader needs to be flashed to boot0 block

OTG does work for flashing OpenWRT+Preloader, @frank-w. I did it on my bpi-R2.

This link has the instructions: https://downloads.openwrt.org/snapshots/targets/mediatek/mt7623/openwrt-mediatek-mt7623-bpi_bananapi-r2-scatter.txt

Where does otg work? Uboot or linux?

Can you or @dwmw2 point me to the otg settings (dts,driver used)? I see no otg patch, and did not found out where uboot is built

It uses the MediaTek SP Flash Tool.

See the instructions I put in the top of the scatter file:

# OpenWrt eMMC scatter file for Bpi Banana Pi R2
# For use with SP Flash Tool: https://spflashtool.com/download/
#
# Unzip the file system file openwrt-mediatek-mt7623-bpi_bananapi-r2-squashfs-img.gz before flashing.
# Connect the device's USB port, although it won't appear to the host yet.
# Load this scatter file into the SP Flash Tool, select 'Format All + Download'
# After pressing the 'Download' button, power on the board.
# The /dev/ttyACM0 device should appear on USB and the tool should find it.

If you boot OpenWrt from SD card, there’s a U-Boot menu option which does all that for you.

Hi, i read the scatter file,but it does not explain in which bootstate (uboot,…) r2 is while using spitool over otg. R2 needs to configure otg port for spitool to connect,right? :slight_smile:

If it is uboot i need position in the sources where otg is defined/initialized :slight_smile: have not found where in openwrt uboot is built (and from which sources/patches).

This is done by the MT7623 boot ROM; you can flash it with the SP Flash Tool when it is entirely bricked and there is nothing on the eMMC (or SD).

As you power it up, it appears to the host as a serial port briefly, until it actually finds something to start the preloader from and disappears again.

OpenWrt’s U-Boot is in package/boot/uboot-mediatek

1 Like

Rod, it´s not the problem to write the file to emmc, it´s the way to get the files. And it´s not the solution, to point to precompiled files at openwrt.org. I have my own compiled files on my hd, but it´s the initramfs and squashfs files only and I want to build proper img images.

ATM I´m comparing the make files between the lexa2 build and the official buildroot. Boring job…

Hey @gotthard.anger, well I was trying to give you the simplest path to make it work with master builds. Feel free to try other methods.

Of course you can always compile from source following the guides on Openwrt, they will produce roughly the same files available on snapshots directory, with the packages you choose on your build(on the make menuconfig step)

If you follow the scatter.txt instructions with the files compiled from source you should have the same results.

Rod, to clear the goal: I tried the official files already, but IMHO this image is readonly, e.g. if I add my alterations to the config, they are lost after reboot. Or did I something wrong? Thats why I want to build my own image

Hey @gotthard.anger, let me try to clear it up for you. Openwrt can use regular EXT4 fylesystem but the most common is an special filesystem called SquashFS. It basically works this way:

  • 1st part of the system is indeed readonly , on this part you are 100% correct, you cannot change or write files;
  • 2nd part is an overlay and it is writeable. That’s where all your configs and packages will be stored. These do not get lost after reboot, only if you flash the drive again.

Openwrt site has a wiki about parts of the OS, you should give it a try if you have the time.

Image formats are explained here: https://openwrt.org/docs/techref/image.format

Rod, as you suggested, I will give a new try with provided images from openwrt.org report will follow here

Here’s an example of changes to make RW filesystem on R64: [R64] Mainline OpenWRT image

finally I get my own version written to sdcard and booting from card. unfortunately network will not work, only predefined openvpn. for creating the proper sdcard images, I modified the script here: yoursunny´s script You just remove the download of the 18.06.4 images (lines 27/28) and point in line 22 and 23 to

build_dir/target-arm…eabi/linux-m…7623/tmp/openwrt…kernel.bin

build_dir/target-arm…eabi/linux-m…7623/tmp/openwrt…sysupgrade.bin

after running the script, just flash the image./bpi-r2-sd.bin to /dev/sdx

sudo if=bpi-r2-sd.bin of=/dev/sdb

How to get the network part working, so it will survive a reboot?

BTW: using the patch from frank-w Howto flash banana pi r2 leads to a make error.