3 3
kjn260

NanoPi Neo Core Ethernet.

Recommended Posts

Hi,

 

Please see my comments in the other thread: 

 

 

Essentially when booting a Neo Core using the current air/core mainline image, the onboard fast ethernet is not being initialised. At a guess its because this is not included in the device tree (dtb/dts) for the nano pi air image or in uBoot config - however, if the image is to serve both boards it almost needs to - or they need to be separated.

Both are probably reasonable options. Right now i'm trying to understand where the board defs for ethernet are collected during the image build using the armbian build environment and try and get a functional image with fast ethernet for the core, with eMMC support (the big difference).

 

As per the other thread there was a difference in the Uboot config via the nano pi neo and the nano pi air, where the neo image initializes ethernet 

 

I built the following patch:

diff --git a/configs/nanopi_neo_air_defconfig b/configs/nanopi_neo_air_defconfig
index 11eb3ab13b..9f83068dd7 100644
--- a/configs/nanopi_neo_air_defconfig
+++ b/configs/nanopi_neo_air_defconfig
@@ -15,6 +15,7 @@
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_ISO_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_SUN8I_EMAC=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
 CONFIG_MMC_SUNXI_SLOT_EXTRA=2

 

And ran through build, even though the patch applies successfully there is still no init - what am I missing?

 

Thanks

 

Share this post


Link to post
Share on other sites
3 hours ago, kjn260 said:

And ran through build, even though the patch applies successfully there is still no init - what am I missing?


Our system for creating patches stops right before the compilation starts, but at that moment defconfig was already applied.  You need to:
1. Edit this config and proceed that patch is created
2. Copy patch from output/patch/u-boot-sunxi*.patch to userpatches/u-boot/u-boot-sunxi

3. Recompile with this patch included

Then it should be applied.
 

3 hours ago, kjn260 said:

and try and get a functional image with fast ethernet for the core


Perhaps best to add eMMc support (CONFIG_MMC_SUNXI_SLOT_EXTRA=2) to Nanopi Neo u-boot config and use that image?

Share this post


Link to post
Share on other sites

Hello Igor,

 

Forgive my ignorance of the armbian build environment - I think I have already done what you asked:

 

1) Create file nanopi_neo_air_defconfig_2 to include line "CONFIG_SUN8I_EMAC=y"

2) diff -Naur nanopi_neo_air_defcong nanopi_neo_air_defconfig_2 > nanopi_core_emac.patch  (contents quoted above)

3) copy nanopi_core_emac.patch to /userpatches/u-boot/u-boot-sunxi

4) run build environment "sudo ./compile.sh"

5) option for full image

6) note application of patches (from: output/debug/patching.log):

...

Processing file /home/armbian/build/patch/u-boot/u-boot-sunxi/lower-default-cpufreq-H5.patch

Processing file /home/armbian/build/userpatches/u-boot/u-boot-sunxi/nanopi_core_emac.patch

Processing file /home/armbian/build/patch/u-boot/u-boot-sunxi/sun8i-set-machid.patch

...

7) flash image and check. No success.....

 

 

Or am I missing something?

 

 

 

Does the behavior of "CONFIG_SUN8I_EMAC=y" add the required lines to the device tree for example:

 

## u-boot/arch/arm/dts/sun8i-h3-nanopi-neo.dts ##

&emac {
	phy-handle = <&int_mii_phy>;
	phy-mode = "mii";
	allwinner,leds-active-low;
	status = "okay";
};

 

or likewise with your suggestion of adding "CONFIG_MMC_SUNXI_SLOT_EXTRA=2" to the neo defconfig add to the device tree for emmc support, for example:

## u-boot/arch/arm/dts/sun8i-h3-nanopi-neo-air.dts ##


&mmc0 {
	pinctrl-names = "default";
	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
	vmmc-supply = <&reg_vcc3v3>;
	bus-width = <4>;
	cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
	cd-inverted;
	status = "okay";
};

 

 

Share this post


Link to post
Share on other sites

Both, but this is only based on my observations of the function in the nano pi neo.

 

Does ethernet have to be enabled in u-boot to properly initialize the device for the kernel driver?

Share this post


Link to post
Share on other sites
8 hours ago, kjn260 said:

Does ethernet have to be enabled in u-boot to properly initialize the device for the kernel driver?


Yes. The simplest way is to add eMMC support to Neo image and both boards are covered.

Share this post


Link to post
Share on other sites

Ok, so the problem seems to be the same as ethernet to air image as emmc to neo image?

 

Is it as simple as patchinng the u--boot nanopi_neo_defconfig : CONFIG_MMC_SUNXI_SLOT_EXTRA=2?

 

 

or does the device tree also need updating to initialise the eMMC device??

## u-boot/arch/arm/dts/sun8i-h3-nanopi-neo-air.dts ##


&mmc0 {
	pinctrl-names = "default";
	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
	vmmc-supply = <&reg_vcc3v3>;
	bus-width = <4>;
	cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
	cd-inverted;
	status = "okay";
};

 

 

Or is there additional configuration required that I still don't know?

 

 

Edit:

Are DTS files compiled at build time in Armbian build? can I generate a userpatch to patch the DTS file if required? or is it a different method?

Share this post


Link to post
Share on other sites

You could use user overlays as "patches" without touching anything else. That's what I have been using and it works pretty well.

Share this post


Link to post
Share on other sites

Hi All,

 

So after some learning and playing, there are three options that worked for me:

 

1) use nanopi-air config, use armbian build to patch device tree for uboot, and patch device tree for kernel to add sun8i emac device.  Patch air defconfig to include CONFIG_SUN8i_EMAC = Y.

 

2) use nanopi-neo config, use armbian build to patch device tree for uboot , and patch device tree for kernel to add mmc device(s). Use Igor's patch above to patch the neo defconfig.

 

3) write custom board configuration, defconfig, and device trees (uboot and kernel) for a "nanopi-neo-core", patch the kernel device tree makefile and make a custom core image [nanopi-air (+ ethernet) (-wireless)]

 

Option 3 worked the best for me, and I now have a nanopi neo core image (and build defs) that supports installation (and boot) from eMMC and also has functioning ethernet in uboot and kernel, that I can run from armbian build. Huzzah.

 

 

I suppose I could push my files from 3) to mainline, but I have never been a contributor (so I don't know the rules) and this goes against the intended plans for the "CORE" Devices. Igor, what are your thoughts?

 

 

Share this post


Link to post
Share on other sites
On 30 aprile 2018 at 4:05 AM, kjn260 said:

Hi All,

 

So after some learning and playing, there are three options that worked for me:

 

1) use nanopi-air config, use armbian build to patch device tree for uboot, and patch device tree for kernel to add sun8i emac device.  Patch air defconfig to include CONFIG_SUN8i_EMAC = Y.

 

2) use nanopi-neo config, use armbian build to patch device tree for uboot , and patch device tree for kernel to add mmc device(s). Use Igor's patch above to patch the neo defconfig.

 

3) write custom board configuration, defconfig, and device trees (uboot and kernel) for a "nanopi-neo-core", patch the kernel device tree makefile and make a custom core image [nanopi-air (+ ethernet) (-wireless)]

 

Option 3 worked the best for me, and I now have a nanopi neo core image (and build defs) that supports installation (and boot) from eMMC and also has functioning ethernet in uboot and kernel, that I can run from armbian build. Huzzah.

 

 

I suppose I could push my files from 3) to mainline, but I have never been a contributor (so I don't know the rules) and this goes against the intended plans for the "CORE" Devices. Igor, what are your thoughts?

 

 

 

Hello,

 

I would be interested in the linux image for the Nanopi NEO Core, or understand what are the steps necessary to create it (I'm not very familiar with embedded linux or kernel recompiling).

 

Regards

Marco

 

 

Share this post


Link to post
Share on other sites

Thank you projetoarduino. Your sun8i-h3-nanopi-neo.dtb worked for me. I downloaded the Stretch nightly for the NEO at https://dl.armbian.com/nanopineo/nightly/Armbian_5.44.180510_Nanopineo_Debian_stretch_next_4.14.40.7z

I booted, logged in and did the usual apt-get update, apt-get upgrade. At this point, I have wired ethernet but no eMMC. I replaced the existing dtb with yours from https://github.com/projetoarduino/armbian-nanopi-core.

Once I rebooted I had wired ethernet AND eMMC. I copied the OS to the eMMC and I can boot from the eMMC!

 

Once again, Armbian comes through!

 

Steve 

Share this post


Link to post
Share on other sites

Hi Projetoarduino,

 

I have a problem with your patch.  I downloaded Armbian version based on Debian Stretch for Nanopi Neo, then I started the system and I downloaded sun8i-h3-nanopi-neo.dtb file. Then I used this command:

 

cp sun8i-h3-nanopi-neo.dtb /boot/dtb-4.14.14-sunxi/

Then i rebooted system but now it does not load anymore. Output is: (consider that there is another system in emmc and I want overwrite it)

 

Device NOT ready
   Request Sense returned 00 00 00
2 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Autoboot in 1 seconds, press <Space> to stop
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot/boot.scr
3708 bytes read in 206 ms (17.6 KiB/s)
## Executing script at 43100000
U-boot loaded from SD
Boot script loaded from mmc
228 bytes read in 167 ms (1000 Bytes/s)
5070071 bytes read in 654 ms (7.4 MiB/s)
6968976 bytes read in 814 ms (8.2 MiB/s)
Found mainline kernel configuration
40285 bytes read in 800 ms (48.8 KiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
No FDT memory address configured. Please configure
the FDT address via "fdt addr <address>" command.
Aborting!
504 bytes read in 1641 ms (0 Bytes/s)
Applying kernel provided DT overlay sun8i-h3-usbhost1.dtbo
No FDT memory address configured. Please configure
the FDT address via "fdt addr <address>" command.
Aborting!
504 bytes read in 1649 ms (0 Bytes/s)
Applying kernel provided DT overlay sun8i-h3-usbhost2.dtbo
No FDT memory address configured. Please configure
the FDT address via "fdt addr <address>" command.
Aborting!
Error applying DT overlays, restoring original DT
40285 bytes read in 800 ms (48.8 KiB/s)
## Loading init Ramdisk from Legacy Image at 43300000 ...
   Image Name:   uInitrd
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    5070007 Bytes = 4.8 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...

Device 0: not available
_sun8i_emac_eth_init: Timeout
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/01-02-81-78-b5-e2-2c
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000000
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0000000
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/000000
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0000
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/000
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default-arm-sunxi
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default-arm
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default
*** ERROR: `serverip' not set
Config file not found
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
BOOTP broadcast 5
BOOTP broadcast 6
BOOTP broadcast 7
BOOTP broadcast 8
BOOTP broadcast 9
BOOTP broadcast 10
BOOTP broadcast 11
BOOTP broadcast 12
BOOTP broadcast 13
BOOTP broadcast 14
BOOTP broadcast 15
BOOTP broadcast 16
BOOTP broadcast 17

Retry time exceeded; starting again
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
BOOTP broadcast 5
BOOTP broadcast 6
BOOTP broadcast 7
BOOTP broadcast 8
BOOTP broadcast 9
BOOTP broadcast 10
BOOTP broadcast 11
BOOTP broadcast 12
BOOTP broadcast 13
BOOTP broadcast 14
BOOTP broadcast 15
BOOTP broadcast 16
BOOTP broadcast 17

Thank you

Marco

Share this post


Link to post
Share on other sites

Hi, @projetoarduino, thank you very much for your straightforward fix.

 

You mention in your readme that your modified device tree also enables audio. What kind of audio? I tried to record audio with my I2S microphone but arecord doesn't show any audio interface...

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
3 3