Discussion:
PDOs - Rules for creation ?
(too old to reply)
Balaboum
2007-10-23 10:10:06 UTC
Permalink
           Hello,
 
 
           I am actually creating a second application using Labview and CANOpen library. In this one, I create PDOs objects at beginning and I have two loops running in paralell receiving and emitting these PDOs to refresh machine Input/Output image. I use SYNC messages ( every 20ms ) to guarantee timing in reception of the PDOs. This works fine.
           I have a third loop ( state machine ) to handle machine cycle. In order to drive other CAN devices than the IOs, I create temporarly other PDOs within this loop. In other words, in several states, I have a subvi which creates another set of PDOs, does the job with them and releases them before returning.
 
           This does not work perfectly. Indeed, time to time, my subvi fails always when creating a TxPDO with the following error message :
 
Error -1074388969 occurred at CANopen PDO Create.vi
Possible reason(s):
NI-CAN:  (Hex 0xBFF62017) This attribute's value must be provided prior to the Open.  Solutions: Set the attribute using the Config function before the Open, and do not set the attribute at any later time; Do not configure multiple CAN Objects for the same ID.
 
          Of course I checked the node ID and it is different from the PDOs used in my first two loops. So my conclusion is that I do not create multiple CAN Object for the same ID.
          "Multiple CAN Object", does that include also SDOs ?
        
          As it exists limitations in the number of PDOs, are there some rules to follow when creating/using/deleting them ?
          Should I better integrate these PDOs in the Rx/Tx loops ?
 
          I hope I am clear enough. Please post answer if this is not the case. Thanks in advance for your messages.
           
DirkW
2007-10-23 14:40:10 UTC
Permalink
Hi,
If you get the 0xBFF62017 eror this has only one reason, you created a PDO with the same ID twice.here are some rules about PDO handles with the CANopen Library:
1. The CANopen Library uses the NI-CAN driver underneath and therefore it uses objects whenever it needs to transmit periodically or to receive a specific ID.
2. If you create a non periodic Rx PDO (period=0) there is no need to close the PDO handle. (close gets ignored)
3. If you create a periodic Rx PDO (period >0) or a Tx PDO you need to close the PDO handle, if you need to get rid of the handle. (CANopen close.vi for the PDO handle, before you open a PDO with the same COB ID. (PDO type +node ID)
4. You can create a maximum of 49 objects per device. If you use a two port board and both ports, you can share 48 objects for both ports and between all functions of the CANopen Library. (one object is allways used for the Interface create function.)
5. If you do not create PDOs periodically and you do not exceed the maximum objects you can call the CANopen Close VI ones for the Interface handle. This will stop and close all objects created before as well.
7. If you are unsure how many objects you have created already, use the NI-SPY Tool to log the API calls for your code. It shows every single object created as follows:
ncConfig ("CAN0::STD0x202", 9, {0x8000000F,0x80000013,...}, {0x00000064,0x00000000,...})
ncOpenObject ("CAN0::STD0x202", 87949556)
See the attached VI for an example of how to create a PDO dynamically and close the handle, to create another one with the sme COB ID.
 


PDO_dynamic_Test.vi:
http://forums.ni.com/attachments/ni/30/2912/1/PDO_dynamic_Test.vi
Balaboum
2007-10-23 21:40:07 UTC
Permalink
Thanks for the information.
I am still using Labview 7.1.1, so I was not able to open attached file.
I downloaded the latest version of NI-CAN and will upgrade from 2.5.0 to 2.5.2. This may not solve the problem but you never know... :smileysurprised:
I checked the "create PDO" function with probing both error cluster and node-id passed to it. I saw no PDO created twice for same ID at application start.The error always occurs when creating a TxPDO never for a RxPDO in different Vis.It is not always for the same node. I use one non-periodical RxPDO and one non-periodical TxPDO to get access to ControlWord and StatusWord of motor drives as defined in the DS402. Whenever I create a PDO in the Vi, I take care of deleting it after use and before leaving the subvi.
Is it possible that the board does not free immediatly the PDO handle or communication object ? According to me, that would explain the "multiple CAN object" error.Do you recommand to create all PDOs at application start ( up to 49 maximum ) instead ?
Is it possible to call PDO functions in Vis running parallel ?
I will continue investigation using NI-SPY and probing the "create PDO" function with a pause in case of error.
DirkW
2007-10-24 15:10:10 UTC
Permalink
Creating 49 objects is not recommended because it has a big performance impact on the NI-CAN driver. In fact it is recommended to use only a few objects at a time.
I thing creating them dynamically should be fine. If you could make your Spy log file with the error in it and the complete configuration, you should find the problem easily.
Yes you can use parallel loops but you have to be careful with creation and close.
Attached you find the 7.1 version for the VI.
DirkW


PDO_dynamic_Test.vi:
http://forums.ni.com/attachments/ni/30/2914/1/PDO_dynamic_Test.vi
Loading...