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.

DSPLink communication problem

Hello,

I use an igepv2 board which has an Arm cortex A8 processor and one TMS320C64x+ dsp processor. I want to send some data (a frame 720 x480) to dsp and save them to a temporal buffer.

I use dsplink for communication. I want to send data for n iterations save them and then to send them back to gpp. I allocate a buffer only for 16 bytes and I send this to DSP-SIDE.When I have sent all the frame to DSP  the DSP sent it back. But when gpp is received data, these are not correct (there a lot of 0 and 255 after the buffer has sent).

When I restart the board, not shutdown there is not any 0 or 255 but the image is not correct. The scenario is the following .

A frame 720x480 has 518400 pixels. If a buffer has 16 bytes size , you must sent 32400 buffers. When all buffers are sent then DSP send these buffers back.

GPP send-> DSP

GPP send->DSP

...

all  frame has sent

DSP send->GPP

DSP send->GPP

----

I save all the pixels to a variable FrmBuf which is defined as "#pragma DATA_SECTION( FrmBuf, "mySection" ); unsigned char FrmBuf[518400];" to dsp side. When I sent a buffer I save this to FrmBuf and then send it back, the gpp the data are correct. But when I sent all the frame and then I wait for receive the data are not correct. I have posted the code for send and receive.

Thanks

Regards

George

//gpp side

//for send

for(j=0;j<img->Iterations;j++){

           //here i save data to buffer//

          ptr8  = (Uint8 *)  (FireDetect_IOReq.buffer) ;
          printf("Iteration %d\n",j);
          for(i=0;i<img->BufferSize;i++){
        if(pixels<Luma_samples){
        //  printf("i::%d\n",i);
         // printf("pixel::%d\n",pixels);
         // printf("Y_cnt::%d\n",Y_cnt);
            ptr8[i]=Y[cnt][Y_cnt++];
        }
        else if (pixels<Luma_samples+Chroma_samples){
          ptr8[i]=U[cnt][U_cnt++];
        }
        else{
           ptr8[i]=V[cnt][V_cnt++];
        }
        pixels++;    
          }

           status = CHNL_issue (processorId, CHNL_ID_OUTPUT, &FireDetect_IOReq) ;
            if (DSP_SUCCEEDED (status)) {
                             status = CHNL_reclaim (processorId,CHNL_ID_OUTPUT,WAIT_FOREVER,&FireDetect_IOReq) ;
                            if (DSP_FAILED (status)) {
                                       FireDetect_1Print ("CHNL_reclaim () failed. Status = [0x%x]\n",status) ;
                                       loop=cnt=atoi(img->Frames);
                                       break;
                            }

}

//for receive

for(j=0;j<img->Iterations;j++){
              printf("Wait for a msg\n");
         status = MSGQ_get (SampleGppMsgq, WAIT_FOREVER, &msg) ;
         printf("Receive a msg\n");
         FireDetect_Sleep(1);
         if (DSP_FAILED (status)) {
            FireDetect_1Print ("MSGQ_get () failed. Status = [0x%x]\n",status) ;
              loop=cnt=atoi(img->Frames);
              break;
        }
         if (DSP_SUCCEEDED (status)) {
              status = CHNL_issue (processorId, CHNL_ID_INPUT, &FireDetect_IOReq) ;
              if (DSP_FAILED (status)) {
                FireDetect_1Print ("CHNL_issue () failed. Status = [0x%x]\n",status) ;
                loop=cnt=atoi(img->Frames);
                break;
               }
          }
          if (DSP_SUCCEEDED (status)) {
                  printf("Send data\n");
              status = CHNL_reclaim (processorId,CHNL_ID_INPUT,WAIT_FOREVER,&FireDetect_IOReq) ;
              if (DSP_FAILED (status)) {
                FireDetect_1Print ("CHNL_reclaim () failed. Status = [0x%x]\n",status) ;
                 loop=cnt=atoi(img->Frames);
                 break;
                }
                else{

                //save data for dsp  back to the frame//
                 for(i=0;i<img->BufferSize;i++){
                    
                      if(pixels<Luma_samples){
                      Y[cnt][Y_cnt]=FireDetect_IOReq.buffer[i];
                      printf("Y[%d][%d]",Y[cnt][Y_cnt]);
                      Y_cnt++;
                    }    
                    else if (pixels<Luma_samples+Chroma_samples){
                       U[cnt][U_cnt]=FireDetect_IOReq.buffer[i];
                         printf("U[%d][%d]",U[cnt][U_cnt]);
                        U_cnt++;
                    }
                    else{
                        V[cnt][V_cnt]=FireDetect_IOReq.buffer[i];
                          printf("V[%d][%d]",V[cnt][V_cnt]);
                         V_cnt++;
                    }
                     pixels++;    
               }//end for
                  
        }end j

//dsp side

for(j=0;j<info->Iterations;j++){
          status = SIO_issue (info->inputStream,buffer,info->bufferSize,arg) ;
          if (status == SYS_OK) {
            nmadus = SIO_reclaim (info->inputStream,(Ptr *) &buffer,&arg) ;
            if (nmadus < 0) {
              status = -nmadus;
              SET_FAILURE_REASON (status) ;
            }
            else {
              info->receivedSize = nmadus ;
            }
          }
          else {
          SET_FAILURE_REASON (status) ;
          }
          //save the received data to Frame//
          if (status == SYS_OK) {
            for (i = 0 ;i < info->noAllignedSize;i++) {
             FrmBuf[pixels]=buffer[i];
           
             LOG_printf (&trace, "%d\n", FrmBuf[pixels]) ;
             pixels++;
             
            }
          }
      }

    //send back the frame

 pixels=0;
      for(j=0;j<info->Iterations;j++){
          if(status==SYS_OK){
              for (i = 0 ;i < info->noAllignedSize;i++) {
                //prepare data for sending

               buffer[i]=FrmBuf[pixels];
          
              LOG_printf (&trace, "%d\n", buffer[i]) ;
              pixels++;
              }
          }
          if (status == SYS_OK) {
              status = SIO_issue (info->outputStream,buffer,info->receivedSize,arg) ;

              if (status == SYS_OK) {
                  nmadus = SIO_reclaim (info->outputStream,(Ptr *)&(buffer),&arg) ;
                  if (nmadus < 0) {
                      status = -nmadus ;
                      SET_FAILURE_REASON (status) ;
                   }
              }
              else {
                  SET_FAILURE_REASON (status) ;
              }
        }
      }
    }

 

 

 

  • How are you allocating the buffers on the ARM?  Are the buffers cacheable?  If so, you'll need to employ manual cache operations on the ARM side to keep the data coherent.  Specifically, before the ARM reads from the buffer it will need to perform a block invalidate.  After the ARM writes to the buffer it will need to perform a block writeback.