SDBlockDevice init takes too much time in bootloader

BacBen
Thu, 08 Jul 2021 19:59:55 +0000
Best practice

Hello all,

within my project I am using a nrf52840 and attached a SD card that is communication through the SDBlockDevice and SPI interface. While the SD communication and operations like rear, write, erase work all flawlessly I am having an issue with the SDBlockDevice Init function - especially in Bootloader mode. It is working and always ends with 0 but it takes about 5 seconds to complete the initialization. Is it an expected behavior? If I ran init again from my application (after bootloader was successfully passed) initialization of the blockdevice is immediately finished. I wonder if there is something else that I need to do before initializing the SDblockDevice? Anyone else experiencing this behavior?

I have run it on 3 different test boards - all with the same result. My code looks basically like this:

SDBlockDevice *sdbd;
sdbd = new SDBlockDevice(MBED_CONF_SD_SPI_MOSI,
                                            MBED_CONF_SD_SPI_MISO,
                                            MBED_CONF_SD_SPI_CLK,
                                            MBED_CONF_SD_SPI_CS, 1000000);

	int err = sdbd->init();
	printf("sdbd.init -> %d\n", err);
	fflush(stdout);

	uint64_t sdsize = sdbd->size();
	printf("sd size:  %llu\n", sdsize););

9 posts - 2 participants