AnsweredAssumed Answered

Help me please init mscan on dz32 tja1042 125kbps

Question asked by andrey lapshov on Nov 20, 2018

Hello. I am trying to add CAN support for my project on s9s08dz32. First code isnt mine.. So i having some troubles. I founded an excel table to calculate mscan registers. MC worked without external osc.

 


// Declare 'define' constants
#define FTrim_Val 0 //Part 64-2 ftrim value for 24 MHz


#define ICSC1_FEI 0x04
#define ICSC2_FEI 0x00
#define ICSSC_FEI FTrim_Val // 0x80 | FTrim_Val
#define FEI_Speed 24000000
#define hi_baud 115000
#define fei_baud FEI_Speed/16/hi_baud

 

// Selects FEI mode
// Sets trimming for fBUS about 25 MHz
ICS_FEI();

 

 

#pragma INLINE
void ICS_FEI() {

#define NVICSTRM_US (*(byte *)0xFFAF)

if (NVICSTRM_US != 0xFF)
MCGTRM = NVICSTRM_US; // load trim value if NV location not blank
else
MCGTRM = 0xAD; // use a default value if NVICSTRM is blank
MCGC1 = ICSC1_FEI;
MCGC2 = ICSC2_FEI;
MCGSC = ICSSC_FEI;
while (MCGC1_CLKS != MCGSC_CLKST) {} // wait for clk state to match clk select
} //end InitICG

 

This is code to init FEI

 

Is am right that fbus is 24mhz? 

 

In picture my calculations of mscan register with 125kbps and tja1042.

 

Help me please what i need to change in mscan.h or mscan.c to use extended identifiers with baudrate 125kbps

Thanx in advance.

Attachments

Outcomes