This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Read and Write To SD card using NullSrc

Hi All,

We are evaluating the TDA2x_Evm board for one project.We are using the vision SDK3.0(Bios only) for the development.we are new for this SOC.and we have basic idea of link and chain framework.

My demo application contains following usecase chain.

UseCase: chains_sdcard_Display

NullSource (IPU1_0) -> Display

if i directly using the fatfs APIs,all the APIs are defined under


#if ( defined(FATFS_PROC_TO_USE_IPU1_0) && defined(BUILD_M4_0) ) || \
    ( defined(FATFS_PROC_TO_USE_IPU1_1) && defined(BUILD_M4_1) ) || \
    ( defined(FATFS_PROC_TO_USE_IPU2)   && defined(BUILD_M4_2) ) || \
    ( defined(FATFS_PROC_TO_USE_A15_0)  && defined(BUILD_A15) )

static void File_lock(void);
static void File_unlock(void);
static Int32 File_allocObj();
static Void File_freeObj(Int32 fd);
static Void File_registerCioFxns();

so how to use this APIs in my application?

But i have following queries.

1) How to read and write to the sd card using NullSrc link?

2) I want to read the text file from the sd card and give this to the algortihm link.so i how to do this?what shoulbe the apporoach for this?

3) I am not able to find any existing use case for sd card read and write.

Any help will be highly appreciated.

Thanks and regards

  • Hi Rakesh,

    I have forwarded your question to an expert for comment.

    Regards,
    Yordan
  • Hello Rakesh,

    Please find my answers below.

    1) How to read and write to the sd card using NullSrc link?

    >> Null source link supports multiple RX modes like network, memory, file read. You need to set this mode using dataRxMode parameter in use-case create time.

    pPrm->dataRxMode = NULLSRC_LINK_DATA_RX_MODE_FILE;

    2) I want to read the text file from the sd card and give this to the algortihm link.so i how to do this?what shoulbe the apporoach for this?

    >> There is already use-case doing similar thing. It reads H264 data along with index from the SD card (file) and decodes and displays it. Below is chain.

    NullSource (IPU1_0) -> Decode -> VPE -> Display

    You can find this use-case @vision_sdk\apps\src\rtos\usecases\null_src_dec_display

    3) I am not able to find any existing use case for sd card read and write.

    >> Refer to vision_sdk\apps\src\rtos\usecases\null_src_dec_display

    pPrm->dataRxMode = NULLSRC_LINK_DATA_RX_MODE_FILE;

  • Hi Prasad,

    Thanks for the quick response.

    I have gone through the use case suggested by you,but still i am littele bit confused.

    1) should i directly call the FatFs APIs?
    2) in the existing use case it is not calling any file related APIs so how it is reading from the file?
    3) where and how to use the APIs defined in file_api.c?

    thanks
  • Rakesh,

    1) should i directly call the FatFs APIs?

    >> No, you dont need to call any of APIs. The nullsource link takes care of this for you. In fact that's how all links abstract the drivers from the user in links framework. User doesnt need to worry about IP functionality unless he needs to.
    2) in the existing use case it is not calling any file related APIs so how it is reading from the file?

    >> It is called via link. You can check that in vision_sdk\links_fw\src\rtos\links_common\nullSrc\ folders.
    3) where and how to use the APIs defined in file_api.c?

    >> You dont need to. If you want to understand it go through null source and null link implementation.

  • Hello Prasad,

    Thanks for the response.
    so can you give me suggestion about what could be the possible chain?
    i want to read data from memory card and than this data should be transferd to algorithm link for proccesing.

    and one more thing for writing to SD card should we use NULL link?
    coz NullSrc link supports only reading right?

    Thanks.
  • Rakesh,

    You can create new use-case or modify existing for something like below.

    NullSource (IPU1_0) -> Alg_LaneDetect(DSP1) -> Null(IPU1_0)

    In use-case main file, set NullSource and Null link parameters for SD read mode.
  • Hi Prasad,

    thanks for the suggestions.

    but nullsrc can not take input from capture link and in my application, I can not skip capture link.

    I want to do the following task.
    1) I will be having LUT in sd card which I should read in app initial and then this should be the input to algorithm link.
    2) in algorithm link I have to process on every pixel of the frame received from capture source.

    for this I have to Read sd card only once and this should be given to algorithm for processing.
    is there any way to do this?

    any help will be highly appreciated

    thanks.
  • Hello,

    but nullsrc can not take input from capture link and in my application, I can not skip capture link.
    >> Null source link is source link like capture link so you can't interconnect it.

    For your requirement you should not use, null source link. The flow you require like read LUT is already used in our example surround view use-case.

    Please refer to vision_sdk\apps\src\rtos\usecases\lvds_vip_sv_standalone

    We too read LUT and other parameters from SD during use-case initialization, refer to ChainsCommon_SurroundView_CalibInit function called from this use-case



  • hello prasad,

    Thanks for the response.

    My issue is resolved, with help of your suggestion.
  • Hello Prasad,

    I have one query related to sd card read.

    1)  is it possible to run the file operations directly in  AlgorithmName_algplugin.c.?

    2)  If my algorithm is running on DSP or A15?

    Thanks

  • Hello Rakesh,

    1) You should be able to call File IO APIs from algrithm link.

    2) The FATFS is only supported on IPU_0. So it is not possible to directly use File IO APIs from the DSP or A15 or any other core than IPU_0. 

    But you can use system link to call IPU_0 to do file writes from DSP or A15. Basically you pass file(buffer) to be read or written and tell IPU_0 to do file operations for you. 

    VSDK by default doesnt support this functionality but should be easy to implement. There are similar example (like qspi flash writing) which can be useful

    What is your VSDK version? 

  • Hello Prasad,

    Thanks for the quick response.

    I am using vision SDK version 3.0(BIOS Only).
  • I am also having same query could you please help!
  • Hello Yash,

    Could you please elaborate?

    Did you check suggestions given in earlier replies?