Acqua technical documentation

How to mount the NAND FLASH on Acqua A5

This article illustrates how to mount and test the NAND FLASH mounted on Acqua A5 board

To try this article we need a bootable Linux microSD for Acqua A5. Create one by following this article in case you haven't it:

Boot Linux on your Acqua A5 and access to its command line as acme user via SSH or debug port:

login: acme
password: acmesystems

Launch a package index update:

sudo apt update

then install the mtd-utils package

sudo apt install mtd-utils

Create a 200MB lenght file of random numbers to use as sample for the test by typing:

dd if=/dev/urandom of=sample bs=1M count=200

Check its lenght by typing:

ls -al sample

Create a new directory and mount on it the NAND FLASH

sudo ubiformat /dev/mtd0
sudo ubiattach -p /dev/mtd0
sudo ubimkvol /dev/ubi0 -N rootfs -m
sudo mount -t ubifs /dev/ubi0_0 /mnt/ubifs

Save the ramdom sample file on the NAND FLASH partition and check if the copy is correct by typing:

md5sum sample 
ff46a364e90d22ba6d218bf20511d55b  sample

md5 /mnt/ubifs/sample 
ff46a364e90d22ba6d218bf20511d55b  /mnt/ubifs/sample

Umount the NAND FLASH

sudo umount /mnt/ubifs

Device tree definition

Place this definition under ahb section inside the device tree

ahb {
    ebi@10000000 {
        pinctrl-0 = <&pinctrl_ebi_addr &pinctrl_ebi_cs0>;
        pinctr-name = "default";
        status = "okay";

        nand_controller: nand-controller {
            status = "okay";

            nand@3 {
                reg = <0x3 0x0 0x2>;
                atmel,rb = <0>;
                nand-ecc-mode = "hw";
                nand-ecc-strength = <4>;
                nand-ecc-step-size = <512>;
                label = "atmel_nand";

Ready-to-use files

Device tree source used on Kernel 4.19.x

Device tree blob used on Kernel 4.19.x

Save the old version of at91-sama5d3_acqua.dtb saved in the first partition of microSD and replace with this file renamed in at91-sama5d3_acqua.dtb.

Alessia Tocci
Electronic expert in manufacturing, Linux embedded system integrator


Older version of this article:

Acqua technical documentation