Sender Node - mbedLPC1768
1st CAN device - CANBed - Arduino CAN-BUS Development Kit (Atmega32U4 with MCP2515 and MCP2551)
Connected to 2nd CAN device - CANBed - Arduino CAN-BUS Development Kit (Atmega32U4 with MCP2515 and MCP2551)
Receiver Node - mbed LPC1768
Does it work with 2 development board to Send and Receive CAN communication? Can I get Data sheet for CANBed - Arduino CAN-BUS Development Kit (Atmega32U4 with MCP2515 and MCP2551) and schematics how to interact with LPC1768?
Here is TX and RX code of LPC1768
TX Code:
#include “mbed.h”
Ticker ticker;
DigitalOut led1(LED1);
DigitalOut led2(LED2);
CAN can1(p30, p29);
char counter = 0;
void send() {
printf(“send()\n”);
if(can1.write(CANMessage(1337, &counter, 1))) {
printf(“wloop()\n”);
counter++;
printf(“Message sent: %d\n”, counter);
}
led1 = !led1;
}
int main() {
printf(“main()\n”);
ticker.attach(&send, 1);
CANMessage msg;
while(1) {
printf(“loop()\n”);
wait(0.2);
}
}
RX Code:
#include “mbed.h”
Ticker ticker;
DigitalOut led1(LED1);
DigitalOut led2(LED2);
CAN can2(p30, p29);
char counter = 0;
int main() {
printf(“main()\n”);
//ticker.attach(&send, 1);
CANMessage msg;
while(1) {
printf(“loop()\n”);
if(can2.read(msg)) {
printf(“Message received: %d\n”, msg.data[0]);
led2 = !led2;
}
wait(0.2);
}
}
Can anyone of you please help me out and please let me know how to do the connections as well?
Thank you.