Item is now solved with setting "S"- (Standby) Pin on Phy Transceivers to Low for wake up of HW TJA1050 and connecting two nodes via CANH and CANL with pullup 120 OHms.
Using the R4 Maxima as CAN message transmitter with intgrated CAN module and external Phy transceiver (TJA1051) with header Arduino_CAN.h i always get error message in the Arduino IDE 2.3 serial monitor:
"CAN write failed. Error code is: -60003"
from the source lines:
int const rc = CAN.write(msg);
if(rc < 0)
{
Serial.print("CAN write failed. Error code is: ");
Serial.println(rc);
while(1);
}
Questions:
What is sthe meaning of this error code -60003? - i cannot find it in the library code:
class R7FA4M1_CAN
... inline bool isError(int & err_code) const { err_code = _err_code; return _is_error; }
I suppose i much search in the Renesas Controller or renesas part of the library HW Abstraction layer, is this the correct Manual:
"R7FA4M1AB3CNB#AC0.pdf" for electrical data and https://www.renesas.com/en/document/mah/renesas-ra4m1-group-users-manual-hardware?r=1054146 HW manual with chapter 30 CAN Module ?
?
What could be the reason of this sent error callback, maybe the mailboxes are not correct initialized or the send buffer is full?
- On the hardware, there is no connection between the SIgnal "S" of the TJA 1051 and the R4 Maxima for wakeup/Sleep. Is it correct, that the R4 and the transceiver is alsways full operational without sleepmode?
Thanks for support.
This is the complete INO SW i tried:
#include <Arduino_CAN.h>
static uint32_t const CAN_ID = 0x20;
uint8_t RandomNumber;
uint8_t msg_data[8];
void setup()
{
Serial.begin(9600);
delay(5000);
if (!CAN.begin(CanBitRate::BR_125k))
{
Serial.println("CAN begin failed...");
while(1);
}
else
Serial.println("CAN begin success...");
}
void loop()
{
RandomNumber = random(1, 21); // Random number
Serial.print("Random number is: ");
Serial.println(RandomNumber);
msg_data[0] = RandomNumber;
msg_data[1] = 0x55;
msg_data[2] = 0xAA;
msg_data[3] = 0x11;
msg_data[4] = 0x22;
msg_data[5] = 0x33;
msg_data[6] = 0x44;
msg_data[7] = 0x44;
CanMsg msg(CAN_ID, sizeof(msg_data), msg_data);
int const rc = CAN.write(msg);
if(rc < 0)
{
Serial.print("CAN write failed. Error code is: ");
Serial.println(rc);
while(1);
}
{
delay(3000); // Wait 3 secs and repeat
}
}```