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

Update with latest "main" code. #12

Open
wants to merge 43 commits into
base: hc32f460_work
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9b342c6
armcm_link: Rename CONFIG_FLASH_START to CONFIG_FLASH_APPLICATION_ADD…
KevinOConnor Dec 14, 2022
fe0fc29
rp2040: Move watchdog code to new watchdog.c file
KevinOConnor Dec 15, 2022
f6199ef
config: Update generic-bigtreetech-octopus.cfg for f429 and h723 chips
KevinOConnor Dec 13, 2022
9d668d6
stm32: Rework usb_reboot_for_dfu_bootloader() so it works on stm32h723
KevinOConnor Dec 13, 2022
e33b41a
stm32g0: add stm32g0b0 support
leptun Dec 12, 2022
f31540b
stm32: Minor changes to stm32g0b0 ifdefs
KevinOConnor Dec 15, 2022
ac090d9
stm32: Fix stm32l4 build
KevinOConnor Dec 15, 2022
41c7bb8
test: Add compile test builds for stm32g431, stm32h723, stm32l412
KevinOConnor Dec 13, 2022
7d1df81
stm32: Fix USB support on stm32g0b1
KevinOConnor Dec 15, 2022
b0d9cbf
stm32: Fix usb build on stm32g0b0
KevinOConnor Dec 15, 2022
02b45c9
armcm_reset: Flush dcache before rebooting into canboot
KevinOConnor Dec 16, 2022
0c43ae1
stm32: Just clean dcache instead of disabling on stm32h7 dfu reboot
KevinOConnor Dec 16, 2022
3c1ed3b
initial_pins: Add check to reduce compile time size when not in use
KevinOConnor Dec 17, 2022
2a25733
screws_tilt_adjust: Add get_status() method (#5921)
theophile Dec 17, 2022
be74c72
stm32: Separate out USB DFU reboot logic in stm32g4.c
KevinOConnor Dec 15, 2022
b6cd77f
stm32: Separate out USB DFU reboot logic in stm32l4.c
KevinOConnor Dec 15, 2022
4af8786
stm32: Move dfu reboot logic to new dfu_reboot.c file
KevinOConnor Dec 15, 2022
8621ebb
bed_mesh: Allow bedmeshing at 1mm spaced intervals (#5918)
kmobs Dec 19, 2022
f078a27
manual_probe: Add Z_OFFSET_APPLY_ENDSTOP for delta
janherich Nov 25, 2022
aac613b
scripts: support CanBoot on RP2040 in flash_usb.py
clee Dec 19, 2022
9b60daf
tmc: Configurable microstep lookup table (#5920)
leptun Dec 22, 2022
d4bbb83
Merge pull request #1 from SteveGotthardt/hc32f460_work
bsas Dec 23, 2022
56bc3b8
Merge pull request #2 from Klipper3d/master
bsas Dec 23, 2022
4753315
Kconfig: No need to specify "default n" in main Kconfig file
KevinOConnor Dec 19, 2022
4ca1e5f
serial_irq: Rename SERIAL_BOOTLOADER_SIDECHANNEL to HAVE_BOOTLOADER_R…
KevinOConnor Dec 19, 2022
806cf23
stm32: Include "misc.h" in stm32l4.c and stm32g4.c
KevinOConnor Dec 19, 2022
34fd3f4
usb_cdc: Only call bootloader_request() if CONFIG_HAVE_BOOTLOADER_REQ…
KevinOConnor Dec 19, 2022
c620f48
canserial: Only call bootloader_request() if CONFIG_HAVE_BOOTLOADER_R…
KevinOConnor Dec 19, 2022
b51b068
avr: No need to define bootloader_request()
KevinOConnor Dec 19, 2022
1ff0a54
stm32: Check for CONFIG_HAVE_BOOTLOADER_REQUEST in dfu_reboot.c
KevinOConnor Dec 19, 2022
29ba5ab
delta: Better delta build volume constraint check
janherich Nov 30, 2022
f57ff2c
docs: Fix typo in mpu9250 documentation
CODeRUS Dec 29, 2022
6ae6aaf
board_defs: Add Fysetc Cheetah V2 to spi_flash (#5952)
JamesH1978 Dec 31, 2022
40d8c2e
palette2: Fix errors with bad handling of NoneType in a few locations
cmroche Dec 31, 2022
b337cc3
config: Added precise location of [bed_screws] for Ender-3-s1 (#5944)
fire1ce Jan 2, 2023
9c2ccce
stm32: Expand stm32g0 family (#5838)
leptun Jan 3, 2023
448c1a1
stm32: Reindent ifdefs in stm32f0_i2c.c
KevinOConnor Jan 3, 2023
3cd8a72
spi_flash: Add SKR2 F429 chip variant to spi_flash (#5956)
JamesH1978 Jan 4, 2023
cbc17a7
docs: Note v0.11.0 release in Config_Changes.md
KevinOConnor Jan 4, 2023
a564824
serialqueue: Add comment to do_write()
KevinOConnor Jan 5, 2023
4395ae9
serialhdl: Add a get_serialqueue() method
KevinOConnor Jan 5, 2023
01f90e8
console: No need to import pins module
KevinOConnor Jan 7, 2023
9eee141
Merge pull request #3 from Klipper3d/master
bsas Jan 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
stm32: Expand stm32g0 family (Klipper3d#5838)
Add stm32g07x family support.

Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
  • Loading branch information
leptun authored Jan 3, 2023

Verified

This commit was signed with the committer’s verified signature.
TheSpiritXIII Daniel Hrabovcak
commit 9c2ccceb9f4890abe9d2c8a0953ae59fd529b8ef
13 changes: 13 additions & 0 deletions src/stm32/Kconfig
Original file line number Diff line number Diff line change
@@ -65,6 +65,14 @@ choice
bool "STM32F072"
select MACH_STM32F0
select MACH_STM32F0x2
config MACH_STM32G070
bool "STM32G070"
select MACH_STM32G0
select MACH_STM32G07x
config MACH_STM32G071
bool "STM32G071"
select MACH_STM32G0
select MACH_STM32G07x
config MACH_STM32G0B0
bool "STM32G0B0"
select MACH_STM32G0
@@ -104,6 +112,8 @@ config MACH_STM32F4
bool
config MACH_STM32G0
bool
config MACH_STM32G07x
bool
config MACH_STM32G0Bx
bool
config MACH_STM32G4
@@ -149,6 +159,8 @@ config MCU
default "stm32f407xx" if MACH_STM32F407
default "stm32f429xx" if MACH_STM32F429
default "stm32f446xx" if MACH_STM32F446
default "stm32g070xx" if MACH_STM32G070
default "stm32g071xx" if MACH_STM32G071
default "stm32g0b0xx" if MACH_STM32G0B0
default "stm32g0b1xx" if MACH_STM32G0B1
default "stm32g431xx" if MACH_STM32G431
@@ -203,6 +215,7 @@ config RAM_SIZE
default 0x20000 if MACH_STM32F207
default 0x10000 if MACH_STM32F401
default 0x20000 if MACH_STM32F4x5 || MACH_STM32F446
default 0x9000 if MACH_STM32G07x
default 0x24000 if MACH_STM32G0Bx
default 0x20000 if MACH_STM32H7

4 changes: 4 additions & 0 deletions src/stm32/hard_pwm.c
Original file line number Diff line number Diff line change
@@ -117,10 +117,12 @@ static const struct gpio_pwm_info pwm_regs[] = {
{TIM1, GPIO('B', 3), 2, GPIO_FUNCTION(1)},
{TIM3, GPIO('B', 4), 1, GPIO_FUNCTION(1)},
{TIM3, GPIO('B', 5), 2, GPIO_FUNCTION(1)},
#if CONFIG_MACH_STM32G0Bx
{TIM4, GPIO('B', 6), 1, GPIO_FUNCTION(9)},
{TIM4, GPIO('B', 7), 2, GPIO_FUNCTION(9)},
{TIM4, GPIO('B', 8), 3, GPIO_FUNCTION(9)},
{TIM4, GPIO('B', 9), 4, GPIO_FUNCTION(9)},
#endif
{TIM15, GPIO('B', 14), 1, GPIO_FUNCTION(5)},
{TIM15, GPIO('B', 15), 2, GPIO_FUNCTION(5)},
{TIM15, GPIO('C', 1), 1, GPIO_FUNCTION(2)},
@@ -134,10 +136,12 @@ static const struct gpio_pwm_info pwm_regs[] = {
{TIM14, GPIO('C', 12), 1, GPIO_FUNCTION(2)},
{TIM16, GPIO('D', 0), 1, GPIO_FUNCTION(2)},
{TIM17, GPIO('D', 1), 1, GPIO_FUNCTION(2)},
#if CONFIG_MACH_STM32G0Bx
{TIM4, GPIO('D', 12), 1, GPIO_FUNCTION(2)},
{TIM4, GPIO('D', 13), 2, GPIO_FUNCTION(2)},
{TIM4, GPIO('D', 14), 3, GPIO_FUNCTION(2)},
{TIM4, GPIO('D', 15), 4, GPIO_FUNCTION(2)},
#endif
{TIM3, GPIO('E', 3), 1, GPIO_FUNCTION(1)},
{TIM3, GPIO('E', 4), 2, GPIO_FUNCTION(1)},
{TIM3, GPIO('E', 5), 3, GPIO_FUNCTION(1)},
55 changes: 33 additions & 22 deletions src/stm32/stm32f0_i2c.c
Original file line number Diff line number Diff line change
@@ -27,27 +27,34 @@ DECL_ENUMERATION("i2c_bus", "i2c1", 0);
DECL_CONSTANT_STR("BUS_PINS_i2c1", "PB6,PB7");
DECL_ENUMERATION("i2c_bus", "i2c1a", 1);
DECL_CONSTANT_STR("BUS_PINS_i2c1a", "PF1,PF0");

#elif CONFIG_MACH_STM32G0 || CONFIG_MACH_STM32L4
#elif CONFIG_MACH_STM32G0
DECL_ENUMERATION("i2c_bus", "i2c1_PB6_PB7", 0);
DECL_CONSTANT_STR("BUS_PINS_i2c1_PB6_PB7", "PB6,PB7");
DECL_ENUMERATION("i2c_bus", "i2c1_PB8_PB9", 1);
DECL_CONSTANT_STR("BUS_PINS_i2c1_PB8_PB9", "PB8,PB9");
#if CONFIG_MACH_STM32G0
#define GPIO_AF_INDEX 6
DECL_ENUMERATION("i2c_bus", "i2c3_PB3_PB4", 2);
DECL_ENUMERATION("i2c_bus", "i2c1_PA9_PA10", 2);
DECL_CONSTANT_STR("BUS_PINS_i2c1_PA9_PA10", "PA9,PA10");
DECL_ENUMERATION("i2c_bus", "i2c2_PB10_PB11", 3);
DECL_CONSTANT_STR("BUS_PINS_i2c2_PB10_PB11", "PB10,PB11");
DECL_ENUMERATION("i2c_bus", "i2c2_PB13_PB14", 4);
DECL_CONSTANT_STR("BUS_PINS_i2c2_PB13_PB14", "PB13,PB14");
#ifdef I2C3
DECL_ENUMERATION("i2c_bus", "i2c3_PB3_PB4", 5);
DECL_CONSTANT_STR("BUS_PINS_i2c3_PB3_PB4", "PB3,PB4");
#elif CONFIG_MACH_STM32L4
#define GPIO_AF_INDEX 4
DECL_ENUMERATION("i2c_bus", "i2c3_PA7_PB4", 2);
DECL_CONSTANT_STR("BUS_PINS_i2c3_PA7_PB4", "PA7,PB4");
#endif
#elif CONFIG_MACH_STM32L4
DECL_ENUMERATION("i2c_bus", "i2c1_PB6_PB7", 0);
DECL_CONSTANT_STR("BUS_PINS_i2c1_PB6_PB7", "PB6,PB7");
DECL_ENUMERATION("i2c_bus", "i2c1_PB8_PB9", 1);
DECL_CONSTANT_STR("BUS_PINS_i2c1_PB8_PB9", "PB8,PB9");
DECL_ENUMERATION("i2c_bus", "i2c1_PA9_PA10", 2);
DECL_CONSTANT_STR("BUS_PINS_i2c1_PA9_PA10", "PA9,PA10");
DECL_ENUMERATION("i2c_bus", "i2c2_PB10_PB11", 3);
DECL_CONSTANT_STR("BUS_PINS_i2c2_PB10_PB11", "PB10,PB11");
DECL_ENUMERATION("i2c_bus", "i2c2_PB13_PB14", 4);
DECL_CONSTANT_STR("BUS_PINS_i2c2_PB13_PB14", "PB13,PB14");
DECL_ENUMERATION("i2c_bus", "i2c1_PA9_PA10", 5);
DECL_CONSTANT_STR("BUS_PINS_i2c1_PA9_PA10", "PA9,PA10");
DECL_ENUMERATION("i2c_bus", "i2c3_PA7_PB4", 5);
DECL_CONSTANT_STR("BUS_PINS_i2c3_PA7_PB4", "PA7,PB4");
#elif CONFIG_MACH_STM32G4
DECL_ENUMERATION("i2c_bus", "i2c1_PA13_PA14", 0);
DECL_CONSTANT_STR("BUS_PINS_i2c1_PA13_PA14", "PA13,PA14");
@@ -72,18 +79,22 @@ static const struct i2c_info i2c_bus[] = {
{ I2C1, GPIO('B', 6), GPIO('B', 7), GPIO_FUNCTION(1) },
{ I2C1, GPIO('F', 1), GPIO('F', 0), GPIO_FUNCTION(1) },
{ I2C1, GPIO('B', 8), GPIO('B', 9), GPIO_FUNCTION(1) },

#elif CONFIG_MACH_STM32G0 || CONFIG_MACH_STM32L4
{ I2C1, GPIO('B', 6), GPIO('B', 7), GPIO_FUNCTION(GPIO_AF_INDEX) },
{ I2C1, GPIO('B', 8), GPIO('B', 9), GPIO_FUNCTION(GPIO_AF_INDEX) },
#if CONFIG_MACH_STM32G0
{ I2C3, GPIO('B', 3), GPIO('B', 4), GPIO_FUNCTION(GPIO_AF_INDEX) },
#elif CONFIG_MACH_STM32L4
{ I2C3, GPIO('A', 7), GPIO('B', 4), GPIO_FUNCTION(GPIO_AF_INDEX) },
#elif CONFIG_MACH_STM32G0
{ I2C1, GPIO('B', 6), GPIO('B', 7), GPIO_FUNCTION(6) },
{ I2C1, GPIO('B', 8), GPIO('B', 9), GPIO_FUNCTION(6) },
{ I2C1, GPIO('A', 9), GPIO('A', 10), GPIO_FUNCTION(6) },
{ I2C2, GPIO('B', 10), GPIO('B', 11), GPIO_FUNCTION(6) },
{ I2C2, GPIO('B', 13), GPIO('B', 14), GPIO_FUNCTION(6) },
#ifdef I2C3
{ I2C3, GPIO('B', 3), GPIO('B', 4), GPIO_FUNCTION(6) },
#endif
{ I2C2, GPIO('B', 10), GPIO('B', 11), GPIO_FUNCTION(GPIO_AF_INDEX) },
{ I2C2, GPIO('B', 13), GPIO('B', 14), GPIO_FUNCTION(GPIO_AF_INDEX) },
{ I2C1, GPIO('A', 9), GPIO('A', 10), GPIO_FUNCTION(GPIO_AF_INDEX) },
#elif CONFIG_MACH_STM32L4
{ I2C1, GPIO('B', 6), GPIO('B', 7), GPIO_FUNCTION(4) },
{ I2C1, GPIO('B', 8), GPIO('B', 9), GPIO_FUNCTION(4) },
{ I2C1, GPIO('A', 9), GPIO('A', 10), GPIO_FUNCTION(4) },
{ I2C2, GPIO('B', 10), GPIO('B', 11), GPIO_FUNCTION(4) },
{ I2C2, GPIO('B', 13), GPIO('B', 14), GPIO_FUNCTION(4) },
{ I2C3, GPIO('A', 7), GPIO('B', 4), GPIO_FUNCTION(4) },
#elif CONFIG_MACH_STM32G4
{ I2C1, GPIO('A', 13), GPIO('A', 14), GPIO_FUNCTION(4) },
{ I2C1, GPIO('A', 15), GPIO('A', 14), GPIO_FUNCTION(4) },
13 changes: 11 additions & 2 deletions src/stm32/stm32g0.c
Original file line number Diff line number Diff line change
@@ -36,14 +36,18 @@ lookup_clock_line(uint32_t periph_base)
if ((periph_base == FDCAN1_BASE) || (periph_base == FDCAN2_BASE))
return (struct cline){.en=&RCC->APBENR1,.rst=&RCC->APBRSTR1,.bit=1<<12};
#endif
#ifdef USB_BASE
if (periph_base == USB_BASE)
return (struct cline){.en=&RCC->APBENR1,.rst=&RCC->APBRSTR1,.bit=1<<13};
#endif
#ifdef CRS_BASE
if (periph_base == CRS_BASE)
return (struct cline){.en=&RCC->APBENR1,.rst=&RCC->APBRSTR1,.bit=1<<16};
#endif
#ifdef I2C3_BASE
if (periph_base == I2C3_BASE)
return (struct cline){.en=&RCC->APBENR1,.rst=&RCC->APBRSTR1,.bit=1<<23};
#endif
if (periph_base == TIM1_BASE)
return (struct cline){.en=&RCC->APBENR2,.rst=&RCC->APBRSTR2,.bit=1<<11};
if (periph_base == SPI1_BASE)
@@ -106,8 +110,11 @@ clock_setup(void)
}
pllcfgr |= (pll_freq/pll_base) << RCC_PLLCFGR_PLLN_Pos;
pllcfgr |= (pll_freq/CONFIG_CLOCK_FREQ - 1) << RCC_PLLCFGR_PLLR_Pos;
pllcfgr |= (pll_freq/FREQ_USB - 1) << RCC_PLLCFGR_PLLQ_Pos;
RCC->PLLCFGR = pllcfgr | RCC_PLLCFGR_PLLREN | RCC_PLLCFGR_PLLQEN;
#ifdef RCC_PLLCFGR_PLLQ
pllcfgr |= ((pll_freq/FREQ_USB - 1) << RCC_PLLCFGR_PLLQ_Pos)
| RCC_PLLCFGR_PLLQEN;
#endif
RCC->PLLCFGR = pllcfgr | RCC_PLLCFGR_PLLREN;
RCC->CR |= RCC_CR_PLLON;

// Wait for PLL lock
@@ -119,8 +126,10 @@ clock_setup(void)
while ((RCC->CFGR & RCC_CFGR_SWS_Msk) != (2 << RCC_CFGR_SWS_Pos))
;

#ifdef USB_BASE
// Use PLLQCLK for USB (setting USBSEL=2 works in practice)
RCC->CCIPR2 = 2 << RCC_CCIPR2_USBSEL_Pos;
#endif
}