Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: dsp write share memory, but cpu reads wrong data! #431

Open
xulan007 opened this issue Jan 3, 2023 · 1 comment
Open

[Bug]: dsp write share memory, but cpu reads wrong data! #431

xulan007 opened this issue Jan 3, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@xulan007
Copy link

xulan007 commented Jan 3, 2023

What happened

when cpu(dsp_log) reads share memory written by DSP, the result is partially wrong!

Reproduction steps

step1, memcpy data to share memory in DSP, and set fft_share_memory->dsp_input_end=0xff:

        for(int j=0;j<(fft_n/2+1);j++){
            i_real[j]=j;
            i_imag[j]=j;
        }
        memcpy(fft_share_memory->dsp_input_data, i_real, (fft_n/2+1)*sizeof(float));
        memcpy(fft_share_memory->dsp_input_data + (fft_n/2+1)*sizeof(float), i_imag, (fft_n/2+1)*sizeof(float));
        fft_share_memory->dsp_input_end = 0xff;

step2,When dsp log detected fft_share_memory->dsp_input_end==0xff, read the data from the fft_share_memory->dsp_input_data and print:

    float * ret = (float*)fft_share_memory->dsp_input_data;
    for(int j=0;j<n_fft+2;j++){
        printf("%14.8f  ", ret[j]);
        if(j%8==0){
            printf("\r\n");
        }
    }

step3:
the ret print goes "0. 0. 0. ...0.", but the dsp input is "0. 1. 2. 3. ... "

Hardware board

k510 crb kit

Software version

No response

Bug frequency

everytime

Anything else

No response

@xulan007 xulan007 added the bug Something isn't working label Jan 3, 2023
@xulan007 xulan007 changed the title [Bug]: [Bug]: dsp write share memory, but cpu reads wrong data! Jan 3, 2023
@wangjianxin-canaan
Copy link
Contributor

volatile struct share_memory *fft_share_memory; Please check if fft_share_memory define have volatile .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants