You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Colin.
I have an odd issue with the library. I did basically modify the example: Can_SendingTest
I have removed all CAN1 related information and i have added the function to print the output message.
The issue is when it sends data 2 times it suddenly stops receiving data in.
The set up is the following Arduino UNO with mcp2515 sending some data.
Then Arduino Due gets it via SN65HVD230 module.
The first thing is the receive buffer seems to not be cleared after read. so i get rapidly same thing that got in once.
Second thing is that after a few sends the receiving stops stops.
Last problem i have is that the sent data can't be read on my Uno it is like it was never sent out.
Here is the modified sketch :
#include "variant.h"
#include <due_can.h>
//Leave defined if you use native port, comment if using programming port
//#define Serial SerialUSB
void setup()
{
Serial.begin(115200);
// Initialize CAN0 and CAN1, Set the proper baud rates here
Can0.begin(CAN_BPS_500K);
Hi Colin.
I have an odd issue with the library. I did basically modify the example: Can_SendingTest
I have removed all CAN1 related information and i have added the function to print the output message.
The issue is when it sends data 2 times it suddenly stops receiving data in.
The set up is the following Arduino UNO with mcp2515 sending some data.
Then Arduino Due gets it via SN65HVD230 module.
The first thing is the receive buffer seems to not be cleared after read. so i get rapidly same thing that got in once.
Second thing is that after a few sends the receiving stops stops.
Last problem i have is that the sent data can't be read on my Uno it is like it was never sent out.
Here is the modified sketch :
#include "variant.h"
#include <due_can.h>
//Leave defined if you use native port, comment if using programming port
//#define Serial SerialUSB
void setup()
{
Serial.begin(115200);
// Initialize CAN0 and CAN1, Set the proper baud rates here
Can0.begin(CAN_BPS_500K);
Can0.watchFor();
}
void printFrame(CAN_FRAME &frame) {
Serial.print("ID: 0x");
Serial.print(frame.id, HEX);
Serial.print(" Len: ");
Serial.print(frame.length);
Serial.print(" Data: 0x");
for (int count = 0; count < frame.length; count++) {
Serial.print("0x");
if(frame.data.bytes[count]<10)
Serial.print("0");
Serial.print(frame.data.bytes[count], HEX);
Serial.print(" ");
}
Serial.print("\r\n");
}
void sendData()
{
CAN_FRAME outgoing;
outgoing.id = 0x688;
outgoing.extended = false;
outgoing.priority = 4; //0-15 lower is higher priority
outgoing.length = 8;
outgoing.data.byte[0] = 0x55;
outgoing.data.byte[1] = 0x11;
outgoing.data.byte[2] = 0xDD;
outgoing.data.byte[3] = 0x33;
outgoing.data.byte[4] = 0x44;
outgoing.data.byte[5] = 0x55;
outgoing.data.byte[6] = 0x66;
outgoing.data.byte[7] = 0x77;
printFrame(outgoing);
}
void loop(){
CAN_FRAME incoming;
static unsigned long lastTime = 0;
if (Can0.available() > 0) {
Can0.read(incoming);
printFrame(incoming);
}
if ((millis() - lastTime) > 1000)
{
lastTime = millis();
sendData();
}
}
The text was updated successfully, but these errors were encountered: