I was just going through the CAN code for MCB2300 provided by Keil and there i saw that the toolbox can enable/disable loopback. This was done using the CAN_Simulate.ini. Im trying to do the same for my project on LPC1778. What im not able to understand is what is CAN1OUT,CAN1B0,CAN1B1 etc in the .ini. Any references for understanding how the .ini file was written,so that I can do the same for my project would be useful.
/*----------------------------------------------------------------------------*/ /* CAN_loopback_1_to_2() simulates loopback connection from CAN1 to CAN2 port */ /*----------------------------------------------------------------------------*/ signal void CAN_loopback_1_to_2 (void) { while (1) { wwatch(CAN1OUT); CAN2ID = CAN1ID; CAN2B0 = CAN1B0; CAN2B1 = CAN1B1; CAN2B2 = CAN1B2; CAN2B3 = CAN1B3; CAN2B4 = CAN1B4; CAN2B5 = CAN1B5; CAN2B6 = CAN1B6; CAN2B7 = CAN1B7; CAN2L = CAN1L; CAN2IN = CAN1OUT; } } /*----------------------------------------------------------------------------*/ /* CAN_loopback_2_to_1() simulates loopback connection from CAN2 to CAN1 port */ /*----------------------------------------------------------------------------*/ signal void CAN_loopback_2_to_1 (void) { while (1) { wwatch(CAN2OUT); CAN1ID = CAN2ID; CAN1B0 = CAN2B0; CAN1B1 = CAN2B1; CAN1B2 = CAN2B2; CAN1B3 = CAN2B3; CAN1B4 = CAN2B4; CAN1B5 = CAN2B5; CAN1B6 = CAN2B6; CAN1B7 = CAN2B7; CAN1L = CAN2L; CAN1IN = CAN2OUT; } }
CAN1OUT is the virtual output of the simulated processor. SO the simulation script will wait until the simulated processor sends a CAN frame on the CAN device 1.
CAN1B0, CAN1B1, ... are the 8 individual data bytes of a CAN frame.
But the above is only relevant when simulating a processor that doesn't just have core simulation but also have full peripheral simulation complete with simulated CAN interfaces.
I'm not sure if Keils new web page allows us users to know when they have full simulation or not.
This page is quite empty of simulation support information.
www.keil.com/.../
LPC17xx and LPC40xx are almost identical to LPC23xx with the exception of the interrupt controller and some few additional configuration bits for some improved functionality.