Hi, all. I have 2 microcontrollers and want to make a DCAN communication between both of them. I use the CAN transceiver MCP2551, all of hardware is proper wired. I think it should be the software problem.
I follow the tutorial from official TI Training, however, it does not work.
The main part of transmit code is
canInit();
canTransmit(canREG1, canMESSAGE_BOX1, tx_data);
while(1);
The main part of receiver code is
canInit();
while( !canIsRxMessageArrived(canREG1, canMESSAGE_BOX1) );
while(1); //Set Breakpoint here, it does not execute
As I said in comments, I set a breakpoint at while(1);, it does not execute when I transmit.
I use the oscilloscope to troubleshoot it, firstly, I check the Transmit MicroController's Tx pin, there is data send out. I check the Receive MicroController's Rx pin, there is data receive. However, it does not execute the breakpoint line.
I check the technique documents, I think it should be some problems of initialization or CAN protocol problem? Or, could you give me some idea how to trouble shoot it? I doubt the driver code has problem, the canTransimit( ... ) function is implemented wrong? How could I send message and receive message by direct accessing the CAN RAM? Could you give some sample code?
Please please help, thanks.