BTR0 & BTR1 for MSCAN controller on the TOTAL5200?

Hello,

I have a Total5200SDP. On the Total5200 an the PC Ã

wowtschik wrote:

Hello,

I have a Total5200SDP. On the Total5200 an the PC � have install
QNX6.3.0.
I want to receive massages from another tool (CANoe), but it doesn’t
work.
I think that I start the CAN driver with the wrong options.
I start it with the options “can -B0xAF -i81 &”.
Which value must have BTR1 ? (BTR0 = 0xAF. Is it OK?)

It is correct if you trying to use 125kb/s and the clockrate of the CAN
controller is 264MHz.

Is the latest BSP for QNX6.3 installed on the TotalBox ??
If not … then you don’t have to specify the IRQ.

Or is there another problem, why I can’t receive massages with the
TOTAL5200?

Please Help me!

What baudrate you want to use ? What is the clockrate of your CPU/CAN
controller ? Are you connected to the correct CAN connector ??

–Armin

Hello Armin,

I want to use the baudrate 125kb/s.
The BTR0 for this baudrate is 0xAF and the BTR1 0x4F. These
information I’ve got from a datasheet. But in these datasheet is
the BTR1 for other baudrate and BTR0 always the same.

Example:
Baud Rate kb/s BTR0 BTR1
100 0xBB 0x4F
125 0xAF 0x4F
250 0x97 0x4F

Is that correct?

I can’t find out with which clockrate the CAN controller works.
There is no documentation about this.

I don’t have install a BSP from QNX. I got the OS (BSP6.3.0) for my
TOTAL5200 from Freescale, because there where some problems with the
drivers.

If I start the CAN driver with the option –B0xAF& and try to
send some messages from CANoe, my CANoe tool don’t get some ERROR
FRAMES. That means that the total box send a ACK to the CANoe tool.
Is it correct?
But the FIFO of the total5200 is empty!

What should I do?


– wowtschik

wowtschikwrote:
Hello Armin,

I want to use the baudrate 125kb/s.
The BTR0 for this baudrate is 0xAF and the BTR1 0x4F. These
information I’ve got from a datasheet. But in these datasheet is

the BTR1 for other baudrate and BTR0 always the same.

Example:
Baud Rate kb/s BTR0 BTR1
100 0xBB 0x4F
125 0xAF 0x4F
250 0x97 0x4F

Is that correct?

I can’t find out with which clockrate the CAN controller works.
There is no documentation about this.

I don’t have install a BSP from QNX. I got the OS (BSP6.3.0) for
my TOTAL5200 from Freescale, because there where some problems with

the drivers.

If I start the CAN driver with the option –B0xAF& and try to
send some messages from CANoe, my CANoe tool don’t get some ERROR

FRAMES. That means that the total box send a ACK to the CANoe tool.
Is it correct?

But the FIFO of the total5200 is empty!

What should I do?


– wowtschik

Hello Armin,

I want to use the baudrate 125kb/s.
The BTR0 for this baudrate is 0xAF and the BTR1 0x4F. These
information I’ve got from a datasheet. But in these datasheet is
the BTR1 for other baudrate and BTR0 always the same.

Example:
Baud Rate kb/s BTR0 BTR1
100 0xBB 0x4F
125 0xAF 0x4F
250 0x97 0x4F

Is that correct?

I can’t find out with which clockrate the CAN controller works.
There is no documentation about this.

I don’t have install a BSP from QNX. I got the OS(BSP6.3.0) for my
TOTAL5200 from Freescale, because there where some problems with the
drivers.

If I start the CAN driver with the option –B0xAF& and try to
send some messages with the CANoe tool, my CANoe tool don’t get
some ERROR FRAMES. That means that the total box send a ACK to the
CANoe. Is it correct?
But the FIFO of the total5200 is empty!

What should I do?


– wowtschik

wowtschik wrote:

Hello Armin,

I want to use the baudrate 125kb/s.
The BTR0 for this baudrate is 0xAF and the BTR1 0x4F. These
information I�ve got from a datasheet. But in these datasheet is
the BTR1 for other baudrate and BTR0 always the same.

Example:
Baud Rate kb/s BTR0 BTR1
100 0xBB 0x4F
125 0xAF 0x4F
250 0x97 0x4F

Is that correct?

That’s correct for a clockrate of 264MHz.

I can�t find out with which clockrate the CAN controller works.
There is no documentation about this.

Please ask Freescale is there are any changes at hardware level.

I don�t have install a BSP from QNX. I got the OS(BSP6.3.0) for my
TOTAL5200 from Freescale, because there where some problems with the
drivers.

That BSP doesn’t work reliable with the CAN controllers of the
MPC5200. The whole system will lock up if both CAN controllers are
receiving the same CAN frame. (This interrupt problem is well known at
Freescale …)

If I start the CAN driver with the option �B0xAF& and try to
send some messages with the CANoe tool, my CANoe tool don�t get
some ERROR FRAMES.

That means there are any problems with the baudrate and/or the
transmission of frames.

That means that the total box send a ACK to the
CANoe. Is it correct?

No … an ACK isn’t the same as an ERROR FRAME.

If the CANoe station sends frames … the TotalBox must send the ACK
signals.

But the FIFO of the total5200 is empty!

You mean the receiving FIFO?

What should I do?

Check the hardware details with Freescale and make sure that at first
sending of frames is working (MPC5200 → CANoe).

–Armin

Hello,

the sending of CAN- massages from the Total5200 to CANoe is working.

Hello,

Who can tell me how can I charge BTR0 and BTR1 against of the clock
rate?
I need a formula!

Thank you!

– wowtschik

wowtschik wrote:

Hello,

Who can tell me how can I charge BTR0 and BTR1 against of the clock
rate?

You wrote that sending of frames is working, that means you got valid
BTR0 and BTR1 values. So why do you need a ‘formula’ ??

I need a formula!

And what is the clockrate of your CAN controllers ??

–Armin

Thank you!

– wowtschik

clockrate=33MHz.

The receiving of massages is working but not
correctly.

The telminal show me, that the FIFO buffer is empty.
But the terminal show me some data.
These data don’t are the same which I have send with the CANoe tool to
the Total5200.

Are there any mistakes in my programm?
These ist the programm code:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/neutrino.h>

#include “…/include/candef.h”
#include “…/include/canstr.h”
#include “…/include/canglob.h”


int NameId;
short resp;
struct can_object rmsg;
struct status st;


int main(int argc, char **argv)
{

unsigned short i;
struct sigevent pulse_event;
struct _pulse pulse;
int chid, coid, rcvid, con_id;
int n;
short puls;
struct can_object rmsg, msg;

struct config config_data;


// create notification channel
if ((chid = ChannelCreate(0)) == -1) exit( -1);
printf (“chid: %d\n”,chid);

if ((coid = ConnectAttach(0, 0, chid, _NTO_SIDE_CHANNEL, 0)) == -1)
{
ChannelDestroy(chid);
exit( -1);
}

printf (“coid: 0x%X\n”,coid);

// initialize notification event
SIGEV_PULSE_INIT(&pulse_event, coid, getprio(0),
_PULSE_CODE_MINAVAIL, 0);

if ((con_id = ConnectDriver (0, “CANDRV”)) < 0)
{
printf (“CAN recv: can’t connect the CAN driver.
STOP\n”);
exit (-1);
}

printf (“con_id: %X\n”,con_id); //ConnectDriver()
printf (“CAN status: 0x%04x\n”, CanGetStatus(con_id,
&st));



rmsg.DLC=3;
rmsg.RTR=0;
//rmsg.PRIO=1;
rmsg.FF=StdID;
rmsg.id=0x0100;



// register a pulse for channel 1
printf (“RegRdPulse: %d\n”,RegRdPulse(con_id, 1,
&pulse_event));


//read current configuration data
CanGetConfig(con_id, &config_data);

for (;:wink: //Endlosschleife
{
//rcvid = MsgReceivePulse(chid, &pulse, sizeof(struct _pulse),
NULL);
//perror("");
//printf (“rcvid gesetzt\n”);


//if(rcvid == -1)
//perror(“recv\n”);
//else
{
// specify the receive channel
rmsg.channel = 1;


// read frames fom channel 0
printf (“rmsg.channel: %d\n”,rmsg.channel);
resp = CanRead (con_id, &rmsg, NULL); // read and register
pulse again
printf(“CAN Status: %04x %d”, CanGetStatus(con_id,
&st), rmsg.DLC);
printf (" FF: %d .%04x",rmsg.FF, rmsg.id);
for (i = 0; i < 8; i++)
printf(".%02x", rmsg.data);
printf (" 0: %d\n", resp);

printf (“RxERR: %04x\n”,st.RxERR);
printf (“TXERR: %04x\n”,st.TxERR);

printf(“RXF: %04x\n”,RXF);
printf(“config_data.IDAC: 0x%X\n”,config_data.IDAC);

}
delay(100);
}
return 0;
}

wowtschik wrote:

clockrate=33MHz.

The receiving of massages is working but not
correctly.

The telminal show me, that the FIFO buffer is empty.

That means there are no frames received.

But the terminal show me some data.

rubbish …

These data don’t are the same which I have send with the CANoe tool to
the Total5200.

If you don’t receive frames why did you expect that the data of your
frame buffer will be the same as the frames send out by CANoe ???

–Armin


Are there any mistakes in my programm?
These ist the programm code:

#include <stdio.h
#include <stdlib.h
#include <unistd.h
#include <errno.h
#include <signal.h
#include <fcntl.h
#include <sys/neutrino.h

#include “…/include/candef.h”
#include “…/include/canstr.h”
#include “…/include/canglob.h”


int NameId;
short resp;
struct can_object rmsg;
struct status st;


int main(int argc, char **argv)
{

unsigned short i;
struct sigevent pulse_event;
struct _pulse pulse;
int chid, coid, rcvid, con_id;
int n;
short puls;
struct can_object rmsg, msg;

struct config config_data;


// create notification channel
if ((chid = ChannelCreate(0)) == -1) exit( -1);
printf (“chid: %d\n”,chid);

if ((coid = ConnectAttach(0, 0, chid, _NTO_SIDE_CHANNEL, 0)) == -1)
{
ChannelDestroy(chid);
exit( -1);
}

printf (“coid: 0x%X\n”,coid);

// initialize notification event
SIGEV_PULSE_INIT(&pulse_event, coid, getprio(0),
_PULSE_CODE_MINAVAIL, 0);

if ((con_id = ConnectDriver (0, “CANDRV”)) < 0)
{
printf (“CAN recv: can’t connect the CAN driver.
STOP\n”);
exit (-1);
}

printf (“con_id: %X\n”,con_id); //ConnectDriver()
printf (“CAN status: 0x%04x\n”, CanGetStatus(con_id,
&st));



rmsg.DLC=3;
rmsg.RTR=0;
//rmsg.PRIO=1;
rmsg.FF=StdID;
rmsg.id=0x0100;



// register a pulse for channel 1
printf (“RegRdPulse: %d\n”,RegRdPulse(con_id, 1,
&pulse_event));


//read current configuration data
CanGetConfig(con_id, &config_data);

for (;:wink: //Endlosschleife
{
//rcvid = MsgReceivePulse(chid, &pulse, sizeof(struct _pulse),
NULL);
//perror("");
//printf (“rcvid gesetzt\n”);


//if(rcvid == -1)
//perror(“recv\n”);
//else
{
// specify the receive channel
rmsg.channel = 1;


// read frames fom channel 0
printf (“rmsg.channel: %d\n”,rmsg.channel);
resp = CanRead (con_id, &rmsg, NULL); // read and register
pulse again
printf(“CAN Status: %04x %d”, CanGetStatus(con_id,
&st), rmsg.DLC);
printf (" FF: %d .%04x",rmsg.FF, rmsg.id);
for (i = 0; i < 8; i++)
printf(".%02x", rmsg.data);
printf (" 0: %d\n", resp);

printf (“RxERR: %04x\n”,st.RxERR);
printf (“TXERR: %04x\n”,st.TxERR);

printf(“RXF: %04x\n”,RXF);
printf(“config_data.IDAC: 0x%X\n”,config_data.IDAC);

}
delay(100);
}
return 0;
}

wowtschik wrote:

clockrate=33MHz.

If you believe that 33MHz are correct, use:

http://www.port.de/engl/canprod/content/sv_req_form.html

–Armin

What is the problem?
Why can’t I receive messages?
Is it possibly because of the operating system?

wowtschik wrote:

What is the problem?
Why can’t I receive messages?

Because of the fact that sending of frames doesn’t work in your setup.

Is it possibly because of the operating system?

No … it could be an issue of the BSP or the hardware.

–Armin