Commit Graph

448 Commits

Author SHA1 Message Date
Kevin O'Connor df6136802a linux: Use enumerations for pin mappings
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-17 19:38:18 -04:00
Kevin O'Connor ae24baf99a pru: Use enumerations for pin mappings
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-17 19:38:18 -04:00
Kevin O'Connor 91cf497656 stm32f1: Use enumerations for pin mappings
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-17 19:38:18 -04:00
Kevin O'Connor 8aa8feedb8 lpc176x: Use enumerations for pin mappings
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-17 19:38:18 -04:00
Kevin O'Connor 7e2c0ffa91 atsamd: Use enumerations for pin mappings
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-17 19:38:18 -04:00
Kevin O'Connor 8b0195f896 atsam: Use enumerations for pin mappings
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-17 19:38:18 -04:00
Kevin O'Connor 8f541d090e avr: Use enumerations for pin mappings
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-17 19:38:18 -04:00
Kevin O'Connor db6e2d4c9e msgproto: Convert static strings to a more generic enumeration system
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-17 19:38:18 -04:00
Kevin O'Connor 7d73a35805 command: Support evaluating C expressions in DECL_CONSTANT()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-17 19:38:18 -04:00
Kevin O'Connor b28e95ca1a command: Always pass a string to the DECL_CONSTANT() macro
Make it clear that the name of the constant being defined is a string.
When the value being defined is also a string, use a new
DECL_CONSTANT_STR() macro.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-17 19:38:18 -04:00
Kevin O'Connor b9b03dd082 stepper: Require an explicit reset_step_clock after stepper_stop()
If the stepper is stopped by the endstop code, then ignore any further
stepper moves until a reset_step_clock command is received.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-17 19:38:18 -04:00
Kevin O'Connor 4718f39b2f flash_usb: Run dfu-util via sudo
Default to running dfu-util via sudo as most machines will not have
the user setup with permissions to access the raw usb device.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-11 22:33:24 -04:00
Kevin O'Connor a5aede52cb flash_usb: Try to make the bossac atsam reboot logic more stable
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-10 15:06:41 -04:00
Kevin O'Connor 34d32c7823 stepper: Support an optimized step/unstep function on ARM
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-10 10:27:02 -04:00
Kevin O'Connor 9466c2d66c stm32f1: Add support for entering the bootloader via USB
Add support for entering the "stm32duino" bootloader via the arduino
1200 baud USB request.  Add supprot for flashing over USB via the
"make flash" command.

Rename the existing "make flash" command to "make serialflash".

Default to using a bootloader in Kconfig.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-08 22:22:41 -05:00
Kevin O'Connor 6a16e1f4c5 atsamd: Add support to "make flash" to automatically enter the bootloader
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-08 22:22:41 -05:00
Kevin O'Connor 079fdf8807 atsam: Improve support for flashing over USB
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-08 22:22:41 -05:00
Kevin O'Connor f5b10f0c13 lpc176x: Add support for flashing via "make flash"
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-08 22:22:41 -05:00
Kevin O'Connor 399d539969 Makefile: Reduce use of $^ in build rules
It's rare to use all of a target's prerequisites in a recipe - replace
most cases with $< (the target's first prerequisite).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-02 12:01:44 -05:00
Kevin O'Connor 9430fea2c5 Makefile: Fix lpc176x and stm32f1 builds
Commit e18501d0 broke the build for targets that added objects to
klipper.elf via adding dependencies.  Rework the build so that it is
possible to add objects to klipper.elf via a new OBJS_klipper.elf
makefile variable.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-02 11:26:14 -05:00
Kevin O'Connor 309a47c781 atsamd: Reduce memory for have_run_init in spi/i2c
Some of the samd21 chips have limited memory - change the code to
reduce the size of global variables.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-01 19:31:18 -05:00
Kevin O'Connor 946eb6b7ae atsamd: Add definitions for SAMD21E18 chip
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-01 19:05:00 -05:00
Kevin O'Connor 0b33e0b427 atsamd: Implement custom memory allocation functions
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-01 19:05:00 -05:00
Kevin O'Connor fbef144e7b atsamd: Use CONFIG_MCU in Makefile
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-01 19:03:34 -05:00
Kevin O'Connor d57bc79513 atsamd: Use the full micro-controller name for CONFIG_MCU
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-01 19:03:34 -05:00
Kevin O'Connor d33c4820bd atsamd: Use local linker script
Use a local linker script instead of the linker script provided by
Atmel.  This will allow Klipper to use dynamic memory allocation.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-01 19:03:34 -05:00
Kevin O'Connor c8d7e28a35 atsamd: Add support for programming SERCOM pins
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-01 00:40:44 -05:00
Kevin O'Connor 7c50bd89cf pru: Wrap code to 80 columns
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-27 14:20:15 -05:00
Kevin O'Connor c3eb976119 stm32f1: Wrap code to 80 columns
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-27 14:20:15 -05:00
Kevin O'Connor 796b7ac738 avr: Wrap code to 80 columns
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-27 14:20:15 -05:00
Kevin O'Connor 2a64dfc242 spicmds: Wrap code to 80 columns
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-27 14:20:15 -05:00
Kevin O'Connor f1be6a3969 pwmcmds: Wrap code to 80 columns
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-27 14:20:15 -05:00
Kevin O'Connor 69247d87fb stepper: Wrap code to 80 columns
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-27 14:20:15 -05:00
Kevin O'Connor 03348fab47 buttons: Wrap code to 80 columns
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-27 14:20:15 -05:00
Kevin O'Connor 7b3331ff52 atsamd: Wrap code to 80 columns
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-27 14:20:15 -05:00
Kevin O'Connor c07371a2f0 simulator: Wrap code to 80 columns
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-27 14:20:15 -05:00
Kevin O'Connor 5a74549ef6 atsam: Wrap code to 80 columns
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-27 14:20:15 -05:00
Kevin O'Connor dddfb681c7 pins: Add support for pull down resistors
Add initial support for selecting pull down resistors (for
micro-controllers that support it).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-27 11:13:21 -05:00
Kevin O'Connor 9e8077009e atsamd: Default to using an external 32Khz crystal
Most samd boards have the crystal and it does improve the clock
accuracy, so default to enabling it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-24 00:37:03 -05:00
Kevin O'Connor da68da7a63 atsamd: Add support for reference clock selection to SAMD21
Add support for using the internal clocks (with USB clock recovery
mode if available) on the SAMD21.  Don't use the internal clock if the
external crystal is requested (instead use the PLL synced to the
external 32Khz signal).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-22 09:07:26 -05:00
Kevin O'Connor d452a1de48 atsamd: Update SAMD51 clock configuration
Add support for USB clock recovery mode if an external 32Khz crystal
is not in use.  If using an external crystal, then don't use the
internal 48Mhz DFLL48Mhz clock (just use the PLLs synced to the
external 32Khz signal).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-22 09:02:04 -05:00
Kevin O'Connor 7a32860455 atsamd: Increase ADC frequency on SAMD51
The SAMD51 ADC is only clocked on rising edges (vs both rising and
falling edges on the SAMD21) and it has a greater minimum frequency
than the SAMD21.  So, increase the ADC clock.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-22 08:56:44 -05:00
Kevin O'Connor ebc80ecea4 atsamd: Only support 8KiB bootloader on SAMD21
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-22 08:51:46 -05:00
Kevin O'Connor 37797c8128 atsamd: Add a GET_FUSE() helper macro
Add a helper macro for accessing the non-volatile factory-calibrated
"fuse" values.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-22 08:51:46 -05:00
Kevin O'Connor a285668b46 avr: Only prompt for cpu speed and uart port on LOW_LEVEL_OPTIONS
The cpu is almost always 16Mhz and the serial port is almost always
UART0, so no need to prompt in the normal case.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-16 08:23:00 -05:00
Kevin O'Connor a090b31713 atsamd: Fix samd51 get_clock() sync bit check
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-16 08:03:28 -05:00
Kevin O'Connor 52eef84228 atsamd: Fix typo in Makefile
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-16 07:57:30 -05:00
Kevin O'Connor b33ad59e25 atsamd: Do not generate 200M/100M interal clocks
Now that the internal DWT timer is used for software timers, there is
no need to clock the peripherals at a higher clock speed.  Clock all
peripherals at 48Mhz and simplify the clock generation code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-16 07:57:24 -05:00
Kevin O'Connor a00657d2ae atsamd: Don't clear the watchdog if a clear is still in progress
Clearing the watchdog while it is in progress can cause bus stalls on
the SAMD21.  It appears that clearing the watchdog on the SAMD51 can
cause lockups of the watchdog device.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-15 22:13:28 -05:00
Kevin O'Connor 00e0a70a94 atsamd: Move watchdog code to its own files
Move the watchdog code from main.c to watchdog.c and
samd51_watchdog.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-15 22:10:41 -05:00