Sign in

username:

password:



Not a member?

Search 68hc12



Search tips

Subscribe to 68hc12



68hc12 by Keywords

68HC1 | 812A4 | 9S12DP256 | Bootloader | CodeWarrior | D60A | Debugger | DP256 | ECT | EEPROM | EVB | Flash | HC1 | HCS12 | I2C | IAR | ICC1 | Interrupts | LCD | M68KIT912DP256 | MC9S12DP256 | MC9S12DP256B | Metrowerks | Motor | MSCAN | Multilink | PLL | Quadrature | SDI | SPI | Transceiver | XFC

Ads

Discussion Groups

Discussion Groups | 68HC12 | Problem with initialising msCAN 6812dp256b

Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).

Problem with initialising msCAN 6812dp256b - Sebastian Schuster - Apr 19 2:24:00 2004

This time I need some help with the msCAN. The program runs in loop-
mode, so the data from the transmiter buffer should turn up in the
reveiver buffer. But this is not the case.

Regards

Sebastian #include <hidef.h> /* common defines and macros
*/
#include <6812dp256b.h> /* derivative information */
#include "my_vectors.h" static int cnt;
static int mycnt;

static struct daten
{

char IDR0;
char IDR1;
char IDR2;
char IDR3;
char DSR[8];
char DLR;

char TBPR;
char TSRH;
char TSRL;

}; void caninit(void)
{

CAN0CTL1_CANE=1; //msCAN-Enable

CAN0CTL0_INITRQ=1; //CAN-Modul im Resetzustand
//CANxTIDR0_IDE
CAN0CTL1_CLKSRC=1; //Clock=Busclock

CAN0IDMR0=0xFF;
CAN0IDMR1=0xFF;
CAN0IDMR2=0xFF;
CAN0IDMR3=0xFF;
CAN0IDMR4=0xFF;
CAN0IDMR5=0xFF;
CAN0IDMR6=0xFF;
CAN0IDMR7=0xFF;

CAN0CTL1=0xc7; //CAN0BTR0=0x01; //Bittiming nach Angabe des
Notebooks
//CAN0BTR1=0x1C;
CAN0BTR0_SJW1=0;
CAN0BTR0_SJW0=0;

CAN0BTR0_BRP5=0; //Einstellung nur im INITRQ=1-Mod
möglich
CAN0BTR0_BRP4=0;
CAN0BTR0_BRP3=0;
CAN0BTR0_BRP2=0;
CAN0BTR0_BRP1=1;
CAN0BTR0_BRP0=1; CAN0BTR1_TSEG22=1;
CAN0BTR1_TSEG21=1;
CAN0BTR1_TSEG20=1;

CAN0BTR1_TSEG12=0;
CAN0BTR1_TSEG12=1;
CAN0BTR1_TSEG11=0;
CAN0BTR1_TSEG10=1; CAN0IDAC_IDAM1=1; //Filtereinstellung auf zwei 32
Acceptance Filter
CAN0IDAC_IDAM0=1; CAN0CTL0_INITRQ=0; //Resetzustand aus
MODE=0x80; //Enter Normal Single Chip
Mode

CAN0CTL0_WUPE=1;
CAN0CTL1_LOOPB=1; //Loop Back Self Test Mode
CAN0CTL0_TIME=1; //CAN-Timer enable

DDRB=0xFF;
PORTB=0;
}

void senddata(struct daten)
{
//Daten können nur gesendet werden, wenn die TXEx-Flags 1 und
damit die Sende-Puffer leer sind
if(CAN0TFLG_TXE2==1)
{
//zum Puffern bereit
CAN0TBSEL=0x04;//Puffer TX2 ist ausgwählt (durch
einen Pointer)

CAN0TXIDR0=daten.IDR0; /* MSCAN Identifier Register 0
*/
CAN0TXIDR1=daten.IDR1; /* MSCAN Identifier Register 1
*/
CAN0TXIDR2=daten.IDR2; /* MSCAN Identifier Register 2
*/
CAN0TXIDR3=daten.IDR3; /* MSCAN Identifier Register 0
*/

CAN0TXDSR0=daten.DSR[0]; /* MSCAN Data Segment
Register 0 */
CAN0TXDSR1=daten.DSR[1]; /* MSCAN Data Segment
Register 1 */
CAN0TXDSR2=daten.DSR[2]; /* MSCAN Data Segment
Register 2 */
CAN0TXDSR3=daten.DSR[3]; /* MSCAN Data Segment
Register 3 */
CAN0TXDSR4=daten.DSR[4]; /* MSCAN Data Segment
Register 4 */
CAN0TXDSR5=daten.DSR[5]; /* MSCAN Data Segment
Register 5 */
CAN0TXDSR6=daten.DSR[6]; /* MSCAN Data Segment
Register 6 */
CAN0TXDSR7=daten.DSR[7]; /* MSCAN Data Segment
Register 7 */
//CAN0RXERR; /* MSCAN Receive Error Counter Register
*/

CAN0TXDLR =daten.DLR; //Datenlängenregister
CAN0TXTBPR=daten.TBPR; //Sendepufferpriorität
CAN0TFLG_TXE2=1; //Löschen des Flag
durch Einschreiben einer 1 für Sendebereitschaft
}
}

void main(void) {
/* put your own code here */ caninit();
struct daten message1 ={ 0,0,0,0,
55, 55, 55,
55, 55, 55, 55, 55,
16,0,0,0};
//DDRH=0;
//PTH=0;
//PERH=0xFF;

senddata(message1);
for(;;)
{
cnt++;

//if(PTH==0x7F)
//{

//}

if(CAN0CTL0_SYNCH==1)
{
PORTB=0x55;
}

}
}





(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )


AW: Problem with initialising msCAN 6812dp256b - Christoph Brügge - Apr 19 3:27:00 2004

Hello Sebastian,

in my opinion, you have to set the CAN0IDAR0-Registers too!
Otherwise the Controller drop the Message because it doesn't
pass the Criteria!

The Manual sys's:
"On reception, each message is written into the background receive
buffer. The CPU is only signalled to read the message if it passes the
criteria in the identifier acceptance and identifier mask registers
(accepted); otherwise, the message is overwritten by the next message
(dropped)."

Regards Christoph

-----Ursprüngliche Nachricht-----
Von: Sebastian Schuster [mailto:]
Gesendet: Montag, 19. April 2004 09:24
An:
Betreff: [68HC12] Problem with initialising msCAN 6812dp256b This time I need some help with the msCAN. The program runs in loop-
mode, so the data from the transmiter buffer should turn up in the
reveiver buffer. But this is not the case.

Regards

Sebastian #include <hidef.h> /* common defines and macros
*/
#include <6812dp256b.h> /* derivative information */
#include "my_vectors.h" static int cnt;
static int mycnt;

static struct daten
{

char IDR0;
char IDR1;
char IDR2;
char IDR3;
char DSR[8];
char DLR;

char TBPR;
char TSRH;
char TSRL;

}; void caninit(void)
{

CAN0CTL1_CANE=1; //msCAN-Enable

CAN0CTL0_INITRQ=1; //CAN-Modul im Resetzustand
//CANxTIDR0_IDE
CAN0CTL1_CLKSRC=1; //Clock=Busclock

CAN0IDMR0=0xFF;
CAN0IDMR1=0xFF;
CAN0IDMR2=0xFF;
CAN0IDMR3=0xFF;
CAN0IDMR4=0xFF;
CAN0IDMR5=0xFF;
CAN0IDMR6=0xFF;
CAN0IDMR7=0xFF;

CAN0CTL1=0xc7; //CAN0BTR0=0x01; //Bittiming nach Angabe des
Notebooks
//CAN0BTR1=0x1C;
CAN0BTR0_SJW1=0;
CAN0BTR0_SJW0=0;

CAN0BTR0_BRP5=0; //Einstellung nur im INITRQ=1-Mod
möglich
CAN0BTR0_BRP4=0;
CAN0BTR0_BRP3=0;
CAN0BTR0_BRP2=0;
CAN0BTR0_BRP1=1;
CAN0BTR0_BRP0=1; CAN0BTR1_TSEG22=1;
CAN0BTR1_TSEG21=1;
CAN0BTR1_TSEG20=1;

CAN0BTR1_TSEG12=0;
CAN0BTR1_TSEG12=1;
CAN0BTR1_TSEG11=0;
CAN0BTR1_TSEG10=1; CAN0IDAC_IDAM1=1; //Filtereinstellung auf zwei 32
Acceptance Filter
CAN0IDAC_IDAM0=1; CAN0CTL0_INITRQ=0; //Resetzustand aus
MODE=0x80; //Enter Normal Single Chip
Mode

CAN0CTL0_WUPE=1;
CAN0CTL1_LOOPB=1; //Loop Back Self Test Mode
CAN0CTL0_TIME=1; //CAN-Timer enable

DDRB=0xFF;
PORTB=0;
}

void senddata(struct daten)
{
//Daten können nur gesendet werden, wenn die TXEx-Flags 1 und
damit die Sende-Puffer leer sind
if(CAN0TFLG_TXE2==1)
{
//zum Puffern bereit
CAN0TBSEL=0x04;//Puffer TX2 ist ausgwählt (durch
einen Pointer)

CAN0TXIDR0=daten.IDR0; /* MSCAN Identifier Register 0
*/
CAN0TXIDR1=daten.IDR1; /* MSCAN Identifier Register 1
*/
CAN0TXIDR2=daten.IDR2; /* MSCAN Identifier Register 2
*/
CAN0TXIDR3=daten.IDR3; /* MSCAN Identifier Register 0
*/

CAN0TXDSR0=daten.DSR[0]; /* MSCAN Data Segment
Register 0 */
CAN0TXDSR1=daten.DSR[1]; /* MSCAN Data Segment
Register 1 */
CAN0TXDSR2=daten.DSR[2]; /* MSCAN Data Segment
Register 2 */
CAN0TXDSR3=daten.DSR[3]; /* MSCAN Data Segment
Register 3 */
CAN0TXDSR4=daten.DSR[4]; /* MSCAN Data Segment
Register 4 */
CAN0TXDSR5=daten.DSR[5]; /* MSCAN Data Segment
Register 5 */
CAN0TXDSR6=daten.DSR[6]; /* MSCAN Data Segment
Register 6 */
CAN0TXDSR7=daten.DSR[7]; /* MSCAN Data Segment
Register 7 */
//CAN0RXERR; /* MSCAN Receive Error Counter Register
*/

CAN0TXDLR =daten.DLR; //Datenlängenregister
CAN0TXTBPR=daten.TBPR; //Sendepufferpriorität
CAN0TFLG_TXE2=1; //Löschen des Flag
durch Einschreiben einer 1 für Sendebereitschaft
}
}

void main(void) {
/* put your own code here */ caninit();
struct daten message1 ={ 0,0,0,0,
55, 55, 55,
55, 55, 55, 55, 55,
16,0,0,0};
//DDRH=0;
//PTH=0;
//PERH=0xFF;

senddata(message1);
for(;;)
{
cnt++;

//if(PTH==0x7F)
//{

//}

if(CAN0CTL0_SYNCH==1)
{
PORTB=0x55;
}

}
}

--------------------------------------------------------To learn more about
Motorola Microcontrollers, please visit
http://www.motorola.com/mcu
o learn more about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu

Yahoo! Groups Links





(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

Re: Problem with initialising msCAN 6812dp256b - Sebastian Schuster - Apr 19 7:28:00 2004

But when setting CAN0IDAR [0...7] with 0xFF nothing really has
changed. Because my mcu has no identifer-number, how will it be
possible that my test-message could pass the identifer-filter? --- In , Christoph Brügge <mistertom20@g...>
wrote:
> Hello Sebastian,
>
> in my opinion, you have to set the CAN0IDAR0-Registers too!
> Otherwise the Controller drop the Message because it doesn't
> pass the Criteria!
>
> The Manual sys's:
> "On reception, each message is written into the background receive
> buffer. The CPU is only signalled to read the message if it passes
the
> criteria in the identifier acceptance and identifier mask registers
> (accepted); otherwise, the message is overwritten by the next
message
> (dropped)."
>
> Regards Christoph
>
> -----Ursprüngliche Nachricht-----
> Von: Sebastian Schuster [mailto:schusti@w...]
> Gesendet: Montag, 19. April 2004 09:24
> An:
> Betreff: [68HC12] Problem with initialising msCAN 6812dp256b > This time I need some help with the msCAN. The program runs in loop-
> mode, so the data from the transmiter buffer should turn up in the
> reveiver buffer. But this is not the case.
>
> Regards
>
> Sebastian > #include <hidef.h> /* common defines and macros
> */
> #include <6812dp256b.h> /* derivative information */
> #include "my_vectors.h" > static int cnt;
> static int mycnt;
>
> static struct daten
> {
>
> char IDR0;
> char IDR1;
> char IDR2;
> char IDR3;
> char DSR[8];
> char DLR;
>
> char TBPR;
> char TSRH;
> char TSRL;
>
> }; > void caninit(void)
> {
>
> CAN0CTL1_CANE=1; //msCAN-Enable
>
> CAN0CTL0_INITRQ=1; //CAN-Modul im Resetzustand >
> //CANxTIDR0_IDE
> CAN0CTL1_CLKSRC=1; //Clock=Busclock
>
> CAN0IDMR0=0xFF;
> CAN0IDMR1=0xFF;
> CAN0IDMR2=0xFF;
> CAN0IDMR3=0xFF;
> CAN0IDMR4=0xFF;
> CAN0IDMR5=0xFF;
> CAN0IDMR6=0xFF;
> CAN0IDMR7=0xFF;
>
> CAN0CTL1=0xc7; > //CAN0BTR0=0x01; //Bittiming nach Angabe des
> Notebooks
> //CAN0BTR1=0x1C; >
> CAN0BTR0_SJW1=0;
> CAN0BTR0_SJW0=0;
>
> CAN0BTR0_BRP5=0; //Einstellung nur im INITRQ=1-Mod
> möglich
> CAN0BTR0_BRP4=0;
> CAN0BTR0_BRP3=0;
> CAN0BTR0_BRP2=0;
> CAN0BTR0_BRP1=1;
> CAN0BTR0_BRP0=1; > CAN0BTR1_TSEG22=1;
> CAN0BTR1_TSEG21=1;
> CAN0BTR1_TSEG20=1;
>
> CAN0BTR1_TSEG12=0;
> CAN0BTR1_TSEG12=1;
> CAN0BTR1_TSEG11=0;
> CAN0BTR1_TSEG10=1; > CAN0IDAC_IDAM1=1; //Filtereinstellung auf zwei 32
> Acceptance Filter
> CAN0IDAC_IDAM0=1; > CAN0CTL0_INITRQ=0; //Resetzustand aus
> MODE=0x80; //Enter Normal Single Chip
> Mode
>
> CAN0CTL0_WUPE=1;
> CAN0CTL1_LOOPB=1; //Loop Back Self Test Mode
> CAN0CTL0_TIME=1; //CAN-Timer enable
>
> DDRB=0xFF;
> PORTB=0;
> }
>
> void senddata(struct daten)
> {
> //Daten können nur gesendet werden, wenn die TXEx-Flags 1 und
> damit die Sende-Puffer leer sind
> if(CAN0TFLG_TXE2==1)
> {
> //zum Puffern bereit
> CAN0TBSEL=0x04;//Puffer TX2 ist ausgwählt (durch
> einen Pointer)
>
> CAN0TXIDR0=daten.IDR0; /* MSCAN Identifier Register 0
> */
> CAN0TXIDR1=daten.IDR1; /* MSCAN Identifier Register 1
> */
> CAN0TXIDR2=daten.IDR2; /* MSCAN Identifier Register 2
> */
> CAN0TXIDR3=daten.IDR3; /* MSCAN Identifier Register 0
> */
>
> CAN0TXDSR0=daten.DSR[0]; /* MSCAN Data Segment
> Register 0 */
> CAN0TXDSR1=daten.DSR[1]; /* MSCAN Data Segment
> Register 1 */
> CAN0TXDSR2=daten.DSR[2]; /* MSCAN Data Segment
> Register 2 */
> CAN0TXDSR3=daten.DSR[3]; /* MSCAN Data Segment
> Register 3 */
> CAN0TXDSR4=daten.DSR[4]; /* MSCAN Data Segment
> Register 4 */
> CAN0TXDSR5=daten.DSR[5]; /* MSCAN Data Segment
> Register 5 */
> CAN0TXDSR6=daten.DSR[6]; /* MSCAN Data Segment
> Register 6 */
> CAN0TXDSR7=daten.DSR[7]; /* MSCAN Data Segment
> Register 7 */
> //CAN0RXERR; /* MSCAN Receive Error Counter Register
> */
>
> CAN0TXDLR =daten.DLR; //Datenlängenregister
> CAN0TXTBPR=daten.TBPR; //Sendepufferpriorität
> CAN0TFLG_TXE2=1; //Löschen des Flag
> durch Einschreiben einer 1 für Sendebereitschaft
> }
> }
>
> void main(void) {
> /* put your own code here */ > caninit();
> struct daten message1 ={ 0,0,0,0,
> 55, 55, 55,
> 55, 55, 55, 55, 55,
> 16,0,0,0};
> //DDRH=0;
> //PTH=0;
> //PERH=0xFF;
>
> senddata(message1);
> for(;;)
> {
> cnt++;
>
> //if(PTH==0x7F)
> //{
>
> //}
>
> if(CAN0CTL0_SYNCH==1)
> {
> PORTB=0x55;
> }
>
> }
> } >
>
> --------------------------------------------------------To learn
more about
> Motorola Microcontrollers, please visit
> http://www.motorola.com/mcu
> o learn more about Motorola Microcontrollers, please visit
> http://www.motorola.com/mcu
>
> Yahoo! Groups Links




(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

Re: Re: Problem with initialising msCAN 6812dp256b - Sydney Faria - Apr 23 7:14:00 2004

Is filtering applied in loop back mode? I have written an msCAN program in
assembly for the D60A chip and seem to remember that the very first thing I
experimented with was the loop back mode to talk to myself ( I do that a
lot) and got the sending portion to work but I could not get the filtering
to do anything. I then started the experiment with a receive program using
loopback and ignoring filtering. Once both of these were working I started
to work on the same two programs without loopback and set up filtering to
accept all msgs. My problems were frustrating because of the bit timing so
we bought a tinCAN interface and discovered www.port.de! It did not take
long to straighten out the bus timiing problems after we got the tinCAN. I
can tell you that I first tried to use 8 bit filters with the D60A chip and
the filtering acted very strangely! After much frustration and getting and
using the freebie filtering tool from metrowerks I learned a lot more and
was even more convinced that the filtering of 8 bit filters was not working
as it should - even Motorola could not see how to fix the filtering for 8
bit filters. So I went to standard 11 bit ID configured msgs and 16 bit
filters and had very few problems.
Sydney
----- Original Message -----
From: Sebastian Schuster
To:
Sent: Monday, April 19, 2004 8:28 AM
Subject: [68HC12] Re: Problem with initialising msCAN 6812dp256b But when setting CAN0IDAR [0...7] with 0xFF nothing really has
changed. Because my mcu has no identifer-number, how will it be
possible that my test-message could pass the identifer-filter? --- In , Christoph Brügge <mistertom20@g...>
wrote:
> Hello Sebastian,
>
> in my opinion, you have to set the CAN0IDAR0-Registers too!
> Otherwise the Controller drop the Message because it doesn't
> pass the Criteria!
>
> The Manual sys's:
> "On reception, each message is written into the background receive
> buffer. The CPU is only signalled to read the message if it passes
the
> criteria in the identifier acceptance and identifier mask registers
> (accepted); otherwise, the message is overwritten by the next
message
> (dropped)."
>
> Regards Christoph
>
> -----Ursprüngliche Nachricht-----
> Von: Sebastian Schuster [mailto:schusti@w...]
> Gesendet: Montag, 19. April 2004 09:24
> An:
> Betreff: [68HC12] Problem with initialising msCAN 6812dp256b > This time I need some help with the msCAN. The program runs in loop-
> mode, so the data from the transmiter buffer should turn up in the
> reveiver buffer. But this is not the case.
>
> Regards
>
> Sebastian > #include <hidef.h> /* common defines and macros
> */
> #include <6812dp256b.h> /* derivative information */
> #include "my_vectors.h" > static int cnt;
> static int mycnt;
>
> static struct daten
> {
>
> char IDR0;
> char IDR1;
> char IDR2;
> char IDR3;
> char DSR[8];
> char DLR;
>
> char TBPR;
> char TSRH;
> char TSRL;
>
> }; > void caninit(void)
> {
>
> CAN0CTL1_CANE=1; //msCAN-Enable
>
> CAN0CTL0_INITRQ=1; //CAN-Modul im Resetzustand >
> //CANxTIDR0_IDE
> CAN0CTL1_CLKSRC=1; //Clock=Busclock
>
> CAN0IDMR0=0xFF;
> CAN0IDMR1=0xFF;
> CAN0IDMR2=0xFF;
> CAN0IDMR3=0xFF;
> CAN0IDMR4=0xFF;
> CAN0IDMR5=0xFF;
> CAN0IDMR6=0xFF;
> CAN0IDMR7=0xFF;
>
> CAN0CTL1=0xc7; > //CAN0BTR0=0x01; //Bittiming nach Angabe des
> Notebooks
> //CAN0BTR1=0x1C; >
> CAN0BTR0_SJW1=0;
> CAN0BTR0_SJW0=0;
>
> CAN0BTR0_BRP5=0; //Einstellung nur im INITRQ=1-Mod
> möglich
> CAN0BTR0_BRP4=0;
> CAN0BTR0_BRP3=0;
> CAN0BTR0_BRP2=0;
> CAN0BTR0_BRP1=1;
> CAN0BTR0_BRP0=1; > CAN0BTR1_TSEG22=1;
> CAN0BTR1_TSEG21=1;
> CAN0BTR1_TSEG20=1;
>
> CAN0BTR1_TSEG12=0;
> CAN0BTR1_TSEG12=1;
> CAN0BTR1_TSEG11=0;
> CAN0BTR1_TSEG10=1; > CAN0IDAC_IDAM1=1; //Filtereinstellung auf zwei 32
> Acceptance Filter
> CAN0IDAC_IDAM0=1; > CAN0CTL0_INITRQ=0; //Resetzustand aus
> MODE=0x80; //Enter Normal Single Chip
> Mode
>
> CAN0CTL0_WUPE=1;
> CAN0CTL1_LOOPB=1; //Loop Back Self Test Mode
> CAN0CTL0_TIME=1; //CAN-Timer enable
>
> DDRB=0xFF;
> PORTB=0;
> }
>
> void senddata(struct daten)
> {
> //Daten können nur gesendet werden, wenn die TXEx-Flags 1 und
> damit die Sende-Puffer leer sind
> if(CAN0TFLG_TXE2==1)
> {
> //zum Puffern bereit
> CAN0TBSEL=0x04;//Puffer TX2 ist ausgwählt (durch
> einen Pointer)
>
> CAN0TXIDR0=daten.IDR0; /* MSCAN Identifier Register 0
> */
> CAN0TXIDR1=daten.IDR1; /* MSCAN Identifier Register 1
> */
> CAN0TXIDR2=daten.IDR2; /* MSCAN Identifier Register 2
> */
> CAN0TXIDR3=daten.IDR3; /* MSCAN Identifier Register 0
> */
>
> CAN0TXDSR0=daten.DSR[0]; /* MSCAN Data Segment
> Register 0 */
> CAN0TXDSR1=daten.DSR[1]; /* MSCAN Data Segment
> Register 1 */
> CAN0TXDSR2=daten.DSR[2]; /* MSCAN Data Segment
> Register 2 */
> CAN0TXDSR3=daten.DSR[3]; /* MSCAN Data Segment
> Register 3 */
> CAN0TXDSR4=daten.DSR[4]; /* MSCAN Data Segment
> Register 4 */
> CAN0TXDSR5=daten.DSR[5]; /* MSCAN Data Segment
> Register 5 */
> CAN0TXDSR6=daten.DSR[6]; /* MSCAN Data Segment
> Register 6 */
> CAN0TXDSR7=daten.DSR[7]; /* MSCAN Data Segment
> Register 7 */
> //CAN0RXERR; /* MSCAN Receive Error Counter Register
> */
>
> CAN0TXDLR =daten.DLR; //Datenlängenregister
> CAN0TXTBPR=daten.TBPR; //Sendepufferpriorität
> CAN0TFLG_TXE2=1; //Löschen des Flag
> durch Einschreiben einer 1 für Sendebereitschaft
> }
> }
>
> void main(void) {
> /* put your own code here */ > caninit();
> struct daten message1 ={ 0,0,0,0,
> 55, 55, 55,
> 55, 55, 55, 55, 55,
> 16,0,0,0};
> //DDRH=0;
> //PTH=0;
> //PERH=0xFF;
>
> senddata(message1);
> for(;;)
> {
> cnt++;
>
> //if(PTH==0x7F)
> //{
>
> //}
>
> if(CAN0CTL0_SYNCH==1)
> {
> PORTB=0x55;
> }
>
> }
> } >
>
> --------------------------------------------------------To learn
more about
> Motorola Microcontrollers, please visit
> http://www.motorola.com/mcu
> o learn more about Motorola Microcontrollers, please visit
> http://www.motorola.com/mcu
>
> Yahoo! Groups Links
--------------------------------------------------------To learn more
about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu
o learn more about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu

----------------------------------------------------------------------------
--
Yahoo! Groups Links

a.. To
[Non-text portions of this message have been removed]




(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

Re: Problem with initialising msCAN 6812dp256b - Sydney Faria - Apr 23 7:37:00 2004

Have you tried to send a msg frame and look for it in memory with the
debugger? In my unit, the D60A, I look at $0940 because of the offset of
$0800 for relocated registers. We had a lot of problems with the dp256 so
we changed to the d60A, but they both use msCAN! Motorola has several ANs
that you should check out. And, as I said before, in loopback mode, timing
and filtering should not be a problem, just keep looking for the CAN msg
frame in the receive buffer register to prove your sending routine is OK.
Sydney

----- Original Message -----
From: Christoph Brügge
To:
Sent: Monday, April 19, 2004 4:27 AM
Subject: AW: [68HC12] Problem with initialising msCAN 6812dp256b Hello Sebastian,

in my opinion, you have to set the CAN0IDAR0-Registers too!
Otherwise the Controller drop the Message because it doesn't
pass the Criteria!

The Manual sys's:
"On reception, each message is written into the background receive
buffer. The CPU is only signalled to read the message if it passes the
criteria in the identifier acceptance and identifier mask registers
(accepted); otherwise, the message is overwritten by the next message
(dropped)."

Regards Christoph

-----Ursprüngliche Nachricht-----
Von: Sebastian Schuster [mailto:]
Gesendet: Montag, 19. April 2004 09:24
An:
Betreff: [68HC12] Problem with initialising msCAN 6812dp256b This time I need some help with the msCAN. The program runs in loop-
mode, so the data from the transmiter buffer should turn up in the
reveiver buffer. But this is not the case.

Regards

Sebastian #include <hidef.h> /* common defines and macros
*/
#include <6812dp256b.h> /* derivative information */
#include "my_vectors.h" static int cnt;
static int mycnt;

static struct daten
{

char IDR0;
char IDR1;
char IDR2;
char IDR3;
char DSR[8];
char DLR;

char TBPR;
char TSRH;
char TSRL;

}; void caninit(void)
{

CAN0CTL1_CANE=1; //msCAN-Enable

CAN0CTL0_INITRQ=1; //CAN-Modul im Resetzustand
//CANxTIDR0_IDE
CAN0CTL1_CLKSRC=1; //Clock=Busclock

CAN0IDMR0=0xFF;
CAN0IDMR1=0xFF;
CAN0IDMR2=0xFF;
CAN0IDMR3=0xFF;
CAN0IDMR4=0xFF;
CAN0IDMR5=0xFF;
CAN0IDMR6=0xFF;
CAN0IDMR7=0xFF;

CAN0CTL1=0xc7; //CAN0BTR0=0x01; //Bittiming nach Angabe des
Notebooks
//CAN0BTR1=0x1C;
CAN0BTR0_SJW1=0;
CAN0BTR0_SJW0=0;

CAN0BTR0_BRP5=0; //Einstellung nur im INITRQ=1-Mod
möglich
CAN0BTR0_BRP4=0;
CAN0BTR0_BRP3=0;
CAN0BTR0_BRP2=0;
CAN0BTR0_BRP1=1;
CAN0BTR0_BRP0=1; CAN0BTR1_TSEG22=1;
CAN0BTR1_TSEG21=1;
CAN0BTR1_TSEG20=1;

CAN0BTR1_TSEG12=0;
CAN0BTR1_TSEG12=1;
CAN0BTR1_TSEG11=0;
CAN0BTR1_TSEG10=1; CAN0IDAC_IDAM1=1; //Filtereinstellung auf zwei 32
Acceptance Filter
CAN0IDAC_IDAM0=1; CAN0CTL0_INITRQ=0; //Resetzustand aus
MODE=0x80; //Enter Normal Single Chip
Mode

CAN0CTL0_WUPE=1;
CAN0CTL1_LOOPB=1; //Loop Back Self Test Mode
CAN0CTL0_TIME=1; //CAN-Timer enable

DDRB=0xFF;
PORTB=0;
}

void senddata(struct daten)
{
//Daten können nur gesendet werden, wenn die TXEx-Flags 1 und
damit die Sende-Puffer leer sind
if(CAN0TFLG_TXE2==1)
{
//zum Puffern bereit
CAN0TBSEL=0x04;//Puffer TX2 ist ausgwählt (durch
einen Pointer)

CAN0TXIDR0=daten.IDR0; /* MSCAN Identifier Register 0
*/
CAN0TXIDR1=daten.IDR1; /* MSCAN Identifier Register 1
*/
CAN0TXIDR2=daten.IDR2; /* MSCAN Identifier Register 2
*/
CAN0TXIDR3=daten.IDR3; /* MSCAN Identifier Register 0
*/

CAN0TXDSR0=daten.DSR[0]; /* MSCAN Data Segment
Register 0 */
CAN0TXDSR1=daten.DSR[1]; /* MSCAN Data Segment
Register 1 */
CAN0TXDSR2=daten.DSR[2]; /* MSCAN Data Segment
Register 2 */
CAN0TXDSR3=daten.DSR[3]; /* MSCAN Data Segment
Register 3 */
CAN0TXDSR4=daten.DSR[4]; /* MSCAN Data Segment
Register 4 */
CAN0TXDSR5=daten.DSR[5]; /* MSCAN Data Segment
Register 5 */
CAN0TXDSR6=daten.DSR[6]; /* MSCAN Data Segment
Register 6 */
CAN0TXDSR7=daten.DSR[7]; /* MSCAN Data Segment
Register 7 */
//CAN0RXERR; /* MSCAN Receive Error Counter Register
*/

CAN0TXDLR =daten.DLR; //Datenlängenregister
CAN0TXTBPR=daten.TBPR; //Sendepufferpriorität
CAN0TFLG_TXE2=1; //Löschen des Flag
durch Einschreiben einer 1 für Sendebereitschaft
}
}

void main(void) {
/* put your own code here */ caninit();
struct daten message1 ={ 0,0,0,0,
55, 55, 55,
55, 55, 55, 55, 55,
16,0,0,0};
//DDRH=0;
//PTH=0;
//PERH=0xFF;

senddata(message1);
for(;;)
{
cnt++;

//if(PTH==0x7F)
//{

//}

if(CAN0CTL0_SYNCH==1)
{
PORTB=0x55;
}

}
}

--------------------------------------------------------To learn more
about
Motorola Microcontrollers, please visit
http://www.motorola.com/mcu
o learn more about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu

Yahoo! Groups Links

--------------------------------------------------------To learn more
about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu
o learn more about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu

----------------------------------------------------------------------------
--
Yahoo! Groups Links

a.. To
[Non-text portions of this message have been removed]




(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )