Skip to content

Commit

Permalink
Improve and extend RUMBA32 (#18249)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissbarr authored Jun 12, 2020
1 parent ea20c77 commit c12111e
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 60 deletions.
29 changes: 15 additions & 14 deletions Marlin/src/core/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,20 +324,21 @@
#define BOARD_BEAST 4200 // STM32F4xxVxT6 Libmaple-based STM32F4 controller
#define BOARD_GENERIC_STM32F4 4201 // STM32 STM32GENERIC-based STM32F4 controller
#define BOARD_ARMED 4202 // Arm'ed STM32F4-based controller
#define BOARD_RUMBA32_AUS3D 4203 // RUMBA32 STM32F446VET6 based controller from Aus3D
#define BOARD_RUMBA32_MKS 4204 // RUMBA32 STM32F446VET6 based controller from Makerbase
#define BOARD_BLACK_STM32F407VE 4205 // BLACK_STM32F407VE
#define BOARD_BLACK_STM32F407ZE 4206 // BLACK_STM32F407ZE
#define BOARD_STEVAL_3DP001V1 4207 // STEVAL-3DP001V1 3D PRINTER BOARD
#define BOARD_BTT_SKR_PRO_V1_1 4208 // BigTreeTech SKR Pro v1.1 (STM32F407ZG)
#define BOARD_BTT_BTT002_V1_0 4209 // BigTreeTech BTT002 v1.0 (STM32F407VG)
#define BOARD_BTT_GTR_V1_0 4210 // BigTreeTech GTR v1.0 (STM32F407IGT)
#define BOARD_LERDGE_K 4211 // Lerdge K (STM32F407ZG)
#define BOARD_LERDGE_X 4212 // Lerdge X (STM32F407VE)
#define BOARD_VAKE403D 4213 // VAkE 403D (STM32F446VET6)
#define BOARD_FYSETC_S6 4214 // FYSETC S6 board
#define BOARD_FLYF407ZG 4215 // FLYF407ZG board (STM32F407ZG)
#define BOARD_MKS_ROBIN2 4216 // MKS_ROBIN2 (STM32F407ZE)
#define BOARD_RUMBA32_V1_0 4203 // RUMBA32 STM32F446VET6 based controller from Aus3D
#define BOARD_RUMBA32_V1_1 4204 // RUMBA32 STM32F446VET6 based controller from Aus3D
#define BOARD_RUMBA32_MKS 4205 // RUMBA32 STM32F446VET6 based controller from Makerbase
#define BOARD_BLACK_STM32F407VE 4206 // BLACK_STM32F407VE
#define BOARD_BLACK_STM32F407ZE 4207 // BLACK_STM32F407ZE
#define BOARD_STEVAL_3DP001V1 4208 // STEVAL-3DP001V1 3D PRINTER BOARD
#define BOARD_BTT_SKR_PRO_V1_1 4209 // BigTreeTech SKR Pro v1.1 (STM32F407ZG)
#define BOARD_BTT_BTT002_V1_0 4210 // BigTreeTech BTT002 v1.0 (STM32F407VG)
#define BOARD_BTT_GTR_V1_0 4211 // BigTreeTech GTR v1.0 (STM32F407IGT)
#define BOARD_LERDGE_K 4212 // Lerdge K (STM32F407ZG)
#define BOARD_LERDGE_X 4213 // Lerdge X (STM32F407VE)
#define BOARD_VAKE403D 4214 // VAkE 403D (STM32F446VET6)
#define BOARD_FYSETC_S6 4215 // FYSETC S6 board
#define BOARD_FLYF407ZG 4216 // FLYF407ZG board (STM32F407ZG)
#define BOARD_MKS_ROBIN2 4217 // MKS_ROBIN2 (STM32F407ZE)

//
// ARM Cortex M7
Expand Down
10 changes: 8 additions & 2 deletions Marlin/src/pins/pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,9 @@
#include "stm32f4/pins_GENERIC_STM32F4.h" // STM32F4 env:STM32F4
#elif MB(ARMED)
#include "stm32f4/pins_ARMED.h" // STM32F4 env:ARMED
#elif MB(RUMBA32_AUS3D)
#elif MB(RUMBA32_V1_0)
#include "stm32f4/pins_RUMBA32_AUS3D.h" // STM32F4 env:rumba32_f446ve
#elif MB(RUMBA32_V1_1)
#include "stm32f4/pins_RUMBA32_AUS3D.h" // STM32F4 env:rumba32_f446ve
#elif MB(RUMBA32_MKS)
#include "stm32f4/pins_RUMBA32_MKS.h" // STM32F4 env:rumba32_mks
Expand Down Expand Up @@ -651,6 +653,7 @@
#define BOARD_BIGTREE_SKR_MINI_E3 -1016
#define BOARD_BIGTREE_SKR_E3_DIP -1017
#define BOARD_RUMBA32 -1018
#define BOARD_RUMBA32_AUS3D -1019

#if MB(MKS_13)
#error "BOARD_MKS_13 has been renamed BOARD_MKS_GEN_13. Please update your configuration."
Expand Down Expand Up @@ -691,7 +694,9 @@
#elif MB(STEVAL)
#error "BOARD_STEVAL has been renamed BOARD_STEVAL_3DP001V1. Please update your configuration."
#elif MB(RUMBA32)
#error "BOARD_RUMBA32 is now BOARD_RUMBA32_MKS or BOARD_RUMBA32_AUS3D. Please update your configuration."
#error "BOARD_RUMBA32 is now BOARD_RUMBA32_MKS or BOARD_RUMBA32_V1_0. Please update your configuration."
#elif MB(RUMBA32_AUS3D)
#error "BOARD_RUMBA32_AUS3D is now BOARD_RUMBA32_V1_0. Please update your configuration."
#else
#error "Unknown MOTHERBOARD value set in Configuration.h"
#endif
Expand All @@ -715,6 +720,7 @@
#undef BOARD_BIGTREE_SKR_MINI_V1_1
#undef BOARD_BIGTREE_SKR_E3_DIP
#undef BOARD_RUMBA32
#undef BOARD_RUMBA32_AUS3D

#endif

Expand Down
56 changes: 46 additions & 10 deletions Marlin/src/pins/stm32f4/pins_RUMBA32_AUS3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,57 @@
#pragma once

/**
* Pin assignments for the MKS RUMBA32
* Pin assignments for the RUMBA32
*
* https://aus3d.com.au/rumba32
* https://github.com/Aus3D/RUMBA32
*
* The MKS and Aus3D versions have the same pinout but the MKS version
* has some added resistors and LEDs. The resistors needed for the
* TMC2208/9 UART interface are among the additions. Also added were
* connectors and resistors dedicated to the TMC2130 sensorless homing
* interface.
*/

#define BOARD_INFO_NAME "Aus3D RUMBA32"
#define BOARD_INFO_NAME "RUMBA32"

#if NO_EEPROM_SELECTED
#if MB(RUMBA32_V1_0)
#define FLASH_EEPROM_EMULATION
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#elif MB(RUMBA32_V1_1)
#define I2C_EEPROM
#define MARLIN_EEPROM_SIZE 0x2000 // 8KB (24LC64T-I/OT)
#endif
#endif

#define RUMBA32_V1_0
//#define I2C_EEPROM
#if ENABLED(FLASH_EEPROM_EMULATION)
// Decrease delays and flash wear by spreading writes across the
// 128 kB sector allocated for EEPROM emulation.
#define FLASH_EEPROM_LEVELING
#endif

#include "pins_RUMBA32_common.h"

#if MB(RUMBA32_V1_1)

#define SERVO0_PIN PA15
#undef BTN_PIN

#if HAS_TMC_UART
//
// TMC2208/TMC2209 stepper drivers - Software Serial is used according to below pins
//
#define X_SERIAL_TX_PIN PA14
#define X_SERIAL_RX_PIN PC14

#define Y_SERIAL_TX_PIN PA13
#define Y_SERIAL_RX_PIN PE4

#define Z_SERIAL_TX_PIN PB10
#define Z_SERIAL_RX_PIN PE0

#define E0_SERIAL_TX_PIN PD11
#define E0_SERIAL_RX_PIN PC13

#define E1_SERIAL_TX_PIN PB3
#define E1_SERIAL_RX_PIN PD5

#define E2_SERIAL_TX_PIN PB4
#define E2_SERIAL_RX_PIN PD1
#endif
#endif
39 changes: 11 additions & 28 deletions Marlin/src/pins/stm32f4/pins_RUMBA32_MKS.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,21 @@

#define BOARD_INFO_NAME "MKS RUMBA32"

#define RUMBA32_V1_0
#if NO_EEPROM_SELECTED
#define FLASH_EEPROM_EMULATION
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#endif

#if ENABLED(FLASH_EEPROM_EMULATION)
// Decrease delays and flash wear by spreading writes across the
// 128 kB sector allocated for EEPROM emulation.
#define FLASH_EEPROM_LEVELING
#endif

#define ENABLE_SPI1
//#define I2C_EEPROM

#include "pins_RUMBA32_common.h"

//
// Software SPI pins for TMC2130 stepper drivers
//
#if ENABLED(TMC_USE_SW_SPI)
#ifndef TMC_SW_MOSI
#define TMC_SW_MOSI PA7
#endif
#ifndef TMC_SW_MISO
#define TMC_SW_MISO PA6
#endif
#ifndef TMC_SW_SCK
#define TMC_SW_SCK PA5
#endif
#endif

#if HAS_TMC_UART
/**
* TMC2208/TMC2209 stepper drivers
Expand Down Expand Up @@ -96,14 +90,3 @@
#define E2_SERIAL_TX_PIN PD12
#define E2_SERIAL_RX_PIN PD1
#endif

//
// LCD / Controller
//

// Alter timing for graphical display
#if HAS_GRAPHICAL_LCD
#define BOARD_ST7920_DELAY_1 DELAY_NS(96)
#define BOARD_ST7920_DELAY_2 DELAY_NS(48)
#define BOARD_ST7920_DELAY_3 DELAY_NS(600)
#endif
44 changes: 40 additions & 4 deletions Marlin/src/pins/stm32f4/pins_RUMBA32_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

/**
* Common pin assignments for all RUMBA32 boards
*
*/

#ifndef STM32F4
Expand All @@ -31,11 +32,21 @@
#error "RUMBA32 boards support up to 3 hotends / E-steppers."
#endif

#define RUMBA32_V1_0
#define DEFAULT_MACHINE_NAME BOARD_INFO_NAME

//#define I2C_EEPROM
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
// Use soft PWM for fans - PWM is not working properly when paired with STM32 Arduino Core v1.7.0
// This can be removed when Core version is updated and PWM behaviour is fixed.
#define FAN_SOFT_PWM

//
// Configure Timers
// TIM6 is used for TONE
// TIM7 is used for SERVO
// TIMER_SERIAL defaults to TIM7 so we'll override it here
//
#define STEP_TIMER 10
#define TEMP_TIMER 14

This comment has been minimized.

Copy link
@thinkyhead

thinkyhead Jun 19, 2020

Member

@chrissbarr — Looks like this change is causing some major problems. What did you test with?

This comment has been minimized.

Copy link
@chrissbarr

chrissbarr Jun 20, 2020

Author Contributor

A few standard hardware configurations in PlatformIO and the Arduino IDE. What problems are we seeing - can you point me towards any discussion/reports on this? Happy to investigate.

This comment has been minimized.

Copy link
@dankatanka

dankatanka Jun 20, 2020

@chrissbarr I have MKS rumba32 board.
With #define STEP_TIMER steppers going too fast. 120mm/s +
With #define TEMP_TIMER PID autotune never ends

Also #define TIMER_SERIAL defines in Marlin/src/HAL/STM32/SoftwareSerial.cpp so I am do not uderstend why it need here

This comment has been minimized.

Copy link
@chrissbarr

chrissbarr Jun 20, 2020

Author Contributor

Hi @dankatanka, thanks for the info. I'll test and see if I can reproduce the issues you're experiencing. Out of interest, does the motor speed seem to be some multiple of the speed you expect? (i.e. is it going twice as fast, for example?)

With regards to TIMER_SERIAL, the SoftwareSerial.cpp definition evaluates to TIM7, as the STM32F446 has no TIM18:

#if !defined(TIMER_SERIAL)
#if  defined(TIM18_BASE)
#define TIMER_SERIAL TIM18
#elif defined(TIM7_BASE)
#define TIMER_SERIAL TIM7

The STM32Duino Core is already using TIM7 to generate servo signals, so when both software serial and servos are used at the same time there is a conflict and things do not work correctly. Manually defining TIMER_SERIAL to a timer that does not clash fixes this. I have more details on which timers are assigned for what purpose here.

Edit: @dankatanka, any chance you can provide a link to your configuration.h file so I can copy your setup?

This comment has been minimized.

Copy link
@romandoss

romandoss Jun 20, 2020

I can confirm too that changes on MKS provides x2 or so speed on steppers, but PID I not trying.

This comment has been minimized.

Copy link
@dankatanka

This comment has been minimized.

Copy link
@chrissbarr

chrissbarr Jun 20, 2020

Author Contributor

Thanks @romandoss and @dankatanka.

I can confirm I am seeing the speed change, and that it looks to be exactly 2x speed. Annoyed I didn't notice this in testing, thanks for pointing it out. Sorry you had to discover it in use though!

It looks like this is because some of the timers clock from F_CPU, and some from F_CPU/2. The previous timer used F_CPU/2, and TIM10 uses F_CPU. The timer initialisation code in the HAL assumes all timers clock from F_CPU/2:

#define HAL_TIMER_RATE (F_CPU / 2) // frequency of timer peripherals

I'm unsure how to improve the initialisation to distinguish which timers use which clock source.

One solution is to change to a timer that uses the same timebase as the original. Changing STEP_TIMER in the pins file from 10 to 12 is working for me - can you give that a go and see if that gets things running at correct speeds for you?

This comment has been minimized.

Copy link
@dankatanka

dankatanka Jun 20, 2020

Seems works normaly with #define STEP_TIMER 12

This comment has been minimized.

Copy link
@chrissbarr

chrissbarr Jun 21, 2020

Author Contributor

That's good, thanks for confirming @dankatanka. It looks like the above assumption in the HAL_TIMER_RATE is the issue, and I've opened a PR (#18374) with a fix.

Are you still experiencing the PID autotune issue? I have not attempted to reproduce this yet. I notice there is a PR (#18352) merged yesterday that fixes a problem with the PID autotune - perhaps that is the cause of the problem you're seeing?

#define TIMER_SERIAL TIM9

//
// Limit Switches
Expand Down Expand Up @@ -80,6 +91,18 @@
#define E2_ENABLE_PIN PD0
#define E2_CS_PIN PD1

#if ENABLED(TMC_USE_SW_SPI)
#ifndef TMC_SW_MOSI
#define TMC_SW_MOSI PA7
#endif
#ifndef TMC_SW_MISO
#define TMC_SW_MISO PA6
#endif
#ifndef TMC_SW_SCK
#define TMC_SW_SCK PA5
#endif
#endif

//
// Temperature Sensors
//
Expand All @@ -101,7 +124,7 @@
#define FAN1_PIN PA8

//
// I2C
// SPI
//
#define SCK_PIN PA5
#define MISO_PIN PA6
Expand Down Expand Up @@ -143,4 +166,17 @@
#define LCD_PINS_D7 PE15
#endif

// Alter timing for graphical display
#if HAS_GRAPHICAL_LCD
#ifndef BOARD_ST7920_DELAY_1
#define BOARD_ST7920_DELAY_1 DELAY_NS(96)
#endif
#ifndef BOARD_ST7920_DELAY_2
#define BOARD_ST7920_DELAY_2 DELAY_NS(48)
#endif
#ifndef BOARD_ST7920_DELAY_3
#define BOARD_ST7920_DELAY_3 DELAY_NS(600)
#endif
#endif

#endif
14 changes: 12 additions & 2 deletions buildroot/share/tests/rumba32_f446ve-tests
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,24 @@ set -e

# Build examples
restore_configs
opt_set MOTHERBOARD BOARD_RUMBA32_AUS3D
opt_set MOTHERBOARD BOARD_RUMBA32_V1_0
opt_set SERIAL_PORT -1
opt_disable PIDTEMP
opt_enable PIDTEMPBED
opt_set TEMP_SENSOR_BED 1
opt_disable THERMAL_PROTECTION_BED
opt_set X_DRIVER_TYPE TMC2130
exec_test $1 $2 "rumba32_f446ve with TMC2130, PID Bed, and bed thermal protection disabled"
exec_test $1 $2 "rumba32_f446ve V1.0 with TMC2130, PID Bed, and bed thermal protection disabled"

# Build examples
restore_configs
opt_set MOTHERBOARD BOARD_RUMBA32_V1_1
opt_set SERIAL_PORT -1
opt_enable PIDTEMPBED EEPROM_SETTINGS EEPROM_CHITCHAT REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
opt_set TEMP_SENSOR_BED 1
opt_set X_DRIVER_TYPE TMC2130
opt_set Y_DRIVER_TYPE TMC2208
exec_test $1 $2 "rumba32_f446ve V1.1 with TMC2130, TMC2208, PID Bed, EEPROM settings, and graphic LCD controller"

# cleanup
restore_configs

0 comments on commit c12111e

Please sign in to comment.