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.

C5505/C5515 CSL_SPI Questions



All:

I am using the EVM5515 (eventually C5505) with CSL ver. 2.50.00 and DSP-BIOS version 5.41.11.38

1. When I get a "handle" from CSL for SPI, it many times takes two requests. Why?

  hSpi = SPI_open(SPI_CS_NUM_1, SPI_POLLING_MODE);

  hSpi = SPI_open(SPI_CS_NUM_1, SPI_POLLING_MODE);

I have seen and will probably implement code that looks for a non-null response to the first "handle" request. If there is a non-null, then it will not do the second request.

2. I use SPI to initialize an attached FPGA, using 12-bit SPI mode, and it seems to work fine. However, an earlier post stated that only 8-bit and 16-bit modes were supported. Will my 12-bit mode continue to be supported?

3. When I get a "handle" and use it for initialization, I keep a copy of that handle, and later under a DSP-BIOS recurring task, use the handle to set up SPI for a Status read. So far that works fine, but are there any problems with doing it this way?

Regards,

Todd Anderson

  • Hi Todd,

    The issue is that one of the internal variables in the CSL-library does not get zero initialized. (The "SPI_Instance", defined in csl_spi.h to be precise).

    I belive this is due to a bug in the compiler.

    My solution was to modify the CSL-library csl_spi.h:

    static CSL_SpiObj SPI_Instance;
    became
    extern CSL_SpiObj SPI_Instance;

    and
    CSL_SpiObj SPI_Instance;
    Void main()
    {
        memset(&SPI_Instance,0,sizeof(CSL_SpiObj));

    (....)

    I think it is totally OK to just call SPI_open() twice if the first time fails. (But you must not call it again if the first time was a success.)
    
    
    I hope this helps you and that you did not need to spend as much time as i needed...
    Regards
    Mats