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

Part Number: TMS470MF06607
Other Parts Discussed in Thread: ADS1220, HALCOGEN

Hi,

i am using TMS470MF06607 microcontroller.

i am trying to do SPI communication on this controller with ADS1220 ic.

For generate the MIBSPI1 driver i am using the HALCOGEN.  There is no example for this micro.

i didn't change any default setting in the HALCOGEN. only one change i did it in MIBSPI1 GROUP 0-7   , here i changed that length of the buffer from zero to eight.

i enabled the vim channel interrupt also.

what ever the code i written for the MIBSPI1  it's not working. because i checked that clock pin. i did not get the continues pulses.

i copied my code in down side. if any problem in my program means please help to me to correct it.

otherwise if any example code is available for TMS470MF06607     spi communication ( MIBSPI1) can you please share that one to me.

program:

#include "sys_common.h"
//#include "sys_core.h"
#include "spi.h"
//#include "system.h"
//#include "sys_vim.h"

#include "sys_common.h"
#include "system.h"
#include "rti.h"

#include "sys_vim.h"

#include "esm.h"


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};

uint32_t TG3_IS_Complete;

void main(void)
{

TG3_IS_Complete = 0x55555555;

/* Enable IRQ Interrupt in Cortex R4 CPU */
_enable_interrupts();

spiInit();


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

/* Fill the transfer Groups */
spiSetData(spiREG1,0,TG0_TX_DATA);


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


/* Configure TICKCNT *
* DATA FORMAT 0 is selected which has SPICLK set as 1000KHz *
* So tick is 0xFFFF * (1/1000KHz) = 65.5535 msec*/

spiREG1->TICKCNT = 0x8000FFFF;

/* Wait until this flag is set in TG3 ISR */
while(TG3_IS_Complete != 0xA5A5A5A5);
spiGetData(spiREG1,0,TG0_RX_DATA);


while(1);


}


#pragma WEAK(spiGroupNotification)
void spiGroupNotification(spiBASE_t *spi, uint32 group)
{

switch (group)
{
case 0 :
/* Enable TG1 to start, SW Trigger */
spiTransfer(spiREG1,1);
break;
case 1 : /* Enable TG1 to start, SW Trigger */
spiTransfer(spiREG1,2);
break;
case 2 : /* Enable TG1 to start, SW Trigger */
spiTransfer(spiREG1,3);
break;
case 3 :
TG3_IS_Complete = 0xA5A5A5A5;
break;
default :
while(1);
break;
}

}

 

  • In HALCoGen, did you enable the MibSPI1 TXINT?

  • Here is a working sample project that transfers 4 groups, each consisting of 8 16-bit numbers using interrupts. The HALCoGen files are included in the .zip.

    /cfs-file/__key/communityserver-discussions-components-files/312/1256.SPI.zip

  • hi sir,

    i try to import your program in to my CCS. but it's not import. i thought may be because of the CCS version issue.
    so , i just take the source & include file from your program and past in to my program.
    After copied that source & include file i compiled successfully , and i flashed that program in to my microcontroller.
    After flashing i check the clock pin , still i didn't get the clock pulses in my MIBSPI1 clock pin.
    Can you please tell me the reason for that one. (i didn't connect my slave to microcontroller , it may cause any problem).


    Regards
    Arun Kumar.N
  • hi sir,

    i am using as a main program as a example_spi_master.c (what example program you given to me same one).


    regards
    Arun Kumar.N
  • The project I sent to you I created using CCS v7.3. I verified that the SPI1CLK, pin 34, is toggling. You need to use all of the files I sent, not just "example_spi_Master.c". The file "notification.c" was also modified. The other files are HALCoGen generated, but you must use the "SPI.dil" and "SPI.hcg" files to create them.

    I suggest that first you program the SPI.out file that was in the project I sent and verify that see SPI1CLK. Then you might consider upgrading to the latest version of CCS so that you can import this project.
  • hi,

    i am using your source & include files. the notification.c is in the source file only.
    i am using your "SPI.dil" & "SPI.hcg" file also.
    but, now also i didn't get the clock pulses.
    in the launchpad only i am checking that SPI1CLK pin.
    can you please suggest me any other solution to solve my issue sir.

    other wise can you please tell me what are the configuration i want to do in the HALCOGEN , before generate the code.

    kindly, give me some suggestion to solve my issue....

    regards
    Arun Kumar.N
  • Did you try programming the "SPI.out" file that was in the zip I sent? If so, were you able to see the SCLK output?
  • hi sir,

    sorry for the delayed response.
    i replaced my "SPI.out" by what ever the code you sended to me. after replacing that "SPI.out" also i can not see the clock pulse.
    any other possibilities aere there means can you please suggest me those things sir.

    regards
    Arun Kumar.N
  • This suggests that it is a hardware problem, not software. What hardware are you using?

  • hi sir,

    i tried to paste your "SPI.out" file in to my project , but after few minutes that "SPI.out" file is disabled.
    i think the version of the CCS is a issue. if suppose i paste that "SPI.out" file while compiling again it's disabled.

    so i thought the ccs version is an issue. if it's possible means can you please suggest me the SPI communication for CCS V6.1 . (IF ANY ISSUE MEANS I WILL UPDATE MY CCSV 7.3).

    regards
    Arun Kumar.N
  • The SPI.out file need not be in the project. It can be anywhere on your system. You just navigate to it from the "Run" -> "Load" -> "Load Program" menu selections by selecing "Browse".

    I have attached the same project build with CCS6.1.1.  

    /cfs-file/__key/communityserver-discussions-components-files/312/3021.SPI.zip

    This project creates a burst of SPI transfers and then stops. Remember that you should use the scope single sequence trigger to catch it.

  • hi sir,

    sorry for the inconvenience. my CCS version is CCSv6.1.0 . so i tried to import your project. but i can not import the project what ever you
    sended it to me.

    so, i tried create the same project name in my CCS (SPI), and just copy your all files from your SPI project into my project(SPI).

    while building i am not getting any error or issue. but while trying to flash the that program into my microcontroller i am getting this following error. kindly can you please suggest me to solve my issue.

    error :
    loading program error:

    Encountered a problem loading file C:\CCS PROJECT:\SPI:\Debug:\SPI.out could not open file.

    for me in RUN there is no option like "load " & "Load program" . for me only these 3 options are there. (Debug , "Debug history" , "Debug configuration") . kindly let me know what are the changes i want to do in the Debug Configuration.


    regards
    Arun Kumar.N
  • You are still running in simple mode. Select "View" -> "Getting Started" and turn off simple mode. Then you can load and run the program I sent you.

  • hi sir,

    In my CCS also i already disabled that simple mode. but then also i am getting his error means what may be the issue sir ???

    regards
    Arun Kumar.N
  • hi sir,

    i think the program is same in every version. in my CCS the CAN & uart drivers are working properly.
    only the SPI is an issue. so better can you please explain me what are the things i want to do in the HALCOGEN side.
    then i will try the SPI in my CCS itself.

    regards
    Arun Kumar.N
  • I had included the files SPI.dil and SPI.hcg in the zip file I uploaded earlier. You should be able to open those in HALCoGen and see how I configured the SPI.