sam9x75curiosity

Last modified by Microchip on 2025/07/17 12:24

Information

when choosing the board variant with the -b parameter of SAM-BA, the default PMECC configuration for the NAND populated on the board is valid. You can verify its value by running the command that reads one byte in a dummy file (named test.bin in the following command):

# sam-ba -p serial -b sam9x75-curiosity -a nandflash -c read:test.bin:0:1
Opening serial port 'ttyACM0'
Connection opened.
Detected memory size is 536870912 bytes.
Page size is 4096 bytes.
Buffer is 12288 bytes (3 pages) at address 0x003085a0.
NAND header value is 0xc2605007.
Supported erase block sizes: 256KB
Executing command 'read:test.bin:0:1'
Read 1 bytes at address 0x00000000 (100.00%)
Connection closed.

You can figure out that the default PMECC parameter for this == board is 0xc2605007.

Information

Note that if you connect a serial console to the SoC RomCode default UART, you can see even more details about the NAND ECC parameters given by the SAM-BA Applet:

Applet 'NAND Flash' from SAM-BA Applets Framework 3.8 (v3.8).
Initializing NAND ioSet1 Bus Width 8
PMECC configuration: 0xc2605007
Sector size: 512
Sectors per page: 8
Spare size: 256
ECC bits: 8
ECC offset: 152
ECC size: 104
PMECC enabled
Buffer Address: 0x003085a0
Buffer Size: 12288 bytes
NAND applet initialized successfully.

If you want to change the default PMECC parameters you can simply specify another value on the SAM-BA command line with the -a nandflash argument as shown below:

# sam-ba -p serial -b sam9x75-curiosity -a nandflash:help
Syntax: nandflash:[<ioset>]:[<bus_width>]:[<header>]
Parameters:
    ioset      I/O set
    bus_width  NAND bus width (8/16)
    header     NAND header value
Examples:
    nandflash                 use default board settings
    nandflash:2:8:0xc0098da5  use fully custom settings (IOSET2, 8-bit bus, header is 0xc0098da5)
    nandflash:::0xc0098da5    use default board settings but force header to 0xc0098da5
For information on NAND header values, please refer to SAMA5D4 datasheet section \"12.4.4 Detailed Memory Boot Procedures\".

By reading this in-line documentation we can specify the NAND PMECC parameter with this command:

# sam-ba -p serial -b sam9x75-curiosity -a nandflash:::0xc2605007
Opening serial port 'ttyACM0'
Connection opened.
Detected memory size is 536870912 bytes.
Page size is 4096 bytes.
Buffer is 20480 bytes (5 pages) at address 0x0020a240.
NAND header value is 0xc2605007.
Supported erase block sizes: 256KB
Connection closed.