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.

Problem with DCAN trying to make TMS570LS1227 development kit communicate with TMS570LS1224 Launchpad.

Other Parts Discussed in Thread: HALCOGEN, TMS570LS1224, TMS570LS1227

 Hi All,

I am quite new with DCAN commuication. At the moment I am using HalCoGen for helping me programming the Hercules microcontrollers.

Now I am stuck with making the comunication possible between the TMS570LS1227 development kit and the TMS570LS1224 Launchpad. (Communication with two of the CAN modules of the same card, TMS570LS1227 or TMS570LS1224, has allready being done and it works fine). 

The TMS570LS1227 is being used as the transmitter and the TMS570LS1224 as the receiver. I take care in the HalCoGen adjustments to make the Bit Rate and Nominal Bit Time at each of the microcontrollers to be the same. The conection of the CAN modules is being made as  in the following link (www.element14.com/.../probing-your-hercules-launchpad-can-bus). The TMS570LS1227 is sending the serial message (i can see it on the oscilloscope), but the TMS570LS1224 is not reading the message, actually is doing nothing and I really don’t know why (it's an easy example and i am confused).

Could it be some problems with the DCC, just because one of them has a clk of 90 [MHz] and the other has a 80[MHz]. (but as much as I understand bit rate and nominal bit time are the imprtant staff for receiving the message properly, that´s why there are prescalers, isn´t it?).

I will put my code and images of the HalCoGen configuration below.

Best regards and I wish my problem is understandable despite my lack of english writing

Franciso Dumont

Driver enable:

PinMux:

CAN2 general Settings:

CAN2 Message Config:

The lenght of data is just 1 byte in both of them. 

DCC (1 & 2):

In the GIO and HET1 window there were some configurations, but just for adjust some outputs for LED´s and inputs por the user Switch on each board.

Code of the TMS570LS1224:

/* USER CODE BEGIN (0) */
#include "can.h"
#include "gio.h"
#include "het.h"
#include "system.h"
#include "esm.h"
#include "sys_core.h"
/* USER CODE END */

/* USER CODE BEGIN (1) */
#define D_SIZE 1
uint8 rx_data[D_SIZE]={0};
uint32 cnt=0;

/* USER CODE END */

/* USER CODE BEGIN (3) */
gioInit();
hetInit();
canInit();

while(1)
{

gioSetBit(gioPORTB, 2, 1); // this led is just to see if it some kind of change

while(!canIsRxMessageArrived(canREG2, canMESSAGE_BOX1)){};

canGetData(canREG1, canMESSAGE_BOX1, rx_data);

// see on external Leds the four bits that were send
gioSetBit(hetPORT1,14, (rx_data[0] & (1<<0)));
gioSetBit(hetPORT1,12, (rx_data[0] & (1<<1)));
gioSetBit(hetPORT1, 4, (rx_data[0] & (1<<2)));
gioSetBit(hetPORT1, 9, (rx_data[0] & (1<<3)));

gioSetBit(gioPORTB, 2, 0);

for(cnt=0; cnt<=0x00A0FFFF; cnt++){}; // some kind of delay to see the Led gioPORTB,2 blink

}

/* USER CODE END */

Code on TMS570LS1227:

/* USER CODE BEGIN (0) */
#include "can.h"
#include "gio.h"
#include "het.h"
#include "esm.h"
#include "system.h"
#include "sys_core.h"
/* USER CODE END */

/* USER CODE BEGIN (1) */
#define D_SIZE 1

uint8 tx_data[D_SIZE]={0x05};
uint32 cnt=0;
/* USER CODE END */

/* USER CODE BEGIN (3) */
canInit();
gioInit();
hetInit();

while(1)
{

// some led to see if there is something going on
gioSetBit(hetPORT1, 29, 0);


if(gioGetBit(gioPORTA, 7)==0)
{


gioSetBit(hetPORT1, 29, 1);


canTransmit(canREG2, canMESSAGE_BOX1, tx_data);

// external leds to see what was the message send like
gioSetBit(gioPORTB, 4, (tx_data[0] & 1<<0));
gioSetBit(gioPORTB, 5, (tx_data[0] & 1<<1));
gioSetBit(gioPORTB, 6, (tx_data[0] & 1<<2));
gioSetBit(gioPORTB, 7, (tx_data[0] & 1<<3));

 // kind of delay to see the led on hetPORT1, 29 blink and so that the switch doesn´t enter in the if so often
for(cnt=0; cnt<0x00A0FFFF; cnt++){};
}
}
/* USER CODE END */

  • Franciso,

    I'm not sure you can mix the diode/resistor interconnect with a true CAN transceiver. That may be the problem.
    I would suggest you try adding a CAN transceiver to the launchpad of the same type that is used on the HDK .. if the goal
    is to make the HDK talk to the launchpad.

    I didn't really check through your code at all because you say it's working launchpad to launchpad or HDK to HDK.
    And it looks like you have the bit rates set the same so HalCoGen should correct for any difference in crystal frequencies etc.
    (but launchpad and hdk both use 16MHz so this shouldn't be a difference anyway). Also the DCC is for comparing the clock
    frequencies on the device - it wouldn't normally be involved in a CAN transaction. I'd probably disable the DCC just to get it
    out of the picture for now until you find the CAN issue.

    -Anthony
  • Hello Anthony,

    Thank you for your fast reply. I was communicating from de HDK to the Launchpad. I did what you recommended and looked again at the code (as there were possible mistakes). You were right about the DCC, it was doing nothing (I just did what in the HalCoGen example said and there the DCC module was enabled) and i had some wrong stuff with the diodes/resistor interconnection.

    best Regards,
    Francisco Dumont
  • Super!

    - thank you for you blog on using the CAN bus -it is very useful.