Author Topic: Project: Mega2560 to L7 board test.  (Read 15591 times)

Lob0426

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1476
  • Let the Magic Blue Smoke out!
    • View Profile
    • Richards RasPi Web Server
Project: Mega2560 to L7 board test.
« on: August 28, 2016, 11:41:12 PM »
If you have been following the TTL board posts you probably have read most of this already.

I am proposing to test the Mega2560 board (here after called Mega) using an L7 Eleks Maker board as a "Sheild". I will use bread board wires to make connections from the headers on the Mega to the the headers on the L7 board. The Arduino Nano board will be removed from the L7 board. This means that the stock cabling in our Laser kits will be able to be used without modification. The Stock Laser will operate just as it does with a Stock L7 board. I hope!

https://www.adafruit.com/products/153

As an aside the L1, L2, L7, L8 or L6 boards should all work exactly the same.

https://www.arduino.cc/en/Products/Compare

This is not a "permanent" solution. This is a test as to the performance of the Mega versus the Nano controllers. Hopefullly I can come up with a "sheild" that uses the advanced features available on the Mega as an upgrade for our machines. This would mean drawing up a board designed for these laser kits.

The real goal would be to get a ARM powered solution that will really improve performance over these Arduino boards. Grbl is headed that way but not there yet. The Mega would be an intermediate step to better performance and the firmware is available now. It is in BETA but has been out for about 5 months and is based on grbl edge, the precursor to grbl 1.0, the end step of the Nano/Uno work. Grbl 1.0 is supposed to be out "soon" and supposed to support a Laser mode that will enhance laser performance. these updates will also be applied to the Mega branch.

As you can see from this comparison chart both have the same clock speed of 16Mhz. The Nano, with 328P, has 1KB EEPROM, 2KB SRAM and 32KB Flash storage. The Mega has 4KB EEPROM, 8KB SRAM and 256KB Flash storage. There is a lot more resources available on the Mega. Many will see the 16Mhz and think you will not see any speed advantage from the Mega. This is not the case, grbl firmware allocates twice the the Block Buffers on the Mega and 40% more Segment buffers. This means that the Mega accepts more code into memory at each read. So less time is spent reading and writing to memeory. So less of a load on the processor for the same amount of code. This "comparison" will not compare the added "pins" that are available to be used by the Mega. We will use exactly the same number of pins as the L7 board uses, though they may not be the exact same pins!

In my earlier ramblimgs I had thought that re-doing the cpu_map for the Mega firmware;

https://github.com/gnea/grbl-Mega/  Mega version
https://github.com/grbl/grbl        Nano/Uno version

was the way to go. meaning re-allocating the mega pins the same as the Nano pins used. This would have worked. I now believe for simplicities sake the better route is to use the default mega pin mapping to run the tests. This means people will not have to fool with cpu_map at all. And if we find a solution to using the Mega in our machines people will not have to remember what they changed. I would like everyones thoughts on this!

I plan on posting plenty of pictures of this Frankensteins mess in case any of you wish to follow along.


@Zax pointed out to me that T2Laser does not necessarily need grbl to operate.

"T2Laser supports G-code, it doesn't need to be Grbl in particular. I can write an interface module for a different hardware setup if there's enough interest. The concept of being modular allows me to have a different sender / controller for other systems.

I'm also very interested in the other ports (ARM) that seems to be the future for Grbl. It sounds like the Nano version is dead once 1.0 is released."

BenCutLaser I believe does need grbl to operate, but I am decently sure @Ralph could change that if need be.


To Do List:
Remove Nano from L7 board, leave everything plugged into the board, Motors, drivers and Laser. (sshhhh,,, I have an extra if it catches on fire!)
Compare the cpu_map.h from grbl Nano to cpu_map Gnea/Grbl-Mega and draw up a map of where to run wires from and to.
Use bread board wires to make connections from the Mega's headers to the headers on the L7 board.
Double check everything.
Power it up!
Watch for any Magic Blue Smoke being let out!
Run timed tests between boards at engraving.

Many of the 3D Printer firmawares could be used to make our Laser kits work. And that opens up many boards that could be used. But most people want something that they know will work. Not something they have to fool around with to make it work. We know Grbl works for the software (BCL and T2Laser) and for the hardware that we are currently using.

NOTE:
There is no "Benbox" version for the Mega. If you like using Benbox software, then this post is not for you. Benbox is it's own little world. I have been playing with it on the 500mw machine and it actually works ok. I kind of ignored it at first. But it does work even if it has very few features and is relatively simple. There is no source code for the firmware to make adjustments to use the resources available on the Mega. You would get similar if not exactly the same performance as the Nano, if you could make it work!

NOTE 2: The Mega will not be here until at least Tuesday from Amazon.
https://www.amazon.com/gp/product/B00PD92EJ8/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1
« Last Edit: August 28, 2016, 11:47:50 PM by Lob0426 »
Richard
A5 2.5W w/homing switches on L7
A5 2W diode self upgraded from stock 500mw

Experimenting with Mega2560 board upgrade

Administrator

  • Administrator
  • Hero Member
  • *****
  • Posts: 2107
  • Pilot Instructor
    • View Profile
Re: Project: Mega2560 to L7 board test.
« Reply #1 on: August 29, 2016, 08:34:48 AM »
>BenCutLaser I believe does need grbl to operate, but I am decently sure @Ralph could change that if need be.

BCL does not need Grbl to operate. Like T2, BCL just spits out gcode and sends it to the microprocessor/controller board. Who or what receives it, does not matter to BCL.

BCL uses the Spindle gcode command to set the laser power, ranging from S0 to S255 (0% to 100%). As long as the controller board understands that, and can set the laser power accordingly, then all is well. IF it would happen to use a different gcode command, BCL could be easily modified to use that new command for laser power. I would add an item to the Setup tab so the user could 'tell' their laser machine what they would like to use for laser power.

Understandably, the reason one might think BCL needs Grbl is due to the arc bug that exists versions prior to 0.9i. As the default firmware that comes with these laser DIY machines, it uses Grbl, but in order to be able to make arcs and circles, BCL users must be using 0.9i or 0.9j. So we can now clearly see (I hope) that BCL is just spitting out gcode and as long as the firmware on the laser understands gcode (and we all know it will right?) and has no arc bugs (most likely does not right?) BCL will work fine on any laser machine!

« Last Edit: August 29, 2016, 08:36:28 AM by Administrator »
Admin -- Ralph -- support @ BenCutLaser dot us
http://www.BenCutLaser.us/BenCutLaserSetup1.8.4a.exe.zip
BCL Paid license: $39.95
via Paypal to bclpp@primemail.com

Lob0426

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1476
  • Let the Magic Blue Smoke out!
    • View Profile
    • Richards RasPi Web Server
Re: Project: Mega2560 to L7 board test.
« Reply #2 on: August 29, 2016, 09:05:33 AM »
Either one of your programs, BCL or T2Laser, will run on any firmware that understands gcode. Which is every board basically used for CNC and 3D printing. I thought that they were tied to grbl, they are not. The biggest problem is how "canned" routines are handled by different controllers. Example; Printrbot uses G29 to perform a bed level check, but G29 it is supposed to be a return to reference command. But the Lasers do not seem to use any of those routines.

The Marlin/Sprinter firmware on my Printrbot Printrboard does not have an "arc bug".  But they too are over running the controllers (AT90USB1286) that they have been using for them. But that is because they are delving into advanced features, such as WiFi and Bluetooth connections, trying to "unleash" their printers from USB. And of course they are trying to improve speed which is the most complained about thing in 3D printing. Printrbot moved to a Synthetos TinyG board as it was ARM based and had advanced motion control. It has smoother, faster motion than their own Printrboard. And was easier to adapt to WiFi. More expensive too!
Richard
A5 2.5W w/homing switches on L7
A5 2W diode self upgraded from stock 500mw

Experimenting with Mega2560 board upgrade

Administrator

  • Administrator
  • Hero Member
  • *****
  • Posts: 2107
  • Pilot Instructor
    • View Profile
Re: Project: Mega2560 to L7 board test.
« Reply #3 on: August 29, 2016, 09:21:11 AM »
BCL already has many of its gcode commands inside its .ini file to tell it how to handle various gcode words (commands). One BCL user needed the Home command to generate a different Homing string so all he had to do was insert his own string into the ini file and BCL used that!

That's the same process I will follow for future gcode behavioral changes that are needed. And new ones (G29) can be added to the ini file in the same way. I am trying to make BCL customizable to run on any laser machine running any firmware (as long it accepts gcode).
Admin -- Ralph -- support @ BenCutLaser dot us
http://www.BenCutLaser.us/BenCutLaserSetup1.8.4a.exe.zip
BCL Paid license: $39.95
via Paypal to bclpp@primemail.com

Lob0426

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1476
  • Let the Magic Blue Smoke out!
    • View Profile
    • Richards RasPi Web Server
Re: Project: Mega2560 to L7 board test.
« Reply #4 on: August 29, 2016, 10:19:09 AM »
Printrbot canned G29 in the firmware. Its behavior cannot be changed without compiling new firmware.

What we do not want to do is call G29 on that board for one of our Lasers. It takes specific equipment and settings for it to work. It needs limit switches and bed size parameters. If either are missing it is going to crash the gantry. Another example is the canned drilling cycles for milling. They are handled differently by firmware. There is no need for any of those on our lasers so they should not be a problem. But if a standard command like G28 or M3, M5, M6 has been altered, or the command words are used differently, on a specific board it could cause all kinds of problems.

Each board would need to be tested to see how it will react to the code sent from BCL. It really should not be a problem as from what I have seen the gcode sent from BCL is pretty generic. Probably the same for T2Laser.
Richard
A5 2.5W w/homing switches on L7
A5 2W diode self upgraded from stock 500mw

Experimenting with Mega2560 board upgrade

Administrator

  • Administrator
  • Hero Member
  • *****
  • Posts: 2107
  • Pilot Instructor
    • View Profile
Re: Project: Mega2560 to L7 board test.
« Reply #5 on: August 29, 2016, 11:46:02 AM »
BCL should have no problems, other than the Spindle word, everything else is generic gcode. I don't use G29 at all right now.
Admin -- Ralph -- support @ BenCutLaser dot us
http://www.BenCutLaser.us/BenCutLaserSetup1.8.4a.exe.zip
BCL Paid license: $39.95
via Paypal to bclpp@primemail.com

Lob0426

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1476
  • Let the Magic Blue Smoke out!
    • View Profile
    • Richards RasPi Web Server
Re: Project: Mega2560 to L7 board test.
« Reply #6 on: August 29, 2016, 01:11:24 PM »
See the picture below. these are the pins that are different in the cpu_map's. Any without a pin change will be connected to the standard headers on the mega. Just read the labels to connect. If you do not have limits you could just not connect these. RX TX do not really need connection either. I will recheck these again but appear to be right.

As you can see there is a whole lot more pins on the Mega!

Cpu_map Mega2560 grbl
https://github.com/gnea/grbl-Mega/blob/edge/grbl/cpu_map.h
                                  MEGA               TO NANO
X                                 2     D24          D2
Y                                 3     D25          D3
Z                                 4     D26          D4

XDIR                            7     D30          D5
YDIR                            8     D31          D6
ZDIR                            9     D32          D7

Stepper disable             7     D13          D8

X_Limit                        4     D10          D9
Y_Limit                        5     D11          D10
Z_Limit                        6     D12          D11

Spindle Enable              3     D6           D12
Spindle DIR                  3     D5           D13

Coolant Flood               5     D8           A3
Coolant Mist                 6     D9           A4

Ctrl RST                       0     A8           A0
Ctrl feed                       1     A9           A1
Ctrl Cycle                     2     A10          A2
Ctrl Safe Door               3     A11          A1

Probe Bit                      7     A15          A5

Spindle pwm bit            4     D7           D11 combined with pwm by grbl no attachment

These are the cpu_map pin assignments for 328P.

RX                   D0
TX                   D1

X                    D2
Y                    D3
Z                    D4

XDIR                 D5
YDIR                 D6
ZDIR                 D7

Spindle Enable
Spindle_DIR_bit     5 D13
Spindle_PWM_bit   3 D11
Spindle_Enable_bit 4 D12? z limt?

Stepper motor disable bit    D0

X limit              D9   (1)
Y limit              D10  (2)
Z limit              D12  (4)    or     D11  (3) depends on version jumper position.

D13 cannot be pulled high due to LED. D13 activates at boot, Arduino boot loader toggles D13 pin.

Analog A4 and A5 reserved for I2C
Flood                A3
Mist                 A4
reset                A0
feed hold            A1
Cycle start          A2
Safety door          A1 shared with feed hold
probe                A5 see note above
« Last Edit: September 11, 2016, 02:28:25 PM by Lob0426 »
Richard
A5 2.5W w/homing switches on L7
A5 2W diode self upgraded from stock 500mw

Experimenting with Mega2560 board upgrade

kn4ud

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 753
    • View Profile
Re: Project: Mega2560 to L7 board test.
« Reply #7 on: August 30, 2016, 05:23:23 AM »
Good work Richard. You are going to use the gena firmware without any mods or re compile?
Allen

Lob0426

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1476
  • Let the Magic Blue Smoke out!
    • View Profile
    • Richards RasPi Web Server
Re: Project: Mega2560 to L7 board test.
« Reply #8 on: August 30, 2016, 01:35:44 PM »
It will have to be compiled, but it should work with no other changes.

Still waiting for the board, says out for delivery! Waiting sucks!
Richard
A5 2.5W w/homing switches on L7
A5 2W diode self upgraded from stock 500mw

Experimenting with Mega2560 board upgrade

ggallant571

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1287
    • View Profile
Re: Project: Mega2560 to L7 board test.
« Reply #9 on: August 30, 2016, 01:46:22 PM »
Just noticed that the laser PWM signal (D11) is routed to the 6-pin ISP header. Convenient place to grab from when testing the TTL board.
SARCASM - Just one more service we offer here.

Zax

  • T2Laser
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3836
    • View Profile
    • T2Laser
Re: Project: Mega2560 to L7 board test.
« Reply #10 on: August 30, 2016, 01:53:27 PM »
Good catch.

I buy the Nano's in bulk unsoldered (since some have questionably solder quality) and don't usually bother putting the ISP header on unless I need it for programming (boot loader or loading a program that needs the extra space).

kn4ud

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 753
    • View Profile
Re: Project: Mega2560 to L7 board test.
« Reply #11 on: August 30, 2016, 01:54:54 PM »
LOL, o'yes the wait... That is giving me ulsers.. I was looking at the timing , 1.9khz the best I recall using 1/8 scaler , what do we want for this would we be better with 1k or higher. I think this is where the little issue is that I have using the jtech controller with BCL an jtech firmware. I will have 3 of the Agastar boards shipped in 48 hours so here comes the anxiety again..
Allen

Lob0426

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1476
  • Let the Magic Blue Smoke out!
    • View Profile
    • Richards RasPi Web Server
Re: Project: Mega2560 to L7 board test.
« Reply #12 on: August 30, 2016, 02:01:00 PM »
Just looked to see who has it and its ONTRAC. I will be lucky to see it by the end of the week! They have a 85 mile drive from Reno to here and they do not come over every day. Half the time they wait several days then send it by USPS.

Well we will see, but it does not look good from past experience with them.
Richard
A5 2.5W w/homing switches on L7
A5 2W diode self upgraded from stock 500mw

Experimenting with Mega2560 board upgrade

Lob0426

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1476
  • Let the Magic Blue Smoke out!
    • View Profile
    • Richards RasPi Web Server
Re: Project: Mega2560 to L7 board test.
« Reply #13 on: August 30, 2016, 02:05:34 PM »
For you the 1K would probably be best. I see a darker burn with the higher 7.8KHz settings in grbl. Your seeing the opposite. One advantage of the Mega for you is that you have a better chance of changing the rate without affecting another pin.
Richard
A5 2.5W w/homing switches on L7
A5 2W diode self upgraded from stock 500mw

Experimenting with Mega2560 board upgrade

kn4ud

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 753
    • View Profile
Re: Project: Mega2560 to L7 board test.
« Reply #14 on: August 30, 2016, 02:17:42 PM »
I will be using the Agastar test board after I get it assembled. I am not shure what you mean by affecting other pins, I have usede .9i , .9j and the jtech which is .9g but I have not seen any change except the laser burn. The speed of movement was always the same.
Allen