Arduino-Atom-VScode-Platformio-Marlin

Just so you all know, I am a long time noob to all of this and many things are probably wrong! I have an old Ramps 1.4 board, a new BTT Ramps 1.6+ board, BTT SKR 1.3 board and a GTR 1.0 board.

The Ramps boards are attached to an ATmega 2560 and uses Arduino software. Which can be found at the MS app store (That never works for me) or downloaded from https://www.arduino.cc/.
U8glib Library is needed to load the firmware to your board sandwich.
When your done with the code, you plug the board into your PC. Goto Tools, change the board to ATmega 2560 and find which port your board is.
Then upload with the arrow pointing to the right.
This is literally that easy!

On these SKR 32bit boards they can not be ran on the Arduino software. But it look like the ramps boards can be ran on all software
All over the net you can find videos on how to install
Atom https://atom.io/
VScode https://code.visualstudio.com/

They seem to work exactly the same.
You install the program then download Platformio and follow the prompts. Done!
If it were only that easy.
Looks like Atom is the most popular program. However, Atom doesn’t work with Platformio 2.7.1. Everyone that tries gets errors and the whole program crashes. However, there is a way to install Atom-Terminal, after you figure out how to open that you can install “apm install platformio-ide@2.6.0”. Don’t forget to turn off Auto-Update! You might have to install Clang outside of Atom. https://docs.platformio.org/en/stable/integration/ide/atom.html#installation

Coming in second is VScode. Install that program then install Platformio and done. Super easy! Note: I have no idea if any of the steps above affected VScode working so easy.

Then comes Marlin files with the Platform.ini.
The idea is you open the project folder where the Platform.ini file is located.
Do all the code
Then compile that into a firmware.bin file. With the little Check mark button. On Atom the button is huge to the left of the screen and VScode its super tiny at the bottom of the screen. Then you take that .bin file and save it to your microSD card. The SKR board does the rest! Super happy days!

Here is where my problem comes into play. I can download a fresh copy of Marlin 2.0 bugfix and without changing anything I can compile that into a firmware.bin file no problem. I can copy some of the V1cnc’s Config.h to the fresh copy of Marlin and still compile it. But if I try to compile any of V1cnc’s marlin files, it will give me errors if i try to compile it. (Remember I am not changing anything, just opening the file and compiling it.)
Example: 1 failed: LPC1768 or BIGTREE_SKR_PRO or megaATmega2560

Now Ryan or Jeffeb3 or anyone else has done a crazy ton of changes to the firmware. So much that it almost doesn’t look like the Marlin file anymore. As a guy that doesn’t know anything, it takes me a while to compare apples to apples. The awesome thing about V1’s Marlin code is that it comes with the firmware.bin file ready to insert into a microSD card. The problem with their code is that most of the configurations are built for the MPCNC and not the Lowrider. I got a few versions of Jeffeb3’s marlin Lowrider configurations. Two SKR 1.3 with either driver 2209 or DRV8825. Because of Teachers Tech on YouTube I have a Ramps with DRV8825 and a SKR1.3 with 5160.
I wanted to change the drivers on the 2209 to 5160 but I can’t compile it. I could replace the drivers with the DRV8825. Also, I would like to be able to compile code.

Makes me think I am missing a library or a setting? But I am having the same compiling errors on both Atom and VScode programs.

  1. There are instructions for playformio in the docs:
    https://docs.v1engineering.com/learn/platformio/
  2. The Marlin devs prefer vscode and atom has been broken in the past. YMMV, but I have tested with vscode in Linux and it works good for me.
  3. I can help you figure out the error. The code in the zip file built at some point, or it wouldn’t have been zipped. If you’re pasting errors here, it is important to show the very first error. The last error is usually not helpful.

So I would try building one of the LR configurations as close as you can get to your goal. I would use vscode, and not change a thing at first. It should compile. If not, come here for help. Then, when that is working, change one thing at a time (starting with the 5160 drivers) and keep building along the way until you’ve got something you can test on your hardware. Take it to the machine and test it out. If you want to keep going with endstops or lasers or whatever, at least you have a known footing on something that works.

Give us updates along the way and we can help you avoid errors before they ruin your day.

1 Like

As a professional programmer, vs code is awesome.

Meh, it’s no vim… (walks away)

3 Likes

Obligatory

2 Likes

Jeffeb3
I used PlatformIO - V1 Engineering Documentation
with a YouTube video when I was installing VScode the first time.
But I couldn’t get your code to compile at all. Failed every time. I even tried crazy things like taking your code and dropping it onto a Marlin 2.0 Bugfix folder. Kind of like you do when you are changing the logic board type. No luck
So, I tried again on a fresh copy of Windows 10… my wifes computer! I made screenshots of every window. VScode Install Process.zip (2.4 MB)
Guess what, there are a ton of screenshots!
Anyway, there are a few things missing on the V1 doc and the video I watched that might not even cross your mind. First Platformio needs the newest version of Python. I never installed it on the first PC. It never asked to install it. Second V1 code needs Get Bash. However, Marlin 2.0 bugfix does not need Get or Python.

I tried installing the missing items to my first pc and no luck. No matter what I did, it never worked. So I am reinstalling Windows 10 on that computer and will try again soon. Either way, it works on my wifes computer for now. :smile:

1 Like

There’s no probability with compilers (at least, there shouldn’t be). So trying it more than once doesn’t really help.

The best thing to do when you are following a tutorial is to stop on the focus on the first error. Sometimes, you try to fix it, and add in new errors, and with software, it is very hard to tell if it got better or worse. Sometimes you fix one error, and it sends you 3000 new ones that it couldn’t see before, but it is actually better.

If you know what the very first problem is, then we can figure that out. Python hasn’t changed much (except between 2.7 and 3.0+). So an uodate shouldn’t matter there. I didn’t think it needed bash either, but I live in linux, where bash and python are the norm.

That’s interesting!
My thought was, your code compiled, in order to make the file in the first place. So, if I do not change anything at all and just try to compile it. I should get the same results of it compiling.

Anyway, I did compile the SKR pro just fine but the SKR 1.3, no luck. I got the known error:
Error: Detected unknown package ‘framework-arduino-lpc176x’
With funny fixes like using internet from your cell phone somehow fixed it. Or all the people all over the net with the same errors. Then it looks like NXP-LPC is for linux and not Windows.

I am going to plug in the DRV8825 drivers from my ramps to my SKR1.3 and use your lowrider firmware. no changes.
I feel like I wasted this whole week trying to get to the starting line. :slightly_smiling_face:
I don’t want to spend all my time trying to get the program to work when I want to spend my time in the garage getting the LR running.
Thank you for your help.

Oh boy. That seems like a problem. But Ryan uses windows and he has compiled it.

Sorry, this stuff can be easy when it works and complicated when it doesn’t.

Makes sense to me.

Update!
I uninstalled NXP-LPC in VScode on Ubuntu 20. Then reinstalled it with the larger version of the same code… I guess when Installing Platformio you get the short version. I don’t know?
Anyway, it worked.
I can compile the code. Finally getting off the starting line!!!
Sadly I couldn’t compile Teaching Tech’s SKR 1.3 with 5160 drivers as the file was too old to compile and had several errors. i guess the board name was changed in the board.h file plus a bunch of other things. I didn’t want to go hunting down all the issues with that old file.

Instead, I took your SKR 1.3 with 2209 drivers and worked on changing that to 5160. It looks like the 2209 and 5160 are similar drivers. So, I changed the drivers and then I went down the list of things that the internet told me to change. Only driver related, i left Stealth Chop off and stuff like that. The idea is that I kept the file as close to your configuration as possible. I did run into the TMC Connection Error last night before bed.

I do feel way more motivated to work on these files if the program is functioning!!!

Side note: (history)
As you know, I have been all over the place with logic boards. Ramps and SKR. Teaching Tech really motivated me to build this machine. So, I bought the SKR 1.3 with TMC5160 drivers. I was going to copy his machine and call it a day back in Sep 2019. I got the board, I got his code and I couldn’t figure out how to get his code to my board. It was not a Firmware.bin file, but I had to compile it. :expressionless:

In March 2020, I got the table done and I was half way done with the LR2. Not knowing how to get the SKR working, I turned to the Ramps 1.4 as I already owned one but had to buy the DRV8825 drivers. Arduino installs easy. Sadly, my ramps has a problem. When I plug in the power, the LCD doesn’t turn on. But if i plug the USB in too, it does work. If that is a jumper problem, then i can’t find where that jumper goes. So, I bought a new Ramps board that I haven’t even turned on yet. Looks nice.

So which board do I want? At this point I don’t care. Any board that will work!
Larry W has a working machine with the Ramps that I own and I was going to try to get that working. But with it being grbl, that put a wrench in the works. Beautiful machine though!
The v503 board firmware you linked has LR2 configurations for SKR1.3, Rambo, and SKR Pro. Not the Ramps. Which is good, it was the original board I was going to use!
I did go through a fair amount of tutorials to make sure the 5160 drivers were set up correctly on the board itself. Now that I can compile code, I am at least trying to get that one working. If I give up, I will load the DRV8825 drivers to the board. looks like i need to solder a couple pins together to make that work.
What a process!
Building the machine is way easier!

1 Like

We don’t have a great rhyme or reason for the configurations I made to get it started. It needs to cover the machines Ryan designs and the boards he sells. Outside of that, each config has maintenance costs and test costs. But boards like the ramps and skr 1.3 seem to be very popular. So… Meh. That’s where I ended up.

1 Like

That makes so much sense!
If I was were Ryan is, then I would do the same exact thing! Support the stuff that is being sold!
I would also say the MPCNC is the flagship project.
The only reason I didn’t do the MPCNC is because I thought it was harder for me to make cabinet doors with that machine. But that machine looks way more robust than the Lowrider. I have a 3’x8’ LR2. I could probably make a MPCNC that size with rail supports.

I also totally debated about buying a board from V1. The reason I didn’t is because the price was way more than what I wanted to pay. However, in the end I may have spent way more??? SKR1.3, Ramps1.6+, TFT35, 5xDRV8825, and 5xTMC5160 on Ali. Oh I thought V1 sold Ramps boards? Also, looks like V1 sells SKR Pro’s. Don’t remember seeing that.

However, I am thankful that you all support boards outside of what you sale! I also think the reason Ramps and SKR1.3 are popular is because of the YouTube videos I have talked about so much. As a noob, I am spending my time watching YouTube videos on how to do everything and not reading forums that can be very confusing. I can only imagine that you have a ton of people like me.
So thank you so much for all the help!

I think the low rider is still champ at those sizes. An skr 1p3 5160 config isn’t a bad idea, really. Because of the traffic from tt.

1 Like

I think the 5v regulator chip on your arduino mega is bad. It is replaceable if you can de-solder the old one. Ryan has them in the shop and you can also get them from online component suppliers.

2 Likes

IT WORKS! Well only the motors work… if the end stops work, I will find out later because I don’t know.
Jeffeb3 I basically only turned on SPI from your SKR 1.3 2209 build. Well other than changing the drivers, current and rsense. (upload://ddcxfXuHIgEYD1u4ns9MhqvdSEh.zip) (118.1 KB) Oh as well as pulling that one pin to the side of the driver. Dumb design!!! looks like clipping this pin is for the SKR 1.3 and 1.4. But you need that pin for the SKR Pro or GTR. I also added a TFT35 Logo Screen. It has the same effect as the Big Tree Tech Logo. fade to black with the light around the edges. I like all three of Ryan’s Logos. [LR2SKR1p35160plusTFT35Logo.zip|attachment]

The “current” issue is bugging me. In the picture I have a 1.8A motor. I set the X_Current to 760. The motor vibrated… come to find out I have bad wiring. However, I did a M122 command when it was vibrating and the Current was 900 not 760. I changed the current so many times no change (Linked value is 800) But it doesn’t matter, it’s always 900 no matter what I change this value to. I did learn about the M906 X760 command to change the current on the fly. It’s really hard to fix wiring issues from the logic board. :laughing: So, is there a line of code that changes the Current back to 900? (void these values for this value?)
Again thank you so much for all the help!!!

Tom Traband: I will totally try replacing the 5v reg and see if the screen turns back on. Thank you for the advice!

2 Likes

M906 X900 will change it back, but it won’t save it. To save it, you need to do M500. Changing it in the firmware won’t work anymore, sort of. On a freshly flashed Marlin, you can use M502 to restore the settings from the firmware and then M500 to save them.

So if you want to try a new current value:

M906 X

If you like that:

M500

If you flash new firmware and you want it to use all the values from the firmware (everything, steps/mm, max speeds, current, everything):

M502

If you like that and want to save it:

M500

1 Like

Awesome thank you!

Not sure my zip worked?
LR2SKR1p35160plusTFT35Logo.zip (118.1 KB)