6 years, 3 months ago.

Cannot get SD card working with NUCLEO-L476RG pinmap not found for peripheral / Fatal Run-time error

Hello, I am using the NUCLEO_L476RG for a client development, the SD card must be implemented and so i use https://github.com/ARMmbed/sd-driver in an empty project with up to date MBED library.

But, despite a lot of tries for few hours it seems impossible to get it working (at all), i have defined the correct ports in the library intialisation, also in the mbed_lib.json config file,

SDBlockDevice bd(SPI_MOSI,SPI_MISO,SPI_SCK,SPI_CS);

             "SPI_MOSI": "PA_7",
             "SPI_MISO": "PA_6",
             "SPI_CLK":  "PA_5",
             "SPI_CS":   "PB_6"

but all i got is error in console :

  ++ MbedOS Error Info ++
Error Status: 0x80010130 Code: 304 Module: 1
Error Message: pinmap not found for peripheral
Location: 0x8010677
Error Value: 0xffffffff
Current Thread: Id: 0x80396f1 Entry: 0x10 StackSize: 0x200010cc StackMem: 0x0 SP: 0x17 
-- MbedOS Error Info --
[Disconnected]
$$$07650221153367022A77F15A
[Connected]

later when i tried to set SPI 2 in mbed_lib.json i got a fatal (unknown) run-time error, thats it

++ MbedOS Error Info ++
Error Status: 0x80ff0100 Code: 256 Module: 255
Error Message: Fatal Run-time error
Location: 0x8009aa7
Error Value: 0x0
Current Thread: Id: 0x1 Entry: 0x0 StackSize: 0x8009697 StackMem: 0x20000cc0 SP: 0x69 
-- MbedOS Error Info --
error: Unknown error (-5005)

How come such a simple thing is not working? i use the stock example provided in the documentation. https://os.mbed.com/docs/v5.9/reference/fatfilesystem.html modified as shown here: https://os.mbed.com/questions/82144/SD-Card-File-System-example-broken-with-/

I tried to open a SPI port in another project with the same GPIOs of course, and it doesnt throw any error. I also loaded the project in SW4STM32 in order to debug it, however the error is thrown well before the main, in some intialisations done by (the compiled) mbed library, and thus it is impossible to place soem setpoints and step debug.

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32L476RGT6 microcontroller.

3 Answers

6 years, 3 months ago.

Hi Hoel,
Please try my program below.

Import programSD_Card_Control_on_OS5

SD Card control on Mbed os5

I just updated the program and check it on Nucleo-L476RG.
Looks okay.

DigitalOut      vout(PC_9, 1);

I'm controling micro-SD card power line using above vout.
You can comment out the line 28 in main.cpp.
Below part is same as your pin assignment.

SDBlockDevice   sd(D11, D12, D13, D10, 8000000);
FATFileSystem   fs("fs");

Follow is a result in the file.
And time stamp is also collect value.
You can set from PC communication line (115200bps).

DATE 18:25:57,2018/08/29,00010124;00020124;00030124;00040124;00050124;00060124
DATE 18:25:57,2018/08/29,00010125;00020125;00030125;00040125;00050125;00060125
DATE 18:25:58,2018/08/29,00010126;00020126;00030126;00040126;00050126;00060126
DATE 18:25:58,2018/08/29,00010127;00020127;00030127;00040127;00050127;00060127
DATE 18:25:58,2018/08/29,00010128;00020128;00030128;00040128;00050128;00060128
DATE 18:25:58,2018/08/29,00010129;00020129;00030129;00040129;00050129;00060129
DATE 18:25:58,2018/08/29,00010130;00020130;00030130;00040130;00050130;00060130
DATE 18:25:58,2018/08/29,00010131;00020131;00030131;00040131;00050131;00060131
DATE 18:25:58,2018/08/29,00010132;00020132;00030132;00040132;00050132;00060132
DATE 18:25:59,2018/08/29,00010133;00020133;00030133;00040133;00050133;00060133
DATE 18:25:59,2018/08/29,00010134;00020134;00030134;00040134;00050134;00060134
DATE 18:25:59,2018/08/29,00010135;00020135;00030135;00040135;00050135;00060135
DATE 18:25:59,2018/08/29,00010136;00020136;00030136;00040136;00050136;00060136
DATE 18:25:59,2018/08/29,00010137;00020137;00030137;00040137;00050137;00060137
DATE 18:25:59,2018/08/29,00010138;00020138;00030138;00040138;00050138;00060138
DATE 18:25:59,2018/08/29,00010139;00020139;00030139;00040139;00050139;00060139

6 years, 3 months ago.

Hi

You can also check code from ci-test-shield :

https://github.com/ARMmbed/ci-test-shield/blob/master/TESTS/API/SPI/SPI.cpp

Tests are OK with NUCLEO-L476RG

6 years, 3 months ago.

If you are not getting the particular part where you will be having the user to provide the best way to get the sd card so https://netgears.support/netgear-technical-support/ will provide the process for the sd card will work in the nucleo-l which is important for the users to have it for their work.