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.

Time taken for a fuction

Hi all,

I wonder  why the time (round trip) taken, when call a function, to travel from ARM to DSP and back to ARM is 150uS?

The procedure followed to get the round trip time:

1) I got 2 functions: call_arm()(ARM<--->ARM) and call_dsp()(ARM<--->DSP). (They are empty functions)

2) The main function calls the functions  "call_dsp()" and  call_arm()

3) Measured the time elapsed for each function.

Results:

Nx call_arm() call_dsp()
1 8uS 154uS
2 8uS 165uS
3 8uS 149uS
4 9uS 149uS
5 7uS 149uS



Can I reduce call_dsp's latency ?

Regards,

  • Hi Marcelo,

    Could you post the source of call_arm() and call_dsp() functions and how call them?

    BR

    Tsvetolin Shulev

  • main.c(Running on ARM)

    typedef unsigned long long timestamp_t;
     
    timestamp_t get_timestamp()
    {
        struct timeval now;
        gettimeofday(&now, NULL);
        return now.tv_usec + (timestamp_t)now.tv_sec*1000000;
    }
    
    void main(){
    .
    .
    .
    // Call data process function from  ARM to DSP(C6RUN)
    	t_arm_dsp = get_timestamp();
    	data_process_dsp(void);
    	t_arm_dsp = get_timestamp() - t_arm_dsp;//don't consider the overhead
    
    
    // Call data process function from ARM to ARM
    	t_arm = get_timestamp();
    	data_process_arm(void);
    	t_arm = get_timestamp() - t_arm; //don't consider the overhead
    
        printf("\tNX = %d   \tARM: %d   \tARM_DSP: %d\n", nx, (int)t_arm, (int)t_arm_dsp);

    }

    data_process_dsp.c

    void data_process_dsp(void)
    {
    //empty function
    return 0
    }
    

    data_process_arm.c

    void data_process_arm(void)
    {
    //empty function
    return 0
    }
    

  • Hi Marcelo,

    After seeing the source code I can not find nothing that could add some delay the communication between the ARM and DSP is based on hardware interrupts, mail boxes and exchange of messages which take some time. Probably the response of the DSP is slower then the ARM.

    BR

    Tsvetolin Shulev

  • Hi Tsvetolin,


    I appreciate your quick response!.

    I've concluded that if I call a function from DSP to DSP is faster than ARM to DSP.

    main.c(Running on ARM)

    typedef unsigned long long timestamp_t;
     
    timestamp_t get_timestamp()
    {
        struct timeval now;
        gettimeofday(&now, NULL);
        return now.tv_usec + (timestamp_t)now.tv_sec*1000000;
    }
    
    void main(){
    .
    .
    .
    // Call data process function from  ARM to DSP(C6RUN)
    	t_arm_dsp = get_timestamp();
    	data_process_dsp(void);
    	t_arm_dsp = get_timestamp() - t_arm_dsp;//don't consider the overhead
    
    // Call data process function from  ARM to DSP and then DSP to DSP (C6RUN)
    	
    	t_dsp=data_dsp_dsp(void);
    	
    
    // Call data process function from ARM to ARM
    	t_arm = get_timestamp();
    	data_process_arm(void);
    	t_arm = get_timestamp() - t_arm; //don't consider the overhead
    
        printf("\tNX = %d   \tARM: %d  \tDSP: %d \tARM_DSP: %d\n", nx, (int)t_arm,(int)t_dsp, (int)t_arm_dsp);
    
    
    }

    data_dsp_dsp.c (Running on the DSP)

    int data_dsp_dsp(void){
    	
            clock_t t_dsp;
        
    	t_dsp = clock();
    	data_process_dsp(void);
    	t_dsp = clock() - t_dsp;
        
     	return t_dsp;
    }

    data_process_dsp.c (Running on the DSP)

    void data_process_dsp(void)
    {
    //empty function
    return 0
    }



    Results-DM3730:

    Nx

    ARM<-->ARM

    DSP<-->DSP ARM<-->DSP
    1 8uS 980nS 153uS
    2 8uS 982nS 150uS
    3 9uS 979nS 149uS
    4 7uS 979nS 149uS
    5 8uS 980nS 149uS
  • Hi Marcelo,

    Thanks for sharing the data of measuring the time for calling functions ARM<-->ARM, DSP<-->DSP and ARM<-->DSP. As I expect the calling DSP function from the DSP is fastest because in this case there is no exchange of messaging.

    BR

    Tsvetolin Shulev