Skip to contentSkip to conversation

STM32F7 SD/MMC Card Driver - Testing/Review

U-Boot Philipp Rossak 2 participants 6 messages Mar 22, 2017

lore
Share & tools
lore
#0 lore raw

Hey everyone,

I'm currently working on a SD / MMC Card driver for the stm32f746g-disco Board. You can find my actual very early work right here on my github
repository: [0]

Currently I'm getting errors that are not reproducible:

- Errors on sending different commands (happens somtimes but randomly)

- Errors at CMD 17 & 18 reading procedures

And sometimes works everything without any problems....

Right now I think that my hardware got broken (but I'm not sure). It would be nice if someone could test the driver and send me the log. A small code review would help me also.

Thanks in advance!

Best regards,

Philipp Rossak

[0] https://github.com/embed-3d/stm32_mmc_driver/tree/stm32f7_mmc_hw_testing

#1 lore raw

Hi Philipp,

Quoted 9 lines · Philipp Rossak

Hey everyone,

I'm currently working on a SD / MMC Card driver for the stm32f746g-disco Board. You can find my actual very early work right here on my github repository: [0]

Currently I'm getting errors that are not reproducible:

- Errors on sending different commands (happens somtimes but randomly)

- Errors at CMD 17 & 18 reading procedures

If you can also share the log, it's helpful to check your problem. I don't have board to test yours, but i can check your driver as code level.

Best Regards,
Jaehoon Chung

Quoted 17 lines

And sometimes works everything without any problems....

Right now I think that my hardware got broken (but I'm not sure). It would be nice if someone could test the driver and send me the log. A small code review would help me also.

Thanks in advance!

Best regards,

Philipp Rossak

[0] https://github.com/embed-3d/stm32_mmc_driver/tree/stm32f7_mmc_hw_testing

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#2 lore raw

Hi Jaehoon,

Thanks for that hint!

I uploaded two logs to pastebin.

Log [1] is a sandisk ultra 32gb sd card. This time I didn't got it work properly.

Log [2] is from an other 2gb sd card where I pressed the reset button until I received data from CMD 17 command.

Right now there are a lot of debug outputs, to make it for me easy for me to find the errors. The most of them will be removed later.

Best Regards,

Philipp Rossak

[1] http://pastebin.com/LcSSmBfp

[2] http://pastebin.com/zRbRMXtE

Quoted 34 lines · Jaehoon Chung

Hi Philipp,

Quoted 9 lines · Philipp Rossak

Hey everyone,

I'm currently working on a SD / MMC Card driver for the stm32f746g-disco Board. You can find my actual very early work right here on my github repository: [0]

Currently I'm getting errors that are not reproducible:

- Errors on sending different commands (happens somtimes but randomly)

- Errors at CMD 17 & 18 reading procedures

If you can also share the log, it's helpful to check your problem. I don't have board to test yours, but i can check your driver as code level.

Best Regards,
Jaehoon Chung

Quoted 16 lines

And sometimes works everything without any problems....

Right now I think that my hardware got broken (but I'm not sure). It would be nice if someone could test the driver and send me the log. A small code review would help me also.

Thanks in advance!

Best regards,

Philipp Rossak

[0] https://github.com/embed-3d/stm32_mmc_driver/tree/stm32f7_mmc_hw_testing

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#3 lore raw

Hi Philipp,

Quoted 10 lines · Philipp Rossak

Hi Jaehoon,

Thanks for that hint!

I uploaded two logs to pastebin.

Log [1] is a sandisk ultra 32gb sd card. This time I didn't got it work properly.

Log [2] is from an other 2gb sd card where I pressed the reset button until I received data from CMD 17 command.

Quoted 8 lines

Right now there are a lot of debug outputs, to make it for me easy for me to find the errors. The most of them will be removed later.

Best Regards,

Philipp Rossak

[1] http://pastebin.com/LcSSmBfp

In Log [1],

mmc 0, cmd 6(0x00000446), arg 0x00fffff1
START DATA TRANSFER
CMD: 6
Timeout STA2: 00202040------------------
END DATA TRANSFER
Ret: -110 - STA 00202540

It seems timeout error, right? As i know, CMD6 doesn't have any data..
Even if didn't check your source code..i guess that you need to check whether it's waiting for completing data or not. (or check the register about interrupt e.g, end of data interrupt..?)

In Log [2],

It seems to fail the getting sd status...also timeout.. I need to check your source code..after that, i will review more..

Best Regards,
Jaehoon Chung

Quoted 43 lines

[2] http://pastebin.com/zRbRMXtE

Quoted 34 lines · Jaehoon Chung

Hi Philipp,

Quoted 9 lines · Philipp Rossak

Hey everyone,

I'm currently working on a SD / MMC Card driver for the stm32f746g-disco Board. You can find my actual very early work right here on my github repository: [0]

Currently I'm getting errors that are not reproducible:

- Errors on sending different commands (happens somtimes but randomly)

- Errors at CMD 17 & 18 reading procedures

If you can also share the log, it's helpful to check your problem. I don't have board to test yours, but i can check your driver as code level.

Best Regards,
Jaehoon Chung

Quoted 16 lines

And sometimes works everything without any problems....

Right now I think that my hardware got broken (but I'm not sure). It would be nice if someone could test the driver and send me the log. A small code review would help me also.

Thanks in advance!

Best regards,

Philipp Rossak

[0] https://github.com/embed-3d/stm32_mmc_driver/tree/stm32f7_mmc_hw_testing

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#4 lore raw

Hi Jaehoon,

Yes that what you mentioned is a timeout error. That error occurs if I don't get a response from several Hardware/error flags (a counter reaches a limit).

As you mentioned the cmd 6 shoudn't read any data. This is what I'm doing if I'm transfering data:

This is the function called from the upper layers:

stm32_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, struct mmc_data *data)

If it is necessary to transfer data all the related code for that is placed in if conditions like below.

if(data) { ... }

Something interesting:

Here is are two new logs I just recoreded a few minutes ago after some sleep. The sourcecode is the same i just recompiled it and flashed it again. You can see it on the timestamp in line 4. I used the same card as in Log [1].

Log [3] behaves now different than before, there is no data read from the cmd6

Log [4] behaves similar to log [1].

I made a diff between log [3] and Log [4] and till line 265 is everything the same. @ line 266 & 267 the answer to cmd 51 is different!?

Best Regards,

Philipp Rossak

[3] http://pastebin.com/AK3RB1bH

[4] http://pastebin.com/xk2TkGpd

Quoted 84 lines · Jaehoon Chung

Hi Philipp,

Quoted 10 lines · Philipp Rossak

Hi Jaehoon,

Thanks for that hint!

I uploaded two logs to pastebin.

Log [1] is a sandisk ultra 32gb sd card. This time I didn't got it work properly.

Log [2] is from an other 2gb sd card where I pressed the reset button until I received data from CMD 17 command.

Quoted 8 lines

Right now there are a lot of debug outputs, to make it for me easy for me to find the errors. The most of them will be removed later.

Best Regards,

Philipp Rossak

[1] http://pastebin.com/LcSSmBfp

In Log [1],

mmc 0, cmd 6(0x00000446), arg 0x00fffff1
START DATA TRANSFER
CMD: 6
Timeout STA2: 00202040------------------
END DATA TRANSFER
Ret: -110 - STA 00202540

It seems timeout error, right? As i know, CMD6 doesn't have any data..
Even if didn't check your source code..i guess that you need to check whether it's waiting for completing data or not. (or check the register about interrupt e.g, end of data interrupt..?)

In Log [2],

It seems to fail the getting sd status...also timeout.. I need to check your source code..after that, i will review more..

Best Regards,
Jaehoon Chung

Quoted 41 lines

[2] http://pastebin.com/zRbRMXtE

Quoted 34 lines · Jaehoon Chung

Hi Philipp,

Quoted 9 lines · Philipp Rossak

Hey everyone,

I'm currently working on a SD / MMC Card driver for the stm32f746g-disco Board. You can find my actual very early work right here on my github repository: [0]

Currently I'm getting errors that are not reproducible:

- Errors on sending different commands (happens somtimes but randomly)

- Errors at CMD 17 & 18 reading procedures

If you can also share the log, it's helpful to check your problem. I don't have board to test yours, but i can check your driver as code level.

Best Regards,
Jaehoon Chung

Quoted 16 lines

And sometimes works everything without any problems....

Right now I think that my hardware got broken (but I'm not sure). It would be nice if someone could test the driver and send me the log. A small code review would help me also.

Thanks in advance!

Best regards,

Philipp Rossak

[0] https://github.com/embed-3d/stm32_mmc_driver/tree/stm32f7_mmc_hw_testing

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#5 lore raw

Hi Jaehoon,

I had a look in the include/mmc.h file and there are different types of cmd 6 command defined:

ACMD6: Sets Bus width --> no data
CMD6: Switch Function --> data

But it was the right place to look for the error. I forgot to disable the DMA! Shame on me!!! I updated the code on github. The new log [5] looks now much better!

The log shows the following: reset -> mmc rescan -> mmc info

@ reset I couldn't see any error happen (CMD 17 looks also good!). But it has some error the dos partition table.

@ mmc rescan only CMD 17 at the end fails

@ mmc info looks everything ok

Best Regards,

Philipp Rossak

[5] http://pastebin.com/H8mWTP4C

Quoted 141 lines · Philipp Rossak

Hi Jaehoon,

Yes that what you mentioned is a timeout error. That error occurs if I don't get a response from several Hardware/error flags (a counter reaches a limit).

As you mentioned the cmd 6 shoudn't read any data. This is what I'm doing if I'm transfering data:

This is the function called from the upper layers:

stm32_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, struct mmc_data *data)

If it is necessary to transfer data all the related code for that is placed in if conditions like below.

if(data) { ... }

Something interesting:

Here is are two new logs I just recoreded a few minutes ago after some sleep. The sourcecode is the same i just recompiled it and flashed it again. You can see it on the timestamp in line 4. I used the same card as in Log [1].

Log [3] behaves now different than before, there is no data read from the cmd6

Log [4] behaves similar to log [1].

I made a diff between log [3] and Log [4] and till line 265 is everything the same. @ line 266 & 267 the answer to cmd 51 is different!?

Best Regards,

Philipp Rossak

[3] http://pastebin.com/AK3RB1bH

[4] http://pastebin.com/xk2TkGpd

Quoted 96 lines · Jaehoon Chung

Hi Philipp,

Quoted 15 lines · Philipp Rossak

Hi Jaehoon,

Thanks for that hint!

I uploaded two logs to pastebin.

Log [1] is a sandisk ultra 32gb sd card. This time I didn't got it work properly.

Log [2] is from an other 2gb sd card where I pressed the reset button until I received data from CMD 17 command.

Right now there are a lot of debug outputs, to make it for me easy for me to find the errors. The most of them will be removed later.

Quoted 6 lines

Best Regards,

Philipp Rossak

[1] http://pastebin.com/LcSSmBfp

In Log [1],

mmc 0, cmd 6(0x00000446), arg 0x00fffff1
START DATA TRANSFER
CMD: 6
Timeout STA2: 00202040------------------
END DATA TRANSFER
Ret: -110 - STA 00202540

It seems timeout error, right? As i know, CMD6 doesn't have any data.. Even if didn't check your source code..i guess that you need to check whether it's waiting for completing data or not.
(or check the register about interrupt e.g, end of data interrupt..?)

In Log [2],

It seems to fail the getting sd status...also timeout.. I need to check your source code..after that, i will review more..

Best Regards,
Jaehoon Chung

Quoted 49 lines

[2] http://pastebin.com/zRbRMXtE

Quoted 42 lines · Jaehoon Chung

Hi Philipp,

Quoted 6 lines · Philipp Rossak

Hey everyone,

I'm currently working on a SD / MMC Card driver for the stm32f746g-disco Board. You can find my actual very early work right here on my github repository: [0]

Quoted 6 lines

Currently I'm getting errors that are not reproducible:

- Errors on sending different commands (happens somtimes but randomly)

- Errors at CMD 17 & 18 reading procedures

If you can also share the log, it's helpful to check your problem. I don't have board to test yours, but i can check your driver as code level.

Best Regards,
Jaehoon Chung

Quoted 20 lines

And sometimes works everything without any problems....

Right now I think that my hardware got broken (but I'm not sure). It would be nice if someone could test the driver and send me the log. A small code review would help me also.

Thanks in advance!

Best regards,

Philipp Rossak

[0]
https://github.com/embed-3d/stm32_mmc_driver/tree/stm32f7_mmc_hw_testing

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot