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.

TMS470MF06607: Tms470mf06607 SPI driver receive

Part Number: TMS470MF06607
Other Parts Discussed in Thread: HALCOGEN

hi sir,

i am using the TMS470mf06607 microcontroller. with CCS V6.1.0.

i am using the SPI communication in my application .

i enabled the SPI base driver for transmit the data. i want to know how to receive the the data in to my buffer.

in the Halcogen code generator i enabled the TX interrupt also. in notification file also i did tha changes. 

i copied my code in the below. can you please tell me how can receive the data from my slave device.

1)  i want to transmit and receive the data. but i dont know how to receive the data.

     i tried that   receive function also.          (    uint32 spiGetData(spiBASE_t *spi, uint32 group, uint16 * data);      )

      but i am not sure what i did it is correct or not.

2)   i want to know how to toggle the chip select also. 

any one please suggest me what are the changes i want to do in my program.

program:

#include "spi.h"
/* USER CODE END */

/** @fn void main(void)
* @brief Application main function
* @note This function is empty by default.
*
* This function is called after startup.
* The user can use this function to implement the application.
*/

/* USER CODE BEGIN (2) */
uint32_t TG3_IS_Complete;

uint16 TG0_TX_DATA[8] = {0x1000, 0x1111, 0x1222, 0x1333, 0x1444, 0x1555, 0x1666, 0x1777};
uint16 TG0_RX_DATA[8]= {0};

uint16 TG1_TX_DATA[8] = {0x2000, 0x2111, 0x2222, 0x2333, 0x2444, 0x2555, 0x2666, 0x2777};
uint16 TG1_RX_DATA[8]= {0};

uint16 TG2_TX_DATA[8] = {0x3000, 0x3111, 0x3222, 0x3333, 0x3444, 0x3555, 0x3666, 0x3777};
uint16 TG2_RX_DATA[8]= {0};

uint16 TG3_TX_DATA[8] = {0x4000, 0x4111, 0x4222, 0x4333, 0x4444, 0x4555, 0x4666, 0x4777};
uint16 TG3_RX_DATA[8]= {0};

/* USER CODE END */

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

/* Enable CPU Interrupt through CPSR */
_enable_IRQ();

/* Initialize SPI Module Based on GUI configuration
* SPI1 - Master ( SIMO, SOMI, CLK, CS0 ) * */
spiInit();

/* Enable TG 0, 1, 2, 3 complete interrupt to INT 0 */
spiEnableGroupNotification(spiREG1,0,0);
spiEnableGroupNotification(spiREG1,1,0);
spiEnableGroupNotification(spiREG1,2,0);
spiEnableGroupNotification(spiREG1,3,0);

/* Fill the transfer Groups */
spiSetData(spiREG1,0,TG0_TX_DATA);
spiSetData(spiREG1,1,TG1_TX_DATA);
spiSetData(spiREG1,2,TG2_TX_DATA);
spiSetData(spiREG1,3,TG3_TX_DATA);


/* Enable TG0 to start, once tickCNT triggers */
while(1)
{
spiTransfer(spiREG1,0);
}

}

regards

Arun Kumar.N

  • 1)  i want to transmit and receive the data. but i dont know how to receive the data.

         i tried that   receive function also.          (    uint32 spiGetData(spiBASE_t *spi, uint32 group, uint16 * data);      )

    Yes, that is the right function if you are using transfer groups.

    2)   i want to know how to toggle the chip select also. 

    If using HALCoGen to configure, select which CS to use for each transfer group.

    Then make sure that CS pin is configured to be used by the SPI.

  • hi,

    can you please give me any example , where i want to use this SPI receive funtion .
    i dont know i want to use in the notification file or in main itself.
    kindly suggest me where & how i want to use this SPI receive function. ( uint32 spiGetData(spiBASE_t *spi, uint32 group, uint16 * data); )


    regards
    Arun Kumar.N