Page 1 of 1

[SAMA5D2 Xplained] Sam-ba 3.1.2 problems with eMMC flash

Posted: Mon Jun 20, 2016 11:56 am
by cimcim49
Hello all,
I'm trying to flash the eMMC of the sama5d2 Xplained demo board using sam-ba 3.1.2, but it doesn't work.
I also tried to flash a SD card plugged into the sdmmc connector, but it leads me to the same results.


Code: Select all

- plug jumper JP9
- removing SD card
- connect the USB port J23 (A5-USB-A, power the board)
- waiting to have the device discovered by windows 7
- removing jumper JP9
- plugging the SD card (if trying to flash sdmmc1 instead of eMMC)
- executing sam-ba with command (using a bash on windows, or the windows "cmd" stuff):
    ./sam-ba_3.1.2/sam-ba -x test_sdmmc-usb.qml
below, the contents of my test_sdmmc-usb.qml

Code: Select all

import SAMBA 3.1
import SAMBA.Connection.Serial 3.1
import SAMBA.Device.SAMA5D2 3.1

AppletLoader {
	connection: SerialConnection {
		//port: "ttyACM0"
		//port: "COM85"
		//port: "COM5"
		//baudRate: 57600

	device: SAMA5D2 {
		// this configuration is suitable for the sama5d2-xplained:
		// board: "samad2-xplained"
		config {
			// SDMMC0 (eMMC)
			// sdmmcInstance: 0
			// SDMMC1 (SD/MMC slot)
			sdmmcInstance: 1
			// Partition 0 (User Partition)
			// Partition 1 (1st boot partition)
			sdmmcPartition: 0
			sdmmcBusWidth: 4
			sdmmcVoltages: 5

	onConnectionOpened: {
		// read and display current BSCR/BUREG/FUSE values
		//print("-I- === Boot config value ===")

		// initialize SD/MMC applet
		print("-I- === Initialyse MMC ===")

		//print("-I- === Erase SD Card ===")
		//appletErase(0, connection.applet.memorySize)

		// write file
		print("-I- === Write on MMC ===")
		//appletWrite(0, "filesystem_image.raw", false)
		appletWrite(0, "linux4sam-poky-sama5d2_xplained-5.3.img", false)


	// read and display current BSCR/BUREG/FUSE values
	function printBootConfig() {
		var bscr = appletReadBootCfg(BootCfg.BSCR)
		print("BSCR=" + Utils.hex(bscr, 8) + " / " + BSCR.toText(bscr))
		var bureg0 = appletReadBootCfg(BootCfg.BUREG0)
		print("BUREG0=" + Utils.hex(bureg0, 8) + " / " + BCW.toText(bureg0))
		var bureg1 = appletReadBootCfg(BootCfg.BUREG1)
		print("BUREG1=" + Utils.hex(bureg1, 8) + " / " + BCW.toText(bureg1))
		var bureg2 = appletReadBootCfg(BootCfg.BUREG2)
		print("BUREG2=" + Utils.hex(bureg2, 8) + " / " + BCW.toText(bureg2))
		var bureg3 = appletReadBootCfg(BootCfg.BUREG3)
		print("BUREG3=" + Utils.hex(bureg3, 8) + " / " + BCW.toText(bureg3))
		var fuse = appletReadBootCfg(BootCfg.FUSE)
		print("FUSE=" + Utils.hex(fuse, 8) + " / " + BCW.toText(fuse))
The communication with the xplained board works and it detects the SD card (or the eMMC), but it seems that the writing never starts, it just stands doing nothing...

The bash output:

Code: Select all

$ ./sam-ba_3.1.2/sam-ba.exe -x test_sdmmc-usb.qml
Opening serial port 'COM11'
Connection opened.
-I- === Initialyse MMC ===
Detected memory size is 3046637568 bytes.
-I- === Write on MMC ===
the output catch on the serial line on the same time:

Code: Select all

Applet 'SD/MMC' from softpack 1.3 (v1.3-33-g563f963).
Initializing SDMMC1, user partition, 4-bit, 1.8V/3.3V
-I- Device clk 400 kHz
-W- CMD52 ended with error flags 0001, cmd status ERR_NO_RESPONSE
-W- CMD5 ended with error flags 0001, cmd status ERR_NO_RESPONSE
-I- Device clk 49500 kHz
High-capacity SD card v3.0x, 4-bit data, in HS mode at 49500 kHz
Device memory size: 15193 MiB, 31116288 * 512B
SD/MMC device initialization successful
Buffer Address: 0x22b608
Buffer Size: 83968 bytes
Page Size: 512 bytes
Memory Size: 5950464 pages

If anyone has already do that, can you explain me what is my error ?

Tanks to all,

Re: [SAMA5D2 Xplained] Sam-ba 3.1.2 problems with eMMC flash

Posted: Tue Jun 28, 2016 10:11 am
by cimcim49
Ok, just to close this thread, if it can help some others:
it seems that there's an issue in the ROM code of revision A and B of the sama5d2 which forbids booting (see in errata) from eMMC but also flashing on eMMC from sam-ba.

Re: [SAMA5D2 Xplained] Sam-ba 3.1.2 problems with eMMC flash

Posted: Tue Jul 04, 2017 11:43 am
by nferre

Booting from eMMC on sama5d2 revB: yes.
Preventing using SAM-BA to access eMMC: no.

However, you can test newer revisions of SAM-BA (3.2.x) which I tested working well for eMMC flashing:

Re: [SAMA5D2 Xplained] Sam-ba 3.1.2 problems with eMMC flash

Posted: Mon Oct 09, 2017 5:08 pm
by cimcim49
it seems that rev C of sama5d2 fix all issues on emmc support (flashing using sam-ba and booting)
Did someone have any feedback about it ?