|
Post by mi6kata on Mar 27, 2023 11:37:20 GMT
Hello, I have a Tc375 shieldbuddy and I am using arduino IDE as environment. I directly connected the CANH and CANL of the CAN bus directly to the CANH and CANL pin of the shieldbuddy and programmed it to transmit data. It worked as it should,but when I programmed it to receive messages it detects that a message is sent to it but never filles CANMessagePayloadType msg1 with data. This is my code:#include <Servo.h>
Servo servo;
void setup() { // put your setup code here, to run once: SerialASC.begin(115200); servo.attach(2); servo.write(0); CAN_Init(500000); CAN_TxInit(0x200,0x7FFFF000UL,8,11,0); CAN_RxInit(0x60,0x7FFFF000UL,8,11,0); SerialASC.println("CAN init ok"); }
void loop() { CanRxMessageObjectType msg1; IfxCan_Status rxStatus = CAN_ReceiveMessage(0x60, &msg1.Payload, 8); if (rxStatus == 0) { SerialASC.print("Received message:"); for (int i = 0; i < 8; i++) { SerialASC.print(" "); SerialASC.print(msg1.Payload.bytes); } SerialASC.println(msg1.ReceivedMessage.messageIdLength); } delay(500); }
Can anyone tell me is there error in my code? Thank you for your time.
|
|
|
Post by mi6kata on Mar 28, 2023 7:27:23 GMT
Just want to correct myself. This "CAN_RxInit(0x60,0x7FFFF000UL,8,11,0);" is actually this in my code "CAN_RxInit(0x60,0x7FFFF000UL,8,11,1);" I made a mistake in the post.
|
|
sinai1
Junior Member
Posts: 81
|
Post by sinai1 on Mar 28, 2023 19:46:52 GMT
Hi, connect canh and canl will not work, you need a transceiver. second who is sending the singnal on id 0x60?
|
|
|
Post by mi6kata on Mar 29, 2023 6:29:43 GMT
But what is the on-board transceiver which is on port p202 on the schematics.I generate signal from raspberry pi connected to mcp2515 transceiver, but tried sending data between the shieldbuddy and the TC375 Lite Kit, but the same result. The receive status changes to 0, but no data is filled in the CANMessagePayloadType msg1.
|
|
sinai1
Junior Member
Posts: 81
|
Post by sinai1 on Apr 2, 2023 2:16:45 GMT
put both codes here plz
|
|
|
Post by mi6kata on Apr 7, 2023 9:35:54 GMT
From the Raspberry pi I just generate messages using the cansend can0 060#12234563 command. For the tc375 lite kit I use the example code just with changed id. I will paste it here when I get chance but the problem isn't in the ids or the code. The problem is in filling the CanMessagePayloadType. Today I tried with external TLE9251V transceiver on CAN0 and the result is the same. A message is received but when I print the msg1 there is nothing there and the receive function apparently never interacts with it.
|
|
|
Post by mi6kata on Apr 7, 2023 9:57:54 GMT
The problem is that I don't have access to the receive function and can't modify or see what's inside. So if anyone have duplicate of the multican library with cpp file that I can use in the arduino project I will be grateful
|
|
burov
New Member
Posts: 1
|
Post by burov on Mar 12, 2024 17:49:15 GMT
Hi, I am experiencing the same problem. Have you managed to resolve it?
|
|
sinai1
Junior Member
Posts: 81
|
Post by sinai1 on Apr 1, 2024 16:27:15 GMT
|
|
|
Post by ph30n1x on May 18, 2024 15:36:13 GMT
I too am running into an issue on a TC375 Shieldbuddy when using the simplified CAN with the onboard transceiver (P202 pin2 & pin1). I can transmit messages as expected, however receive function triggers but does not place any data into the specified destination. Ive looked at the updated library mentioned by sinai1 but it doesnt appear to have the functions for the onboard CAN interface (eg. can_init(), can_rxinit(), CAN_ReceiveMessage()) Are the CAN libraries fundamentally broken / unreliable? I have also tried the mcmcan calls but I cant get anything working since it doesnt appear to be setup for the onboard CAN (memory and registers are not in the library)
|
|