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.

Easy way to transfer a file from PC to DSP for data processing example - C6678 - evmc6678l

Other Parts Discussed in Thread: SPRC090

I've been working with the EVMC6678l for a few weeks running sample programs. I have run the FFT_Example project from the DSPLIB package and have modified, built, executed successfully. Now I want to transfer in my own sampled data to run the FFT on this array. What is the easiest way to transfer an array of 2048 float samples from the PC to the DSP for processing?

I have the EmacExample project from the MCSDK_PDK working on the target device. 

Thank you,

Ryan

  • Is there a little more information I can divulge to clarify my question? 

    In short, I am looking for a routine to transfer data (one time) to the DSP to load into an array. I understand how to do the FFT and other work already.

    Thanks,

    Ryan

  • Ryan,

    If there's no real time requirements for this, then I'd suggest using STDIO operations such as fread() operations to read in the array when using CCS.

    Best Regards,

    Chad

  • Chad,

    That is fine, this isn't a real-time requirement. I have two questions about using fread() for this:

    1)  How is the file transferred if fread() is used, since I haven't defined a transfer channel?

    2) I borrowed someone's code from http://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/t/152143.aspx , and I'm using this block:

    #include <stdlib.h>
    #include <stdio.h>
    #include <stdint.h>
    #include <math.h>
    #include <string.h>

    ...

    #define N 256

    FILE *fp;
    char *filename = "test.bin";

    ...

    float *gRxBuffer = (float *)malloc( N * sizeof( float ) );
    memset( gRxBuffer, 0 , ( N * sizeof( float ) ) );
    fp = fopen( filename, "rt" );
    fread( gRxBuffer, sizeof( float ), N, fp );

    for( i = 0; i < 20; i++ )
    {
        printf( "index = %d ; value = %d\n", i, &gRxBuffer[ sizeof( float ) + i ] );
    }

    ...

    My code gets stuck running at the malloc() call. Why?

  • Not sure, I've asked a colleague to have a look at it.

    Best Regards,

    Chad

  • Chad,

    I solved my fread() problem from above. I wasn't doing this properly.

    After using fread() and fwrite() to communicate with the board successfully, I've gotten to the point where this is now a real-time constraint. I'm processing from a 24 MB binary file that takes nearly 30 minutes to fread() all of. 

    Now what is a better option for reading in an array such as :

    int16_t myInputBuffer[ 2048 * 6000 ];

    And also, how can I later transfer that array off the device?

    Cheers,

    Ryan

  • It depends, does this data actually change? If it doesn't, then I would simply build it into the project, that way it's loaded into memory via JTAG when program is loaded.

    If it changes, then you'll want to use a peripheral communicating to the DSP, such as UART to pull the data.

    Best Regards,
    Chad

  • Hi Chad,

    My requirement is to transfer and process 4096 Bytes at a rate of 100kHz. Looking at http://www.ti.com/lit/ug/sprugp1/sprugp1.pdf, it appears I must use the 3GBaud setting to download data to the DSP. 

    Does that sound like a reasonable plan? 

    Thanks,

    Ryan

  • If you need a sustained data rate of 3Gbaud, then no UART won't be able to do that.  You'd want PCIe or SRIO most likely.  That said, it sounds like you're just want to develop and test with some fixed data.  In which case you don't need that when developing, but just want to get the data over for the time being, UART would be fine, or building it into the code would be fine for the debugging stages.

    Once, you go to full solution of processing at that data rate though, you'll need to use a high speed interface such as PCIe, which can support 3Gbaud traffic.

    Best Regards,
    Chad

  • Chad,

    Table 2-2 of sprugp1 lists 3Gbaud as a setting for UART. Am I misunderstanding the documentation? 

    Ryan

  • The DSP side understanding is correct, but in general a PC isn't going to support this high of baud rate via a UART connection.  PCs tend to support more in the 128Kbaud range for a UART interface.

    Best Regards,
    Chad

  • Chad,

    What is a good example to get started with some UART communication Rx (and later Tx)? I read on another forum to try the Chip Support Library's example ( http://www.ti.com/tool/sprc090 ), but I cannot get the example to compile. Is there a better project to use?

    Thanks,

    Ryan

  • I'm sorry, let me clarify which example project I'm trying to run. I'm trying to execute the PDK platform_test example project. The CSL package was a supporting package I needed, so it's not really related.

  • The CSL you linked up above is the wrong CSL, it's for some older devices.  The CSL is part of the PDK, which was included in the disc that came with the EVM.  There should be some UART example with the code that came on the disc with the EVM.

    Best Regards,
    Chad