On 05/03/2019 13:36, Zubair Lutfullah Kakakhel wrote: > On Mon, Feb 25, 2019 at 10:43 AM Zubair Lutfullah Kakakhel > <zub...@balena.io> wrote: >> >> Hi, >> >> I've encountered occasional glitches while writing to the sd card >> via u-boot(2018.07) on a Pi 3 B+. The goal is to write the bootcount >> in the boot partition. As a test, this is the loop I used to read, display >> contents, write to the same file over and over again. >> >> ``` >> mw 200000 0 >> while itest *200000 == 0 ; do >> fatload mmc 0:1 $kernel_addr_r resin-image >> md $kernel_addr_r 18 >> fatwrite mmc 0:1 $kernel_addr_r resin-image 18 >> echo === done ==== >> done >> ``` >> resin-image is a file in the boot partition that has some text in it. >> >> After a few minutes of this loop running, I 'sometimes' get this error >> and the sd card stops working >> >> ``` >> writing resin-image >> wait_transfer_complete - still waiting after 100001 retries >> mmc write failed >> Error: flush fat buffer >> >> ** Unable to write "resin-image" from mmc 0:1 ** >> WARNING at >> /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:376/bcm2835_prepare_data()! >> WARNING at >> /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! >> WARNING at >> /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! >> WARNING at >> /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! >> WARNING at >> /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! >> WARNING at >> /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! >> ** Can't read partition table on 0:0 ** >> ** Invalid partition 1 ** >> 00080000: 4e204f44 5220544f 564f4d45 48542045 DO NOT REMOVE TH >> 00080010: 46205349 0a454c49 0f030f03 0f030f03 IS FILE......... >> 00080020: 0f030f03 0f030f03 01600103 03030300 ..........`..... >> 00080030: 03030303 03030303 03030303 03030303 ................ >> 00080040: 03030303 03030303 03030303 03034103 .............A.. >> 00080050: 03030303 03030303 03030303 03030303 ................ >> WARNING at >> /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! >> WARNING at >> /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! >> WARNING at >> /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! >> WARNING at >> /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! >> WARNING at >> /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! >> WARNING at >> /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! >> ** Can't read partition table on 0:0 ** >> ** Invalid partition 1 ** >> ``` >> >> What is even more concerning is that the device can't boot. Even if a >> write failed. >> Subsequent reads seem to fail as well. >> >> ``` >> U-Boot> mmc part >> >> Partition Map for MMC device 0 -- Partition Type: DOS >> >> Part Start Sector Num Sectors UUID Type >> WARNING at >> /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! >> WARNING at >> /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! >> WARNING at >> /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! >> WARNING at >> /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! >> WARNING at >> /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! >> WARNING at >> /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! >> ** Can't read partition table on 0:0 ** >> U-Boot> >> ``` >> >> I can recover the device after a reboot. >> >> Any thoughts/ideas about where/what I should look for? >> Or if I'm lucky, any wip patches floating around? > > Any thoughts? >
I tried with master branch: 8303467e80 ("Merge git://git.denx.de/u-boot-fsl-qoriq") And I wasn't able to reproduce the issue. I see you are using a one year old u-boot. If you can't bump to a newer version, then I would propose to find a version that doesn't show this bug and run git-bisect between the two to find the commit that fixed the issue. Best regards, Matthias _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot