This is an example application demonstrating building an EtherCAT system using Esmacat

Dependencies:   EsmacatShield X_NUCLEO_IHM01A1

Basic Information of Esmacat

Information about Esmacat and EASE is provided in the link below. https://os.mbed.com/users/esmacat/code/EASE_Example/wiki/Homepage

Information about the hardware needs and setup is provided in the link below. https://os.mbed.com/users/esmacat/code/EASE_Example/wiki/Hardware-Setup

Information about the structure of the system and it's software is provided in the link below. https://os.mbed.com/users/esmacat/code/EASE_Example/wiki/Software

About this example

This is an example application to demonstrate the ease with which a system, which communicates over EtherCAT, can be build. It measures the RPM of a motor using a proximity sensor.

Following lists the hardware required

  • 2 x Mbed boards with Arduino UNO form factor (NUCLEO-F103RB)
  • 2 x EASE boards
  • 1 x proximity sensor shield (X_NUCLEO_6180XA1)
  • 1 x Motor shield (X-NUCLEO-IHM01A1)
  • 1 x stepper motor
  • 1 x Ethernet POE injector with a 24VDC power supply
  • 2 x Ethernet cables
  • Keyboard, mouse, and monitor
  • PC with Linux/Windows OS installed
  • DC power supply for motor

https://os.mbed.com/media/uploads/pratima_hb/system_pic1.jpg

Click here to know more about this Example

Revision:
41:74e394ae8b5f
Parent:
39:1270497828ca
--- a/main.cpp	Thu Feb 06 22:44:58 2020 +0000
+++ b/main.cpp	Wed Feb 12 22:08:37 2020 +0000
@@ -165,32 +165,24 @@
 
 int main()
 {
-    /*----- Initialization of EASE -----*/
 
-   
-    /*----- Initialization. -----*/
-
-    /* Initializing SPI bus. */
+    /* Initializing SPI bus for Motor  */
     DevSPI dev_spi(D11, D12, D13);// SPI device for the motor
     dev_spi.setup(8, 3, 3E6);      // Set-up SPI device for the motor
-    
+/* EASE slave object creation and Initializing SPI bus for EASE */    
     EsmacatShield slave(spi, selectPin);    //Define Chip Selector Pin
     slave.setup_spi();                      //Setup SPI for EASE
 
-
     /* Initializing Motor Control Component. */
     motor = new L6474(D2, D8, D7, D3, D10, dev_spi);//PWM pin is set to D3 as D9 is used by EASE
     if (motor->init(&init) != COMPONENT_OK) {
         exit(EXIT_FAILURE);
     }
-
+    
     /* Attaching and enabling interrupt handlers. */
     motor->attach_flag_irq(&flag_irq_handler);
     motor->enable_flag_irq();
-    
-
-
-
+ 
     while(1)
     {
         // This part of the code sets up the Mode 1 for SPI to be used for
@@ -206,8 +198,7 @@
         wait_us(1000);  
            /* Printing to the console. */
         printf("--> Moving to position : %d\r\n", ease_read[0]);
-      
-        
+              
         // This part of the code sets up the Mode 1 for SPI to be used for
         // communication with EASE. This is needed because SPI for EASE operates
         // in Mode 1 which is different than what the motor shield SPI operates in.
@@ -215,8 +206,7 @@
         wait_us(200); 
         
         // command the motor to go to a set postion
-        motor->go_to(ease_read[0]);
-        
+        motor->go_to(ease_read[0]);       
     
         /* Getting current position. */
        int position = motor->get_position();