Help me please init mscan on dz32 tja1042 125kbps

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help me please init mscan on dz32 tja1042 125kbps

684 Views
punxer
Contributor II

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.

pastedImage_1.png


// 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.

Tags (3)
0 Kudos
1 Reply

543 Views
punxer
Contributor II

ure really useless community

0 Kudos