[etherlab-users] mini.c modify

Drew Bertwistle Drew.Bertwistle at lightsource.ca
Thu Jun 25 01:10:39 CEST 2009


Hello,
 
I am new to ethercat and etherlab.  I am running into some errors  I am attempting to modify the mini.c program for use with a temposonics sensor.  The XML file provided by temposonic and my edits to the mini.c file are shown below.  Loading the module reports that 'this operation is not permitted'  According to the log the program gets as far as "Registering PDO entries" and then the master is released.  But I don't get an error saying 'PDO entry registration failed!'.  I introduced a prink statement after the registering pdo entries section but before #if EXTERNAL_MEMORY and that point in the program was not reached.

-Thanks, Drew
 
 
<?xml version="1.0" ?> 
- <file:///C:/Documents%20and%20Settings/kaos17/Desktop/MTS%20EtherCat.xml#>  <EtherCATInfo Version="1.2">
- <!-- 
MTSSensor.com 12 Okt 2006 
  --> 
- <file:///C:/Documents%20and%20Settings/kaos17/Desktop/MTS%20EtherCat.xml#>  <Vendor>
  <Id>64</Id> 
  <Name>MTS Systems Corp</Name> 
  <ImageData16x14>424DE6000000000000007600000028000000100000000E000000010004000000000070000000C40E0000C40E000000000000000000000000000000008000008000000080800080000000800080008080000080808000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00999999999999999999999999999999999999999999999999FFFFFFFFFFFFFFFF9FFF9FFF9FFF99999FFF9FFF9FFFFFF99F9F9FFF9FFFF99999999FFF9FFF999F99F99FFF9FFF9FFF9FFF9F99999F9999FFFFFFFFFFFFFFFF999999999999999999999999999999999999999999999999</ImageData16x14> 
  </Vendor>
- <file:///C:/Documents%20and%20Settings/kaos17/Desktop/MTS%20EtherCat.xml#>  <Descriptions>
- <file:///C:/Documents%20and%20Settings/kaos17/Desktop/MTS%20EtherCat.xml#>  <Groups>
- <file:///C:/Documents%20and%20Settings/kaos17/Desktop/MTS%20EtherCat.xml#>  <Group>
  <Type>MTSDevice</Type> 
  <Name LcId="1033">MTS Device</Name> 
  <ImageData16x14>424DE6000000000000007600000028000000100000000E000000010004000000000070000000C40E0000C40E000000000000000000000000000000008000008000000080800080000000800080008080000080808000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF77711111117FFFF877711111117FFFF87771111111777FF8777111111177788088899999998778878889FFFF99877FF78889FFFF998FFFFF88899999998FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF</ImageData16x14> 
  </Group>
  </Groups>
- <file:///C:/Documents%20and%20Settings/kaos17/Desktop/MTS%20EtherCat.xml#>  <Devices>
- <file:///C:/Documents%20and%20Settings/kaos17/Desktop/MTS%20EtherCat.xml#>  <Device Physics="YY">
  <Type ProductCode="#x26483052" RevisionNo="#x03020101">MTS Temposonics</Type> 
- <file:///C:/Documents%20and%20Settings/kaos17/Desktop/MTS%20EtherCat.xml#>  <Name LcId="1033">
- <![CDATA[ 
MTS R-Series EtherCat (1 Magnet)
  ]]> 
  </Name>
- <file:///C:/Documents%20and%20Settings/kaos17/Desktop/MTS%20EtherCat.xml#>  <Name LcId="1031">
- <![CDATA[ 
MTS R-Series EtherCat (1 Magnet)
  ]]> 
  </Name>
  <GroupType>MTSDevice</GroupType> 
  <Fmmu>Inputs</Fmmu> 
  <Sm MinSize="32" MaxSize="256" DefaultSize="192" StartAddress="#x1800" ControlByte="#x26" Enable="1">MBoxOut</Sm> 
  <Sm MinSize="32" MaxSize="256" DefaultSize="192" StartAddress="#x1C00" ControlByte="#x22" Enable="1">MBoxIn</Sm> 
  <Sm StartAddress="#x1000" ControlByte="#x64" Enable="0">Outputs</Sm> 
  <Sm StartAddress="#x1400" ControlByte="#x20" Enable="1">Inputs</Sm> 
- <file:///C:/Documents%20and%20Settings/kaos17/Desktop/MTS%20EtherCat.xml#>  <TxPdo Fixed="0" Sm="3">
  <Index>#x1A00</Index> 
  <Name>Inputs</Name> 
- <file:///C:/Documents%20and%20Settings/kaos17/Desktop/MTS%20EtherCat.xml#>  <Entry>
  <Index>#x3101</Index> 
  <SubIndex>1</SubIndex> 
  <BitLen>16</BitLen> 
  <Name>Status 1</Name> 
  <DataType>UINT</DataType> 
  </Entry>
- <file:///C:/Documents%20and%20Settings/kaos17/Desktop/MTS%20EtherCat.xml#>  <Entry>
  <Index>#x3101</Index> 
  <SubIndex>2</SubIndex> 
  <BitLen>32</BitLen> 
  <Name>Position 1</Name> 
  <DataType>UDINT</DataType> 
  </Entry>
- <file:///C:/Documents%20and%20Settings/kaos17/Desktop/MTS%20EtherCat.xml#>  <Entry>
  <Index>#x3101</Index> 
  <SubIndex>3</SubIndex> 
  <BitLen>32</BitLen> 
  <Name>Velocity 1</Name> 
  <DataType>DINT</DataType> 
  </Entry>
  </TxPdo>
- <file:///C:/Documents%20and%20Settings/kaos17/Desktop/MTS%20EtherCat.xml#>  <Mailbox>
  <CoE SdoInfo="1" PdoAssign="1" PdoConfig="0" /> 
  <FoE /> 
  </Mailbox>
- <file:///C:/Documents%20and%20Settings/kaos17/Desktop/MTS%20EtherCat.xml#>  <Dc>
- <file:///C:/Documents%20and%20Settings/kaos17/Desktop/MTS%20EtherCat.xml#>  <OpMode>
  <Name>Distributed Clocks</Name> 
  <Desc>Distributed Clocks</Desc> 
  <AssignActivate>#x0000</AssignActivate> 
  </OpMode>
  </Dc>
- <file:///C:/Documents%20and%20Settings/kaos17/Desktop/MTS%20EtherCat.xml#>  <ESC>
  <Reg0400>25000</Reg0400> 
  <Reg0420>100</Reg0420> 
  </ESC>
- <file:///C:/Documents%20and%20Settings/kaos17/Desktop/MTS%20EtherCat.xml#>  <Eeprom>
  <ByteSize>128</ByteSize> 
  <ConfigData>05000304</ConfigData> 
  <BootStrap>0010140200181402</BootStrap> 
  </Eeprom>
 
// process data
static uint8_t *domain1_pd; // process data memory
#define AnaInSlavePos  0, 1
#define AnaOutSlavePos 0, 2
#define DigOutSlavePos 0, 3
#define MTS 0x00000040, 0x26483052
// offsets for PDO entries
static unsigned int off_ana_in;
static unsigned int off_ana_out;
static unsigned int off_dig_out;
const static ec_pdo_entry_reg_t domain1_regs[] = {
    {AnaInSlavePos,  MTS, 0x3101, 16, &off_ana_in},
    {}
};
static unsigned int counter = 0;
static unsigned int blink = 0;
/*****************************************************************************/
#if CONFIGURE_PDOS
// Analog in --------------------------
static ec_pdo_entry_info_t MTS_pdo_entries[] = {
    {0x3101, 1, 16}, // channel 1 status
    {0x3101, 2, 32}, // channel 2 value
    {0x3101, 3, 32}, // channel 3 value
};
static ec_pdo_info_t MTS_pdos[] = {
    {0x1A00, 3, MTS_pdo_entries}
};
static ec_sync_info_t MTS_syncs[] = {
    {1, EC_DIR_INPUT, 1, MTS_pdos},
    {0xff}
};

#endif
 
int __init init_mini_module(void)
{
#if CONFIGURE_PDOS
    ec_slave_config_t *sc;
#endif
#if EXTERNAL_MEMORY
    unsigned int size;
#endif
    
    printk(KERN_INFO PFX "Starting...\n");
    if (!(master = ecrt_request_master(0))) {
        printk(KERN_ERR PFX "Requesting master 0 failed!\n");
        goto out_return;
    }
    ecrt_master_callbacks(master, request_lock, release_lock, NULL);
    printk(KERN_INFO PFX "Registering domain...\n");
    if (!(domain1 = ecrt_master_create_domain(master))) {
        printk(KERN_ERR PFX "Domain creation failed!\n");
        goto out_release_master;
    }
    if (!(sc_ana_in = ecrt_master_slave_config(
                    master, AnaInSlavePos, MTS))) {
        printk(KERN_ERR PFX "Failed to get slave configuration.\n");
        goto out_release_master;
    }

 
 
 
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20090624/f61f6c90/attachment-0003.htm>


More information about the Etherlab-users mailing list