5 years, 3 months ago.

Running the SDBLOCKDEVICE example code

Hello, i'm using the NUCLEO F411RE board, together with a DIGILENT PMODSD card board. To access this SD card I'm trying to compile the example present in the following link: https://os.mbed.com/docs/mbed-os/v5.13/apis/sdblockdevice.html

However this code does not compile, and the only error I get is: "Internal Error", with no other details. I'm stumped. I've also attached the code files/media/uploads/ryudas/main.cpp , as well as the images of the json objects and project structure /media/uploads/ryudas/screen_shot_2019-08-14_at_11.59.25_am.png /media/uploads/ryudas/screen_shot_2019-08-14_at_11.59.20_am.png /media/uploads/ryudas/screen_shot_2019-08-14_at_11.59.15_am.png

I've tried changing quite a few things, to no avail

1 Answer

5 years, 3 months ago.

Hello John,

Because you have the mbed library attached to your project you are trying to build an Mbed OS-2 (aka Mbed Classic) program. However, the SDBlockDevice is designed for Mbed OS-5:

  • Delete your current SDCardTest project from the online compiler.
  • When creating a new one, make sure you select an Mbed OS-5 template. For example Blinky example for mbed OS 5.0 ... . Once created, you should see the mbed-os library attached to the new SDCardTest project rather than the mbed one.
  • Replace the main.cpp with the one from the SDBlockDevice example.
  • Add the mbed_app.json file (with the same content as before).
  • Do not add the targets.json file.

For more examples have a look at:

Thank you very much for your response. I dont get an internal error anymore, however I do get : Error: Could not parse mbed app configuration from /tmp/chroots/ch-1ba86681-6b4b-4fc3-9638-df40ede89799/src/mbed_app.json, although I followed the examples yet again.

Would you know why this json is not being parsed?

Thanks again for all your help

posted by john mayer 19 Aug 2019

Copy & paste the following text into the mbed_app.json file. It worked fine for me:

mbed_app.json

{
    "target_overrides": {
        "*": {
            "target.components_add": ["SD"],
            "sd.SPI_MOSI": "D11",
            "sd.SPI_MISO": "D12",
            "sd.SPI_CLK": "D13",
            "sd.SPI_CS": "D9"
        }
    }
}

Repeat compilation until it succeeds.

posted by Zoltan Hudak 19 Aug 2019

Unfortunately it is still unsuccessful. Thank you for your help.

posted by john mayer 09 Sep 2019