This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PROCESSOR-SDK-AM62X: EMMC read write on u-boot

Part Number: PROCESSOR-SDK-AM62X

Hi,

I would like to test emmc read write on AM62x EVK during u-boot.

I saw that there are a few commands i could use: "mmc read" and "mmc write".

But here is the error i encountered.

=> mmc read addr blk 0

MMC read: dev # 0, block # 11, count 0 ... 0 blocks read: OK
=> mmc write addr blk 0

MMC write: dev # 0, block # 11, count 0 ... 0 blocks written: OK
=> mmc write addr blk 2

MMC write: dev # 0, block # 11, count 2 ... sdhci_transfer_data: Transt
mmc write failed
0 blocks written: ERROR
=> mmc write addr blk 1

MMC write: dev # 0, block # 11, count 1 ... 0 blocks written: ERROR
=> mmc write addr blk 3

MMC write: dev # 0, block # 11, count 3 ... 0 blocks written: ERROR
=> mmc read addr blk 1 

MMC read: dev # 0, block # 11, count 1 ... 0 blocks read: ERROR
=> mmc read addr blk 2

MMC read: dev # 0, block # 11, count 2 ... 0 blocks read: ERROR
=> mmc read addr blk 3

MMC read: dev # 0, block # 11, count 3 ... 0 blocks read: ERROR

Then restart and try the following, and different issue comes up.

=> mmc read addr blk 0

MMC read: dev # 0, block # 11, count 0 ... 0 blocks read: OK
=> mmc read addr blk 1

MMC read: dev # 0, block # 11, count 1 ... 
ERROR:   Unhandled External Abort received on 0x80000000 from EL2
ERROR:   exception reason=1 syndrome=0x92000010
Unhandled Exception from EL2

  • Hello,
    Will you share more details:
    1/. SDK version?
    2/. Upload the full log in attachment?
    3/. The error was not reproduced from different test runs, correct?
    Best,
    -Hong

  • I’m using 8.4.1.9.

    I don’t understand what’s number 3 is.

  • Update:

    As you can see below, the data written is not the same as data read back, but why?

    => mmc write 0x80000000 20 2       
    
    MMC write: dev # 0, block # 32, count 2 ... 2 blocks written: OK
    => mmc read 0x81000000 20 2        
    
    MMC read: dev # 0, block # 32, count 2 ... 2 blocks read: OK
    => cmp.b 0x80000000 0x81000000 1024
    byte at 0x80000400 (0x90) != byte at 0x81000400 (0xff)
    Total of 1024 byte(s) were the same
    

  • Update:

    Since the MMC address starts from 0x1000000 and the mmc write does not seem to be working, i tried another method.

    => md.l 0x1000000 0x2   
    01000000: 00000010 007b0468          
    => mw.l 0x1000000 0xAAAAAAAA 0x10  
    => md.l 0x1000000 0x2            
    01000000: 00000010 007b0468      

  • Hello Cyra,

    The syntax of cmp command is

    cmp [.b, .w, .l, .q] addr1 addr2 count

    where count is interpreted as hexadecimal value.

    So, the correct command to compare 1024 bytes (2 blocks of eMMC) would be

    cmp.b 0x80000000 0x81000000 0x400

    Regards,

    Prashant

  • Hello Cyra,

    The mmc read/write command interprets the arguments as hexadecimal numbers. So, when you are running the below commands

    => mmc write addr blk 2
    
    MMC write: dev # 0, addr # 0000000000000add, block # 11, count 2 ... sdhci_transfer_data: Transfer data timeout
    mmc write failed
    0 blocks written: ERROR
    =>
    .
    // Reboot the board
    .
    
    => mmc read addr blk 1
    
    MMC read: dev # 0, addr # 0000000000000add, block # 11, count 1 ...
    ERROR:   Unhandled External Abort received on 0x80000000 from EL2
    ERROR:   exception reason=1 syndrome=0x92000010
    Unhandled Exception from EL2
    

    the addr and blk are literally interpreted as hexadecimal numbers to derive the decimal value of address and block number. The addr and blk are evaluated to 0xadd and 11 respectively by considering only the valid hexadecimal digits and dropping the invalid ones. For example, lk is dropped from blk and b alone is evaluated to 11.

    Now, the above mmc read/write commands are trying to access an address (0xadd) which is either invalid or not supposed to be accessed resulting in errors or exceptions being generated. To overcome this, we have to use literal hexadecimal values as arguments to mmc read/write command.

    One such successful example of mmc read/write is shown below

    => print loadaddr
    loadaddr=0x82000000
    => mmc write ${loadaddr} 0xb 0x2
    
    MMC write: dev # 0, addr # 0000000082000000, block # 11, count 2 ... 2 blocks written: OK
    => mmc read ${loadaddr} 0xb 0x2
    
    MMC read: dev # 0, addr # 0000000082000000, block # 11, count 2 ... 2 blocks read: OK
    =>
    

    Regards,

    Prashant