I bought this CAN cape http://www.waveshare.com/rs485-can-cape.htm
I enabled the can0 interface on my BBB as follows:
I used the device tree overlay BB-CAN1-00A0.dtbo already present in the folder /lib/firmware .
I set the BB-CAN1 in the file /boot/uEnv.txt:
The output of ```
``` is then :
0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1
4: P-O-L- 0 Override Board Name,00A0,Override Manuf,BB-UART2
5: P-O-L- 1 Override Board Name,00A0,Override Manuf,BB-UART4
7: P-O-L- 2 Override Board Name,00A0,Override Manuf,BB-CAN1
Then i typed
sudo modprobe can
sudo modprobe can-dev
sudo modprobe can-raw
sudo ip link set can0 up type can bitrate 125000
sudo ifconfig can0 up
//just for testing:
cansend can0 5A1#ABCDABCD
// the output of the candump command is:
can0 5A1  AB CD AB CD
//but sometimes i get this one:
can0 5A1  AB CD AB CD
can0 81  00 00 10 00 00 00 00 00
On the BBB side the interface seems to work properly. Now I'd like to create a project in codesys to work with the CAN bus. I created a new CANbus Device in codesys with Network 0 and Baudrate 125000 but when i login i always get a CANbus Status = No Driver Found as you can see in the attached picture.
Obviously i'm missing somethings... I don't know how to solve this problem. Do i have to insert some statements in the CODESYSControl.cfg file to decleare the can0 interface ? Or the problem is on the Codesys side and i have to configure the Canbus device in a different way ? The Codesys Control for BB SL Getting Started guide is lacking information about this last part.
Thank you in advance.
you need to add an CANopenManager, then it will probably work.
After that if needed Import your EDS files from your CAN slaves and add them to the CANopenManager.
Your suggestion worked very well.
I installed the ESD of my motor and i inserted the Motion Axis as shown in the first attached image.
All the green arrows icons are present but i cannot read the position of my motor.
I inserted the MC_Power block and the MC_ReadStatus one but both bRegulatorRealState and bDriveStartRealState are FALSE as you can see in the second attached image.
I typed $candump can0 to see what is going on on the bus and i get 1 byte frame as shown in the third attached image. I'm quite sure i cannot read the StatusWord from my motor and i don't no why. Codesys successfully opened the can0 interfaca since if i type:
sudo ip link set can0 up type can bitrate 125000
//the ouptut is
RTNETLINK answers: Device or resource busy
I set the right bitrate and slave ID for my motor.
If i disconnect for example CAN+ i see the Bus Failure error.
you need to activate sync for using SoftMotion and your sync cylce should be the same
like your Task cycle(in your case MainTask).
I have a question here with BBB & Preempt:
when the Soft Motion Task and Cycle Period should be the same, how about the correct window length?
In my experience the BBB can handle maximum 3 Axes with 2ms task time with MC-objects /2ms cycle period (and which window size preferable?!) / ms PDO send/receive. with 4ms and 4 axes, the system stats to ripple while moving.
When adding a 4th axis, the axis will drop out or there will be laggy and faulty homing cycle. but my can interface shows 30~40% bus load only.
1) is there any potential to make the system reliable for up to 6 axes?
2) Is there any option to add event based can bus axes in addition to softmotion? maybe mixing softmotion (can open soft motion d river) with asynchronous handled bus members ( regular soft motion ) ? my first attemt failed.
3) When you say, that softmotion SL will just send set-points and the axes calculate the trajectories themself, how should the canopen manager/PDO times should be configured?
4) Is there any proof/ documentation where I can see which MC_move object will need CSP or event based commanding!?
Thank you and best regards
1) depeding what the axis need to do ( axis dependend or point to point) the question if the performance for the setpoint calc / trajectory is good enough
I would check if the system will be accurate enough if you go up to 4ms motion cylce
2) no - if you need only point to point axis movements you could use SoftMotion Light - and sure you could mix SoftMotion Axis an SoftMotion light axis. ( you'll need then license for both)
3) see screenshot
If you use SoftMotion Light for the axis which allow it - (point to point movement only) you need to call MC_Movexxx_SML FB.
thank you, works like charm!
Thanks for you fast reply.
I did what you suggested but i get the exactly same result.
I don't know where the problem is. It seems to be on the codesys side rather than on the BBB one.
Moreover, what does the frame i get from the $candump can0 command mean ?
can0 701  05
Is it related to the problem i have ?
Thank you very much.
add CANOPEN_DEBUG and check the plc logger.
and check the PDO configuration (maybe you give me a screenshot or the project)
Please find attached the log file.
Here is the link to download my project archive (~32MB)
CAN_Log.xml [111.74 KiB]
you need to add the PDO mapping.
I would use 2ms task cycle and sync cycle for a first try.
I added the PDO mapping, The motor is in StandStill ready to move.
Unfortunatly when i try any of the moveAbsolute, moveRelative blocks i get this error: SMC_ERROR.SMC_FB_WASNT_CALLED_DURING_MOTION.
Please take a look at the attached pictures.
which task cycle time is this?
Could you check the Task jitter here of you CAN task.
Please find attached the jitter time.
is this on a 1ms or 2ms Motion cycle?
Does the drive report any error?
This is 1ms Motion cycle.
The driver does not report any sort of errors or warnings. Actually the motor is in standstill and the driver is ready to move the motor.
guess at this point we could not solve this by posting her in this forum... you need to write to support.
Here is the deal!
I substituted the soft motion axis with the LIGHT one as you can see in the attached picture. Now I can control the motor. Despite the fact the motor is spinning, I get an orange arrows icon that tells me the license in not found! I bought the license and I installed it as written in the getting started guide. Actually the BBB disconnects after 2 hours as the license is not installed at all.
Why does the light motion axis work but the "full" version does not?? It is related to the missing license ? Or should I open a new thread to solve the missing license problem ?
then maybe it is related to the timing of sending the telegrams (maybe I'm wrong because usually you get a drive error on being unync in sending the telegrams)
For SoftMotion you need an realtime kernel 'rt_preempt' patched.
Do you have applied this changes to your Linux kernel?
SoftMotion Light does not need it, the drive does calc the trajectoy in compare to SoftMotion the master does calc the trajectory for all drives.
So if your application need several drives for example interpolated movement-> use SoftMotion
if the application need only axis Independent movement point to point -> use SoftMotionLight.
are you using waveshare angstrom image?
I use this image:
I patched my kernel with the RT-PREEMPT one. Please find attached the output of both commands $ uname -a and $ dmesg.
Does someone have a hint on how get the SoftMotion working ??
guess only possible by checking together online.
I am working on the same stuff, making my nanotec PD4-N controller work with softmotion. I have also nanotec SMCI47-S, which works like a charm with softmotion.
I have BeagleBoneBlack with RT-PREEMPT and waveshare RS485 / CAN cape. In codesys, I have inserted the drives with softmotion axis and set them up based on conversations on this forum and some SM function blocks in PRG. Task cycle is 20ms, CAN baud rate is 125k, Sync cycle is 20000 and window length is 22000
The SM_Drive_CAN_GenericDSP402 indicates configuration error and in log there is SDO read error, even when I inserted every SDO object into SDO mapping.
Do you see any configuration mistake in my setup? Is there a way to use softmotion axis from SMCI47-S for PD4N as the manufacturer indicated that the drives are exactly same?
EDIT: The addition of CANOPEN_DEBUG breaks all communication on CAN. Device status says 'polling for object 0x1000', canopen is at 'module not found' and in log 'read error 16#1000sub16#00' like 50 times per second.
EDIT2: Found out that the warning in log is for SDO 6076, so Motor Rate Torque. This SDO isn't present in Nanotec. Can this be the reason?
i also have the problem with the SDO 16 # 6076.
I tried to look for it to add it in the SDOs configuration but it is not there.
I am using Raspberry + SocketCan + Lexium32A CanOpen.
Any ideas to solve this problem?
Log in to post a comment.