STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
sntnjrg
Posts: 65
Joined: Mon Jul 22, 2019 2:19 pm
Has thanked: 18 times
Been thanked: 3 times

Re: STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory  Topic is solved

Postby sntnjrg » Mon Jun 01, 2020 12:09 pm

Hi,

I'm sorry, I'm a newbie user. Please, can you tell me what's problem? I've run the example(/chibios_trunk/testhal/STM32/multi/SDMMC) and it doesn't work for me. Have you tested the example on the stm32L4r5zi model?

The examples have been tested by different people and different boards (strm32l4r5zi). In all cases the same thing happens.

Please, would you or someone from Chibios' team please test it on that board?

It would be useful to know if it really works on the strm32l4r5zi model.

I forgot to tell you: I only run this command once time: sdc all

Thanks for the help.

sntnjrg
Posts: 65
Joined: Mon Jul 22, 2019 2:19 pm
Has thanked: 18 times
Been thanked: 3 times

Re: STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory

Postby sntnjrg » Mon Jun 01, 2020 1:31 pm

Hi Giovanni,

I've analyzed the code in depth. In the mcuconf.h file, I notice the following differences:
mcu1.png


Not sure, but probably my problems stem from an incorrect board configuration. Please, can you check and comment on possible errors?

Concerning the code, in the adaptation of the example (https://github.com/ChibiOS/ChibiOS/tree ... ulti/SDMMC), I have added the following:

Code: Select all

  /*
   * Port mapping.
   */
  const uint32_t mode = PAL_MODE_ALTERNATE(12) | PAL_STM32_OTYPE_PUSHPULL |
      PAL_STM32_OSPEED_HIGH | PAL_STM32_PUPDR_FLOATING | PAL_STM32_MODE_ALTERNATE;

  palSetPadMode(GPIOC, 8U,  mode | PAL_STM32_PUPDR_PULLUP); // D0
  palSetPadMode(GPIOC, 9U,  mode | PAL_STM32_PUPDR_PULLUP); // D1
  palSetPadMode(GPIOC, 10U, mode | PAL_STM32_PUPDR_PULLUP); // D2
  palSetPadMode(GPIOC, 11U, mode | PAL_STM32_PUPDR_PULLUP); // D3
  palSetPadMode(GPIOC, 12U, mode                         ); // CK
  palSetPadMode(GPIOD, 2U,  mode | PAL_STM32_PUPDR_PULLUP); // CMD

  palSetPadMode(GPIOF, 13U, PAL_MODE_INPUT_PULLUP); // CD


Another difference is that I use the instance LPSD1 and in the example SD2. Also, you have activated STM32_TRNG_USE_RNGI. Is this last one necessary?

mcu2.png


Thanks for the help.

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory

Postby Giovanni » Mon Jun 01, 2020 1:54 pm

All those changes make no difference, one board is clocked by MSI, the other by HSE. I tested on an STM32L4R9AI which is very similar to your device.

I run the command "sdc write" and it always work. Does it fail for you each time or randomly?

Just a note, do not specify PAL_STM32_PUPDR_FLOATING and PAL_STM32_PUPDR_PULLUP at same time, it should make no difference anyway. Are all those pins unused on your board?

Giovanni

sntnjrg
Posts: 65
Joined: Mon Jul 22, 2019 2:19 pm
Has thanked: 18 times
Been thanked: 3 times

Re: STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory

Postby sntnjrg » Tue Jun 02, 2020 1:00 pm

Hi Giovanni,

I have performed the following tests:

sdc read --> working
sdc write --> working
sdc erase --> failed! the thread goes to sleep
sdc all --> failed! due to the erase part.

The reading and writing works fine. I tried it several times (resetting the board inclusive) and it works fine.

At this moment, the erase option is not a priority in my project.

I tested the other project, located at: https://github.com/ChibiOS/ChibiOS/blob ... TFS/main.c
The file system is loaded but when it is read the content of the card, nothing is displayed. It also cannot create the file (the f_open() function fails).

Does the card have to be formatted according to the value set in FF_CODE_PAGE?

Thank you very much for your help.

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory

Postby Giovanni » Tue Jun 02, 2020 1:55 pm

hi,

The erase command does not work for me too, not sure why but the card executes it but the erase is not performed. However the thread does not go to sleep in my case, if fails the comparison after reading back the erased sector (the erase did not happen, the sector is not modified)..

Giovanni

sntnjrg
Posts: 65
Joined: Mon Jul 22, 2019 2:19 pm
Has thanked: 18 times
Been thanked: 3 times

Re: STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory

Postby sntnjrg » Wed Jun 03, 2020 3:05 pm

Hi Giovanni,

In the case of erase command, when the sdcRead() function is invoked at this point in the code, the thread is sent to sleep.

Code: Select all

    sdcflags_t errflags = sdcGetAndClearErrors(&PORTAB_SDCD1);
    if(errflags) {
      chprintf(chp, "sdcErase() yielded error flags: %d\r\n", errflags);
      goto exittest;
    }
    if(sdcRead(&PORTAB_SDCD1, startblk, buf2, 2)) {                              // <--- HERE
      chprintf(chp, "single-block sdcErase() failed\r\n");
      goto exittest;
    }


Another question, I have been working with this example: https://github.com/ChibiOS/ChibiOS/blob ... TFS/main.c and I have noticed that the function f_write() fails. The error is: FR_DISK_ERR (A hard error occurred in the low level disk I/O layer). By tracing, the error originates here:

Code: Select all

if (clst == 0xFFFFFFFF) ABORT(fs, FR_DISK_ERR);


At a low level, this function uses the sdcWrite() and sdcRead() functions.

Does this example work for you?

The card is formatted in Fat32 (I had used the tool: gnome-disks). The file system is mounted without problems. The tree command works. If I create a text file with content from GNU/Linux and then create a command to read a file, I have checked that it works fine. But the create command that creates a file and adds content to it, fails to write the content.

Thanks for the help

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory

Postby Giovanni » Wed Jun 03, 2020 3:26 pm

It does not happen to me, the read after the erase is performed. So far I have been unable to reproduce the issue.

Try to get the same board I am using, this way you could compare.

Giovanni

sntnjrg
Posts: 65
Joined: Mon Jul 22, 2019 2:19 pm
Has thanked: 18 times
Been thanked: 3 times

Re: STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory

Postby sntnjrg » Wed Jun 03, 2020 4:01 pm

Ok.

With respect to the example:

https://github.com/ChibiOS/ChibiOS/blob ... TFS/main.c

Does it work for you? If you take the card out and put it back in, will the associated events be triggered?

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory

Postby Giovanni » Wed Jun 03, 2020 4:36 pm

It does not work because that board does not implement correctly card insertion detection, sdcConnect() is only called at startup, it should be called each time the card is inserted. It works on other boards with card detection.

There is a function in board.c to be implemented for that to work.

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 54 guests