at91bootstrap not able to read sd-card

Discussion around products based on ARM Cortex-A5 core.

Moderator: nferre

aeZ7ieVa
Posts: 3
Joined: Tue Oct 02, 2018 3:38 pm

at91bootstrap not able to read sd-card

Wed Oct 03, 2018 5:00 pm

Hi,
i built a custom circuit with the sama5d27-som1. The SD-Card is connected as the one in the evaluation kit.
The bootstrap showed me something like "no card inserted".
After some investigations i solved this by:

Code: Select all

...
#define PMC_PCER0 (*(volatile unsigned int*)0xF0014010)
#define PIOA_MSKR (*(volatile unsigned int*)0xFC038000U)
#define PIOA_CFGR (*(volatile unsigned int*)0xFC038004U)

static int sdhc_is_card_inserted(struct sd_card *sdcard)
{
PMC_PCER0 = 1 << 18;
PIOA_MSKR = 0x3FFF;
PIOA_CFGR = 0x201;
...
It seems like the PIO isn't set up correctly.
Is there really a bug or did i misconfigure something.

Config:

Code: Select all

HAVE_DOT_CONFIG=y
CONFIG_SAMA5D27_SOM1_EK=y
CONFIG_BOARDNAME="sama5d27_som1_ek"
SAMA5D2=y
CONFIG_MACH_TYPE="9999"
CONFIG_LINK_ADDR="0x200000"
CONFIG_TOP_OF_MEMORY="0x210000"
CONFIG_CRYSTAL_24_000MHZ=y
ALLOW_CRYSTAL_24_000MHZ=y
CONFIG_CRYSTAL="CRYSTAL_24_000MHZ"
CONFIG_CPU_CLK_492MHZ=y
ALLOW_CPU_CLK_492MHZ=y
CONFIG_BUS_SPEED_164MHZ=y
SUPPORT_BUS_SPEED_164MHZ=y
CPU_HAS_TRUSTZONE=y
CONFIG_CPU_V7=y
CORE_CORTEX_A5=y
CPU_HAS_SCKC=y
CPU_HAS_H32MXDIV=y
CPU_HAS_SDHC0=y
CPU_HAS_SDHC1=y
CPU_HAS_SPI0=y
CPU_HAS_SPI1=y
CPU_HAS_SPI0_IOSET1=y
CPU_HAS_SPI0_IOSET2=y
CPU_HAS_SPI1_IOSET1=y
CPU_HAS_SPI1_IOSET2=y
CPU_HAS_SPI1_IOSET3=y
CPU_HAS_QSPI0=y
CPU_HAS_QSPI1=y
CPU_HAS_QSPI0_IOSET1=y
CPU_HAS_QSPI0_IOSET2=y
CPU_HAS_QSPI0_IOSET3=y
CPU_HAS_QSPI1_IOSET1=y
CPU_HAS_QSPI1_IOSET2=y
CPU_HAS_QSPI1_IOSET3=y
CPU_HAS_L2CC=y
CPU_HAS_PMECC=y
CPU_HAS_TWI0=y
CPU_HAS_TWI1=y
CPU_HAS_AES=y
CPU_HAS_PIO4=y
CONFIG_DDRC=y
ALLOW_DATAFLASH=y
ALLOW_SDCARD=y
CONFIG_RAM_128MB=y
CONFIG_DDR2=y
CONFIG_SDCARD=y
CONFIG_MEMORY="sdcard"
CONFIG_SDHC=y
CONFIG_SDHC0=y
CONFIG_FATFS=y
CONFIG_BOOTSTRAP_MAXSIZE="65536"
CONFIG_PROJECT="sdcard"
CONFIG_LOAD_UBOOT=y
CONFIG_JUMP_ADDR="0x23f00000"
CONFIG_IMAGE_NAME="u-boot.bin"
CONFIG_DEBUG=y
CONFIG_DEBUG_INFO=y
CONFIG_DISABLE_WATCHDOG=y
CONFIG_HW_DISPLAY_BANNER=y
CONFIG_HW_BANNER="\"\\n\\nAT91Bootstrap \" AT91BOOTSTRAP_VERSION \" (\" COMPILE_TIME \")\\n\\n\""
CONFIG_HW_INIT=y
CONFIG_SCLK=y
CONFIG_MATRIX=y
CONFIG_REDIRECT_ALL_INTS_AIC=y
blue_z
Location: USA
Posts: 1745
Joined: Thu Apr 19, 2007 10:15 pm

Re: at91bootstrap not able to read sd-card

Thu Oct 04, 2018 2:24 am

aeZ7ieVa wrote: i built a custom circuit with the sama5d27-som1. The SD-Card is connected as the one in the evaluation kit.
Since the ATSAMA5D27-SOM1-EK1 board has two (2) SDcard sockets, your description of "the one" is ambiguous.
You also neglect to specify the version of software.

aeZ7ieVa wrote: Is there really a bug or did i misconfigure something.
I don't know if there is a "bug", but don't rush to claim that you have found a bug.
You certainly did misconfigure a few "something"s.

A quick glance at your configuration indicates that you've enabled mutually-exclusive items in four sets.

Code: Select all

CPU_HAS_SPI0_IOSET1=y
CPU_HAS_SPI0_IOSET2=y

Code: Select all

CPU_HAS_SPI1_IOSET1=y
CPU_HAS_SPI1_IOSET2=y
CPU_HAS_SPI1_IOSET3=y

Code: Select all

CPU_HAS_QSPI0_IOSET1=y
CPU_HAS_QSPI0_IOSET2=y
CPU_HAS_QSPI0_IOSET3=y

Code: Select all

CPU_HAS_QSPI1_IOSET1=y
CPU_HAS_QSPI1_IOSET2=y
CPU_HAS_QSPI1_IOSET3=y

Presumably one of these oddball configurations clobbered the required PIO configuration for whatever SDcard interface that you're using.

Regards
aeZ7ieVa
Posts: 3
Joined: Tue Oct 02, 2018 3:38 pm

Re: at91bootstrap not able to read sd-card

Thu Oct 04, 2018 10:44 am

Thanks for your reply.

I use the SDMMC0 Peripheral with Ports PA00-PA13 or so.
The config was auto-generated with:

Code: Select all

make sama5d27_som1_eksd_uboot_defconfig
As the evaluation kit uses the same wiring this should work.
Can anyone confirm that the defconfig is broken for the eval kit too?
I don't know if there is a "bug", but don't rush to claim that you have found a bug.
Therefore i'm asking and not complaining. :D

Commenting the IOSET lines doesn't help by the way. The following Change:

Code: Select all

...
CPU_HAS_SDHC0=y
#CPU_HAS_SDHC1=y
#CPU_HAS_SPI0=y
#CPU_HAS_SPI1=y
#CPU_HAS_SPI0_IOSET1=y
#CPU_HAS_SPI0_IOSET2=y
#CPU_HAS_SPI1_IOSET1=y
#CPU_HAS_SPI1_IOSET2=y
#CPU_HAS_SPI1_IOSET3=y
#CPU_HAS_QSPI0=y
#CPU_HAS_QSPI1=y
#CPU_HAS_QSPI0_IOSET1=y
#CPU_HAS_QSPI0_IOSET2=y
#CPU_HAS_QSPI0_IOSET3=y
#CPU_HAS_QSPI1_IOSET1=y
#CPU_HAS_QSPI1_IOSET2=y
#CPU_HAS_QSPI1_IOSET3=y
...
Leads to the same Problem.
blue_z
Location: USA
Posts: 1745
Joined: Thu Apr 19, 2007 10:15 pm

Re: at91bootstrap not able to read sd-card

Thu Oct 04, 2018 11:57 am

aeZ7ieVa wrote: I use the SDMMC0 Peripheral with Ports PA00-PA13 or so.
That's salient information, but you still haven't revealed what version of AT91Bootstrap you're using.

aeZ7ieVa wrote: Can anyone confirm that the defconfig is broken for the eval kit too?
On the contrary, another user has reported success for the other SDMMC1 socket.
The Linux4SAM 5.8 demo image can be tested with the SDMMC0 socket; see this.

Regards
aeZ7ieVa
Posts: 3
Joined: Tue Oct 02, 2018 3:38 pm

Re: at91bootstrap not able to read sd-card

Thu Oct 04, 2018 4:20 pm

I use the latest git version 65a65620f82ac195c524c9fbae3fa28e597ff373.
But the version 3.8.9 mentioned in your thread gives me the same error:
AT91Bootstrap 3.8.9 (Do 4. Okt 13:16:40 CEST 2018)
SD/MMC: Image: Read file u-boot.bin to 0x23f00000
SDHC: Error: No Card Inserted
I investigated this further and found the code that should set up the pins. It is in board/sama5d27_som1_ek/sama5d27_som1_ek.c:458.
Inserted debug prints are showing that this is also called before the error happens.

Ist it possible to read out the state of an Pin whether it is GPIO or Peripheral ABC. Because the thing with the mask register makes this not clear.
blue_z
Location: USA
Posts: 1745
Joined: Thu Apr 19, 2007 10:15 pm

Re: at91bootstrap not able to read sd-card

Thu Oct 04, 2018 8:01 pm

The simple sanity test is to boot with the prebuilt Linux4SAM 5.8 demo image for the ATSAMA5D27-SOM1-EK1.
That should either refute your claim that your board is wired like the eval board, or cast suspicion on your build environment.

The following was added to at91bootstrap/KNOWN_ISSUES four weeks ago:

Code: Select all

2./ With older gcc , version below 5.0, there are reported errors on accessing
eMMC and SD-Card devices, namely when using 8-bit bus width.
It is recommended to use toolchain newer than 6.0.
There's also the list of validated toolchains in the AT91Bootstrap's README.txt.


Regards

Return to “SAMA5D Cortex-A5 MPU”

Who is online

Users browsing this forum: No registered users and 2 guests