EtherCAT slave that reads 3 Xsens IMU's connected to a Xbus Master

Dependencies:   MODSERIAL mbed KL25Z_ClockControl

Fork of EtherCAT by First Last

Committer:
vsluiter
Date:
Fri Sep 11 15:33:31 2015 +0000
Revision:
42:ef78d11f2bd7
Parent:
27:93c0e4ae943e
Also implemented samplecounter

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vsluiter 1:5e22bf1a3817 1 /*
vsluiter 1:5e22bf1a3817 2 * SOES Simple Open EtherCAT Slave
vsluiter 1:5e22bf1a3817 3 *
vsluiter 1:5e22bf1a3817 4 * File : cpuinit.c
vsluiter 1:5e22bf1a3817 5 * Version : 0.9.2
vsluiter 1:5e22bf1a3817 6 * Date : 22-02-2010
vsluiter 1:5e22bf1a3817 7 * Copyright (C) 2007-2010 Arthur Ketels
vsluiter 1:5e22bf1a3817 8 *
vsluiter 1:5e22bf1a3817 9 * SOES is free software; you can redistribute it and/or modify it under
vsluiter 1:5e22bf1a3817 10 * the terms of the GNU General Public License version 2 as published by the Free
vsluiter 1:5e22bf1a3817 11 * Software Foundation.
vsluiter 1:5e22bf1a3817 12 *
vsluiter 1:5e22bf1a3817 13 * SOES is distributed in the hope that it will be useful, but WITHOUT ANY
vsluiter 1:5e22bf1a3817 14 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
vsluiter 1:5e22bf1a3817 15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
vsluiter 1:5e22bf1a3817 16 * for more details.
vsluiter 1:5e22bf1a3817 17 *
vsluiter 1:5e22bf1a3817 18 * As a special exception, if other files instantiate templates or use macros
vsluiter 1:5e22bf1a3817 19 * or inline functions from this file, or you compile this file and link it
vsluiter 1:5e22bf1a3817 20 * with other works to produce a work based on this file, this file does not
vsluiter 1:5e22bf1a3817 21 * by itself cause the resulting work to be covered by the GNU General Public
vsluiter 1:5e22bf1a3817 22 * License. However the source code for this file must still be made available
vsluiter 1:5e22bf1a3817 23 * in accordance with section (3) of the GNU General Public License.
vsluiter 1:5e22bf1a3817 24 *
vsluiter 1:5e22bf1a3817 25 * This exception does not invalidate any other reasons why a work based on
vsluiter 1:5e22bf1a3817 26 * this file might be covered by the GNU General Public License.
vsluiter 1:5e22bf1a3817 27 *
vsluiter 1:5e22bf1a3817 28 * The EtherCAT Technology, the trade name and logo "EtherCAT" are the intellectual
vsluiter 1:5e22bf1a3817 29 * property of, and protected by Beckhoff Automation GmbH.
vsluiter 1:5e22bf1a3817 30 */
vsluiter 1:5e22bf1a3817 31 //#include <avr/io.h>
vsluiter 1:5e22bf1a3817 32 #include "cpuinit.h"
vsluiter 1:5e22bf1a3817 33 #include "mbed.h"
vsluiter 1:5e22bf1a3817 34
vsluiter 18:6629e8c5d59e 35 extern xbus_t xbus_master;
vsluiter 18:6629e8c5d59e 36 extern MODSERIAL xbus_serial;
vsluiter 5:6d75f432a41f 37
vsluiter 1:5e22bf1a3817 38 void cpuinit(void)
vsluiter 1:5e22bf1a3817 39 {
vsluiter 1:5e22bf1a3817 40 //shoe_serial.baud(921600);
vsluiter 1:5e22bf1a3817 41 //et1100_spi.format(8,3);
vsluiter 8:09dcef3ed467 42 et1100_spi.frequency(1000000);
vsluiter 13:5e4dcbd44786 43
vsluiter 27:93c0e4ae943e 44 xbus_serial.baud(230400);
vsluiter 13:5e4dcbd44786 45 wait(1);//because Xbus master and IMU's need to boot.
vsluiter 17:c5946a0fde83 46 XbusSetupReceiver(&xbus_master); //initialize struct
vsluiter 13:5e4dcbd44786 47 XbusInitializeXbusMaster();
vsluiter 13:5e4dcbd44786 48
vsluiter 5:6d75f432a41f 49 wait_ms(20);
vsluiter 13:5e4dcbd44786 50
vsluiter 1:5e22bf1a3817 51
vsluiter 1:5e22bf1a3817 52 }
vsluiter 1:5e22bf1a3817 53