AnsweredAssumed Answered

At wits end setting up CAN bus with msCAN08 driver on a MC9S08DZ60

Question asked by Tom Harvey on Dec 10, 2010
Latest reply on Dec 12, 2010 by Tom Harvey

Hi all,

 

I'm trying to setup a CAN bus using a MC9S08DZ60 and the msCAN08 driver.  I have an 8MHz resonator and have msCAN08 configured (I think) for 250kbps, where the msCAN module is fed directly from the resonator.  The config portion is below:

 

/*===========================================================================
 Define S08 msCAN module clock source: BUSCLK or MCGERCLK
 Permitted values: BUSCLK:   Bus clock is used as clock source
                   MCGERCLK: Oscillator clock is used as clock source
===========================================================================*/
#define CLKSRC_CAN        MCGERCLK        
/*===========================================================================
 Define clock prescaler for msCAN module: permitted values 1 to 64
 msCAN module clock = CLKSRC_CAN / PRESCALER_CAN
===========================================================================*/
#define PRESCALER_CAN    4
/*===========================================================================
  Define msCAN module bit timing
 
  Permitted values: PROP_SEG_CAN:   1 to 8 time quanta
                    PHASE_SEG1_CAN: 1 to 8 time quanta
                    PHASE_SEG2_CAN: 2, or PHASE_SEG1_CAN if greater

  Bit time = (SYNC_SEG + PROP_SEG_CAN + PHASE_SEG1_CAN + PHASE_SEG2_CAN) * time quanta
  SYNC_SEG is always 1

  Tq = 500nS with msCAN module fed from an 8MHz resonator, prescaler = 4
  Bit time = (1 + 1 + 3 + 3)*500nS = 250kbps
===========================================================================*/
#define PROP_SEG_CAN       1
#define PHASE_SEG1_CAN     3
#define PHASE_SEG2_CAN     3
/*===========================================================================
 Define msCAN module re-synchronisation jump width
 Permitted values: 1 to smaller of 4 and PHASE_SEG1_CAN time quanta
===========================================================================*/
#define RJW_CAN            3
/*==========================================================================*/

 

Problem is everytime I attempt to transmit I get a sync error, and see nothing on the scope. 

 

Questions is given I need a 250kbps bus speed, do the settings above make sense?

 

Thanks in advance,

 

Tim

Outcomes