Other Parts Discussed in Thread: CONTROLSUITE
I started working on CAN with DSP TMS320F28335. I have seen sample program of CAN in controlsuite.
I have changed GPIO pins according to my circuit, apart from it, i haven't changed anything in the program.
when i run this program i'm not getting any data or signal on CAN pins (CANH,CANL). I am using transceiver.
Below sample program is "ECan_A_To_ECanB", i don't understand few things in the program.
1) As i understood, If there is no other node, CAN will enter into loop and continuously sends the data. then we have observe some waveforms(Signal) on CANH and CANL pins, Am i correct?
2) By connecting CANA (CANH,CANL) and CANB (CANA,CANL) pins of the DSP, can we test this program? If we can, we need to modify the program i.e. we need to enable CANB and write values in GID,MD,ME. Am i correct or not?
3) The name of the program is "ECanA to ECanB", then why are we not assigning values to MD, ME, GID etc of ECanB ? are they no required?
/* Write to the MSGID field */
ECanaMboxes.MBOX25.MSGID.all = 0x95555555; // Extended Identifier
/* Configure Mailbox under test as a Transmit mailbox */
ECanaShadow.CANMD.all = ECanaRegs.CANMD.all;
ECanaShadow.CANMD.bit.MD25 = 0;
ECanaRegs.CANMD.all = ECanaShadow.CANMD.all;
/* Enable Mailbox under test */
ECanaShadow.CANME.all = ECanaRegs.CANME.all;
ECanaShadow.CANME.bit.ME25 = 1;
ECanaRegs.CANME.all = ECanaShadow.CANME.all;
/* Write to DLC field in Master Control reg */
ECanaMboxes.MBOX25.MSGCTRL.bit.DLC = 8;
/* Write to the mailbox RAM field */
ECanaMboxes.MBOX25.MDL.all = 0x55555555;
ECanaMboxes.MBOX25.MDH.all = 0x55555555;
/* Begin transmitting */
for(i=0; i < TXCOUNT; i++)
{
ECanaShadow.CANTRS.all = 0;
ECanaShadow.CANTRS.bit.TRS25 = 1; // Set TRS for mailbox under test
ECanaRegs.CANTRS.all = ECanaShadow.CANTRS.all;
do
{
ECanaShadow.CANTA.all = ECanaRegs.CANTA.all;
} while(ECanaShadow.CANTA.bit.TA25 == 0 ); // Wait for TA5 bit to be set..
ECanaShadow.CANTA.all = 0;
ECanaShadow.CANTA.bit.TA25 = 1; // Clear TA5
ECanaRegs.CANTA.all = ECanaShadow.CANTA.all;
loopcount ++;
}
__asm(" ESTOP0"); // Stop here
}