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.

mibspi driver support

Other Parts Discussed in Thread: HALCOGEN

Hi 

I tried to use the next mibspi function :

mibspisetdat() the last parameter in the function is uint16_t data[ ]  

how should I use this parameter I tried to send an array address array but nothing works 

anyone use this function and there is not compilation error ?

Yehonatan 

  • Yehonata,

    The mibspisetdat() is used to copy data from your input array to the mibspi transmit buffer.

    In Halcogen, when you configure the mibspi, you have to define for each transfert group you are using, the size of the buffer associated to the transfer group.
    mibspisetdata() needs as parameter, which transfer group you want to initialize.
    mibspisetdata() will use the definition for the transfer group to copy from your input array, the data to be copied in the transmit buffer.

    In this example, the transfer group 0 has a transmit buffer (and receive buffer) of 2 characters (Length).
    This transfer group uses the Data Format 0.
    The data size is defined in the SPI Data Format 0.


    Please let me know if I've answered your question.

    Regards,

    Jean-Marc


  • Hi 

    I undestand what should I do at halcogen but my problem relate to the function 

    mibspisetdata() which the last parameter of the function is uint16_t data[ ]  is my problem 

    evrey try to deal with this parameter cause an  compiler error (ccs5.1)

    what should I do ?

    uint16_t data[]  is bug and should be insted uint16_t *data a pointer to array?

    if you have an example of c code it could help because the halcogen part I did well 


    Yehonatan

  • Yehonatan,

    The third argument in the spiSetData is defined as "unsigned short".

    /* USER CODE BEGIN (1) */
    #include "spi.h"
    /* USER CODE END */

        unsigned short data_out[]={0x14,0x28};
        unsigned short SPI1group;
        SPI1group=0;

    void main(void)
    {
    /* USER CODE BEGIN (3) */

        spiInit();

        spiSetData(spiREG1,SPI1group,data_out);

    /* USER CODE END */
    }

    Regards,

    Jean-Marc

  • Thanks a lot I will try this example

    but few things I did not understand 

    #include "spi.h"

    it should not be "mibspi.h"

    and second

     spiSetData(spiREG1,SPI1group,data_out);

    data_out data_out is pointer to the first argument of the array 

    but what recived the data is  uint16_t a[ ] which is not a pointer to an address or I wrong and that what I think cause the problem

    (please check mibspi.c file)

    Yehonatan 

    Yehonatan

  • Yehonatan,

    I did my Halcogen project for TMS570LS2x device. I think you are using TMS570L3x device.
    This explains the SPI.H versus MIBSPI.h.

    In my example, data_out is a pointer on the array data_out[].
    There is no error or warning when I compile this code.

    Regards,

    Jean-Marc

  • Hi

    The MIBSPI works fine but another  question 

    How can I get an ISR when transfer group  complete ?

  • Yehonatn,

    Yes, it is possible to have an interrupt (and or DMA request) at the end of a transfer.

    Please have a look at chapter 14.6 Interrupts in the TMS570LS2x Users Guide.

    Best Regards,

    Jean-Marc

  • Yehonatn,

    Can you please mark this post as "Verified Answer" so I can close this thread.

    Your question about MIBSPI and ISR will stay open in your other thread.

    Thanks and Regards,

    Jean-Marc