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

CAN Simulation for the 8051 - Incomming messages

Hi I've been trying to simulate receiving an incomming message from the CAN bus. I have followed the application notes AP147 and 167, and I have viewed discussion topics on this subject.

I have included an ini file (project options > debug) with the following code to simulate a CAN signal:

 CAN0ID = 0x196;     //CANID
 CAN0L  = 1; //Data length
 CAN0B0 = 0x01; //Data
 CAN0IN = 1;    //11bit Identifier

But I get errors messages after each line.

*** error 34, line 9 : undefined identifier

does anyone have any suggestions?

Stewart

Parents
  • Hi Jon,

    I tried the DIR VTREG and all the CAN registers appeared, although they were all set to 0.

    I'm using the Infineon C515C, one of the characteristics of the Infineon chips is that you need to include the following script in an ini to stop the watchdog timer reseting:

    
    PE_SWD = 0  /* Disable Watchdog with pin PE_SWD */
    reset       /* perform CPU reset: uses value at PE_SWD */
    g,main
    
    

    I just added the CAN simulation text onto the end of this ini, do you think this could be of relevance?

    Line 9 is the CAN0ID statement.

    CAN0ID = 0x196;
    

    The errors continue for each line to the end of the script.

    Any ideas?

    Cheers
    Stewart

Reply
  • Hi Jon,

    I tried the DIR VTREG and all the CAN registers appeared, although they were all set to 0.

    I'm using the Infineon C515C, one of the characteristics of the Infineon chips is that you need to include the following script in an ini to stop the watchdog timer reseting:

    
    PE_SWD = 0  /* Disable Watchdog with pin PE_SWD */
    reset       /* perform CPU reset: uses value at PE_SWD */
    g,main
    
    

    I just added the CAN simulation text onto the end of this ini, do you think this could be of relevance?

    Line 9 is the CAN0ID statement.

    CAN0ID = 0x196;
    

    The errors continue for each line to the end of the script.

    Any ideas?

    Cheers
    Stewart

Children
  • The Infineon C515C has just one CAN channel. The debug command DIR VTREG shows the available registers:

            :
           CANID:  ulong, value = 0x00000000
            CANL:  uchar, value = 0x00
           CANB0:  uchar, value = 0x00
           CANB1:  uchar, value = 0x00
           CANB2:  uchar, value = 0x00
           CANB3:  uchar, value = 0x00
           CANB4:  uchar, value = 0x00
           CANB5:  uchar, value = 0x00
           CANB6:  uchar, value = 0x00
           CANB7:  uchar, value = 0x00
           CANIN:  uchar, value = 0x00
          CANOUT:  uchar, value = 0x00

    The CAN peripheral registers have just the name CANID, not CAN0ID as it is the case with devices where multiple CAN channels exist.