xlsmt 发表于 2011-11-9 21:20:05

mini2440的嵌入式主板上的CNC控制器

下载链接http://code.google.com/p/miniemc2/wiki/PageName


Introduction
Miniemc2 it's port of well known EMC2 CNC controller to embedded device. It allows you to control your CNC machine without PC via Ethernet or WI-FI (in the future). Miniemc2 provides STEP and DIRECTION signals to control stepper motors. Main features:

Up to 6 axis ( should be clarified during tests )
Step frequency up to 40 kHz
STEP's width and polarity fixed: 10 uS, rising
19 digital inputs, 19 digital outputs. Each of them can be inverted.
Each output can be assigned to STEP/DIR/PWM or Digital Output ( controlled from NC program)
Each input can be assigned to axes Home or Limit switch, or to E-STOP button
2 PWM channels with fixed frequency (1 kHz) and 100 values of duty cycle
NC program execution from USB Flash or SD card
FTP access for data uploading
Control over network with TkEMC
Original WEB interface instead of TkEMC
External control panel can be connected via Digital Inputs ( with halui )
Difference from original EMC2
As a base for miniEMC2 was selected version 2.2.0. Later was added changes from v 2.2.8, so this is almost EMC2-2.2.8. Due to S3C2440 CPU limitation was added some changes to HAL. First of all Xenomai real-time development framework is used instead of RTAI. There is no special abstraction for Xenomai, just added some changes to sim RTAPI abstraction in such way, that instead of libpth used Xenomai's native API. Second diffrence is how hard realtime parts implemented. All standart HW drivers, like partport and stepgen was discarded due to their performance. Hard realtime functions, based on FIQ interrupt from periodic timer with 10 uS period, was used instead. This patch was taken from OpenMoko projects. More details will be provided in the last part on this doc. At present time just one important note. There is dedicated coordinate FIFO between motion controller and FIQ frequency synthesizer. That is we always have some delays between commanded and actual position. This delay can be calculated as N*1mS, N is FIFO deep. By default FIFO deep is 32, so delay is 32 mS. User can vary this value from 8 to 32. FIFO's delay adds some restrictions of usage of this port, please note this. Interaction between FIQ and motion controller provided by dedicated HAL driver named modminiemc. It implements almost all functions of parport and stepgen components. All other HW drivers are absent at present time, but HAL components, like logical primitives, regulators, i.е. HW-independent parts, are avaliable to user. miniEMC2 don't use mini2440's display due to low performance of GUI together with EMC2, only remote control is possible. User can choise between remote control by TkEMC and dedicated WEB-based GUI. Number of simultaneously working axis is open question. FIQ frequency synthesizer supports up to 6 channels, but author not sure if CPU has enough performance. 4 channels forks fine, if you would like more - try and share results. And the latest: only trivial kinematics are working fine, non-trivial ones also present, but they don't work due to CPU's perfomance. If you have read this chapter careful and you still interested in this project - go ahead with quick start in the next chapter.

Quick start
Software binary package consits tree parts: u-boot boot loader, Linux kernel image and root filesystem image (and its tarbal). Before start you need to dowload the latest firmware archive from Download section of this site and untar it. Of course you need mini2440 evalution board without display. You need to connect it to PC with RS-232 cable and Ethernet cable. Will be good to have inseted SD card for NC program storing.

From PC side you have to install serial communication util, like PuTTY and TFTP server, for example TFTP32 for Windows or any other. Copy files from the tarball to the root folder of TFTP server. Your PC should be connected to the same Ethernet network as the mini2440.

First you need to install u-boot bootloader. I just point you to page with detailed description of setup process. Binary image of u-boot provided by me is almost the same as in that one at my link except some additional environment varibles I've added. So if you have already flashed u-boot, then you can just set next variables:

set update_kernel 'tftpboot 0x32000000 uImage; nand erase 0x60000 0x500000; nand write.e 0x32000000 0x60000 0x500000'
set update_fs 'tftpboot 0x32000000 rootfs.jffs2; nand erase 0x560000 0x2000000; nand write.e 0x32000000 0x560000 ${filesize}'
set bootargs 'bootargs=console=ttySAC0,115200n8 root=/dev/mtdblock3 rootfstype=jffs2'
set bootcmd 'nand read.e 0x32000000 0x60000 0x500000; bootm 0x32000000'
set update 'run update_kernel;run update_fs;run bootcmd'
saveenv

Next you have to setup mini2440 IP address and your TFTP server IP:
set ipaddr 192.168.1.80
set serverip 192.168.1.8
run update

Change 192.168.1.8 with the proper TFTP server address. Last line starts firmware downloading and NAND flash update. After that it will start miniEMC2 booting process. First boot will take minute or two. WEB server will be accessible at address 192.168.1.80. Also device is accessible through FTP and SSH: ftp://root:root@192.168.1.80 ( that is user name root, password root). SD card and USB flash should be mounted and unmounted automatically. They are accessible at /media/mmc and /media/usb. Note: supported mounting of only one (last) partition of SD or USB stick. Filesystem type can be FAT16/32 or EXT3.
All images was tested on mini2440 with 256Mb and 1Gb of NAND flash.

Connections
miniEMC2 has 19 digital inputs and 19 outputs connected to CPU's GPIO. Below connections table according to mini2440 schematics. Please note: you have not apply signals from mini2440 to steppper motor driver, or from switches and buttons directly to inputs of mini2440 - this may destroy your CPU. You need to use buffering circuit and may be logical level shifiting sircuit! CPU is not 5V tolerant!

Out #        Conn. #        Pin                In #        Conn. #        Pin
0       5       9               0       5       21
1       5       10               1       5       22
2       5       11               2       5       23
3       5       12               3       5       24
4       5       13               4       5       25
5       5       14               5       5       26
6       5       15               6       5       27
7       5       16               7       5       28
8       5       17               8       20       1
9       5       18               9       20       2
10       5       19               10       20       3
11       5       20               11       20       4
12       20       11               12       20       5
13       20       12               13       20       6
14       20       13               14       20       7
15       20       14               15       20       8
16       20       15               16       20       9
17       20       16               17       20       10
18       5       31               18       5       32
Software package comes with the single configuration:

4 linear axes with mm unit
maximum axis speed is 720 mm/min
Step ratio: 3200 steps/revolution
Inputs for 4 home switches and E-Stop button
Outputs for Motor Enable and Spindle ON/OFF
1 PWM output connected to Spindle RPM
Below Input and Output pins table:

Name       Number        Type
Step X       1       Out
Dir X       2       Out
Step Y       3       Out
Dir Y       4       Out
Step Z       5       Out
Dir Z       6       Out
Step A       7       Out
Dir A       8       Out
Enable       11       Out
Spindle PWM       16       Out
Spindle       0       Out
Home X       0       In
Home Y       1       In
Home Z       2       In
Home A       3       In
E-Stop       18       In

samkkk 发表于 2011-11-10 02:38:28

mark!!!!!!!

cncmill 发表于 2011-11-11 07:36:08

好东西 谁要仿制一起给我做个降低点费用

huangstone 发表于 2011-11-11 07:46:35

mark 不错 看看

3rocks 发表于 2011-11-12 01:26:39

对ARM CNC Controller 很有兴趣。mini2440 太贵。我有 SimpleNet, 日立NAS 基于ARM922 Linux系统。 想把它用以cnc 控制。

changhui0222 发表于 2011-11-12 08:52:02

MARK!
页: [1]
查看完整版本: mini2440的嵌入式主板上的CNC控制器