Hello!
I’m working on getting both TX and RX working using a single CAN bus from the TX2’s SPE. Currently, I have TX working based on the can-app demo code. I’d like to add in the functionality of RX where the SPE will be consistently sending out a signal, but will send out a different signal when a message is received.
This is the code I currently have for this:
while (1) {
vTaskDelay(CAN_TEST_DELAY * 5);
struct mttcanfd_frame cf;
// can_test_transmit(&fd, ttcan, false, false, false);
if (!tegra_can_receive(ttcan, &cf, portMAX_DELAY)) {
// no message received, send heartbeat frame
can_test_transmit(&h, ttcan, false, false, false);
continue;
}
/* Normal CAN frame with 11 bit identifier */
can_test_transmit(&fd, ttcan, false, false, false);
}
I am looking to send the frame “h” until a frame is received, at which point I’d like to send the frame “fd”.
This the output I am currently getting when the SPE boots:
~/Desktop/jetson_scripts: candump rcan0
rcan0 0A5 [2] AD EF -> sent to the Jetson
rcan0 0A5 [2] A4 55 -> frame fd
rcan0 0A5 [2] A4 55
rcan0 0A5 [2] A4 55
rcan0 0A5 [2] A4 55
rcan0 0A5 [2] A4 55
rcan0 0A5 [2] A4 55
rcan0 0A5 [2] A4 55
rcan0 0A5 [2] A4 55
rcan0 0A5 [2] A4 55
Currently, I am having no messages sent from the SPE when it boots until I send it a frame. Once it receives a frame, the SPe continually send frame “fd” (from after the if statement checking for input.
As for hardware, I have CAN0 from the Jetson connected to a PEAK PCAN USB adapter, which is connected to my laptop.
Any help would be appreciated!