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 Brge 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 -----Ursprgliche 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 mlich 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 knen 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 ausgwlt (durch einen Pointer) CAN0TXIDR0en.IDR0; /* MSCAN Identifier Register 0 */ CAN0TXIDR1en.IDR1; /* MSCAN Identifier Register 1 */ CAN0TXIDR2en.IDR2; /* MSCAN Identifier Register 2 */ CAN0TXIDR3en.IDR3; /* MSCAN Identifier Register 0 */ CAN0TXDSR0en.DSR[0]; /* MSCAN Data Segment Register 0 */ CAN0TXDSR1en.DSR[1]; /* MSCAN Data Segment Register 1 */ CAN0TXDSR2en.DSR[2]; /* MSCAN Data Segment Register 2 */ CAN0TXDSR3en.DSR[3]; /* MSCAN Data Segment Register 3 */ CAN0TXDSR4en.DSR[4]; /* MSCAN Data Segment Register 4 */ CAN0TXDSR5en.DSR[5]; /* MSCAN Data Segment Register 5 */ CAN0TXDSR6en.DSR[6]; /* MSCAN Data Segment Register 6 */ CAN0TXDSR7en.DSR[7]; /* MSCAN Data Segment Register 7 */ //CAN0RXERR; /* MSCAN Receive Error Counter Register */ CAN0TXDLR en.DLR; //Datenlgenregister CAN0TXTBPRen.TBPR; //Sendepufferpriorit CAN0TFLG_TXE2=1; //Lchen des Flag durch Einschreiben einer 1 f 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 |