Commit Graph

906 Commits

Author SHA1 Message Date
D4SK c1136bef10 stm32: Add hardware pwm for stm32h7
Signed-off-by: Konstantin Vogel <konstantin.vogel@gmx.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-06 18:20:29 -04:00
D4SK 0a55489e2c stm32: Add initial support for stm32h7
Signed-off-by: Konstantin Vogel <konstantin.vogel@gmx.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-06 18:20:29 -04:00
D4SK 28b3c9e88c armc_boot: Support cortex-m7 chips
Signed-off-by: Konstantin Vogel <konstantin.vogel@gmx.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-06 18:17:06 -04:00
D4SK a05650f33c armcm_irq: Support cortex-m7 chips
Signed-off-by: Konstantin Vogel <konstantin.vogel@gmx.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-06 18:17:06 -04:00
Kevin O'Connor 8cf1b51223 linux: Support spidev4 through spidev7
The rpi4 has additional spi devices.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-09-15 11:06:10 -04:00
Kevin O'Connor 22167f9510 adxl345: Compress each sample from 6 bytes to 5 bytes
Transmit data from mcu to host using 5 bytes per sample and up to 10
samples per message block.  This improves bandwidth efficiency.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-30 12:25:50 -04:00
Kevin O'Connor e34137582d adxl345: Implement timing via new adxl345_status messages
Query the adxl345 message counter every 100ms so that accurate timing
can be obtained during measurements.  This allows the adxl345 data to
be exported with timestamps while captures are running.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-30 12:25:50 -04:00
Kevin O'Connor 3f46609c1d usb_cdc: Increase USB transmit size
Increase the transmit buffer size to better support bulk transmission
of sensor data.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-30 12:12:11 -04:00
Michael Kurz efbb704522 lpc176x: Fix wrong inital value at PWM setup
This fixes a PWM going to full scale output when a initial value != 0 was
given. The output was on 100% until another update occurred.

This change enables the PWM counter before setting the channel values.

Fixes KevinOConnor/klipper#4559

Signed-off-by: Michael Kurz <michi.kurz@gmail.com>
2021-08-23 21:29:29 -04:00
Kevin O'Connor 7fddc5a8fa avr: Fix typo causing broken gpio mappings
Commit 070fac07 had a typo causing two PINE definitions to be added to
the list of available GPIOs.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-15 09:48:33 -04:00
Kevin O'Connor 070fac0702 avr: Define PORTE on atmega328p
The atmega328pb supports PORTE, but the current avr-libc toolchain
doesn't support the atmega328pb.  So, for now, add support for PORTE
to atmega328p.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-14 22:00:17 -04:00
Kevin O'Connor cf3c7cd99a avr: Rename the analog-only PE0/PE1 pins on atmega168/328 to PE2/PE3
The atmega328pb has officially named these pins as PE2 and PE3, so use
that naming scheme instead of the previous Klipper invented names.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-14 22:00:17 -04:00
Kevin O'Connor 0971a8c2e1 stm32: Support PB7/PB6 for USART1 on stm32f0
Add support for USART1 on PB7/PB6.

Remove STM32_SERIAL_USART1_ALT_PA15_PA14 option and allow all serial
mappings to be used on stm32f031.

Reported by @Desuuuu.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-01 13:46:31 -04:00
Simon Hawkenson 698ca1d0ae
stm32: Add 16KiB bootloader option for STM32F103 (#4493)
The Eryone ER-20 is a STM32F103 based 3D printer which ships with a 16KiB bootloader. Their official version of Marlin starts at 0x08004000.

Signed-off-by: Simon Hawkenson <simon@hawkenson.ca>
2021-07-15 14:09:56 -04:00
Lasse Dalegaard 84523f2811 rp2040: implement SPI
This implements SPI for the rp2040 target. All output groupings of both
SPI blocks are available for use.

Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
2021-07-15 13:30:20 -04:00
Lasse Dalegaard 28f60f7ef6 rp2040: hardware PWM support
This implements hardware PWM support for the rp2040. The maximum
value(100% duty) is set to 255 to match the other controllers. Cycle
time is clamped automatically, and uses the full 8.4 fractional range of
the rp2040 PWM block. This allows a maximum PWM frequency of 490kHz and
a minimum frequency of 1915 Hz.

Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
2021-07-09 11:23:48 -04:00
Henky Prayoga 4802c6d86a
stm32: Allow STM32F401 boards to use STM32 HID Bootloader (#4461)
Signed-off-by: Henky Prayoga <henky.prayoga@callysta-engineering.com>
2021-07-09 11:20:30 -04:00
Kevin O'Connor f2b4d353d8 rp2040: Add _ramfunc macro to internal.h and use in bootrom.c and chipid.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-04 12:45:27 -04:00
Lasse Dalegaard ba958468b7 rp2040: add chipid support
The rp2040 doesn't have a chip ID, but the flash chip connected does. We
can get this ID by asking the flash chip directly, but doing so requires
disengaging the XIP layer, performing the interrogation of the flash
chip, and then re-enabling the XIP layer. This gives us a 64-bit unique
ID that we can use as our USB serial number.

Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
2021-07-04 12:43:45 -04:00
Lasse Dalegaard 0597210cb9 rp2040: support usb_request_bootloader
Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-04 11:30:19 -04:00
Lasse Dalegaard bb2f27f928 rp2040: remove unused linker option
In binutils 2.36 and above the -nostartfiles option is no longer
ignored. -nostartfiles is actually a gcc option, and so isn't supported
by ld. Earlier versions of binutils however had less error checking, and
thus just ignored the option.

Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
2021-07-04 16:36:52 +02:00
Kevin O'Connor c5667193c9 rp2040: Initial USB support
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-04 10:11:02 -04:00
Kevin O'Connor 59fe878241 rp2040: Add initial adc support
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-04 10:11:02 -04:00
Kevin O'Connor 045bfa4e8d rp2040: Add initial support for the rp2040 mcu
Support the rp2040 (as tested on a Raspberry Pi Pico board).  This
adds basic uart, timer, gpio, and watchdog support.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-04 10:11:02 -04:00
Kevin O'Connor 1b79ffcad2 lcd_st7920: Check CONFIG_MACH_AVR for slow mcus
Use CONFIG_MACH_AVR instead of CONFIG_CLOCK_FREQ to check for slow
mcus.  Some fast MCUs do not export a high clock frequency.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-04 10:11:02 -04:00
Kevin O'Connor b55703d837 Makefile: Allow CONFIG_HAVE_GPIO_BITBANGING when not CONFIG_HAVE_GPIO_SPI
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-04 10:11:02 -04:00
Kevin O'Connor 1e11b76379 usb_cdc: Add comments on debugging USB connections via UART
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-04 10:11:02 -04:00
henrikssn 430578957f
stm32: Add support for STM32F072 (used in the TurboCAN board) (#4412)
* Add menuconfig option for stm32f072
* Add support for internal temp of stm32f072
* Share the temperature calculation logic between stm32f0x2 MCUs

Signed-off-by: Erik Henriksson <erikhenrikssn@gmail.com>
2021-06-27 20:35:34 -04:00
github@matthewlloyd.net 23f466bfce config: Add configs for Prusa Buddy and Mini+
Signed-off-by: Matthew Lloyd <github@matthewlloyd.net>
2021-06-14 12:37:34 -04:00
Kevin O'Connor 05c2d51a12 trsync: Introduce new "trigger synchronization" support
Separate out the stepper stopping code from endstop.c into its own
trsync.c code file.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-09 18:58:35 -04:00
Sergey Alirzaev c19d1fbb59 Makefile: Include debug symbols in the .elf
Signed-off-by: Sergey Alirzaev <zl29ah@gmail.com>
2021-06-08 19:29:16 -04:00
Kevin O'Connor bd65c37ed5 atsamd: Add support for 25Mhz crystals
Needed for the Duet3 Mini 5+ board.  Reported by @lukeslaboratory.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-04 17:48:21 -04:00
Kevin O'Connor 6266e7c259 atsamd: Fix pll reference in samd51 config_dpll()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-04 17:02:17 -04:00
Kevin O'Connor d619796495 Revert "linux: Raise an error if configuring a pullup when that is not supported"
This reverts commit 70ea0806d9.

The above commit breaks software spi on linux hosts.  Revert that
commit until an improved error check can be implemented.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-05-27 11:33:24 -04:00
Kevin O'Connor 4ea434796b stm32: Support spi1 on PB4/PB5/PB3 on stm32f103 and stm32f2
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-05-26 00:04:30 -04:00
Kevin O'Connor f99dca0918 stm32: Allow alternate USART1 and USART2 ports on stm32f1 and stm32f2
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-05-25 23:50:28 -04:00
Kevin O'Connor 273106358d stm32: Reorganize stm32f1 pin remap handling
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-05-25 23:50:28 -04:00
Kevin O'Connor 12acb99a38 stm32: Fix USART3 on stm32f1 and stm32f2
Commit 6a3c357a incorrectly disabled support for USART3 on stm32f1 and
stm32f2 - restore that support.

Also, add support for USART3 on PD9/PD8 on stm32f103.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-05-25 22:13:09 -04:00
Kevin O'Connor b1f6a608c3 lpc176x: Add support for serial on UART3 P4.29/P4.28
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-05-25 12:58:26 -04:00
Kevin O'Connor ce8fe615ed lpc176x: Move pin definitions together in serial.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-05-25 12:44:13 -04:00
Kevin O'Connor 6a3c357a50 stm32: Add alternate serial ports on stm32f4
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-05-24 21:17:51 -04:00
Kevin O'Connor c1e8ee58e7 stm32: Include pin names in STM32_SERIAL_USART?_ALT kconfig symbols
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-05-24 21:06:04 -04:00
Kevin O'Connor 338bc82d0b stm32: Allow 32KiB bootloader on stm32f446
Useful on the Octopus board.  Reported by @bigtreetech.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-05-20 19:12:09 -04:00
Kevin O'Connor 1ed67120cd debugcmds: Remove start/end_group commands
These commands were never used by the main code and are not
particularly helpful for debugging.  Remove them to reduce code size -
in particular on the pru architecture.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-05-07 13:53:47 -04:00
Kevin O'Connor bde6215c3f stm32: Enable ADC3 pins on stm32f446
Reported by @bigtreetech.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-05-06 12:43:13 -04:00
Kevin O'Connor 45cd3543e3 lpc176x: Use full peripheral clock speed; fix UART interface
Commit ae89a659 caused a regression in the lpc176x UART handling.
After that commit the UART clock divisor would need to be 6.25 on
lpc1768 or 7.5 on lpc1769, but the code only supports whole numbers.

Set the PCLKSELx registers at startup and return to using full speed
peripheral clocks.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-05-04 20:29:48 -04:00
Wilhelm Schuster 1fb091c4fa stm32: Allow selecting bootloader size for STM32F446
Signed-off-by: Wilhelm Schuster <ws@rot13.io>
2021-05-03 14:36:18 -04:00
Kevin O'Connor edea52863a endstop: Report trigger time in endstop_query response
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-30 11:40:37 -04:00
Kevin O'Connor 470b1e2e46 adxl345: Use "clock" suffix instead of "time" in commands
The debugging code knows how to handle fields that end in "clock".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-30 11:40:37 -04:00
Kevin O'Connor b611e72a19 pulse_counter: Use "clock" suffix instead of "time" in commands
The debugging code knows how to handle fields that end in "clock".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-30 11:40:37 -04:00
Kevin O'Connor 8f76e53c0e stepper: Remove min_stop_interval from mcu code
Now that the host never uses a min_stop_interval, remove it from the
mcu code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-30 11:26:19 -04:00
Kevin O'Connor 70ea0806d9 linux: Raise an error if configuring a pullup when that is not supported
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-25 11:54:11 -04:00
Kevin O'Connor 3dadcd3614 linux: Minor formatting, variable name, and error reporting changes
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-25 11:12:46 -04:00
Michael Kurz 308f0338cf lpc176x: Add i2c_read functionality
This adds the i2c_read command to the lp176x MCU.

Signed-off-by: Michael Kurz <michi.kurz@gmail.com>
2021-04-25 10:37:28 -04:00
pkElectronics dd7085cbca
stm32: Added mcu temperature support additional mcu (#4211)
Enabled MCU_Temperature sensor for STM32F405 based boards

Signed-off-by: Pascal Wistinghausen <pascal.wistinghausen@ib-wistinghausen.de>
2021-04-25 10:35:15 -04:00
Kevin O'Connor acd94909bc linux: Don't use timer_repeat_until for linux "irq" polling
Use a simpler counter system to prioritize tasks and irqs when busy.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-21 22:02:08 -04:00
Kevin O'Connor 92fe116dc7 sched: Call irq_poll() at start of run_tasks() loop
On architectures that poll for irqs, check for any pending irqs prior
to checking if tasks are idle.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-21 19:38:31 -04:00
Kevin O'Connor 8f9e497d69 linux: Rework timer_check_periodic() to use ticks
Avoid using a 'struct timespec' to simplify the code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-19 09:50:40 -04:00
Kevin O'Connor e0aba590f9 linux: Move timer fields into a struct
Storing the fields in a struct allows gcc to optimize memory pointers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-19 08:53:47 -04:00
Kevin O'Connor db0fb5d596 linux: Avoid calling timer_read_time() in timer_dispatch() when not needed
The timer_read_time() call can be expensive - when the next timer is
definitely pending, avoid making that call.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-18 13:12:32 -04:00
Kevin O'Connor 89af88d016 linux: Simplify timer dispatch code
Implement rescheduling math using the simple 32-bit timer instead of
the Unix timespec struct.  This makes the code simpler and doesn't
adversely impact the overall performance.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-18 12:25:50 -04:00
Kevin O'Connor d5c72e3693 linux: Fix local timer_repeat_until cache in timer.c
Make sure to update the local copy of timer_repeat_until when updating
it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-18 12:17:00 -04:00
Oliver 41999eb94d stm32: CAN Kconfig typo
Fixed simple typo in the Kconfig and can.c. stm32f4 CAN Pins

Signed-off-by: Oliver Walter <oli1111@web.de>
2021-04-07 13:06:13 -04:00
Arksine 689c2f9baf stm32f1: reset peripherals in enable_pcclock()
Some bootloaders do not disable peripherals in use before jumping to the application.  Reset peripherals to assure correct operation.

SIgned-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-04-07 12:57:21 -04:00
Michael Kurz 59c4c49893 stm32: Add hardware PWM support for STM32F1
This adds hardware PWM support for STM32F1 processors.
This should also work for STM32 F0/F2/F4 processors, but I
don't have one of those to test it.

Signed-off-by: Michael Kurz <michi.kurz@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-26 12:04:51 -04:00
Michael Kurz 39188e1cf3 lpc176x: Add hardware PWM support for LPC176x
This adds hardware PWM support for LPC176x processors.

Signed-off-by: Michael Kurz <michi.kurz@gmail.com>
2021-03-26 12:01:42 -04:00
Kevin O'Connor ae89a65956 lpc176x: Do not modify PCLKSELx at runtime
The lpc176x has an errata that could cause updates to PCLKSELx to not
take effect.  Rework the code to use the default peripheral clock
speed (25Mhz or 30Mhz) so that this register does not need to be
updated at runtime.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-25 11:35:04 -04:00
Kevin O'Connor 6cab7bcfcb lpc176x: Introduce get_pclock_frequency()
Add get_pclock_frequency() - a standard way of obtaining the
peripheral clock frequency.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-25 11:35:04 -04:00
Evgeny Chukreev 8c369b54ab ds18b20: Segmentation fault on 64bit Raspberry Pi
Signed-off-by: Evgeny Chukreev <Evgeny.Chukreev@gmail.com>
2021-03-19 11:18:51 -04:00
Kevin O'Connor 4566392faf stm32: Minor optimization to can.c IRQ data reading
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-18 16:55:04 -04:00
Kevin O'Connor fee84c2afb canbus: Support reading CAN packets directly from IRQ handler
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-18 15:58:09 -04:00
Kevin O'Connor d5a3ef6c40 avr: Fix Kconfig USB/Serial selection
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-18 14:45:12 -04:00
Kevin O'Connor 2024451f50 lpc176x: Use "communication interface" menu option in Kconfig
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-18 14:23:24 -04:00
Kevin O'Connor 1804fbfce9 atsamd: Use "communication interface" menu option in Kconfig
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-18 14:23:14 -04:00
Kevin O'Connor 6a4f1ece89 atsam: Use "communication interface" menu option in Kconfig
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-18 14:22:57 -04:00
Kevin O'Connor c5f21aa16c avr: Use "communication interface" menu option in Kconfig
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-18 14:22:15 -04:00
Kevin O'Connor 1eddc0fd90 stm32: Simplify USB/Serial/CANbus Kconfig selection
Combine the various communication options into a single "make
menuconfig" menu item.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-18 13:33:33 -04:00
Kevin O'Connor 6cb419a90a canbus: Rework CAN command protocol
Rework the micro-controller command protocol so that it supports
direct communication with the serialqueue.c code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-13 11:29:41 -05:00
Matt Baker 3f07b16b35
armcm_boot: Improve ARM Cortex-M control transfer from bootloaders (#4024)
Signed-off-by: Matt Baker <baker.matt.j@gmail.com>
2021-03-09 09:32:20 -05:00
Michael Kurz ab979a52cf
stm32: Add support for STM32F1 I2C1 alternate pin mapping (#4012)
This adds support for the alternate pin mapping of
I2C1 on PB8/9 in STM32F1 devices

Signed-off-by: Michael Kurz <michi.kurz@gmail.com>
2021-03-02 23:02:20 -05:00
Adrian Keet 16d85d1a78 fan: Add tachometer support
This adds new config options for fans:  'tachometer_pin' to specify the
GPIO pin, and 'tachometer_ppr' (default 2) to specify the number of
signal pulses per revolution.  The rpm is also exposed by get_status for
command templates and the API server.  For fast fans (at least 10000
RPM), the polling interval can be shortened using the
'tachometer_poll_interval' option.

There is a new mcu object for a generic edge counter, which repeatedly
polls a GPIO pin and periodically reports the count to the host.

Signed-off-by: Adrian Keet <arkeet@gmail.com>
2021-03-01 14:53:13 -05:00
Kevin O'Connor c4edc7d946 stm32: Add support for 48KiB bootloaders
Reported by @mks-viva.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-20 09:37:43 -05:00
Kevin O'Connor 267a2f3a38 stm32: Optimize stm32f401 peripheral clock
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-19 12:19:32 -05:00
Arkadiusz Raj 90ffa0685f stm32: stm32f401 pll_freq updates
Signed-off-by: Arkadiusz Raj <arek.raj@gmail.com>
2021-02-19 12:15:44 -05:00
Arkadiusz Raj 28e41806f5 stm32: 25MHz clock fixes
Signed-off-by: Arkadiusz Raj <arek.raj@gmail.com>
2021-02-19 12:15:31 -05:00
Arkadiusz Raj a6e28f7d6a stm32: Fix missing STM32F429 clock initialization
Signed-off-by: Arkadiusz Raj <arek.raj@gmail.com>
2021-02-19 12:14:55 -05:00
Arkadiusz Raj 7f63efdcea stm32: F429 shall use 168Mhz to allow easy USB clock configuration
Signed-off-by: Arkadiusz Raj <arek.raj@gmail.com>
2021-02-19 12:14:19 -05:00
Arek e6d1910ef9
stm32: Add STM32F429 variant (#3926)
* Add F429 variant; add CAN on PD0,PD1; add 25Mhx clock; move CAN1_RX from PI8 to correct position (PI9)

* Add test for STM32F429

Signed-off-by: Arkadiusz Raj <arek.raj@gmail.com>
2021-02-18 20:12:32 -05:00
Kevin O'Connor fc783f9b83 stm32: Add support for spi bus on stm32f407 pins PI2,PI3,PI1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-12 17:32:54 -05:00
Kevin O'Connor 6698b249ce stm32: Minor indention change to spi.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-12 17:32:49 -05:00
Kevin O'Connor d7bacae29d pru: Request the host not send more than 496 bytes to the pru
Writes over 496 bytes don't fit in a single "rpmsg" page.  Request the
host limit the number of bytes outstanding to avoid getting "write:
(22)Invalid argument" errors.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-12 11:23:29 -05:00
Kevin O'Connor 8666a724db canbus: Call can_notify_rx() at startup so low-level code does not need to
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-09 18:51:03 -05:00
Kevin O'Connor 5c4cf54557 canbus: Rename canbus_set_dataport() to canbus_set_filter() and simplify
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-09 18:27:29 -05:00
Elias Bakken 8b443acae8
stm32: Adding support for STM32F031x6 (#3871)
Add support for alt usart 1

Do not select all functions on 16 K mcu

Signed-off-by: Elias Bakken <elias@iagent.no>
2021-02-03 12:23:17 -05:00
Kevin O'Connor d9f6abdb56 canbus: Move high-level CAN code to new src/generic/canbus.c
Separate out the high-level command processing logic from the
low-level transmission code.  Place the high-level code in
src/generic/canbus.c .

This also removes the CAN dependency on serial_irq.c .

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-02 15:24:11 -05:00
Kevin O'Connor bee544eaca stm32: Simplify can.c irq handler
Don't perform any heavy tasks in the CAN interrupt handler - just
notify a background task to handle anything pending.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-02 15:17:14 -05:00
Kevin O'Connor 95adff7431 stm32: Use CAN_TSR_CODE to select next tx fifo in can.c
The spec states that the TX fifo is transmitted in chronological order
if the TXFP bit is set, but it's unclear if the software needs to fill
the tx fifo in a particular order to obtain that result.  Use the TSR
CODE bit field to fill the TX fifo in the order that the hardware
reports as next.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-02 15:17:14 -05:00
Kevin O'Connor 95eb00740b stm32: Avoid read+write modify instructions in can.c
Prefer explicitly setting the hardware registers and avoid using C
read and modify instructions where possible.  This avoids race
conditions where an interrupt or hardware change could cause subtle
corruption of the register state.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-02 15:17:14 -05:00
Kevin O'Connor c0371c94c8 stm32: Introduce new can_set_filter() helper function in can.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-02 15:17:14 -05:00
Kevin O'Connor 901ccfcb9d stm32: Update can.c to use more consistent indentation
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-02 15:17:14 -05:00
Alan Lord 7d4df65920
ds18b20: new module for 1-wire temperature sensor (#3462)
Initial commit of code to support 1-wire (Dallas) sensors such
as the DS18B20. Requires Linux kernel drivers to create a file
in /sysfs which is read by this module, and temperature
typically returned to a temperature_fan.

Signed-off-by: Alan Lord <alanslists@gmail.com>
Signed-off-by: Josh Headapohl <joshhead@gmail.com>
2021-02-02 14:34:56 -05:00
Kevin O'Connor 55185e9a7e atsamd: Fix bug in sercom_pads mapping on samd21 in sercom.c
Reported by @tech2077.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-01 10:55:38 -05:00
smark- ef4d9c3abd
stm32: Support for STM32F401 (#3853)
This module adds support for the STM32F401 microcontrollers

Signed-off-by: Marco D'Alessio <marco@wrecklab.com>
2021-01-31 19:41:53 -05:00
Matt Shepcar ccaf58a02c
stm32f1: Fix for using 16MHz external crystal (#3814)
Signed-off-by: Matt Shepcar <matt@shepcar.co.uk>
2021-01-24 10:24:11 -05:00
Kevin O'Connor 28bca7da77 stm32: Support setting the stm32f0 internal clock trim value
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-01-18 12:49:41 -05:00
Kevin O'Connor cc39beba0e stm32: Add support for spi4 bus on stm32f446 chip
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-01-04 01:54:41 -05:00
Kevin O'Connor f3c5be0f00 gpiocmds: Merge digital output and soft pwm code
The digital output commands implement a subset of the software pwm
commands.  Change the host code to just use the software pwm commands
and simplify the micro-controller code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-10 12:06:26 -05:00
Kevin O'Connor 39a04eac5f stm32: Only use the HSI48 clock when doing "usb clock recovery"
The HSI48 clock on the stm32f042 isn't as accurate as the main HSI
clock.  So, only use the HSI48 clock when using USB to synchronize
that clock.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-08 09:00:47 -05:00
Kevin O'Connor 9e293be5e0 pca9685: Use move queue for pwm updates
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-04 16:10:13 -05:00
Kevin O'Connor 19a96346a8 gpiocmds: Use move queue for software pwm
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-04 16:10:13 -05:00
Pascal Pieper 9cdf9bb6ec gpiocmds: Use move queue for digital output pins
Signed-off-by: Pascal Pieper <accounts@pascalpieper.de>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-04 16:10:13 -05:00
Pascal Pieper e8ec1801ff pwmcmds: Use move queue for hard PWM
Signed-off-by: Pascal Pieper <accounts@pascalpieper.de>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-04 16:10:13 -05:00
Kevin O'Connor 697412d25c stepper: Use a reusable interface to the "move queue"
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-04 16:10:13 -05:00
Kevin O'Connor 3b9412513e basecmd: Change "move queue empty" error to "move queue overflow"
Use a more clear error message.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-04 16:10:13 -05:00
Kevin O'Connor 086f0fafde gpiocmds: Send soft pwm cycle_time separately from schedule_soft_pwm_out
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-04 16:10:13 -05:00
Kevin O'Connor 7b28cdbae5 pru: Disable gpio mux configuration code
The code isn't actually capable of altering the mux registers due to
hardware checks enforced by the chip.  Disable that code to save a few
bytes in the final binary.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-04 16:10:13 -05:00
Kevin O'Connor 123908ac7a neopixel: Fix neopixel_result message so that it contains an oid
In order for commit 82156170 to work properly, the neopixel_result
message must contain the oid.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-11-05 11:40:34 -05:00
Kevin O'Connor a560432041 command: Fix handling of buffer passing in args[] on 64bit mcu
If the buffer pointer can't fit in a uint32_t then pass a relative
buffer offset instead.  This fixes buffer handling on 64bit linux
mcus.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-30 14:04:12 -04:00
Kevin O'Connor 473828ca6a command: Add command_decode_ptr() helper
Add a helper function to convert from a string buffer passed in the
args[] parameter to an actual pointer.  This avoids all the callers
needing to perfrom pointer manipulation.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-30 14:04:08 -04:00
Kevin O'Connor 2bb30265b5 neopixel: Increase the maximum LED chain length
Rework neopixel updates to use an mcu buffer so that more than 18 LEDs
can be in a chain.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-29 11:59:15 -04:00
Kevin O'Connor be4ad29fa3 atsamd: Support reading chip based temperature sensor
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-29 11:55:06 -04:00
Kevin O'Connor 9142200b3a stm32: Support reading chip based temperature sensor on stm32f0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-29 11:55:06 -04:00
Kevin O'Connor a8069e9ba8 stm32: Reduce adc_pins storage size in stm32f0_adc.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-29 11:55:06 -04:00
Kevin O'Connor d985b53ccb stm32: Support reading chip based temperature sensor on stm32f1/2/4
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-29 11:55:06 -04:00
Kevin O'Connor d9b7891133 atsam: Support reading chip based temperature sensor on sam4e
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-29 11:55:06 -04:00
Kevin O'Connor 97d49105b7 atsam: Support reading chip based temperature sensor on sam3/sam4s
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-29 11:55:06 -04:00
Kevin O'Connor ed5ce9cb37 linux: Fix spi handling with more than one spi device
Reported by @opensource-alt.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-25 10:14:15 -04:00
Kevin O'Connor 2885a4c728 stm32: Don't default to HID bootloader in Kconfig
Restore the default of an 8KiB bootloader for stm32f103 and a 32KiB
bootloader for stm32f207/stm32f407.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-13 14:25:17 -04:00
bondus 387fceb453 stm32: Fixed CAN bus for STM32F4, there were syntax errors that prevented compilation
Signed-off-by: Pontus Borg <liquidpontus@yahoo.se>
2020-10-11 11:24:05 -04:00
Guy Shapira 27cefb2b38 gpiocmds: Add soft-pwm frequency modulation support
Signed-off-by: Guy Shapira <gayuha@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-26 20:51:38 -04:00
Kevin O'Connor 1cdf0d474d sensor_adxl345: Remove unused stop_time parameter
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-05 09:18:59 -04:00
Kevin O'Connor 3405095f0a adxl345: Add support for adxl345 accelerometer
Add support for taking measurements from an adxl345 accelerometer via
SPI interface.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-05 09:11:04 -04:00
Cabia Rangris 15853da28c
config: Added TronXY X5SA support (#3265)
Added printer-tronxy-x5sa-v6 config.
Added "chitu" bootloader option to stm32 Kconfig.
Added chitu_crypt.

Signed-off-by: Vladimir Serov <me@cab404.ru>
2020-08-30 12:59:28 -04:00
bondus 35d28e880d
stm32: Improvements to CAN bus ID generation. And added a small fast hash library (#3165)
Improved CAM bus ID generation, there were issues with ID collisions.
Added a small fast hash library.

Signed-off-by: Pontus Borg <liquidpontus@yahoo.se>
2020-08-09 21:07:59 -04:00
Kevin O'Connor 0f3b1bce66 linux: Set the SPI mode in spidev.c
Fix omission causing the SPI mode to not be set on the linux mcu.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-07-31 23:18:46 -04:00
Kevin O'Connor 5f2cb5436c linux: Disable hardware pwm when it is set to zero
Only write "1" to the "enable" file when a non-zero pwm width is
requested.  Write "0" to the "enable" file when a zero pwm width is
requested.

This fixes a problem on the replicape servo lines that prevented them
from being fully disabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-07-20 22:18:28 -04:00
Kevin O'Connor c83688b7bc lpc176x: Fix spi mode bits
The lpc176x hardware spi initialization code was swapping the CPOL and
CPHA bits.  This caused the MAX31865 and MAX31856 chips to not work
correctly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-07-10 16:08:18 -04:00
bondus 7a8e9591e3
stm32: Improved CAN support for STM32 (#2976)
Reworked the STM32F0 CAN bus implementation. It's more robust and higher performance.

Added support for function remapping to different pins.  API is emulating an STM32F0.

Improved and ported CAN bus to STM32F0, F1 and F4.

Signed-off-by: Pontus Borg <glpontus@gmail.com>
2020-06-24 18:59:38 -04:00
combolek 7cab732ae9
stm32: Initial support for stm32f2 (#3001)
Initial support for stm32f2 in general and STM32F207 in particular.

Boots up and communicates on STM32F207VC.

Signed-off-by: Boleslaw Ciesielski <combolek@users.noreply.github.com>
2020-06-23 10:52:15 -04:00
kianusch a4c31bafb0
stm32: Support for 20KiB bootloader offset. (#3008)
Signed-off-by: Kianusch Sayah Karadji <kianusch@gmail.com>
2020-06-20 13:30:10 -04:00
Kevin O'Connor 722770f62f generic: Minor header cleanup to generic/irq.h
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-07 21:18:04 -04:00
Kevin O'Connor 06437c5892 linux: Wait in timer dispatch for up to 2us
Use 2us in the linux timer dispatch code to unify linux timer dispatch
logic with the common timer_irq.c code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-07 09:17:51 -04:00
Lucio Tarantino b7699d374a
linux: Ability to use multiple GPIO chips (#2935)
Signed-off-by: Lucio Tarantino <lucio.tarantino@gmail.com>
2020-06-06 12:47:11 -04:00
Kevin O'Connor 38772492f9 Kconfig: Only show the "usb ids" menu if low-level options are enabled
It's rare to customize the usb ids, so make it a "low-level" option.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-31 21:05:04 -04:00
Kevin O'Connor ea9eac6c38 Kconfig: Change the default usb vendor/product id
Change the product/vendor id to 0x1d50/0x614e, which has been reserved
for Klipper (thanks to the openmoko project).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-31 21:05:04 -04:00
Kevin O'Connor 634dcc7387 lcd_hd44780: Only calibrate cmd_wait_ticks on mcus with strict timing
The calibration isn't valid on the linux mcu, so make it dependent on
CONFIG_HAVE_STRICT_TIMING.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-31 14:57:06 -04:00
Kevin O'Connor 0cbb8fdc9a lcd_st7920: Only calibrate wait ticks on mcus with strict timing
The calibration isn't valid on the linux mcu, so make it dependent on
CONFIG_HAVE_STRICT_TIMING.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-31 14:57:06 -04:00
Kevin O'Connor 98192d710f stepper: Make toggling the step gpio after timer read conditional
On the Linux mcu, toggling the pin after the time is read is not
valid.  Make that optimization dependent on CONFIG_HAVE_STRICT_TIMING.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-31 14:57:06 -04:00
Kevin O'Connor 835ec3513d Kconfig: Add a new CONFIG_HAVE_STRICT_TIMING build definition
Add a new build definition to note micro-controllers that have strict
timing.  The Linux mcu code does not have strict timing - all other
targets currently do.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-31 14:57:06 -04:00
Kevin O'Connor b80d2f7706 stm32: Fix typo causing internal clock to always be used on stm32f042
Reported by Pontus Borg.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-28 15:56:22 -04:00