FezCNC

@ Tommy, Alrighty when I get home later I’ll look up the values and let you know. With SPI the number of bytes you send and receive should be the same. The second byte should be one of the “NOP” bytes.

@ Tommy, btw I am using the EVAL6470 board

Hi,
I appreciate the help. As you can no doubt gather, I am new to SPI interfaces. I am still getting questionable data, so if possible, when you are able, could you reply with:

Your SPI settings
A simple command you are sending that is working
If you are connecting the last in chain jumper on your board (connects MISO to MOSI)

I am using a board that I constructed, but based largely on the demo board.
Regards,
Tom

@ Tommy, so I’m using a 1Mhz clock. When in doubt go slower.

SPI.Configuration _spiConfig = new SPI.Configuration((Cpu.Pin)FEZ_Pin.Digital.Di10,
                false,
                1000,
                1000,
                true,
                true,
                1000,
                SPI.SPI_module.SPI1);

Now I’ve been able to communicate with the chip (sometimes) however I haven’t actually been able to turn the motor. I’m trying to recreate the driver from the application note ([url]http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/APPLICATION_NOTE/DM00037891.pdf[/url]) however it’s a slow process.

@ Tommy,

this code was successfull in returning the status of the device:


using GHIElectronics.NETMF.FEZ;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

namespace EVAL6470
{
    public class Program
    {

        static SPI spiPort = null;
        public static void Main()
        {
            SPI.Configuration _spiConfig = new SPI.Configuration((Cpu.Pin)FEZ_Pin.Digital.Di10,
                !true, // Chip Select, active-low
                1000, // 0 (nanoseconds?) setup time
                1000, // 0 (nanoseconds?) hold time
                true, // Clock low on idle
                true, // Data valid on falling edge
                5000, // 5Mhz Clock Rate
                SPI.SPI_module.SPI1); //SPI device 1
            spiPort = new SPI(_spiConfig);


            while (true)
            {
                PrintBuffer(WriteRead(new byte[] { 0x38, 0, 0 })); ///GetParam [CONFIG] Thank you Jesus, returns 2E 88!
                                                                   
            }
        }

        static byte[] WriteRead(byte[] data)
        {
            byte[] _receive = new byte[data.Length];
            for (int i = 0; i < data.Length; i++)
            {
                byte[] _txData = new byte[1];
                byte[] _rxData = new byte[1];
                _txData[0] = data[i];
                spiPort.WriteRead(_txData, _rxData);

                _receive[i] = _rxData[0];
            }
            return _receive;
        }

        static void PrintBuffer(byte[] data)
        {
            Debug.Print("Buffer Data : " + BitConverter.ToString(data, 0));
        }
    }

    public static class BitConverter
    {
        public static string ToString(byte[] value, int index = 0)
        {
            return ToString(value, index, value.Length - index);
        }
        public static string ToString(byte[] value, int index, int length)
        {
            char[] c = new char[length * 3];
            byte b;
            for (int y = 0, x = 0; y < length; ++y, ++x)
            {
                b = (byte)(value[index + y] >> 4);
                c[x] = (char)(b > 9 ? b + 0x37 : b + 0x30);
                b = (byte)(value[index + y] & 0xF);
                c[++x] = (char)(b > 9 ? b + 0x37 : b + 0x30); 
                c[++x] = ' ';
            }
            return new string(c, 0, c.Length - 1);
        }
    }
}


Now the hard work begins to create the driver.

Guess what showed up from DigiKey!

8 L6470’s! Whohoo,

Well I’ve finally decided on the electronics package. In order to keep cost and complexity down only the stepper driver board for the L6470 needs to be designed and built (for under 30 USD btw) with that in mind all the other parts will be .NET Gadgeteer stuff (because its the only thing that will work and is cost effective). The electronics package is:

  • FEZ Hydra Mainboard (x1)
  • WiFi RS21 Module (or Ethernet ENC28 Module depending on user choice) (x1)
  • USB Client DP Module (x1)
  • SD Card Module (x1)
  • Motor Driver L298 Module (x1)

With this, the Hydra will be able to control as many Y, or S sockets that can be made free on the main board, since with 240Mhz to play with, bit banging SPI into a Y socket should be easy. Package cost without drivers is $242 USD. Added to that is the cost of a Kindle Fire to act as the main computer ($199 USD) and you get an electronics package minus the drivers for ~$441 USD

If anyone has any thoughts…

I can’t help you myself, but given that setup. How simple is it to translate from .stl files to g-code to getting the steppers to be controlled accurately. I.e. how far is there to go?

Btw have you checked out the r2c2 stepper controller board? It different to the standard arduino in its processor but creates a form of sanguinolou code I think from reading through briefly.

It seems that the R2C2 is a single board solution where there were previously many boards. It’s nice.
I believe that there is an open source application that is able to transform from cad files to the intermediary then to g-code. As far as I am aware it it not easy. It requires a lot of calculation.

Well I think the rc2c is worth looking through the development section of. There are references to software adaptations that obviously do work that have been used for the arduino 3d stuff. The software is then adapted.

They are using standard allegro driver boards probably the same as used in a reprap, but with their faster mainboard.

It may be more of a porting job than anything else. I think it’s all open source as well. I think it’s interesting at least. Also room to develop some other modules for the fez I think.

My HTSSOP28 breakout boards are on their way from BatchPCB. Soon I will be able to verify the design for the driver circuit. It will be a gadgeteer module.

Guess what showed up! It even has the thermal vias. Now that I have a breakout board for the chip I can begin the circuit tests.

EDIT: I take really crappy photographs

I though I’d share a snapshot of a 3D model of the FezCNC design thus far.

Thank you SparkFun: http://www.sparkfun.com/products/10859

They have made a Stepper Driver for the L6470 chip! 35 bucks I can’t wait to try it out. This should work perfectly with the L6470 driver in the Codeshare.

During the course of designing the new version of the FezCNC, it was decided that there was no choice but to make a smaller CNC to cut out the parts that are required for the Real CNC. This project is called the MiniCNC. It’s drive system is lead screw, and it uses slide bearings.

2 Likes

Also going small. I’m first getting the mechanics sorted out using tamiya constructor parts, then I want to have everything laser cut. I don’t like the top cam belt, i have another belt, but no suitable pullies, so a guy made me a mold and cast me three resin pullies, just have not had time to fit them…

2 Likes

Ah boy, it’s good to know there is at least 1 other boat on this ocean.

@ GMod - That’s looking sweet!

1 Like

I’m surprised that those Tamiya like plates are sturdy enough to maintain tight tolerances.

Do you have any other members to assist with the structural rigidity?

In case anyone is wondering, the material for the Mini CNC is 5 by 1.5 inch Dressed Pitch Pine. Those silver parts are chrome rods.