Hello. I want to use microSD card mounted in my device tree overlay on SPI3 as "zephyr,mmc-spi-slot" instead of onboard NOR flash for full modem firmware update. Hovewer, during FMFU initialization in function call tree:
Hello. I want to use microSD card mounted in my device tree overlay on SPI3 as "zephyr,mmc-spi-slot" instead of onboard NOR flash for full modem firmware update. Hovewer, during FMFU initialization in function call tree:
Hi,
Do you plan to download the new modem images via the nRF9160, or is the idea that the user will place the image on the SD card themselves?
I don't think you can use the SD card directly with the dfu_target or fmfu_fdev libraries, as they assume you can access a random part of the flash directly, rather than having to read it in blocks. The libraries also don't account for any file system, so that might also cause problems.
However, you should be able to use the full modem update API directly from the modem library, where the application handles reading (and writing if necessary) from the SD card itself.
See the documentation here for how to perform a full modem update.
Best regards,
Didrik
Hi,
Do you plan to download the new modem images via the nRF9160, or is the idea that the user will place the image on the SD card themselves?
I don't think you can use the SD card directly with the dfu_target or fmfu_fdev libraries, as they assume you can access a random part of the flash directly, rather than having to read it in blocks. The libraries also don't account for any file system, so that might also cause problems.
However, you should be able to use the full modem update API directly from the modem library, where the application handles reading (and writing if necessary) from the SD card itself.
See the documentation here for how to perform a full modem update.
Best regards,
Didrik
Idea in that there is no spi NOR flash on my board, but it is only on nRF9160DK board. On my board there is only SD card. The aim is to make Zephyr consider a single file on sd card as an external flash where it can write/read FMFU binary file, using as buffer.
Now I written a driver code with implemented flash_driver_api functionality. This driver writes and read in a single opened file on FAT formatted SD card. However, my driver is not initialized by Zephyr, I dont know how exactly to add it to device tree overlay file. To spi3? Or to sdhc0: sdhc@0, which I put to spi3? How to make Zephyr see and initialize my driver?
You will probably have to write a bindings file, so that you can define your own device tree node.
That way, the device tree node can be tied to your flash driver, so that Zephyr knows that it should initialize it.
You can read more about how it is done here:
https://iwasz.pl/electronics/2021-06-18-out-of-tree-zephyr-module.md/
https://github.com/martelmy/NCS_examples/tree/main/devicetree/devicetree_custom_device
Yes, I just created it "my,file-flash-drive.yaml" , but how to tell build system where to search for this file?
description: | Raw flash storage emulation based on a single file in FAT-FS formatted SD card compatible: "my,file-flash-drive" include: ["base.yaml"]
list(APPEND DTS_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/src/file_flash_drive) list(APPEND EXTRA_ZEPHYR_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/src/file_flash_drive)
dev = device_get_binding(DT_LABEL(DT_INST(0, my_file_flash_drive)));
/ { file-flash-drive { compatible = "my,file-flash-drive"; status = "okay"; }; };
UPD: I make it recognizable by Zephyr, however, I found that fatfs is initialized later than my driver. My driver has priority
But fs system is defined inside of SDK as
What level (e.g. POST_KERNEL, APPLICATION) is your driver initialized at?
Do you need your driver to be initialized that early, or can you initialize it after the fatfs driver?
To initialize it after the fatfs driver, you can set the level to POST_KERNEL and the priority to something higher than CONFIG_KERNEL_INIT_PRIORITY_DEFAULT (the default value for this symbol is 40. Note that you cannot write an expression, so you cannot use e.g. "CONFIG_KERNEL_INIT_PRIORITY_DEFAULT + 1").
Otherwise, you will have to change the fatfs driver to be initialized earlier, but that might cause problems if it depends on other drivers or features that haven't been initialized at that point. The easiest will be to change the initialization level and priority of your driver.