Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIO env for MKS Nano boards in STM32 #19905

Merged
merged 2 commits into from
Oct 29, 2020

Conversation

rhapsodyv
Copy link
Member

Description

This add nano env board for STM32.

Benefits

A popular board using STM32.

@sjasonsmith
Copy link
Contributor

Should we replace the maple environment, instead of adding a new one?

@rhapsodyv
Copy link
Member Author

rhapsodyv commented Oct 26, 2020

Should we replace the maple environment, instead of adding a new one?

Add, for now. LVGL is used by a lot of nano users. The code for LVGL to work in STM32 is not ready yet.

But I have done:

  • Nano V2 to STM32
  • LVGL for STM32
  • F4 for STM32
  • Nano V3 for STM32
  • Full SPI/DMA class for STM32
  • Thumb driver support for STM32

But most of that devs are incomplete waiting for one thing or another. So I will start to send some parts, even if it will not be currently used by Marlin users, to avoid a big waiting forever PR....

@thinkyhead
Copy link
Member

Good to see this migration slowly coming along, like a herd of majestic caribou…

@thinkyhead thinkyhead merged commit 50ba20f into MarlinFirmware:bugfix-2.0.x Oct 29, 2020
@thinkyhead thinkyhead changed the title MKS Nano boards in STM32 PIO env for MKS Nano boards in STM32 Oct 29, 2020
Vertabreak pushed a commit to Vertabreak/Marlin that referenced this pull request Oct 29, 2020
@Malderin
Copy link
Contributor

Description

This add nano env board for STM32.

Mks robin nano v2 board.
My configs: https://github.com/MarlinFirmware/Marlin/files/5440936/Conf.zip
I tried to build the firmware with default_envs = mks_robin_nano35_stm32
Failure:

Marlin\src\HAL\STM32\timers.cpp:278:41: error: static assertion failed: One or more timer conflict detected
  278 | static_assert(verify_no_duplicate_timers(), "One or more timer conflict detected");
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
*** [.pioenvs\mks_robin_nano35_stm32\src\src\HAL\STM32\timers.cpp.o] Error 1
========================= [FAILED] Took 34.05 seconds =========================

@sjasonsmith
Copy link
Contributor

Nice, my check worked!

I have caught myself on that timer conflict check a surprising number of times since I added it.

@sjasonsmith
Copy link
Contributor

@Malderin you can get past the timer conflict by adding the following lines to pins_MKS_ROBIN_NANO_V2.h, but your configs hit quite a few more issues after that. I think this is great, it provides a good test for this board in the new HAL.

Probably place these below BOARD_INFO_NAME near the top of the file. I'm not positive if this is the best timer to choose, but I think it will work.

#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
  // Variant default conflicts with Servo timer
  #define TEMP_TIMER 5
#endif

@rhapsodyv could you take a look at these configs? The serial port number needs changed, but after that it hits some issues in the MKS UI and SPI code.

By the way, to debug those time conflicts, you can hover over the timers_in_use array in VS Code and see which indexes conflict in the popup.
image

@Malderin
Copy link
Contributor

Probably place these below BOARD_INFO_NAME near the top of the file. I'm not positive if this is the best timer to choose, but I think it will work.

#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
  // Variant default conflicts with Servo timer
  #define TEMP_TIMER 5
#endif

2

@rhapsodyv rhapsodyv deleted the nano-in-stm32 branch October 31, 2020 14:14
@rhapsodyv
Copy link
Member Author

You can't use #define SERIAL_PORT_2 -1 in Nano V2.

@Malderin
Copy link
Contributor

You can't use #define SERIAL_PORT_2 -1 in Nano V2.

I pointed it out like this:
#define SERIAL_PORT 3
//#define SERIAL_PORT_2 -1
In file pins_MKS_ROBIN_NANO_V2.h i indicated it like this (otherwise a timer error is thrown):
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
// Variant default conflicts with Servo timer
#define TEMP_TIMER 5
#endif

A new error appears:

Compiling .pioenvs\mks_robin_nano35_stm32\src\src\lcd\extui\lib\mks_ui\draw_wifi_settings.cpp.o
Marlin\src\lcd\extui\lib\mks_ui\draw_ui.cpp: In function 'void GUI_RefreshPage()':
Marlin\src\lcd\extui\lib\mks_ui\draw_ui.cpp:954:8: error: 'systick_uptime_millis' was not declared in this scope
  954 |   if ((systick_uptime_millis % 1000) == 0) temps_update_flag = true;
      |        ^~~~~~~~~~~~~~~~~~~~~
Compiling .pioenvs\mks_robin_nano35_stm32\src\src\lcd\extui\lib\mks_ui\draw_wifi_tips.cpp.o
Marlin\src\lcd\extui\lib\mks_ui\draw_ui.cpp:955:8: error: 'systick_uptime_millis' was not declared in this scope
  955 |   if ((systick_uptime_millis % 3000) == 0) printing_rate_update_flag = true;
      |        ^~~~~~~~~~~~~~~~~~~~~
*** [.pioenvs\mks_robin_nano35_stm32\src\src\lcd\extui\lib\mks_ui\draw_ui.cpp.o] Error 1
Compiling .pioenvs\mks_robin_nano35_stm32\src\src\lcd\extui\lib\mks_ui\gb2312_puhui16.cpp.o
========================= [FAILED] Took 82.57 seconds =========================
 
Environment             Status    Duration
----------------------  --------  ------------
mks_robin_nano35_stm32  FAILED    00:01:22.574
==================== 1 failed, 0 succeeded in 00:01:22.574 ====================

@rhapsodyv
Copy link
Member Author

LVGL was not ported to STM32 yet. You can’t use that yet.
Try color ui.

@Malderin
Copy link
Contributor

LVGL was not ported to STM32 yet. You can’t use that yet.
Try color ui.

ok. thanks!

Speaka pushed a commit to Speaka/Marlin that referenced this pull request Nov 2, 2020
vgadreau pushed a commit to vgadreau/Marlin that referenced this pull request Dec 9, 2020
tharts pushed a commit to tharts/Marlin that referenced this pull request Jan 6, 2021
kpishere pushed a commit to kpishere/Marlin that referenced this pull request Feb 19, 2021
W4tel-BiDi pushed a commit to W4tel-BiDi/Marlin that referenced this pull request Apr 5, 2021
thinkyhead pushed a commit to thinkyhead/Marlin that referenced this pull request Apr 28, 2021
thinkyhead pushed a commit to thinkyhead/Marlin that referenced this pull request Apr 29, 2021
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.

4 participants