CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Thu Jun 29, 2017 1:13 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 20 posts ]  Go to page 1 2 Next
Author Message
PostPosted: Tue Nov 08, 2016 4:35 pm 
Offline

Joined: Mon Oct 31, 2016 5:49 pm
Posts: 22
Hi,

I bought this CAN cape http://www.waveshare.com/rs485-can-cape.htm for my BBB. The CAN Network is composed by the cape and a servo motor; it is terminated at the beginning and at the end with a 120 Ohm resistor .
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:
Code:
##Example v4.1.x
#cape_disable=bone_capemgr.disable_partno=
#cape_enable=bone_capemgr.enable_partno=
cape_enable=bone_capemgr.enable_partno=BB-UART2,BB-UART4,BB-CAN1

The output of
Code:
cat /sys/devices/platform/bone_capemgr/slots
is then :
Code:
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
Code:
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
candump can0
// the output of the candump command is:
 can0  5A1  [4] AB CD AB CD
//but sometimes i get this one:
 can0  5A1  [4] AB CD AB CD
 can0   81  [8] 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 do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Wed Nov 09, 2016 10:26 am 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 1978
Hi,

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.

BR
Edwin


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Thu Nov 10, 2016 1:16 pm 
Offline

Joined: Mon Oct 31, 2016 5:49 pm
Posts: 22
Hi,

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:
Code:
 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.

Thank you.


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Thu Nov 10, 2016 11:11 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 1978
Hi,
you need to activate sync for using SoftMotion and your sync cylce should be the same
like your Task cycle(in your case MainTask).

BR
Edwin


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Fri Nov 11, 2016 4:04 pm 
Offline

Joined: Mon Oct 31, 2016 5:49 pm
Posts: 22
Hi,

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 ?
Code:
can0 701 [1] 05

Is it related to the problem i have ?

Thank you very much.


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Fri Nov 11, 2016 5:14 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 1978
Hi,

add CANOPEN_DEBUG and check the plc logger.

and check the PDO configuration (maybe you give me a screenshot or the project)
BR
Edwin


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Fri Nov 11, 2016 7:10 pm 
Offline

Joined: Mon Oct 31, 2016 5:49 pm
Posts: 22
Hi,

Please find attached the log file.

Here is the link to download my project archive (~32MB)

https://1drv.ms/u/s!Amgfi1iVXoLshJZbQP8DvNXDCXRsbA

Thanks


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Sat Nov 12, 2016 6:47 am 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 1978
Hi,

you need to add the PDO mapping.
See screenshot.
I would use 2ms task cycle and sync cycle for a first try.

BR
Edwin


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Sat Nov 12, 2016 10:39 am 
Offline

Joined: Mon Oct 31, 2016 5:49 pm
Posts: 22
Hi,

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.

Thank you


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Sat Nov 12, 2016 3:13 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 1978
Hi,
which task cycle time is this?
Could you check the Task jitter here of you CAN task.

BR
Edwin


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Mon Nov 14, 2016 9:13 am 
Offline

Joined: Mon Oct 31, 2016 5:49 pm
Posts: 22
Hi,

Please find attached the jitter time.


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Mon Nov 14, 2016 11:56 am 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 1978
Hi.
is this on a 1ms or 2ms Motion cycle?
Does the drive report any error?

BR
Edwin


Top
   
PostPosted: Mon Nov 14, 2016 12:33 pm 
Offline

Joined: Mon Oct 31, 2016 5:49 pm
Posts: 22
Hi,
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.

Thanks


Top
   
PostPosted: Mon Nov 14, 2016 5:38 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 1978
Hi,
guess at this point we could not solve this by posting her in this forum... you need to write to support.
BR
Edwin


Top
   
PostPosted: Mon Nov 14, 2016 7:44 pm 
Offline

Joined: Mon Oct 31, 2016 5:49 pm
Posts: 22
Hi,
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 ?
Thanks.


You do not have the required permissions to view the files attached to this post.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 20 posts ]  Go to page 1 2 Next

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited