1 week ago.

SDBlockDevice does not work with mbed 5.10 and FRDM-K64F

SDBlockDevice example application

#include "mbed.h"
#include "SDBlockDevice.h"

SDBlockDevice sd(PTE3, PTE1, PTE2, PTE4);   // FRDM-K64F, micro SD card

uint8_t block[512] = "Hello World!\n";

int main()
    // call the SDBlockDevice instance initialisation method.
    if ( 0 != sd.init()) {
        printf("Init failed \n");
        return -1;
    printf("sd size: %llu\n",         sd.size());
    printf("sd read size: %llu\n",    sd.get_read_size());
    printf("sd program size: %llu\n", sd.get_program_size());
    printf("sd erase size: %llu\n",   sd.get_erase_size());

    // set the frequency
    if ( 0 != sd.frequency(5000000)) {
        printf("Error setting frequency \n");
    if ( 0 != sd.erase(0, sd.get_erase_size())) {
        printf("Error Erasing block \n");
    // Write some the data block to the device
    if ( 0 == sd.program(block, 0, 512)) {
        // read the data block from the device
        if ( 0 ==, 0, 512)) {
            // print the contents of the block
            printf("%s", block);
    // call the SDBlockDevice instance de-initialisation method.

// mbed os 5.9.5 Success!
// mbed os 5.10.0 Error: Library name 'sd' not unique (defined in /tmp/...)
Comment on this question

2 Answers

1 week ago.

Since Mbed OS 5.10 the SD driver is part of the OS, so delete 'sd-driver' from your project.

Thanks Jan, your reply was very useful

posted by Nikolai Zimfer 11 Oct 2018
6 days, 22 hours ago.

Hi Nikolai,

You will need to add the SD driver present within Mbed OS as a component to the K64F, instructions for using the new configuration can be found here:

Please let me know if you have any questions!

- Jenny, team Mbed

If this solved your question, please make sure to click the "Thanks" link below!

Thanks Jenny, I use the online compiler and the K64F platform. In this case, the compiler should automatically select the configuration parameters for the K64F and integrate them into a binary file.

posted by Nikolai Zimfer 11 Oct 2018

To post an answer, please log in.