Unable to read CAN-data with roboteq's MDC1460
4 years 8 months ago - 4 years 8 months ago #29534505
by igormalic
Unable to read CAN-data with roboteq's MDC1460 was created by igormalic
We're developing a small app with MDC1460, but now ran into an issue of connecting with J1939 (extended ID) inclinometer sensor.
I'll provide additional detail for CAN J1939 connectivity issue: I'm able to read sensor data correctly with Vector CANalyzer. On this same CAN, I am also able to read roboteq heartbeat message and some additional ones that have 400ms occurance rate (alongside sensor data), so this pretty much proves that CAN is correctly connected, both sensor and roboteq controller. When MiniJ1939 was selected, roboteq controller was sending heartbeat and 4 other messages with extended IDs. When mode was different from MiniJ1939, controller was sending standard IDs messages. I think this is all correct and behaving as intended.
The issue is now that I'm unable to read any CAN data on roboteq side (maybe I'm not doing it correctly). First, I tried reading with only _CEN mode 5 selected (MiniJ1939) using script commands such as "If GetValue(_CF, 1) > 0" in combination with "GetValue(_CAN, 3)" as well as console commands ?CF and ?CAN, no success. I then saw in documentation that ?CF is only to be used in combination with RawCAN, so I tried that. Switched _CEN mode to 3 (RawCAN) and starting transmitting generic standard ID with Vector CANalyzer in hopes that now we will be able to use script or console commands ?CF and ?CAN. Tried and result was same -- no received CAN messages.
I'm also including a sample from the code for better overview (link to pastebin in case formatting here will be messed up)
pastebin.com/38VWfetC
SetConfig(_CBR, 3) ' set baud to 250k
SetConfig(_CHB, 100) ' set hearbeat to 100ms
SetConfig(_CNOD, 0x27) ' set roboteq node source address to 0x27
' -- Tried using both RawCAN and MiniJ1939 (I had CAN connected and was able to read extended ID inclinometer sensor data, roboteq heartbeat and 4 other messages and send standard IDs with Vector CANalyzer)
'SetConfig(_CEN, 5) ' set mode to MiniJ1939 (ability to read extended IDs) and enable CAN
'SetConfig(_CEN, 3) ' set mode to RawCAN (read standard IDs, use _CF and _CAN) and enable CAN
loop:
If (GetValue(_CF, 1) > 0) Then
print("Byte 1: ", GetValue(_CAN, 3), "\n")
print("Byte 2: ", GetValue(_CAN, 4), "\n")
receivedCAN = TRUE
End If
' -- Activate LED light if we managed to read CAN (light does not activate)
If (receivedCAN) Then
SetCommand(_DSET, 2)
Else
SetCommand(_DRES, 2)
End If
wait(CONST_CYCLE_TIME)
goto loop
Am I missing something or just using completely wrong commands for appropriate mode? LED does not turn on (does not matter if I'm currently connected to controller with USB or not -- tried both), as well as console prints receivedCAN boolean as FALSE. Any help would be greatly appreciated!
Thank you in advance.
EDIT: 15.01.2019 15:25: Fixing spelling
I'll provide additional detail for CAN J1939 connectivity issue: I'm able to read sensor data correctly with Vector CANalyzer. On this same CAN, I am also able to read roboteq heartbeat message and some additional ones that have 400ms occurance rate (alongside sensor data), so this pretty much proves that CAN is correctly connected, both sensor and roboteq controller. When MiniJ1939 was selected, roboteq controller was sending heartbeat and 4 other messages with extended IDs. When mode was different from MiniJ1939, controller was sending standard IDs messages. I think this is all correct and behaving as intended.
The issue is now that I'm unable to read any CAN data on roboteq side (maybe I'm not doing it correctly). First, I tried reading with only _CEN mode 5 selected (MiniJ1939) using script commands such as "If GetValue(_CF, 1) > 0" in combination with "GetValue(_CAN, 3)" as well as console commands ?CF and ?CAN, no success. I then saw in documentation that ?CF is only to be used in combination with RawCAN, so I tried that. Switched _CEN mode to 3 (RawCAN) and starting transmitting generic standard ID with Vector CANalyzer in hopes that now we will be able to use script or console commands ?CF and ?CAN. Tried and result was same -- no received CAN messages.
I'm also including a sample from the code for better overview (link to pastebin in case formatting here will be messed up)
pastebin.com/38VWfetC
SetConfig(_CBR, 3) ' set baud to 250k
SetConfig(_CHB, 100) ' set hearbeat to 100ms
SetConfig(_CNOD, 0x27) ' set roboteq node source address to 0x27
' -- Tried using both RawCAN and MiniJ1939 (I had CAN connected and was able to read extended ID inclinometer sensor data, roboteq heartbeat and 4 other messages and send standard IDs with Vector CANalyzer)
'SetConfig(_CEN, 5) ' set mode to MiniJ1939 (ability to read extended IDs) and enable CAN
'SetConfig(_CEN, 3) ' set mode to RawCAN (read standard IDs, use _CF and _CAN) and enable CAN
loop:
If (GetValue(_CF, 1) > 0) Then
print("Byte 1: ", GetValue(_CAN, 3), "\n")
print("Byte 2: ", GetValue(_CAN, 4), "\n")
receivedCAN = TRUE
End If
' -- Activate LED light if we managed to read CAN (light does not activate)
If (receivedCAN) Then
SetCommand(_DSET, 2)
Else
SetCommand(_DRES, 2)
End If
wait(CONST_CYCLE_TIME)
goto loop
Am I missing something or just using completely wrong commands for appropriate mode? LED does not turn on (does not matter if I'm currently connected to controller with USB or not -- tried both), as well as console prints receivedCAN boolean as FALSE. Any help would be greatly appreciated!
Thank you in advance.
EDIT: 15.01.2019 15:25: Fixing spelling
Please Log in or Create an account to join the conversation.
- Gabriel_Isko
4 years 8 months ago - 4 years 8 months ago #29534511
by Gabriel_Isko
Replied by Gabriel_Isko on topic Unable to read CAN-data with roboteq's MDC1460
CAN J1939 support is not an officially released or supported feature yet. Please send an email to This email address is being protected from spambots. You need JavaScript enabled to view it. and we will support your application from there.
Please Log in or Create an account to join the conversation.
Time to create page: 0.060 seconds