- Forum
- Roboteq Motor Controllers
- Controller Configuration & Operation
- CANOpen + MicroBasic simultaneously?
CANOpen + MicroBasic simultaneously?
- Peter Degen-Portnoy
- Topic Author
- Offline
Less
More
- Posts: 5
- Thank you received: 0
3 years 2 months ago - 3 years 2 months ago #29535081
by Peter Degen-Portnoy
CANOpen + MicroBasic simultaneously? was created by Peter Degen-Portnoy
The goal is to have an Arduino drive the Motor Control Unit (SBLM2360T) via CAN and I've selected CANOpen because "Practically all of the controller’s real-time queries and real-time commands that can be accessed via Serial/USB communication can also be accessed via CANopen".
Test Setup:
* Solderless breadboard using the power lines to simulate a CAN bus, 100 Ohm resistors at each end
-- Shouldn't need them on something so short & didn't have 120 ohm in my supply cabinet
-- I do have 120 ohm resistors coming, but again, the "CAN bus" is only a few inches long, so they may not be needed at all according the my research.
* 2 @ Arduino w/ Seeed CAN-BUS Shield
-- One is the master, generating a CANOpen query for the motor amps
-- One is a CAN sniffer just reading traffic on the CAN bus
* MCU configured for CANOpen, ID #2 running a MicroBasic script that looks for CAN frames and prints them (script below)
* Everyone one is at 500 KBS, CAN Standard (11 bit frame)
The CAN sniffer can successfully see what the master is generating:
* Message ID: 0x602
* unsigned char stmp[8] = {0x44, 0x20, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00};
But I never see the MCU detect any CAN traffic. I've also got an oscilloscope connected to the bus configured to decode the traffic, but it isn't detecting the frames. So, I'm concerned that I don't have independent verification via the scope that the CAN bus is set up correctly other than the two Arduino's are exchanging information.
Should I expect to be able to see CAN frames with a MicroBasic script while using CANOpen? The MCU *does* support CAN and USB simultaneously; correct? If that is correct, then is it reasonable to use the Roborun+ console to view CAN activity in the MCU?
I would greatly appreciate any thoughts on where I should look next for debugging.
Thanks,
pdp
MicroBasic script:
`top:
` if (getvalue(_CF, 1) > 0 ) then ' If one or more frame is received`
` header = getvalue(_CAN, 1)`
` byte_count = getvalue(_CAN, 2)`
` byte_1 = getvalue(_CAN, 3)`
` byte_2 = getvalue(_CAN, 4)`
` print(header, "\t", byte_count, "\t", byte_1, "\t", byte_2, "\r")`
` end if`
` wait(10)`
`goto top`
Test Setup:
* Solderless breadboard using the power lines to simulate a CAN bus, 100 Ohm resistors at each end
-- Shouldn't need them on something so short & didn't have 120 ohm in my supply cabinet
-- I do have 120 ohm resistors coming, but again, the "CAN bus" is only a few inches long, so they may not be needed at all according the my research.
* 2 @ Arduino w/ Seeed CAN-BUS Shield
-- One is the master, generating a CANOpen query for the motor amps
-- One is a CAN sniffer just reading traffic on the CAN bus
* MCU configured for CANOpen, ID #2 running a MicroBasic script that looks for CAN frames and prints them (script below)
* Everyone one is at 500 KBS, CAN Standard (11 bit frame)
The CAN sniffer can successfully see what the master is generating:
* Message ID: 0x602
* unsigned char stmp[8] = {0x44, 0x20, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00};
But I never see the MCU detect any CAN traffic. I've also got an oscilloscope connected to the bus configured to decode the traffic, but it isn't detecting the frames. So, I'm concerned that I don't have independent verification via the scope that the CAN bus is set up correctly other than the two Arduino's are exchanging information.
Should I expect to be able to see CAN frames with a MicroBasic script while using CANOpen? The MCU *does* support CAN and USB simultaneously; correct? If that is correct, then is it reasonable to use the Roborun+ console to view CAN activity in the MCU?
I would greatly appreciate any thoughts on where I should look next for debugging.
Thanks,
pdp
MicroBasic script:
`top:
` if (getvalue(_CF, 1) > 0 ) then ' If one or more frame is received`
` header = getvalue(_CAN, 1)`
` byte_count = getvalue(_CAN, 2)`
` byte_1 = getvalue(_CAN, 3)`
` byte_2 = getvalue(_CAN, 4)`
` print(header, "\t", byte_count, "\t", byte_1, "\t", byte_2, "\r")`
` end if`
` wait(10)`
`goto top`
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 49
- Thank you received: 4
3 years 2 months ago - 3 years 2 months ago #29535084
by Athanasios
Replied by Athanasios on topic CANOpen + MicroBasic simultaneously?
Hi Peter,
you can use script and CAN communication at the same time.
In the manual page 213 "CF-Read Raw CAN received frames count"
you need to configure the CAN mode to RawCAN in order the _CF command to work.
I tried your script using RawCAN and listen node ID 0 and it works fine.
you can use script and CAN communication at the same time.
In the manual page 213 "CF-Read Raw CAN received frames count"
you need to configure the CAN mode to RawCAN in order the _CF command to work.
I tried your script using RawCAN and listen node ID 0 and it works fine.
Please Log in or Create an account to join the conversation.
- Peter Degen-Portnoy
- Topic Author
- Offline
Less
More
- Posts: 5
- Thank you received: 0
3 years 2 months ago #29535085
by Peter Degen-Portnoy
Replied by Peter Degen-Portnoy on topic CANOpen + MicroBasic simultaneously?
Thanks Athanisios,
Thanks for your response.
I apologize if I wasn't sufficiently clear; the goal is to use CANOpen because I am under the impression that I then do not need to write MicroBasic for motor control, but can concentrate all the logic in the Arduino code. That seems to be a more efficient development process. I'd like to be able to use the SDO 0x600 Command/Query to 0x580 Response cycle without any MicroBasic code although I may want to use TPDO message to broadcast basic motor stats and I understand one uses MicroBasic to write the stats to specific variables for transmission.
At this point, I am trying to use CANOpen with MicroBasic to confirm CANOpen messages are being received and recognized and was wondering if that was possible. Perhaps there are different CAN commands in MicroBasic for reading CANOpen or perhaps MicroBasic is ignored when CANOpen SDO's and PDO's are received. I'm just not clear on the relationship between the two.
Thanks,
pdp
Thanks for your response.
I apologize if I wasn't sufficiently clear; the goal is to use CANOpen because I am under the impression that I then do not need to write MicroBasic for motor control, but can concentrate all the logic in the Arduino code. That seems to be a more efficient development process. I'd like to be able to use the SDO 0x600 Command/Query to 0x580 Response cycle without any MicroBasic code although I may want to use TPDO message to broadcast basic motor stats and I understand one uses MicroBasic to write the stats to specific variables for transmission.
At this point, I am trying to use CANOpen with MicroBasic to confirm CANOpen messages are being received and recognized and was wondering if that was possible. Perhaps there are different CAN commands in MicroBasic for reading CANOpen or perhaps MicroBasic is ignored when CANOpen SDO's and PDO's are received. I'm just not clear on the relationship between the two.
Thanks,
pdp
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 49
- Thank you received: 4
3 years 2 months ago #29535086
by Athanasios
Replied by Athanasios on topic CANOpen + MicroBasic simultaneously?
"
I'd like to be able to use the SDO 0x600 Command/Query to 0x580 Response cycle without any MicroBasic code
"
You don't need any script for the CANopen to work. you just need to configure it correctly and then int works. SDO works without any need for a script.
just send the correct message.
"
although I may want to use TPDO message to broadcast basic motor stats and I understand one uses MicroBasic to write the stats to specific variables for transmission.
"
this can be done with script. You just write the value you need to transmit to the variables that are already mapped for the TPDO you are using.
Though it seems better to remap the TPDOs to send whatever data you need.
"
At this point, I am trying to use CANOpen with MicroBasic to confirm CANOpen messages are being received and recognized and was wondering if that was possible.
"
you don't need a script for this. Just send the SDO and see the response you get
"
Perhaps there are different CAN commands in MicroBasic for reading CANOpen or perhaps MicroBasic is ignored when CANOpen SDO's and PDO's are received. I'm just not clear on the relationship between the two.
"
SDOs and Microbasic script are irrelevant. They work independently.
You send the command and the firmware replies.
use the script you made in RAW can to see if messages arrive at the controller. As they shuld.
This way you can debag your arduino code.
I hope this answer your questions
I'd like to be able to use the SDO 0x600 Command/Query to 0x580 Response cycle without any MicroBasic code
"
You don't need any script for the CANopen to work. you just need to configure it correctly and then int works. SDO works without any need for a script.
just send the correct message.
"
although I may want to use TPDO message to broadcast basic motor stats and I understand one uses MicroBasic to write the stats to specific variables for transmission.
"
this can be done with script. You just write the value you need to transmit to the variables that are already mapped for the TPDO you are using.
Though it seems better to remap the TPDOs to send whatever data you need.
"
At this point, I am trying to use CANOpen with MicroBasic to confirm CANOpen messages are being received and recognized and was wondering if that was possible.
"
you don't need a script for this. Just send the SDO and see the response you get
"
Perhaps there are different CAN commands in MicroBasic for reading CANOpen or perhaps MicroBasic is ignored when CANOpen SDO's and PDO's are received. I'm just not clear on the relationship between the two.
"
SDOs and Microbasic script are irrelevant. They work independently.
You send the command and the firmware replies.
use the script you made in RAW can to see if messages arrive at the controller. As they shuld.
This way you can debag your arduino code.
I hope this answer your questions
Please Log in or Create an account to join the conversation.
- Peter Degen-Portnoy
- Topic Author
- Offline
Less
More
- Posts: 5
- Thank you received: 0
3 years 2 months ago #29535088
by Peter Degen-Portnoy
Replied by Peter Degen-Portnoy on topic CANOpen + MicroBasic simultaneously?
Thank you so very much, this is very helpful!
Please Log in or Create an account to join the conversation.
2 years 1 month ago - 1 year 11 months ago #29535482
by BriggTrim
Replied by BriggTrim on topic CANOpen + MicroBasic simultaneously?
Hi....CRC is utilized in CAN as it were so that a getting hub can choose whether to send an ack. In case there's no ack the message is re-transmitted until an ack is returned or until an blunder hail is set after different disappointments. Tragically, you can't tell whether the primary ack was sent by your aiming beneficiary or a few other hub. Subsequently my expansion of affirmation informing. I too do not think that the CRC field is passed into the get buffer, so my substance check is the less-comprehensive, but quick, information ^ complement in "void RECEIVE_MESSAGE ()".
www.7pcb.com/
www.7pcb.com/
Please Log in or Create an account to join the conversation.
Moderators: tonysantoni
- Forum
- Roboteq Motor Controllers
- Controller Configuration & Operation
- CANOpen + MicroBasic simultaneously?
Time to create page: 0.296 seconds