No data is being transmitted

Started by rithes ameen May 3, 2005
Hello everybody,

I need a help regarding transmission of data using CAN Protocol in MC9S12DP256B. It is not able from to send data ,i have enabled the CANE bit in the CAN0CTRL1 only once . Entered intialisation modes i am setting all the bus configuration where i am seeting it to 10KPBS.

I am putting my program code in this mail. Please help me with this . I am a student undergoing my academic project where a am stuck at this point ,i could make the adc work
My name is Rithesh.M Code :::::::::::::::::::::::::::::::::::::
void delay1(void);
void main(void)
{ unsigned char a;
/* put your own code here */

// mode is entered to write some registers
CAN0CTL0=0x01;
while(CAN0CTL1!=0x11);

// until acknowledge from initRQ bit is set to enter initialisation state
CAN0BTR0=0x3F; // Bus synchronisation is timing is set to 4 Tq state
CAN0BTR1=0x6E;
CAN0CTL1=0x0A4;
// can controller is enabled clk is selected as external crystal and wake up mode is enabled

CAN0CTL0=0x00;
while(1)
{

delay1();
while(CAN0CTL1!=0x0A4);// waiting for acknowledgement

a0TFLG;
CAN0TBSEL=a;

CAN0TXIDR0=0x66;
CAN0TXIDR1=0x60;

CAN0TXDLR=0x02;
CAN0TXDSR0=0x03;
CAN0TXDSR1=0x08;

// CAN0TIER=0x03;

delay1();
delay1();
delay1();
delay1();
delay1();
delay1();
delay1();
delay1();
delay1();
delay1();
delay1();

}
while(1)
{

};

for(;;) {} /* wait forever */
}

void delay1(void)
{unsigned int i=0;
while(i<= 64000)
{
i++;
}
} Thanking you ,
Waiting for reply from anybody who could help me out, i would be really grateful, Yours lovingly,
Rithesh.M

Yahoo! India Matrimony: Find your life partneronline.



Rithesh,

I'm just commenting on the "it is not able to send data".
You set CAN0CTL1 to 0xA4, 10101000b.
Bit 5 of CAN0CTL1 is called LOOPB and, when set, the CAN
module performs an internal loopback, ignoring the RX pin
and holding the TX pin in the recessive state('1'), thus,
you won't see anything on the TX pin. Is that what you see?
If so, try writing 0x84, 10000100b to CAN0CTL1, this should
disable LOOP mode.

hth
-uwe



Hi Rithesh,

You don't appear to be clearing the LISTEN bit in CANxCTL1. You must do
this after entering init mode to enable transmission.

Rob Milne



Hi Rithesh,

Before transmiting, Have u checked wether the synch bit is varying or
const.Because it is depends on the syncronization to the can bus.It supposed
to be constant.

you said that u r using the DP256 controller there are 4 CAN channels,Have
u selected the proper channel for u r transmission.you should not be in
LISTEN mode,LOOP back mode while transmiting the CAN messages.

To start transmission u have to reset the TFLG register corresponding buffer
selection to zero by writing 1.writing ZERO ingnores. --------------
-----Original Message-----
From: 68HC12@68HC... [mailto:68HC12@68HC...]On Behalf Of
rithes ameen
Sent: Tuesday, May 03, 2005 10:35 AM
To: 68HC12@68HC...
Subject: [68HC12] No data is being transmitted Hello everybody,

I need a help regarding transmission of data using CAN Protocol in
MC9S12DP256B. It is not able from to send data ,i have enabled the CANE bit
in the CAN0CTRL1 only once . Entered intialisation modes i am setting all
the bus configuration where i am seeting it to 10KPBS.

I am putting my program code in this mail. Please help me with this . I am a student undergoing my academic project where a am stuck at this
point ,i could make the adc work
My name is Rithesh.M Code :::::::::::::::::::::::::::::::::::::
void delay1(void);
void main(void)
{ unsigned char a;
/* put your own code here */

// mode is entered to write some registers
CAN0CTL0=0x01;
while(CAN0CTL1!=0x11);

// until acknowledge from initRQ bit is set to enter initialisation
state
CAN0BTR0=0x3F; // Bus synchronisation is timing is set to 4 Tq state
CAN0BTR1=0x6E;
CAN0CTL1=0xA4;
// can controller is enabled clk is selected as external crystal and
wake up mode is enabled

CAN0CTL0=0x00;
while(1)
{

delay1();
while(CAN0CTL1!=0x0A4);// waiting for acknowledgement

a0TFLG;
CAN0TBSEL=a;

CAN0TXIDR0=0x66;
CAN0TXIDR1=0x60;

CAN0TXDLR=0x02;
CAN0TXDSR0=0x03;
CAN0TXDSR1=0x08;

// CAN0TIER=0x03;

delay1();
delay1();
delay1();
delay1();
delay1();
delay1();
delay1();
delay1();
delay1();
delay1();
delay1();

}
while(1)
{

};

for(;;) {} /* wait forever */
}

void delay1(void)
{unsigned int i=0;
while(i<= 64000)
{
i++;
}
} Thanking you ,
Waiting for reply from anybody who could help me out, i would be
really grateful, Yours lovingly,
Rithesh.M

Yahoo! India Matrimony: Find your life partneronline. ----
--
Yahoo! Groups Links

a.. To

----------------------------------
Email From "rithes ameen " was security checked by 3.93 version of
CxProtect(tm) On: deiserver at: 10:56:51, 03-May-2005
Tuesday --------------------------------
-- ----------------------------------
Email From ""venki" <venki@venk...>" was security checked by 3.93 version of CxProtect(tm)
On: deiserver at: 18:32:24, 03-May-2005 Tuesday
Engine: 4.110.21, sign.def:23-Mar-2005, sign2.def:23-Mar-2005, macro.def:18-Mar-2005
----------------------------------