2005-07-28 07:50 PM
2005-07-26 02:26 AM
Hello,
I use ST10f276 microcontroller with KEIL compiler and I have some problems with the CAN controller. CAN1 interrupt must be enabled additionaly by the register XIR0SEL. I do the following: - CAN-interrupts initialisation: XPERCON |= 0x401; //XMISCEN=1, CAN1EN=1 SYSCON |= 0x4; //XPEN=1 CAN1_CR = 0x2A; //DAR=1, EIE=1, IE=1 XIR0SET = 0x100; //CAN1 Interrupt Enable=1 XP0IE = TRUE; - Results: DEBUG: OK RELEASE: CAN Interrupts are not generated Why in debug mode everithing is Ok, but in release it doesn't work? I use the CAN to send with a PDO the content of XIR0SEL and I can observe the communication with a special tool. I saw that each line changes the content of register XIR0SEL (???): For example: XIR0SEL is =0x0700 CAN1_IF1_CM = 0xB7; //IF_WRRD=1, IF_ARB=1, IF_CNTRL=1, IF_TXR_ND=1, IF_DATA_A=1, IF_DATA_B=1 now XIR0SEL is changed to 0x00B7 ??? CAN1_IF1_A2 = (0x350 << 2) | 0xA000; //IF_MSGVAL=1, IF_DIR=1; and now XIR0SEL is changed to 0xAD3C ??? CAN1_IF1_MC = 2 | IF_EOB; XIR0SEL is changed to 0x0082 ??? Maybe I'm doing something wrong... Is there anybody who can help me?