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

Dependencies:   MODSERIAL mbed KL25Z_ClockControl

Fork of EtherCAT by First Last

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers cpuinit.cpp Source File

cpuinit.cpp

00001 /*
00002  * SOES Simple Open EtherCAT Slave
00003  *
00004  * File    : cpuinit.c
00005  * Version : 0.9.2
00006  * Date    : 22-02-2010
00007  * Copyright (C) 2007-2010 Arthur Ketels
00008  *
00009  * SOES is free software; you can redistribute it and/or modify it under
00010  * the terms of the GNU General Public License version 2 as published by the Free
00011  * Software Foundation.
00012  *
00013  * SOES is distributed in the hope that it will be useful, but WITHOUT ANY
00014  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
00015  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00016  * for more details.
00017  *
00018  * As a special exception, if other files instantiate templates or use macros
00019  * or inline functions from this file, or you compile this file and link it
00020  * with other works to produce a work based on this file, this file does not
00021  * by itself cause the resulting work to be covered by the GNU General Public
00022  * License. However the source code for this file must still be made available
00023  * in accordance with section (3) of the GNU General Public License.
00024  *
00025  * This exception does not invalidate any other reasons why a work based on
00026  * this file might be covered by the GNU General Public License.
00027  *
00028  * The EtherCAT Technology, the trade name and logo "EtherCAT" are the intellectual
00029  * property of, and protected by Beckhoff Automation GmbH.
00030  */
00031 //#include <avr/io.h>
00032 #include "cpuinit.h"
00033 #include "mbed.h"
00034 
00035 extern xbus_t xbus_master;
00036 extern MODSERIAL xbus_serial;
00037 
00038 void cpuinit(void)
00039 {
00040     //shoe_serial.baud(921600);
00041     //et1100_spi.format(8,3);
00042     et1100_spi.frequency(1000000);
00043     
00044     xbus_serial.baud(230400);
00045     wait(1);//because Xbus master and IMU's need to boot.
00046     XbusSetupReceiver(&xbus_master); //initialize struct
00047     XbusInitializeXbusMaster();
00048     
00049     wait_ms(20);
00050 
00051 
00052 }
00053