Skip to content
Snippets Groups Projects
Commit 2001a788 authored by Florian Pose's avatar Florian Pose
Browse files

CoE state machines raising error, if the slave does not support CoE.

parent d80993ab
No related branches found
No related tags found
No related merge requests found
...@@ -249,6 +249,12 @@ void ec_fsm_coe_dict_start(ec_fsm_coe_t *fsm /**< finite state machine */) ...@@ -249,6 +249,12 @@ void ec_fsm_coe_dict_start(ec_fsm_coe_t *fsm /**< finite state machine */)
ec_slave_t *slave = fsm->slave; ec_slave_t *slave = fsm->slave;
uint8_t *data; uint8_t *data;
if (!(slave->sii_mailbox_protocols & EC_MBOX_COE)) {
EC_ERR("Slave %u does not support CoE!\n", slave->ring_position);
fsm->state = ec_fsm_coe_error;
return;
}
if (!(data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 8))) { if (!(data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 8))) {
fsm->state = ec_fsm_coe_error; fsm->state = ec_fsm_coe_error;
return; return;
...@@ -955,6 +961,12 @@ void ec_fsm_coe_down_start(ec_fsm_coe_t *fsm /**< finite state machine */) ...@@ -955,6 +961,12 @@ void ec_fsm_coe_down_start(ec_fsm_coe_t *fsm /**< finite state machine */)
EC_DBG("Downloading Sdo 0x%04X:%i to slave %i.\n", EC_DBG("Downloading Sdo 0x%04X:%i to slave %i.\n",
sdodata->index, sdodata->subindex, slave->ring_position); sdodata->index, sdodata->subindex, slave->ring_position);
if (!(slave->sii_mailbox_protocols & EC_MBOX_COE)) {
EC_ERR("Slave %u does not support CoE!\n", slave->ring_position);
fsm->state = ec_fsm_coe_error;
return;
}
if (slave->sii_rx_mailbox_size < 6 + 10 + sdodata->size) { if (slave->sii_rx_mailbox_size < 6 + 10 + sdodata->size) {
EC_ERR("Sdo fragmenting not supported yet!\n"); EC_ERR("Sdo fragmenting not supported yet!\n");
fsm->state = ec_fsm_coe_error; fsm->state = ec_fsm_coe_error;
...@@ -1170,6 +1182,12 @@ void ec_fsm_coe_up_start(ec_fsm_coe_t *fsm /**< finite state machine */) ...@@ -1170,6 +1182,12 @@ void ec_fsm_coe_up_start(ec_fsm_coe_t *fsm /**< finite state machine */)
EC_DBG("Uploading Sdo 0x%04X:%i from slave %i.\n", EC_DBG("Uploading Sdo 0x%04X:%i from slave %i.\n",
entry->sdo->index, entry->subindex, slave->ring_position); entry->sdo->index, entry->subindex, slave->ring_position);
if (!(slave->sii_mailbox_protocols & EC_MBOX_COE)) {
EC_ERR("Slave %u does not support CoE!\n", slave->ring_position);
fsm->state = ec_fsm_coe_error;
return;
}
if (!(data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 10))) { if (!(data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 10))) {
fsm->state = ec_fsm_coe_error; fsm->state = ec_fsm_coe_error;
return; return;
......
...@@ -51,12 +51,9 @@ ...@@ -51,12 +51,9 @@
typedef struct ec_fsm_coe ec_fsm_coe_t; /**< \see ec_fsm_coe */ typedef struct ec_fsm_coe ec_fsm_coe_t; /**< \see ec_fsm_coe */
/** /** Finite state machines for the CANopen-over-EtherCAT protocol.
Finite state machine of an EtherCAT master. */
*/ struct ec_fsm_coe {
struct ec_fsm_coe
{
ec_slave_t *slave; /**< slave the FSM runs on */ ec_slave_t *slave; /**< slave the FSM runs on */
ec_datagram_t *datagram; /**< datagram used in the state machine */ ec_datagram_t *datagram; /**< datagram used in the state machine */
unsigned int retries; /**< retries upon datagram timeout */ unsigned int retries; /**< retries upon datagram timeout */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment