This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to generate a CAN receive interrupt in simulator?

Hi,

I'm debugging an interrupt service routine. I simulate a CAN message and expect the simulator to generate a receive interrupt, but this doesn't happen. I also tried this on a Keil code example, but the result was the same, so I assume the problem isn't in my code. Here's what I did:

1) Load the project Keil\ARM\Boards\Keil\MCB2300\CAN\CAN.uvproj in the IDE.
2) Add the following code to CAN_Simulate.ini:

func void CAN_transmit(void) {

        CAN1ID = 0xC7;
        CAN1L = 7;
        CAN1B0 = 0x07;
        CAN1B1 = 0xD4;
        CAN1B2 = 0x0C;
        CAN1B3 = 0x1F;
        CAN1B4 = 0x0A;
        CAN1B5 = 0x01;
        CAN1B6 = 0x00;
        CAN1B7 = 0x00;
        CAN1IN = 1;
}

define button "Send CAN message", "CAN_transmit();"

3) Compile.
4) Set a breakpoint in CAN.c after the line:

if (CAN1->GSR & (1 << 0)) {                    /* CAN Controller #1 meassage is received */

5) Run.
6) Click on the "Send CAN message" button.
7) See a received message in the "CAN communication" window, but no receive interrupt is generated.

At the same time transmit interrupts do get generated. What am doing wrong?

Parents Reply Children
No data