transmitting data from CAN 4 to CAN 1 only when RTR is received

4-Channel CAN Router with Data Logger
Post Reply
SamIO
Posts: 3
Joined: Fri 6. Oct 2023, 15:05

transmitting data from CAN 4 to CAN 1 only when RTR is received

Post by SamIO » Fri 6. Oct 2023, 15:26

Hey,

I have a constant stream of data to CAN 4 and I want to pass one message to CAN 1, only when a RTR is sent to CAN 1. Is it possible to save the latest CAN message from CAN 4 in a buffer and when the RTR is sent on CAN 1, this buffer is emptied? Currently I am using the PPCAN editor 2 software.
I tried it like below, where the message from CAN 4 is transferred to CAN 1, but I need to send a second RTR to stop the router from passing the data, and I want to only sent this RTR once.
pcan.jpg
pcan.jpg (29.9 KiB) Viewed 14802 times
When I change the direction from receive to transmit, I can see by the LED's that data is being transferred only when a RTR is sent, but the transmitted data are always 0's.

I am still new with this software, so thank you in advance.

G.Bohlen
Hardware Development
Hardware Development
Posts: 62
Joined: Wed 22. Sep 2010, 21:38

Re: transmitting data from CAN 4 to CAN 1 only when RTR is received

Post by G.Bohlen » Fri 6. Oct 2023, 17:14

Hello,

you cannot use the gateway function in this case, because the gateway function will always send the message.
Please configure the transmit message for bus CAN1 that should be transmitted when an RTR frame is received, but set the transmit period to 0 and enable RTR. Enable RTR means the message is transmitted when an RTR is received. Transmit period of 0 means that the message is not transmitted by a time event.
can_objects_rtr_enabled.JPG
can_objects_rtr_enabled.JPG (31.72 KiB) Viewed 14794 times
can_objects_tx_period 0.JPG
can_objects_tx_period 0.JPG (28.45 KiB) Viewed 14794 times

The receive data can be stored strored in internal variables (IO-Fuction 0xff). Up to 256 variables can be used.
Please put all required databytes from the receive message on bus 4 into variables, and use the same variables for the transmit message.
map variables.JPG
map variables.JPG (50.4 KiB) Viewed 14794 times
The transmit message is now only transmitted when an RTR is received, and the databytes are the last received databytes form the message on CAN bus 4.

Regards,
Gunnar Bohlen

SamIO
Posts: 3
Joined: Fri 6. Oct 2023, 15:05

Re: transmitting data from CAN 4 to CAN 1 only when RTR is received

Post by SamIO » Mon 9. Oct 2023, 08:41

That worked, thank you very much! :D

Post Reply