sample fat_fs

Hi,

I'm trying the  sample fat_fs  on the nRF5340 DK

1) It does build, but there is awarning

CMake Warning at D:\nRfConnect\v1.8.0\zephyr\CMakeLists.txt:722 (message):
No SOURCES given to Zephyr library: drivers__disk

2) looked with the debugger: in the main() it reaches the  LOG_ERR("Storage init ERROR!");

void main(void)

if (disk_access_init(disk_pdrv) != 0) {
LOG_ERR("Storage init ERROR!");
 
Could you please comment on the above 2 points ?
What steps should i make to have a SD-card running,  is using sample fat_fs the way to go ?
Best Regards,
Theo
Parents
  • Hi Simon,

    Thanks for the help.

    i added  nrf5340dk_nrf5340_cpuapp.overlay   with the same content as nrf52840_blip.overlay

    (added in VisualStudioCode  at input files,  the tool places the file   nrf5340dk_nrf5340_cpuapp.overlay  in the  fat_fs-directory, not in the fat_fs/boards directory)

    i placed the same content from nrf52840_blip.overlay   into the  nrf5340dk_nrf5340_cpuapp.overlay

    it showed 2 problems:   wiggle-line under &spi1  and a wiggle-line under sdhc@0

    I altered &spi1 into &spi2   now the 2 problems where gone.  so did a prestine-build, and looked in the zephyr.dts

    in there i found:

    spi2: spi@b000 {
    #address-cells = < 0x1 >;
    #size-cells = < 0x0 >;
    reg = < 0xb000 0x1000 >;
    interrupts = < 0xb 0x1 >;
    status = "okay";
    label = "SPI_2";
    compatible = "nordic,nrf-spim";
    sck-pin = < 0x2f >;
    miso-pin = < 0x2e >;
    mosi-pin = < 0x2d >;
    cs-gpios = < &gpio0 0x11 0x0 >;
    sdhc0: sdhc@0 {
    compatible = "zephyr,mmc-spi-slot";
    reg = < 0x0 >;
    status = "okay";
    label = "SDHC0";
    spi-max-frequency = < 0x16e3600 >;
    };

    So now the pins ..   does sck-pin <0x2f> means   47 -> 47-32=15   so P1.15    correct??   (and so on for 0x2e, 0x2d)

    in the nrf5340 dk schematic i find   p1.15  on GPIO_IF2 D13  ... so ok 

    But now the cs-gpios   &gpio0 0x11 0x0        does this mean gpio0   -> P0.00    or  0x11->17-> P0.17  

    P0.00 would be OK  (GPIO_IF3 / d14)   but  P0.17 is QSPI_clk (SB21)  so ocuppied.

    i will try  to connect a sd-card on the pins  P1.15, P1.14, P1.13   and the CS on P0.00  ..

    Then bonus question:  could i alter the pins to different location?, how is that being done in the software ?

    Looking forward on your comments Simon,  thanks.

    Best Regards,

    Theo

  • Hi Simon,

    Thanks again for the valuable info.  (definitely more studying on my side :-)

    I connected all  and using p0.17 for the cs., and double, double checked.

    unfortunately, no cigar.., still not working..   it still hits the LOG_ERR("Storage init ERROR!");  (as with my original question 2) )

    maybe relevant to mention .. ??

    in de 'input-files'  there are a few problems signaled:

    -in the file 'nrf5340dk_nrf5340_cpuapp.dts'  a wiggle-line (at line-13)   compatible = "nordic,nrf5340-dk-nrf5340-cpuapp";

    -in the file ''nrf5340_cpuapp_qkaa.dtst 3-wigglles (at line 24)

    compatible = "nordic,nRF5340-CPUAPP-QKAA", "nordic,nRF5340-CPUAPP", "nordic,nRF53", "simple-bus";

     wiggles under all exept "simple-bus".

    --

    then to be sure the connections i made to the sd-card  ( im using: https://www.sparkfun.com/products/544 )

    p1.15  connected to 'sck'

    p1.14 connected to 'DO'

    p1.13 connected to 'DI'

    p0.17 connected to 'CS'

    vdd   connected to 'VCC'

    gnd connected to 'GND'

    Please your comments again.. (lets nail this :-)

    Best Regards,

    Theo

  • Hmm.. I'm sorry it's that much hassle getting it to work

    I will take a deep dive next week and see if I can get to the bottom of it

    Best regards,

    Simon

  • Hi Simon,

    Yes, please do so, ...much appreciated !!

    One point i noticed:  in the Device Tree/ GPIO  there i could not find the  cs-gpios, while the 3-Spi signals can be seen in that list.

    Im looking forward, to your deep-dive result.

    Best Regards,

    Theo

  • Okay, I took a deep dive, but before I add a lot of explanations and what could possibly be the cause, could you test one quick thing? Add these two configs to the file zephyr/samples/subsys/fs/fat_fs/prj.conf.

    I think the warning "No SOURCES given to Zephyr library: drivers__disk" will go away when setting CONFIG_DISK_DRIVER_SDMMC=y

    Check the file zephyr/samples/subsys/fs/fat_fs/build/zephyr/.config and make these two configs are present and that CONFIG_SDMMC_VOLUME_NAME (this should get enabled automatically when enabling CONFIG_DISK_DRIVER_SDMMC) is equal to "SD" (or whatever disk_pdrv is set equal to).

    If it still doesn't work, please get back to me

  • Hi Simon,

    i used:  'create new aplication from sample', 'freestanding'

    and put in the directory D:\Projects\Nordic_Semi\nRF5340DK\MyApps\fat_fs

    D:\Projects\Nordic_Semi\nRF5340DK\MyApps\fat_fs\prj.conf  contains now:

    CONFIG_DISK_ACCESS=y
    CONFIG_LOG=y
    CONFIG_FILE_SYSTEM=y
    CONFIG_FAT_FILESYSTEM_ELM=y
    CONFIG_PRINTK=y
    CONFIG_MAIN_STACK_SIZE=2048

    CONFIG_DISK_DRIVER_SDMMC=y
    CONFIG_SPI=y

    saved all, and did a prestine build:

    this is still there:  

    CMake Warning at D:\nRfConnect\v1.9.0\zephyr\CMakeLists.txt:764 (message):
    No SOURCES given to Zephyr library: drivers__disk

    and in the file  D:\Projects\Nordic_Semi\nRF5340DK\MyApps\fat_fs\build\zephyr\  .conf

    there is indeed:

    CONFIG_SDMMC_VOLUME_NAME="SD"

    Best Regards,

    Theo

    PS: i will go and check if i get signals ??

  • Hi Simon,

    I tried again..   the warning

    CMake Warning at D:\nRfConnect\v1.9.0\zephyr\CMakeLists.txt:764 (message):
    No SOURCES given to Zephyr library: drivers__disk

    is now gone..

    My mistake sorry

    but i do not see the  cs-gpios  signal in the Device Tree/ GPIO

    Best Regards,

    Theo

    PS: i will go and check if i get signals ??

Reply Children
Related