<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body>
<div style="word-wrap:break-word">
<div>Richard,</div>
<div><br>
</div>
<div>Thank you for the reply. I have tried what you suggested with the wire bridge just talking to one EL6001 with a EK1100 bus coupler. I pulled everything out of my existing application that is currently running 10+ slaves and made it a stand alone application. </div>
<div><br>
</div>
<div>I attached my standalone application for usage of the EK1100 (position 0) and the EL6001 (position 1) with a 1mS loop timer. After a successful initialization, it starts sending data immediately. Its quick and dirty.</div>
<div><br>
</div>
<div>The outcome is the same, I am initializing successfully, and receiving a transmit accepted, but no data is going out the port and no lights flashing, which means there is no data to be received.</div>
<div><br>
</div>
<div>The only thing that doesn’t really match with my code compared to your initialization description is the out length byte[1] of TxPDO. The out length and in length are the second byte of the SW and CW, which is what I mask / set to send data (CW) and read
data (SW). Do you use a different sync structure / pdo structure than I do?</div>
<div><br>
</div>
<div>Thank you again for the support.</div>
</div>
<div style="word-wrap:break-word"><br>
<div><b>Derrill Vezina </b>| Electrical Engineer<br>
Caron Engineering Inc.<br>
Direct : 207.641.6839<br>
Cell : 207.251.9072<br>
<a href="http://www.caron-eng.com">www.caron-eng.com</a> </div>
<br>
<div>
<div>On May 24, 2014, at 8:32 AM, Richard Hacker <<a href="mailto:ha@igh.de">ha@igh.de</a>> wrote:</div>
<br class="x_Apple-interchange-newline">
<blockquote type="cite">Firstly, I only have experience with EL6022, but the EL6001 is not much different.<br>
<br>
Start with small steps:<br>
Connect TxD to RxD on the slave with a wire bridge to create a loopback.<br>
<br>
Initialization:<br>
PDO mapping:<br>
<span class="x_Apple-tab-span" style="white-space:pre"></span>RxPdo = 0x1604 (CW and OutData: 24 bytes) to SyncManager 2<br>
<span class="x_Apple-tab-span" style="white-space:pre"></span>TxPdo = 0x1a04 (SW and InData: 24 bytes) to SyncManager 3<br>
<br>
<span class="x_Apple-tab-span" style="white-space:pre"></span>SW is byte[0] of TxPdo<br>
<span class="x_Apple-tab-span" style="white-space:pre"></span>CW is byte[0] of RxPdo<br>
<span class="x_Apple-tab-span" style="white-space:pre"></span>OutLength is byte[1] of RxPdo<br>
<span class="x_Apple-tab-span" style="white-space:pre"></span>OutData = byte[2..24] of RxPdo<br>
SDO settings:<br>
<span class="x_Apple-tab-span" style="white-space:pre"></span>0x8000:0x01 = 0 (disable RTS/CTS)<br>
<span class="x_Apple-tab-span" style="white-space:pre"></span>0x8000:0x05 = 0 (disable transfer rate optimization)<br>
<span class="x_Apple-tab-span" style="white-space:pre"></span>0x8000:0x11 = 10 (115200 baud)<br>
<span class="x_Apple-tab-span" style="white-space:pre"></span>0x8000:0x15 = 3 (8N1)<br>
CW.InitRequest = 1<br>
wait for SW.InitAccepted == 1<br>
CW.InitRequest = 0<br>
CW.OutLength = 10<br>
Data[0..9] = random<br>
<br>
Cyclic:<br>
CW.TransmitRequest = !SW.TransmitAccepted<br>
CW.ReceiveAccepted = SW.ReceiveRequest<br>
sleep 1ms<br>
<br>
By setting TransmitRequest to be inverse of TransmitAccepted, the slave will continuously transmit 10 bytes which are received again due to the loopback, causing TxD and RxD LED's to flicker. If they don't, there is something wrong in your program! Try to get
this working first.<br>
<br>
The above program should be a 50-liner (or so) for the actual coding. You could implement this using state machines, but for a short test program, I would attempt without first.<br>
<br>
- Richard<br>
<br>
<br>
On 05/23/2014 03:01 PM, Derrill Vezina wrote:<br>
<blockquote type="cite">I have 3 state machines in my code, initialization, write, and read. The<br>
write and read state machines cannot be incremented until the<br>
initialization state machine has completed.<br>
<br>
Everything I have done seems to match your data flow, the only<br>
difference was I was setting the 0x407x registers for the SDO<br>
configuration (the Beckhoff docs said from hardware version 03 so I<br>
wanted it to be compatible). I changed my SDO writes to the 8000:xx<br>
registers, but this did not change the data not pushing out the port. I<br>
am running the EL6021 in half duplex mode so I have tx+ tied to rx+ and<br>
tx- tied to tx-. Since I am seeing the issue with the EL6021 and the<br>
EL6001, I am just trying to get the EL6001 working first since I have<br>
the other side of the transmission line hooked up to PC.<br>
<br>
My system is setup through a configuration file which is parsed on<br>
startup and the system adapts to what was in the contents of the file. I<br>
currently have 10 or so Beckhoff cards which are mostly I/O modules.<br>
Therefore, the SDO registers are only set on startup and do not need to<br>
have their own state machine in realtime since they can’t really change<br>
dynamically. I write all SDO registers before I configure the PDOs / domain.<br>
<br>
<br>
Here’s how I am writing my SDO registers for the EL6001 and EL6021:<br>
<br>
// do all of the write requests....<br>
// the write value will change with respect to the data set in the<br>
configuration file<br>
//<br>
// send xon xoff tx<br>
data[0] = ecat.device[i].EL60xx_xon_xoff_tx ? 1 : 0;<br>
*if* (*ecrt_master_sdo_download*(ecat.master, i, 0x8000, 0x02, data, 1,<br>
&abort_code) < 0)<br>
LOGMSG(/LOG_WARNING/) << "Failed to upload xon xoff tx SDO with code "<<<br>
abort_code;<br>
<br>
// check xon xoff rx<br>
data[0] = ecat.device[i].EL60xx_xon_xoff_rx ? 1 : 0;<br>
*if* (*ecrt_master_sdo_download*(ecat.master, i, 0x8000, 0x03, data, 1,<br>
&abort_code) < 0)<br>
LOGMSG(/LOG_WARNING/) << "Failed to upload xon xoff rx SDO with code "<<<br>
abort_code;<br>
<br>
// check the baud rate<br>
*switch* (ecat.device[i].EL60xx_baud_rate){<br>
case 2400: data[0] = EL60XX_BAUD_2400; *break*;<br>
*case* 4800: data[0] = EL60XX_BAUD_4800; *break*;<br>
*case* 9600: data[0] = EL60XX_BAUD_9600; *break*;<br>
*default*:<br>
*case* 19200: data[0] = EL60XX_BAUD_19200; *break*;<br>
*case* 38400: data[0] = EL60XX_BAUD_38400; *break*;<br>
*case* 57600: data[0] = EL60XX_BAUD_57600; *break*;<br>
*case* 115200: data[0] = EL60XX_BAUD_115200; *break*;<br>
}<br>
<br>
// upload the baud rate<br>
*if* (*ecrt_master_sdo_download*(ecat.master, i, 0x8000, 0x11, data, 1,<br>
&abort_code) < 0)<br>
LOGMSG(/LOG_INFO/) << "Failed to upload baud rate with code "<< abort_code;<br>
<br>
// check the data frame<br>
*if* (ecat.device[i].EL60xx_data_bits == 7 &&<br>
ecat.device[i].EL60xx_stop_bits == 1 && ecat.device[i].EL60xx_parity == 1)<br>
data[0] = EL60XX_DATA_7E1;<br>
*else* *if* (ecat.device[i].EL60xx_data_bits == 7 &&<br>
ecat.device[i].EL60xx_stop_bits == 1 && ecat.device[i].EL60xx_parity == 2)<br>
data[0] = EL60XX_DATA_7O1;<br>
*else* *if* (ecat.device[i].EL60xx_data_bits == 8 &&<br>
ecat.device[i].EL60xx_stop_bits == 1 && ecat.device[i].EL60xx_parity == 0)<br>
data[0] = EL60XX_DATA_8N1;<br>
*else* *if* (ecat.device[i].EL60xx_data_bits == 8 &&<br>
ecat.device[i].EL60xx_stop_bits == 1 && ecat.device[i].EL60xx_parity == 1)<br>
data[0] = EL60XX_DATA_8E1;<br>
*else* *if* (ecat.device[i].EL60xx_data_bits == 8 &&<br>
ecat.device[i].EL60xx_stop_bits == 1 && ecat.device[i].EL60xx_parity == 2)<br>
data[0] = EL60XX_DATA_8O1;<br>
*else* *if* (ecat.device[i].EL60xx_data_bits == 7 &&<br>
ecat.device[i].EL60xx_stop_bits == 2 && ecat.device[i].EL60xx_parity == 2)<br>
data[0] = EL60XX_DATA_7O2;<br>
*else* *if* (ecat.device[i].EL60xx_data_bits == 8 &&<br>
ecat.device[i].EL60xx_stop_bits == 2 && ecat.device[i].EL60xx_parity == 0)<br>
data[0] = EL60XX_DATA_8N2;<br>
*else* *if* (ecat.device[i].EL60xx_data_bits == 8 &&<br>
ecat.device[i].EL60xx_stop_bits == 2 && ecat.device[i].EL60xx_parity == 1)<br>
data[0] = EL60XX_DATA_8E2;<br>
*else* *if* (ecat.device[i].EL60xx_data_bits == 8 &&<br>
ecat.device[i].EL60xx_stop_bits == 2 && ecat.device[i].EL60xx_parity == 2)<br>
data[0] = EL60XX_DATA_8O2;<br>
*else*<br>
data[0] = EL60XX_DATA_7E2;<br>
<br>
// upload the data frame<br>
*if* (*ecrt_master_sdo_download*(ecat.master, i, 0x8000, 0x15, data, 1,<br>
&abort_code) < 0)<br>
LOGMSG(/LOG_INFO/) << "Failed to upload data frame with code "<< abort_code;<br>
<br>
// check send fifo data continuous<br>
data[0] = ecat.device[i].EL60xx_send_fifo_continuous ? 1 : 0;<br>
if (*ecrt_master_sdo_download*(ecat.master, i, 0x8000, 0x04, data, 1,<br>
&abort_code) < 0)<br>
LOGMSG(/LOG_INFO/) << "Failed to upload send fifo cont. SDO<br>
with code "<< abort_code;<br>
<br>
// check send transfer rate opt.<br>
data[0] = ecat.device[i].EL60xx_transfer_rate_opt ? 1 : 0;<br>
*if* (*ecrt_master_sdo_download*(ecat.master, i, 0x8000, 0x05, data, 1,<br>
&abort_code) < 0)<br>
LOGMSG(/LOG_INFO/) << "Failed to upload transfer rate opt. SDO with code<br>
"<< abort_code;<br>
<br>
// check the device type<br>
*if* (ecat.device[i].dev_type == /DEV_EL6021/){<br>
// send duplex<br>
data[0] = ecat.device[i].EL6021_duplex ? 1 : 0;<br>
*if* (*ecrt_master_sdo_download*(ecat.master, i, 0x8000, 0x06, data, 1,<br>
&abort_code) < 0)<br>
LOGMSG(/LOG_INFO/) << "Failed to upload duplex type SDO with code "<<<br>
abort_code;<br>
<br>
// check point to point communications<br>
data[0] = ecat.device[i].EL6021_point_to_point ? 1 : 0;<br>
*if* (*ecrt_master_sdo_download*(ecat.master, i, 0x8000, 0x07, data, 1,<br>
&abort_code) < 0)<br>
LOGMSG(/LOG_INFO/) << "Failed to upload point to point SDO with code "<<<br>
abort_code;<br>
}<br>
*else* {<br>
// check send rts cts<br>
data[0] = ecat.device[i].EL6001_rts_cts_enable ? 1 : 0;<br>
*if* (*ecrt_master_sdo_download*(ecat.master, i, 0x8000, 0x01, data, 1,<br>
&abort_code) < 0)<br>
LOGMSG(/LOG_INFO/) << "Failed to upload rts cts enable SDO with code "<<<br>
abort_code;<br>
}<br>
<br>
<br>
<br>
<br>
<br>
Here is my initialization sm which finishes successfully:<br>
<br>
// check the state of the initialization<br>
*if* (ecat.device[device].EL60xx_init_status == /EL6021_Init_Terminal/){<br>
// read the control register first and set initialization request bit to 1<br>
*int* control_byte = EC_READ_U8(ecat.domain_pd +<br>
ecat.device[device].EL60xx_control_offset);<br>
control_byte |= EL60XX_CTRL_INIT_REQUEST;<br>
EC_WRITE_U8(ecat.domain_pd + ecat.device[device].EL60xx_control_offset,<br>
control_byte);<br>
<br>
// wait for verification that the initialization succeed successfully<br>
ecat.device[device].EL60xx_init_status = /EL6021_Init_Accepted/;<br>
}<br>
*else**if* (ecat.device[device].EL60xx_init_status ==<br>
/EL6021_Init_Accepted/){<br>
// read the status register to see if the device accepted the request<br>
uint16_t status = EC_READ_U16(ecat.domain_pd +<br>
ecat.device[device].EL60xx_status_offset);<br>
if (status & EL60XX_STAT_INIT_ACCEPTED){<br>
// clear the init request bit...<br>
*int* control_byte = EC_READ_U8(ecat.domain_pd +<br>
ecat.device[device].EL60xx_control_offset);<br>
control_byte &= ~EL60XX_CTRL_INIT_REQUEST;<br>
EC_WRITE_U8(ecat.domain_pd + ecat.device[device].EL60xx_control_offset,<br>
control_byte);<br>
<br>
// wait for the transmission success<br>
ecat.device[device].EL60xx_init_status = /EL6021_Init_Verified/;<br>
}<br>
*else* {<br>
// waiting for initialization accepted...<br>
*if* (ecat.device[device].EL60xx_init_print){<br>
LOGMSG(/LOG_INFO/) << "Still waiting for verification of transmission on<br>
EL60xx";<br>
ecat.device[device].EL60xx_init_print = *false*;<br>
}<br>
}<br>
}<br>
*else**if* (ecat.device[device].EL60xx_init_status ==<br>
/EL6021_Init_Verified/) {<br>
// check the status bit and wait for terminal to set the initialization<br>
accepted bit to 0<br>
uint16_t status = EC_READ_U16(ecat.domain_pd +<br>
ecat.device[device].EL60xx_status_offset);<br>
*if* (!(status & EL60XX_STAT_INIT_ACCEPTED)){<br>
// everything is up and running!<br>
ecat.device[device].EL60xx_init_status = /EL6021_Terminal_Ready/;<br>
// notify the user<br>
LOGMSG(/LOG_INFO/) << "EL60xx device read / write terminal ready for data";<br>
}<br>
}<br>
<br>
<br>
My write state sm to be working correctly as well since when I set the<br>
transmit request bit after filling the data bytes, the terminal sets the<br>
transmit request accepted bit successfully, I am just not seeing data<br>
coming out the port. This is happening with both the EL6021 and the EL6001.<br>
<br>
This is how my write sm works right now (I just created a temporary<br>
array of 8 bytes and filled it with random data, TEST_SIZE = 8):<br>
<br>
// get the status used for write and write sm<br>
uint16_t status = EC_READ_U16(ecat.domain_pd +<br>
ecat.device[device].EL60xx_status_offset);<br>
<br>
// check the write state<br>
*if*(ecat.device[device].EL60xx_send_status== /EL6021_Send_Idle/){<br>
// map the data to the output registers<br>
*for* (*int* i=0;i<TEST_SIZE;i++)<br>
EC_WRITE_U8(ecat.domain_pd + ecat.device[device].EL60xx_out_offset[i],<br>
data[i]);<br>
<br>
// set the second byte of the control register to be the size of the<br>
output size<br>
// mask with 255...<br>
uint16_tcontrol_byte = (TEST_SIZE & 255) << 8;// bit shift over by 8 and<br>
mask out the first byte<br>
control_byte |= EL60XX_CTRL_TRANSMIT_REQUEST;<br>
<br>
// set the transmit request bit<br>
EC_WRITE_U8(ecat.domain_pd + ecat.device[device].EL60xx_control_offset,<br>
control_byte);<br>
<br>
// set next step in the transaction process<br>
ecat.device[device].EL60xx_send_status= /EL6021_Send_Request/;<br>
}<br>
*else**if*(ecat.device[device].EL60xx_send_status== /EL6021_Send_Request/){<br>
// check the status bit for successful transition...<br>
*if* (status & EL60XX_STAT_TRANSMIT_ACCEPTED){<br>
// transmit accepted and bytes sent to transmission FIFO<br>
LOGMSG(/LOG_INFO/) << "Data transmission from EL6021 success with status<br>
"<< status;<br>
<br>
// set the status back to idle<br>
ecat.device[device].EL60xx_send_status= /EL6021_Send_Idle/;<br>
}<br>
*else* {<br>
// check for additional errors…<br>
…<br>
…<br>
}<br>
}<br>
<br>
The transmit accepted status bit is set high, so my assumption is that<br>
the terminal is receiving the data (my log prints “Data transmission<br>
from EL6021 success with status ” every time through).<br>
<br>
<br>
_______________________________________________<br>
etherlab-users mailing list<br>
<a href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a><br>
http://lists.etherlab.org/mailman/listinfo/etherlab-users<br>
<br>
</blockquote>
<br>
Mit freundlichem Gruß<br>
<br>
Richard Hacker<br>
<br>
-- <br>
------------------------------------------------------------------------<br>
<br>
Richard Hacker M.Sc.<br>
<a href="mailto:richard.hacker@igh-essen.com">richard.hacker@igh-essen.com</a><br>
Tel.: +49 201 / 36014-16<br>
<br>
Ingenieurgemeinschaft IgH<br>
Gesellschaft für Ingenieurleistungen mbH<br>
Heinz-Bäcker-Str. 34<br>
D-45356 Essen<br>
<br>
Amtsgericht Essen HRB 11500<br>
USt-Id.-Nr.: DE 174 626 722<br>
Geschäftsführung:<br>
- Dr.-Ing. T. Finke,<br>
- Dr.-Ing. W. Hagemeister<br>
Tel.: +49 201 / 360-14-0<br>
http://www.igh-essen.com<br>
<br>
------------------------------------------------------------------------<br>
_______________________________________________<br>
etherlab-users mailing list<br>
etherlab-users@etherlab.org<br>
http://lists.etherlab.org/mailman/listinfo/etherlab-users<br>
</blockquote>
</div>
<br>
</div>
</body>
</html>