AZURE RTOS Filex - how to access second volume on a SD card using FILEX

SQ Jin 16 Reputation points
2022-01-27T03:03:46.763+00:00

Two volumes are created on a SD card, the file system is exfat. Then I put some files to partition and try to read files using filex. Now i can access to first volume, but i cannot find a service to read the files on second volume.

Azure RTOS
Azure RTOS
An Azure embedded development suite including a small but powerful operating system for resource-constrained devices.
324 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Xiuwen Cai 366 Reputation points Microsoft Employee
    2022-01-29T11:09:57.017+00:00

    Hi @SQ Jin , the fx_media_open function opens one volume each time. The number of FATs does not mean volume count. The second volume needs to be opened by calling fx_media_open too.
    In current sample drivers, only the first partition is accessed. See the code in the driver:

            status =  _fx_partition_offset_calculate(media_ptr -> fx_media_driver_buffer, 0,  
                                                     &partition_start, &partition_size);  
    

    The driver reads partition 0 info only. To enable access to the second partition, you can modify the driver to support multiple partition access. Besides, you need to pay attention to thread safety issues as the driver may be called from different threads simultaneously.

    1 person found this answer helpful.
    0 comments No comments