Compiling and running RepRapFirmware on an SKR 1.4 (and other LP17XX boards)

Thanks to the fantastic work of sdavi (and gloomyandy – but I will come to his work later on) over on the reprap forums, its possible to run RepRapFirmware on a number of different LPC17XX based 3D printer controllers. If you don’t know what the RepRapFirmware is, its the same software that runs on the duet family of controllers.

The boards that are supported with example configs are:

  • AZSMZ Mini
  • Azteeg Mini
  • SKR v1.1, 1.3 and 1.4 (both normal and turbo)
  • MKS Sbase v1.3
  • Re-ARM controller for Ramps
  • The original Smoothieboard

One of the limitations of the builds that sdavi was producing (which is in no way his fault) was the lack of control of software UART/SPI based drivers (such as the TMC2208 or TMC2209). Boards such as the smoothieboard or the MKS Sbase use hardware SPI to set the motor currents and this was natively supported in RRF (as this is the way the duet boards control the drivers). Cheaper boards, such as the SKR v1.X range use software to set the currents etc.

This is where GloomyAndy comes in. (He added flash eeprom emulation, improved the USBMSD/USBCDC support and implemented software serial, for TMC devices in Marlin, so the printing community already have a lot to thank him for). He has implemented code for software UART/SPI control of TMC 22XX drivers. This code is still being tested but by all accounts is very stable and I am planning to fit an SKR v1.4 turbo to my Da Vinci Jr this week to help with the testing.

I can hear you all ask how you get in on the action. In that case, read on…

Compiling RepRapFirmware

First off, you need to download 4 different github repos. The best way to do it would be using git and cloning each one, but for this guide, we’re just going to download a copy of each one. Please download the following:

All the repos linked to above are for GloomyAndys version for using with software UART/SPI of TMC 22XX drivers. If you don’t need that control, then use sdavi’s version. Make usre you choose the 3.01 branches.

Unzip all of the repos and arrange them so each of the one is in the CoreLPC4RRF folder. The result should look like this.

Make sure you rename any folders to remove the branch name.

Now download and install VSCode.

Open VSCode and open the extension tab (this can be done by using the shortcut Ctrl+Shift+X) and search for windows-arm-none-eabi. Install the version by metalcode-eu.

Download and install git if you haven’t already.

Then download and install make. Use the “complete package except sources” version. Once installed you will need to add the location of the bin folder that is installed to your windows path environment setting. While there also add the location of mkdir.exe which will have been installed with git. It can be found in the usr/bin folder where git is installed. Once thats done, close VSCode and then reopen it.

Now in VSCode, open the CoreRRF4LPC folder (which has everything else in it) and click terminal, run task and then build. Sit back, relax and in about 10 or 15 minutes, the build should’ve completed.

There’s no longer any need to build gloomyandy’s version of the firmware. He has released a prebuilt binary here. This is for the version that supports TMC22XX via UART. Sdavi also releases prebuilt versions (currently without the UART code). They can be found here.

All thats left then is to copy the firmware.bin from the build folder in the CoreRRF4LPC folder to the sd card in your SKR (or other) board. Put that in your SKR board and you’ll soon be running RepRapFirmware. This can be confirmed by connecting the board to your PC, connecting to it with pronterface, and typing M122. The output will confirm that you are running RRF3.

You will also need to replicate the correct folder structure for RepRapFirmware as described here.

Connecting an ESP (wireless control)

I’ve used a nodemcu ESP8266 with USB programming as it already 5v tolerant and it allows for updating via USB. I have created a fritzing schematic available here.

BOM

  • 1 x nodemcu ESP8266 oe Wemos D1 mini
  • 3 x 47R resistor
  • 1 x 470R resistor
  • 3 x 2200R resistor
  • jumpers or other ways of connecting to the SKR

The image for to flash to the ESP can be found here. It should be flashed using esptools.py. Use the code below as an example. Change the Com port to match the ESP device and make sure you give the .bin file its complete file location if its not in the same folder as esptools.

esptools.py --port COM4 write_flash 0x00000 duetwifi.bin

On a side note, I have a very handy little tool installed on my main laptop thats monitoring for any serial devices as they are plugged in and you get a popup with the Com port number. If you’re interested, it can be found here.

Once the ESP is flashed with the correct binary, the next thing to do is connect it to the SKR. The pinout for the SKR can be found here and the schematic for the Duet 2 Wifi for reference can be found here. The table below shows the pins required on the ESP and what they are connected to on the SKR.

ESP PinSKR PinResistor Value
RST1.31470R
CS/GPIO150.162200R
MOSI/GPIO130.1847R
MISO/GPIO120.1747R
SCLK/GPIO140.1547R
ESP_DATA_Ready/GPIO00.282200R
LPC_DATA_Ready/GPIO41.30None
VIN(5v)5V on EXP1
GNDGND on EXP12200R to RST

Before you connect to the board, you need to ensure that an SD card is inserted and it has the correct files required by RepRapFirmware. An overview can be found here. You also need to ensure that the latest version of DWC is on your SD card. It can be found here. You will need to generate the config files required. That can be achieved by using the RRF config tool found here. Once generated, you’ll need to make sure the pin names are correct for the board you have built RRF for. These can be found in this section of github. Looking in the BIQU_SKR.h file, it can be seen that the x endstop pin is called “xstop” etc.

Finally, you will also need a board.txt file in the sys folder. For the SKR v1.4, mine contains the following

//Config file to define Hardware Pins LPC Boards.
//Note: Each line should be less than 120 characters.
//    : Unwanted options can be commented out or set to NoPin. Lines commented out will get default values
//    : for pins the default is NoPin.
//    : Values for Arrays need to be contained within { and }
//    : Comments can be defined with // or # (comments are not supported inside arrays)
//    : Each config entry must be all on a single line.

//Config for BIQU SKR v1.4 (using config setting from Rob Mendon)

lpc.board = biquskr_1.4

//wifi pins
8266wifi.EspDataReadyPin = 0.28
8266wifi.LpcTfrReadyPin = 1.30
8266wifi.EspResetPin = 1.31

Once connected, power up the SKR board using 12-24v and connect to the USB port on the board. Using a program such as YAT or pronterface, connect to the board. Then type in the following

M552 S0
M587 S"your SSID" P"your password"
M552 S1

If you are using pronteface, it has a tendency to convert all text to upper case, in which case, if you wanted to use “PassWord”, you would write P”P’a’s’sW’o’r’d” with the ‘ indicating the following letter should be lower case. Explanation here.

The blue light on the wifi chip shoould then flash blue and will go solid when a connection has been established. The ip address will be shown on the serial connection. It is also possible to type just M552 to get the current ip address reported back.

The final thing to do is add the line “M552 S1” to your config file. This can be done through the web interface. This just ensures that the wifi connection is started at start up. There is no need to add the M587 command as this is written permanently to the flash of the ESP chip.

Now what?

Work your way through configuring the firmware. All of it is one through the web interface so there is no need for you to compile the firmware every time.

Keep an eye on the thread on the reprap forum for updates made. sdavi may even start releasing pre compiled builds. And remember, if you find any bugs, make sure you report them in the forum.

I will point out that with the SKR v1.4, there is no way to disable sensorless homing (unlike other boards that use a jumper), and as sensorless homing is currently not supported, you will have to either remove or bend the diag pin on the TMC2209 to be able to use mechanical endstops. That caught me out for a couple of hours.

As always, any comments for improvements or questions are always welcomed.

48 comments

    1. To be honest, you don’t need one. It’s just as quick to whip out your phone and take a look as it is to mess on with a display.
      I’ve had a paneldue for my predator for almost a year and I hardly ever use it.
      But you may also struggle for two reasons. One, the current setup for WiFi uses some of the connections on EXP1 and EXP2. Two, the LPC have less Ram than the duet processors. I don’t believe there’s enough free ram to run both networking and an LCD.
      I pretty much always initiate a print directly from cura so never even sit in front of my printer.

      1. Thanks. I agree that it’s not necessary. I don’t plan to have one either on my Duet Predator (or what’s left of it when I’m done).

        I was just curious as I have another printer that I’d like to convert to RepRap firmware that I’d like to sell at some point to make room for a CoreXY build and it just sells easier when you have a buzzword like ‘display’ in the ad..

        I’m just in love with the RRF, makes so many things just a whole lot simpler and I don’t really like Marlin that much. Constant re-compiling of FW is a pain that shouldn’t be necessary in 2020..

  1. HI Jay. Looks like this fork works well and printing awesome, thanks for tutorial. I have little issue sometimes. My Wemos ESP8266 loosing connection and reconnecting to wifi router. i tried another router and the situation the same and random. in terminal i see message WiFi reported error: Lost connection, auto reconnecting. Tryed to reflash ESP, no luck. Maybe someone know the solution.

    1. I have the same problem and I can’t figure out what is going on!!! Anyone can help here? I did all the stepps 3x and nothing

    1. to hold the 8266 in a reset state until after the LPC boots and then signals that it is ready to talk to the 8266.

  2. Can I use tmc2208 with this converted reprap firmware ? Sorry for lame question but i just found your blog few min ago. And at the end it is mentioned about 2209 and sensorles homing. I got one skr 1.4 turbo and some tmc2208 drivers and it will be good to convert it and compare with real duet on my hevo.

      1. Follow up on this sub. In the main blog (at the end inreference to an SDK1.4 you say that “sensorless homing isn’t supported” — I just want to make sure you mean in the RepRap build. Also, I’m pretty sure you can turn off senorless homing with jumpers on the board itself.

        1. The SKR 1.4 has no way to turn off sensorless homing with removing the diag pin.
          And I was referring to sensorless homing in RRF as at the time the article was written it wasn’t supported. It is now though.

    1. Sorry. That board uses a different processor and is not supported.
      And at the moment, the TMC5160’s aren’t supported either

    1. not at the moment. The SKR Pro 1.1 has a totally different CPU and will require a lot of work to get it working.
      I wouldn’t hold your breath for a while

  3. hello, is there any chance to use ESP-01 with skr 1.4 turbo? or i must use esp8266 separately for the wifi?

  4. I would like to try to use this on the Cortex M4 on one of my GTR V1.0. I would guess from comments above that that is not going to work, even though current duet boards run this firmware with this processor? Also with a plug in for the ESP8266 on the SKR 1.4 why can’t that be used for controlling the board through UART as it seems like that is how it is used? I guess my main question is why is there a new circuit for wifi control when onboard wifi is possible.

    1. The processors aren’t the same between the GTR and the duet boards.
      The GTR uses an STM32 MCU, whereas the Duets use an ATSAM MCU so they have different pinouts, instruction sets etc.
      To make it work would require the same level of porting as the LPC version.

      There is a plug for an ESP on the SKR boards but that is using UART whereas RRF uses an SPI connection which is faster.
      The ESP that is supported by the SKR natively is an ESP-01. This doesn’t have the pins or ram required for the DWC interface.

  5. Nice work i have 2 doubts:
    A) i have BTT WIFI module will work with reprap firmware on skr 1.4 turbo ? how to setup same way of your ESP8266 ?
    B) i need cut diag pin on driver TMC 2208 V3 ?

    1. No, it won’t work with the BTT cheap WiFi module, you have to use an ESP-07 or ESP-12/13.
      No, you won’t have to cut the diag pin on a 2208 as it doesn’t support sensorless homing

    2. I can confirm that it does indeed work with the BTT RRF Wifi Module and the skr 1.4 turbo. I had to flash the DWC twice but it does work! I’m using the 2209’s so i can’t help with that .

  6. Nice work 🙂
    how about sensorless homing support, I was going for the 2209 hopping for the sensorless homing?

      1. i was considering going the duet2 wifi route on my predators but this might be a better option so i could use mks or btt servo42 closed loop steppers. I wish duet3d made a version with plug in drivers.

  7. Hello, thank you for your effort. But I couldn’t find an option for TMC5161 (or 5160) in the drivers section. I wonder if you are considering an update anytime soon? I would be very grateful if you could offer support

    1. It’s on the list to be looked at but at the moment we don’t actually have any. We should have some to start the work in the next month or so

      1. Remember that your work deserves a standing ovation. Thank you very much for your attention, I look forward to your work for TMC5161. Save us from trouble and other useless software 🙂

    1. No, unfortunately not due to the small processor that is used.
      The SKR E3 Turbo is supported though.
      A new E3 board called the fly-E3 should be launching next week and will full support RRF with onboard wifi

  8. Just wanted to tank you. Am going to hook up a 8266 to my SKR 1.3. Want to try RepRap firmware!!!

  9. Do you think I can use an ESP32 WROOM? I’m looking for the 8266 I have but can’t find it. Would love to try RRF on my SKR 1.3 with Ender 3. Thanks for you work!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.