Cristian Vilar

MSCAN driver problems

Discussion created by Cristian Vilar on Feb 23, 2009
Latest reply on Jan 5, 2015 by TomE


I'm working with MCF51AC microcontroller, and I found some problems when I tried to use the MSCAN drivers.


The interrupts (CAN_TransmitISR, CAN_ReceiveISR, CAN_WakeupISR) aren't executed.


I found an error in the function "CAN_QueueMB", when the transmitted interrupt flag is setting on (CANTFLG register):

if (MB_MSCAN[0] == 0xff)  {
   CANTFLG = 0x01;

This is wrong, the interrupt flag enable when TX buffer 0 is full (loaded with a message due for transmission ) is:
CANTFLG = 0x06;


If I change the register value, the CAN_TransmitISR is executed, but the transmission is not correct. I'll have to find the problem :-(( .

Also, I have problems with receiver canbus data, the data fills the bufferCANRX (@ffff989f) and seems to be OK, but the tx interrupt isn't executed (the address filter is all FF)


this is my MSCAN test code:

UINT8 data[] = {8,0,0,7,0,0,4,0,1};
UINT8  status[2];


EnableInterrupts; /* enable interrupts */
CAN_ConfigMB (1,  TXDF, 1);
CAN_ConfigMB (0,  RXDF, 0);

///receive data
  (void)CAN_CheckStatusMB( 0, status );
  }while ( status[0] != NEWDATA);
  CAN_ReadDataMB(0,data );

/// transmit data
CAN_LoadMB(1, data);
CAN_TransmitMB(1) ;
  (void)CAN_CheckStatusMB(1, status);
 } while(status[0] != TRANSMITTED);




Message Edited by Morrison on 2009-02-23 03:10 PM