Skip to content

SKR Pro 1.1: WiFi support, clarify onboard/lcd SD#17531

Merged
thinkyhead merged 1 commit intoMarlinFirmware:bugfix-2.0.xfrom
Bob-the-Kuhn:BTT-SKR-PRO-WIFIF-and-LCD-SD-support
Apr 16, 2020
Merged

SKR Pro 1.1: WiFi support, clarify onboard/lcd SD#17531
thinkyhead merged 1 commit intoMarlinFirmware:bugfix-2.0.xfrom
Bob-the-Kuhn:BTT-SKR-PRO-WIFIF-and-LCD-SD-support

Conversation

@Bob-the-Kuhn
Copy link
Contributor

@Bob-the-Kuhn Bob-the-Kuhn commented Apr 13, 2020

BTT_SKR_PRO_V1_1 has a connector for an 8 pin ESP8266 WIFI module. This PR adds support for that module.

Changes:

  • pins_BTT_SKR_PRO_V1_1.h - added WIFI section.
  • The enable pin on the WIFI module must be high for it to work. Just leaving it float is not acceptable. The routine WIFI_init was created to do this and added to the setup section of MarlinCore.cpp.
  • pinsDebug_list.h - added WIFI pins to it

I didn't see an obvious home for the WIFI_init routine. I put it in the file WIFI_init.cpp in the \Marlin\src\HAL\shared directory. I have no objection to moving it somewhere else.


The SD card logic was modified in pins_BTT_SKR_PRO_V1_1.h

  • ONBOARD SD card can now be used if a SPI LCD is present
  • Moved the LCD's SD card SDSS declaration into the LCD section
  • Added comments indicating that the ONBOARD SD uses a soft SPI while the LCD's SD card uses the default hardware SPI.

TESTING

The web page provided by the WIFI module is fully functional. I've moved steppers, uploaded files to the SD card and changed the extruder temperature.

The LCD changes were tested with a REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER and a MKS MINI12864.

@BastR
Copy link
Contributor

BastR commented Apr 14, 2020

Hi Bob, if I compile with this:
Capture d’écran 2020-04-14 à 21 59 28

I've got a lot of problems:
Capture d’écran 2020-04-14 à 22 00 06

If I comment this 3 lines, there is no problems:

#if SDCARD_CONNECTION == LCD
#define SDSS PB12 // Uses default hardware SPI for LCD's SD
#endif

There is also the addition of E0_AUTO_FAN_PIN as PC9, I have the same problem described before because I'm using E0_AUTO_FAN_PIN with FAN1_PIN like this:

Capture d’écran 2020-04-14 à 22 06 17

@BastR
Copy link
Contributor

BastR commented Apr 14, 2020

I confirm, ONBOARD SD card works correctly if I comment

//#if SDCARD_CONNECTION == LCD
//#define SDSS PB12 // Uses default hardware SPI for LCD's SD
//#endif

If I uncomment it, the SD card is not detected.

@Keltere
Copy link

Keltere commented Apr 15, 2020

@BastR thanks for testing, ill try to finish rebuild my 3d printer this week so i could also test it.
Did you test if it's visible on windows?

@BastR
Copy link
Contributor

BastR commented Apr 15, 2020

@Keltere no I can't test this because I guess I must have a wi-fi module on the board and I don't have one.

I just tested on octoprint and the SD card is visible, running a gcode also

@Bob-the-Kuhn
Copy link
Contributor Author

There is something strange going on with the declarations for LCD, ONBOARD and CUSTOM_CABLE.

They were not defined in the version of bugfix 2.0.x I started with so only the ONBOARD SD worked. When I manually added the defines then I could switch back and forth using the Configuration_adv.h file.

When I went to submit the PR the dif showed that the current bugfix already had them present but the next day I tried to compile using the latest bugfix and the declarations had apparently disappeared. I remember they were in an unusual location so maybe I'm fooling myself.


That E0_AUTO_FAN_PIN "fun" will always be with us as long as the config file is used to declare it. Some people love it that way, some don't. I figure the safest thing to do is declare it in the pins_BTT_SKR_PRO_V1_1.h file and let the compiler complain. That ensures the user has thought about how to handle it.


Besides the changes to the pins_BTT_SKR_PRO_V1_1.h file, the only other Marlin changes I needed to do to support WIFI was to set SERIAL_PORT_2 to 6 and to enable ESP3D_WIFISUPPORT. I also enabled WEBSUPPORT and OTASUPPORT but I have not tested to see if either or both are needed.

The WIFI module I used was a $2 8 pin ESP8266 module. By far the hardest part was getting the firmware into the module. My first attempt followed a YouTube video. It provided a correct way to program the module but it pointed me at the wrong repository. Using the programming info from the video and the link in Configuration_adv.h resulted in a functioning module.

@grauerfuchs
Copy link
Contributor

LCD SD vs. Onboard:
Why not leave the SDSS declaration where it was? That will eliminate the redefinition warning as well as provide an order of preference with onboard first.

E0_AUTO_FAN_PIN:
If you wrap this in an #ifndef statement, it won't try to override the user's setting but will still define it if the user hasn't set one. I agree it's probably something that will have to be changed in the long run, but it seems it's either this or #undef before defining in the config if you want to avoid the warning.

I don't have a wifi module to test with, but the functional onboard SD is a much needed feature, and I can confirm it works on mine as well. Thank you!

@thinkyhead thinkyhead changed the title BTT_SKR_PRO_V1_1 - Add WIFI support and clarify SD card support SKR Pro 1.1: WiFi support, clarify onboard/lcd SD Apr 16, 2020
@thinkyhead
Copy link
Member

thinkyhead commented Apr 16, 2020

Oops! I forgot in a few pins files that the macro SD_CONNECTION_IS(blob) is required to test for the current value of SDCARD_CONNECTION (which is defined as a "blob"). That is now patched in this PR too.

@thinkyhead thinkyhead force-pushed the BTT-SKR-PRO-WIFIF-and-LCD-SD-support branch 4 times, most recently from 6554a3f to 2538ea6 Compare April 16, 2020 08:33
@thinkyhead thinkyhead force-pushed the BTT-SKR-PRO-WIFIF-and-LCD-SD-support branch from 2538ea6 to 2a1a544 Compare April 16, 2020 08:38
@thinkyhead thinkyhead merged commit f5d809f into MarlinFirmware:bugfix-2.0.x Apr 16, 2020
@thinkyhead
Copy link
Member

I think I got all the kinks out, but please submit any followup patches and I'll get to them asap.

@DroneMang
Copy link

DroneMang commented Apr 16, 2020 via email

@Bob-the-Kuhn
Copy link
Contributor Author

I tried to upload firmware.bin via the WIFI but gave up after 5 failures.

@vivian-ng
Copy link
Contributor

@Bob-the-Kuhn My understanding is that ESP3D_WIFISUPPORT is for enabling ESP3DLib, which is slightly different from ESP3D. Both use the ESP3D_webUI, but ESP3DLib is specifically for running on ESP32 microprocessor being used for Marlin itself. ESP3D is for running on a separate ESP8266 or ESP32 connected to a microprocessor (such as STM32F1 or ATMEGA2560) running Marlin. ESP3D communicates with the Marlin microprocessor via UART.

I could be wrong, so best to ask @luc-github who is the author of both ESP3D and ESP3DLib.

@luc-github
Copy link
Contributor

yes @vivian-ng comment is correct, ESP3D_WIFISUPPORT and others related wifi settings are for esp32 boards hosting marlin not for daughter wifi board, as mentioned https://github.com/MarlinFirmware/Marlin/blob/2.0.x/Marlin/Configuration_adv.h#L3044
I know it could be confusing as esp3d web ui is common for all

@vivian-ng
Copy link
Contributor

@Bob-the-Kuhn As mentioned by @luc-github, the WiFi support options in Configuration_adv.h are only relevant if you are running Marlin on an ESP32 microcontroller. If you are using a daughterboard, as far as I know, these options are ignored since they are only checked by the ESP32 HAL.

@DroneMang For OTA:

  1. If you are running Marlin on an ESP32 microcontroller, the "Update firmware" option in ESP3D_webUI can be used to update Marlin.
  2. If you are using a WiFi daughterboard (like the ESP8266 module connected to the SKR Pro 1.1), the "Update firmware" option in the ESP3D_webUI can be used to update ESP3D firmware on that daughterboard. If you want to use this option to update Marlin... I believe you will need to rewrite the bootloader on the SKR Pro 1.1's microcontroller to create a protocol for such an update via UART, and also amend the ESP3D firmware to tell the daughterboard how to use such a protocol to update the main microcontroller. This is an area beyond me so I am really guessing here.

For the daughterboard to boot up properly, the pins EN, RST, IO0, and IO15 need to be in certain states. I don't have a SKR Pro 1.1 board, so I cannot check, but if you have one on hand, can you check what is the default states for these pins to see if they are in the right configuration? Most manufacturers should already have set these connections to the right state (HIGH or LOW) using pull-up and pull-down resistors, so setting them via firmware is usually not required.
ESP8266 boot selection

@Lino77
Copy link

Lino77 commented Apr 19, 2020

is there a specific reason why your E0_AUTO_FAN_PIN is set to PC9 I have it on PE5 FAN1_PIN PC9 is a pin from the Extension-1 port

@jimhiggs
Copy link

I have updated to the latest bugfix2 which includes this PR but I am stumped. My esp01s works fine when plugged into the back of my tft3v2 and I access via eps3d but plugged into the skr pro i get nothing. I have checked the 3.3v and enable (3.3v) are there. I also double checked that it hadn't switched into AP mode. IP scanner not finding it at all. I have set serial_port_2 to 6 (also tried serial_port). Does it need to receive something before it fires up?

@luc-github
Copy link
Contributor

luc-github commented Apr 20, 2020

@jimhiggs I do not have SKR pro but I had same issue with BTT TFT a standard ESP01 would not start when the one I get with TFT was ok
The issue for me was the EN pin on TFT is not connected when it should be to 3.3V
The BTT ESP01 seems having it connected on board itself when standard ESP01 is not - I soldered a bridge on my ESP01 between EN and 3.3V and that fixed the problem
image

I hope it help

@jimhiggs
Copy link

@luc_github. Thanks for the ideas. My problem is actually the reverse of what you had.The ESP01 work perfectly on the TFT, it is on the SKR Pro main board that it does not work. The latest bugfix defines the pin for EN and pulls it high and I have measured that there is 3.3v on the EN pin when it is plugged into the Pro. I will test the ESP01s to make sure the EN pin is wired to the header pin. I also have a second ESP01S which I would like to load fw and test. I got my esp01s from BTT.
The best solution for me would be if ESP3D could read the SD card in the TFT and the card in the Pro. That way I could use both USB and Wifi options. I want to be able to copy files to the SD without moving sd cards around and be able to start/stop them either from the PC or at the printer.
I have the SD card on board the pro working now and can see files on ESP3D and start a print. Problem is I can not cancel/abort the print from ESP3D but also having a problem cancelling from pronterface running on usb connection. I am am holding back out on raising issues though until I am sure it is not something I have wrong. I also can not upload files but I see from one of your other issues you are aware of that.

@luc-github
Copy link
Contributor

luc-github commented Apr 20, 2020

@jimhiggs my mistake I missed the tft3v2 part on your previous post, though you mentioned the flash device

The best solution for me would be if ESP3D could read the SD card in the TFT and the card in the Pro. That way I could use both USB and Wifi options. I want to be able to copy files to the SD without moving sd cards around and be able to start/stop them either from the PC or at the printer.
I have the SD card on board the pro working now and can see files on ESP3D and start a print. Problem is I can not cancel/abort the print from ESP3D but also having a problem cancelling from pronterface running on usb connection. I am am holding back out on raising issues though until I am sure it is not something I have wrong. I also can not upload files but I see from one of your other issues you are aware of that.

For ESP3D related issues please go to https://github.com/luc-github/ESP3D as they should not be related to Marlin FW, even less when TFT is involved

@jimhiggs
Copy link

Will do.

@jimhiggs
Copy link

Thats great to hear. I bought an i2c memory card from aliexpress, only a couple $. That works great.

@Bob-the-Kuhn
Copy link
Contributor Author

@vivian-ng

Your comments on driving the WIFI interface lines made me nervous so I did some further checking.

The SKR PRO does not have pullups on the lines in question so I went looking for an ESP01 schematic. Below is the schematic I found that matches my board.

The GPIO0 and GPIO2 pins are software configurable for pullup, pulldown or none.

I never did find anything in the ESP8266EX docs on leaving the external reset pin open.

I'm going to submit a PR that will init the pins if they are defined. That way it'll get looked at and someone will yell if it's totally off base.

FYI - both schematics I looked at had the ESP8266's MTDO pin as not connected to anything.

image

@jimhiggs
Copy link

I could not find a schematic for the 3.5TFTv2 I have. I wonder could that have pullups or sw pullups defined? Which could explain why my ESP01S works in the TFT but not on the Pro.

@Bob-the-Kuhn
Copy link
Contributor Author

I'l started PR #17679 to allow the user to initialize the GPIO pins to logic high if desired.

@BastR
Copy link
Contributor

BastR commented Apr 23, 2020

@BastR - saving EEPROM to the SD card is now the default. It's working properly on my board.

@Bob-the-Kuhn Ok I understood my error, with this PR FLASH_EEPROM_EMULATED is enabled by default and doesn't allow to save the eeprom on the SD card, once commented it works correctly.

Capture d’écran 2020-04-23 à 21 09 05

Thanks

@Bob-the-Kuhn
Copy link
Contributor Author

@jimhiggs

I thought the esp01 was set to use 192.168.0 for its AP whereas my home Network is 192.168.1

If your ESP01 is set for 192.168.0 then it'll never show up as a client on your home network.

Does it show up on your home network if it is installed in the 3.5TFTv2? If yes then I expect the 3.5TFTv2 is changing the ESP01's SSID at powerup but not saving the changes.

You might try this:

  1. Plug the ESP01 onto your SKR PRO
  2. Temporarily change your home network to 192.168.0
  3. See if it shows up in the client list.
  4. If it does then open a browser window for it. You may have to use http://your_IP_address?forcefallback=yes to actually get the page to show up in the browser.
  5. Once the window opens you'll be able to use the ESP3D tab to permanently set the SSID credentials.

@jimhiggs
Copy link

jimhiggs commented Apr 24, 2020

@Bob-the-Kuhn
Ok so I changed to 192.168.0 and I could see ESP3D in the client list. So I clicked on the esp3d tab and the IP, gateway etc where all 2 numbers only eg. 192.168. I set them to 192.168.1.1 for the gateway and 192.168.1.59 for the static ip and changed from DHCP to static. I then powered down the printer, changed ip back to 192.168.1 and powered up the printer. I could connect to esp3d on 1.59. Great. Not so fast. I tried viewing onboard sd contents, realised I had no sd in so put it back in and refreshed. Nothing 1.59 was again timing out no response. After an hour of back and forth, including changing back to 192.168.0 and no couldn't see it there either. I pulled the ESP and stuck it back in the TFT and everything works and can connect on 1.59 ! One thing I also noted that the response from M117 showing the IP that is sent by ESP3D never showed all the time it was plugged into the pro. Soon as I plugged it into the TFT it showed 192.168.1.59. Im hoping this is something to do with pins floating as suggested.

@Bob-the-Kuhn
Copy link
Contributor Author

Does the ESP3D show up in the home router's client list?

When things are working on my system the status line on the LCD, after a reset, will show connected after 10-15 seconds followed a few seconds later by the IP address being used by the ESP3D. Are you seeing any of this?

@jimhiggs
Copy link

It always shows up in the client list when plugged into the TFT. It did when plugged into the pro when i changed router ip to 0 and it did after i changed it back to 1 - for a brief while, then it stopped showing??? The IP shows in the lcd when plugged into tft but did not show when plugged into pro.

@jimhiggs
Copy link

jimhiggs commented Apr 24, 2020

Just to confuse matters, I inserted a new esp01s (I originally bought 2) into the pro and flashed the ESP3D (esp3d.bin) software from bigtreetech pro github firmware page and I am able to see it fine on 192.168.1. x.
The other esp01s I was using was initially flashed the same way back in Oct/Nov.

Edit: I cycled the power on the pro with the new esp and the same thing happened as previously. I can no longer connect to it. Put it in the TFT and it works fine.

@jimhiggs
Copy link

@Bob-the-Kuhn
If you could let me know what code you would change in marlin to do it I will test it on my pro.

@jimhiggs
Copy link

jimhiggs commented Apr 24, 2020

Sorry, I just realised you have already defined them in #17679 If I can work out how to merge them in with my local clone I will , otherwise I will make the changes manually. Actually looks like manually may be easier for me.

@jimhiggs
Copy link

I can confirm with your PR #17679 applied I can now use the ESP01S and ESP3D on my SKR Pro. Thank you.

@Sineos
Copy link

Sineos commented Apr 25, 2020

Do these improvements also apply for SKR 1.4?

@Bob-the-Kuhn
Copy link
Contributor Author

They apply to all boards that use the ESP01.

@DroneMang
Copy link

I can confirm with your PR #17679 applied I can now use the ESP01S and ESP3D on my SKR Pro. Thank you.

Could you outline the steps needed to get this working on the SKR PRO? Trying to get this working myself. Thanks!

@oldman4U
Copy link

Hello DroneMang.

Do you still need help with this?

@DroneMang
Copy link

DroneMang commented May 20, 2020 via email

@luc-github
Copy link
Contributor

@DroneMang for this PR and this usage you must not use https://github.com/luc-github/ESP3DLib
this is for Marlin installed on ESP32 board as explained here : #17531 (comment)

For SKP Pro just follow https://github.com/luc-github/ESP3D and https://github.com/luc-github/ESP3D-WEBUI

@DroneMang
Copy link

Installation
Please use the latest ESP3D firmware and copy the index.html.gz file on root of SPIFFS, in theory ESP3D have a version of web-ui but it may not be the latest one

In regards to the above from the install section, how do you actually flash new firmware onto the wifi module for the SKR PRO?

It would be really helpful if someone could post their config files for an SKR PRO with the wifi module working.

Thanks!

@oldman4U
Copy link

Hello Master Luc.

@DroneMang Please make sure you have a ESP01S and NOT a ESP01 (without S) WIFI board and a SKR Pro v1.1 and that the ESP01S board is correctly installed to the SKR board. If so the installation is very easy and if you want, i will guide you the same way i used. For this download the software provided here first: https://github.com/bigtreetech/BIGTREETECH-SKR-PRO-V1.1/tree/master/firmware/esp-01s
Once done, copy the esp3d.bin file onto an SD card and put it into the SKR. Power up the SKR and a green or blue led on the WIFI board will start to flash far approximately 20 seconds. Once this is done, you need a computer and a local network, where you should see the ESP as an available network. This means, that the ESP WIFI module acts like a network you can connect to at this stage. Let me know once this is done and i will explain the next steps.

@Bob-the-Kuhn
Copy link
Contributor Author

I just tried the esp3d.bin file on SD card on a SKR PRO 1.1 that has a working ESP01S. The lights flashed and the file was renamed to ESP3D.CUR. It came up with the old ESP3D config (client mode, logged onto my WIFI). I then uploaded the other 3 files in the Github directory which resulted in the Dashboard and ESP3D pages being available.

Unfortunately the ESP01 no longer talks to the SKR PRO.


I had no idea that the esp3d.bin method was available. Is there any Marlin documentation on this?

@extesy
Copy link

extesy commented May 22, 2020

@Bob-the-Kuhn It has nothing to do with Marlin. That is SKR's bootloader doing.

@Bob-the-Kuhn
Copy link
Contributor Author

Is it the ROM based or secondary bootloader on the STM32 that handles the esp3d.bin file?

Is this a generic function that will examine all xxxx.bin files?

Is this function also on the LPC1768 systems?

@AnHardt
Copy link
Contributor

AnHardt commented May 22, 2020

It's definitely the BTT-bootloader (secondary). Found the string.

Is this a generic function that will examine all xxxx.bin files?

No.

We non't know much about the BTT-bootloader for the SKR PRO 1.1 - the source is not public.

Is this function also on the LPC1768 systems?

I don't think so. At least i have never heard about that.

jmp0x0000 pushed a commit to jmp0x0000/Marlin that referenced this pull request Aug 7, 2020
njibhu pushed a commit to njibhu/Marlin that referenced this pull request Aug 24, 2020
HairingX pushed a commit to HairingX/Marlin that referenced this pull request Jun 16, 2021
@Bob-the-Kuhn Bob-the-Kuhn deleted the BTT-SKR-PRO-WIFIF-and-LCD-SD-support branch June 29, 2022 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.