Kevin O'Connor
9335cc4804
stm32: Configure and enable usbotg endpoint0 during setup
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-30 12:15:45 -04:00
Kevin O'Connor
4a178824aa
stm32: Disable and flush usbotg bulk transmit pipe on usb_set_configure()
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-30 12:15:45 -04:00
Kevin O'Connor
7eba063ac8
stm32: Perform usbotg endpoint init during usb_set_configure()
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-30 12:15:45 -04:00
Kevin O'Connor
917fd51057
stm32: Discard usbotg tx data until usb is ready
...
If the usb interface is not ready, just discard messages.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-30 12:15:45 -04:00
Kevin O'Connor
5e3acff8c7
stm32: No need to clear the usbotg address on reset
...
The controller automatically clears the address.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-30 12:15:45 -04:00
Kevin O'Connor
7229680227
stm32: Enable usbotg bulk reads during endpoint configuration
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-30 12:15:32 -04:00
Kevin O'Connor
c95209bf7a
atsam: ADC pins need to be in input mode with pullups disabled
...
The ADC pins (on at least the sam3x8e) need to be configured in input
mode with the internal pullups disabled in order to get accurate ADC
readings.
Reported by @bryanboettcher.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-28 13:45:01 -04:00
Kevin O'Connor
8f5c15d4dc
buildcommands: Match DECL_X names to the actual C macro names
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 13:26:30 -04:00
Kevin O'Connor
caeb610bb9
armcm_link: Rename armcm_boot.lds.S to armcm_link.lds.S
...
Rename the linker script so the build does not have any conflicts with
the armcm_boot.d dependency file.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 13:18:24 -04:00
Kevin O'Connor
ff7be3e026
ctr: Encode negative integers in normal hex notation
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 13:06:44 -04:00
Kevin O'Connor
7d014933ce
command: Allow count parameter of DECL_ENUMERATION_RANGE() to be an expression
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 12:22:51 -04:00
Kevin O'Connor
84fd89b8cf
ctr: Add support for multiple integers in DECL_CTR_INT
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 12:22:51 -04:00
Kevin O'Connor
e59d875256
ctr: Encode integers in hex
...
Replace the custom encoding with a hex encoding. This makes it a
little easier to inspect the CTR conversions.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 11:08:51 -04:00
Kevin O'Connor
69fc1e63b4
Makefile: Translate null characters to newline characters in ctr requests
...
Store the CTR requests in compile_time_request.txt with the null
characters removed. This makes it slightly easier to inspect the CTR
conversions.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 10:35:26 -04:00
Kevin O'Connor
1022729a2a
lpc176x: Update code to use armcm_boot mechanism
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 09:58:58 -04:00
Kevin O'Connor
6409eda058
lpc176x: Move irq handler code above irq setup
...
Only code movement.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 09:58:58 -04:00
Kevin O'Connor
44f862388f
atsam: Update code to use armcm_boot mechanism
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 09:58:58 -04:00
Kevin O'Connor
fc879456db
atsam: Move irq handler code above irq setup
...
Only code movement.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 09:58:58 -04:00
Kevin O'Connor
6338f6a5f0
atsamd: Update code to use armcm_boot mechanism
...
Replace the custom linker scripts with the src/generic/armcm_boot.c
mechanism.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 09:58:58 -04:00
Kevin O'Connor
4990fe814d
atsamd: Move irq handler code above irq setup
...
Only code movement.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 09:58:58 -04:00
Kevin O'Connor
4ef53ab095
stm32: Update code to use armcm_boot mechanism
...
Replace the stm32 provided assembler with the src/generic/armcm_boot.c
mechanism.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 09:58:58 -04:00
Kevin O'Connor
a44bc950a3
stm32: Move irq handler code above irq setup
...
Only code movement.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 09:58:58 -04:00
Kevin O'Connor
2a2cf1f536
armcm_boot: Add generic code for early board init on armcm machines
...
Add basic ARM Cortex-M C init code and build linker scripts to
src/generic/ code. This can be used to simplify the various ARM board
code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 09:58:58 -04:00
Kevin O'Connor
351910c5ac
Makefile: Add generic rule for precompiling linker scripts
...
Add a general build rule to precompile *.lds.S files to *.ld files.
Remove the custom rules in src/atsamd/Makefile and src/stm32/Makefile.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-21 12:31:12 -04:00
Kevin O'Connor
9c15f00e60
armcm_timer: Fix typo in comment in armcm_timer.h
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-21 12:05:13 -04:00
Kevin O'Connor
078d278611
stm32: Initial support for i2c
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-20 19:39:58 -04:00
Kevin O'Connor
e32be928dc
stm32: Add support for configuring open drain output mode
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-20 19:39:49 -04:00
Kevin O'Connor
c930fc392b
stm32: Make sure to enable the gpio clock prior to setting the first value
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-20 01:10:14 -04:00
Kevin O'Connor
6c908952bd
spi_software: Remove unused include file
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-17 13:49:03 -04:00
Kevin O'Connor
8aca7764c3
stm32: Simplify usbotg packet reading and writing
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-16 21:03:47 -04:00
Kevin O'Connor
4ec6db7a87
stm32: Add support for additional ADC3 ports on stm32f4
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-15 23:21:41 -04:00
Kevin O'Connor
aac51bdb0a
stm32: Initial support for USB On-The-Go (OTG) driver on stm32f4
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-15 22:26:49 -04:00
Kevin O'Connor
841150ff00
stm32: Enable 48Mhz USB clock on stm32f446
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-14 19:33:11 -04:00
Kevin O'Connor
effe6f6ddd
lcd_st7920: Add brief delay around gpio toggle calls on fast MCUs
...
On fast MCUs (like the SAMD51) it is possible for the gpio to toggle
faster than the st7920 can accept. Add a small delay around the clock
rise signal.
Signed-off-by: Lars R. Hansen <popshansen@hotmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-10 11:45:15 -04:00
Kevin O'Connor
a70055a625
stm32: Add support for the 32KiB bootloader on the SKR Pro
...
Signed-off-by: Gerrit Sturm <gsturm16@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-09 20:37:31 -04:00
Kevin O'Connor
96ff54e143
stm32: Add serial USART serial port option for port PD9/PD8
...
Signed-off-by: Gerrit Sturm <gsturm16@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-09 20:32:46 -04:00
Kevin O'Connor
f6d1ab2ea2
neopixel: Rework timing so that it works on AVR micro-controllers
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-07 15:37:05 -04:00
Kevin O'Connor
8712648370
stm32: Fix memory sizing for STM32F405/7 chips
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-06 23:35:45 -04:00
Kevin O'Connor
c2a08962b7
spicmds: Rework spi config commands
...
Rework the spi_config commands so that bus configuration and shutdown
message configuration is done separately from the main "config_spi"
command. This makes the spi configuration more flexible. It's now
possible to use software spi without a CS pin. It's now possible to
define multiple SPI messages to send on a shutdown event.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-06 18:56:53 -04:00
Kevin O'Connor
3d0f7188df
stm32: Automatically disable SWD if PA13/PA14 is used on stm32f103
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-05 11:39:42 -04:00
Kevin O'Connor
36217f27aa
stm32f1: Remove now unused src/stm32f1/ directory
...
Now that the stm32f1 code has been merged into the stm32 code, there
is no longer a need to keep the stm32f1/ directory.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-05 11:25:40 -04:00
Kevin O'Connor
fe065d72d0
stm32: Rename clock.c to stm32f4.c
...
Rename the clock.c file to stm32f4.c to make it more clear that the
code is specific to the stm32f4 chips.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-05 11:25:40 -04:00
Kevin O'Connor
8b9cc62359
stm32: Rename stm32f4/ directory to stm32/
...
Now that the code in stm32f4/ can handle both stm32f1 and stm32f4
chips, rename the directory to just "stm32".
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-05 11:25:40 -04:00
Kevin O'Connor
ec3d865b51
stm32f4: Add support for USB on stm32f103
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-05 11:25:40 -04:00
Kevin O'Connor
7efc53ff59
stm32f4: Add support for STM32F103
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-05 11:25:40 -04:00
Kevin O'Connor
c176b66f29
stm32f4: Allow the USART serial port to be configured
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-28 22:55:48 -04:00
Kevin O'Connor
e6ffef9a9f
stm32f4: Make using the internal clock source a low level option
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-28 22:55:48 -04:00
Kevin O'Connor
9bc3a29ee4
stm32f4: Add support for full range of GPIO pins
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-28 22:55:48 -04:00
Kevin O'Connor
bc9c8cd7a0
stm32f4: Only enable peripherals once
...
Add is_enabled_pclock() and only initialize spi and adc once during
configuration.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-28 17:57:02 -04:00
Kevin O'Connor
ef0784afe6
stm32f4: Encode mode/func into single parameter of gpio_peripheral
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-28 11:32:56 -04:00
Kevin O'Connor
92c2fbdce4
armcm_timer: Improve comments on wrap_timer code
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-27 22:05:50 -04:00
Kevin O'Connor
7bc0a261ab
stm32f4: Automatically calculate dynmem start/end
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-27 21:32:04 -04:00
Kevin O'Connor
16616662ed
stm32f4: Add Kconfig build rules for STM32F405/7
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-27 21:32:04 -04:00
Kevin O'Connor
961d13ee1a
stm32f4: Add support for SPI
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-27 21:01:01 -04:00
Kevin O'Connor
d79f99b188
stm32f4: Add support for ADC
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-27 10:58:28 -04:00
Kevin O'Connor
73709984b0
stm32f4: Add support for watchdog
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-26 08:36:11 -04:00
Kevin O'Connor
899b6726fa
stm32f4: Improve serial baud rate calculation
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-26 08:01:31 -04:00
Kevin O'Connor
f3d7287a28
stm32f4: Add support for external 8Mhz crystal
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-26 07:51:12 -04:00
Kevin O'Connor
1487f8a257
stm32f4: Add support for GPIO
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-25 18:13:06 -04:00
Kevin O'Connor
d501ca6b0b
stm32f4: Add initial support for STM32F446 chip
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-25 18:08:28 -04:00
Kevin O'Connor
52dd6f0b57
atsamd: Fix comment typo in serial.c
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-25 12:18:21 -04:00
Kevin O'Connor
634ec46813
initial_pins: Only build when CONFIG_HAVE_GPIO is enabled
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-24 01:09:45 -04:00
Kevin O'Connor
79bd13dba7
armcm_timer: Support micro-controllers faster than 160Mhz
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-24 01:08:18 -04:00
Kevin O'Connor
4e5ddff00b
neopixel: Update to more flexible bit-banging timing
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-23 22:00:12 -04:00
Kevin O'Connor
893acdb56b
lib: Update stm32f1 code to version 1.8.0
...
Update the stm32f1 code to the latest from ST. Merge the
lib/cmsis-stm32f1/ and lib/hal-stm32f1/ into a single lib/stm32f1/
directory. Document all the differences from the pristine upstream
code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-21 22:40:56 -04:00
Kevin O'Connor
1a387ad509
stm32f0: Remove trailing tab from Makefile
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-21 21:49:22 -04:00
Kevin O'Connor
d5cc2a7b7b
neopixel: Improve timing of gpio bit-banging
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-17 16:36:28 -04:00
Kevin O'Connor
0af5b9ff6d
neopixel: Be sure to set the line low on a failed write
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-13 00:00:57 -04:00
Kevin O'Connor
be2d0abbab
neopixel: Optimize the update loop
...
Optimize the transmit code so it can run on some slower ARM cpus.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-12 23:39:00 -04:00
Kevin O'Connor
b7bc96c3b2
neopixel: Add initial support for "neopixel" leds
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-12 21:44:01 -04:00
Kevin O'Connor
28aa2f507a
endstop: Rename mcu end_stop commands to endstop
...
Rename the commands.
The main reason for this change is to force a micro-controller code
updated (due to important bugfix in 7fefe52d
).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-12 08:10:53 -04:00
Kevin O'Connor
7fefe52df7
stepper: Don't update SF_LAST_DIR if SF_NEED_RESET
...
If the move is not added to the move queue, then the SF_LAST_DIR
setting must not be changed. Otherwise, it could result in an
incorrect direction being set on the stepper after a homing operation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-12 07:54:24 -04:00
Kevin O'Connor
b77375e955
lpc176x: Reset LPC_UART0->FDR when using serial
...
The popular "LPC17xx-DFU-Bootloader" alters the LPC_UART0->FDR
register, so be sure to reset it back to its default when using serial
in Klipper.
Reported by @b-vs.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-10 20:00:58 -04:00
Arksine
0f1d42466b
buttons: initialize mcu buttons based on inverted state
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2019-07-05 20:01:07 -04:00
Kevin O'Connor
8951dc3d51
lpc176x: Add more filtering to workaround adc hardware defect
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-20 08:57:24 -04:00
Kevin O'Connor
8d029ad652
lpc176x: Fix adc clock divisor
...
Commit 1096075d
changed CONFIG_CLOCK_FREQ to the actual cpu frequency,
but that commit failed to update adc.c accordingly. That made the adc
run 4 times slower. Make the corresponding change to adc.c.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-19 21:21:01 -04:00
Kevin O'Connor
700e35c6ac
armcm_timer: Unify udelay() implementation
...
Move the udelay() code from various arm board directories into the
src/generic/armcm_timer.c code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-09 20:27:57 -04:00
Kevin O'Connor
3910a44cc9
atsam: Add support for "timer" controlled hardware pwm pins
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-02 10:59:33 -04:00
Kevin O'Connor
e2e4a5d4e6
atsamd: Add build support for SAMD21E15 chip
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-01 13:43:37 -04:00
Kevin O'Connor
9e7ef3cf89
atsamd: Reduce the compile size of the hard_pwm pin list
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-30 14:05:31 -04:00
Kevin O'Connor
8532e2123e
gpiocmds: Specify soft pwm duration in clock ticks
...
Improve the precision of soft pwm pulses by allowing the host to
directly specify the clock duration of the pulse. This improvement in
precision may be noticeable when controller servos (and bltouch).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-26 11:09:32 -04:00
Kevin O'Connor
2469356861
stm32f1: Add support for building with a 0x7000 code offset
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-23 13:36:15 -04:00
Kevin O'Connor
edb679b83d
atsam: Enable pullup on i2c SDA line
...
The internal pullup helps ensure i2c errors are detected properly.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-23 09:32:10 -04:00
Kevin O'Connor
24b1638c25
atsam: Improve i2c timeout detection
...
Unify timeout detection in i2c_write() and i2c_read().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-23 09:32:10 -04:00
Kevin O'Connor
5fe5f09244
atsam: Minor whitespace changes to i2c.c
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-23 09:13:55 -04:00
Kevin O'Connor
bcfd101867
spi_software: Minor simplification to spi_software_prepare()
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-22 11:40:30 -04:00
Kevin O'Connor
ab5238317b
avr: Simplify spi mode setting
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-07 23:02:20 -04:00
Matt Baker
c95705ba3a
spi_software: save mode setting in config structure.
...
Signed-off-by: Matt Baker <baker.matt.j@gmail.com>
2019-05-07 00:03:17 -04:00
Matt Baker
38f3d65ac5
lpc176x: refactor usbserial to use udelay helper.
...
Signed-off-by: Matt Baker <baker.matt.j@gmail.com>
2019-04-06 20:53:15 -04:00
Matt Baker
e83071c9fe
lpc176x: force minimum usb disconnect time
...
Fixes GitHub Issue #1499 . Resolves USB hang by forcing a minimum
USB disconnection time at boot.
Signed-off-by: Matt Baker <baker.matt.j@gmail.com>
2019-04-06 20:53:15 -04:00
Janne Grunau
aab89e7f85
linux: add support for Linux hardware PWM
...
The replicape servo pins (P9_14/P9_16) are muxed to the SOCs hardware
PWM unit driven by a 13MHz GP timer. They have to be driven by the
linux host mcu. This commits adds hardware PWM support using the linux
sysfs user space interface.
Signed-off-by: Janne Grunau <janne-3d@jannau.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-04-05 19:06:15 -04:00
Janne Grunau
e6c3eeafd7
pwmcmds: allow 16-bit resolution
...
Signed-off-by: Janne Grunau <janne-3d@jannau.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-04-05 19:02:48 -04:00
Kevin O'Connor
e6157c1600
atsamd: Minor whitespace changes to sercom.c
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-04-04 18:30:05 -04:00
Kevin O'Connor
f8bde6b1ef
linux: Convert SPI to use enumerations
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-04-04 18:29:31 -04:00
Kevin O'Connor
3e71a57f67
lpc176x: Use enumerations for buses and reserve pins
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-04-04 18:29:31 -04:00
Kevin O'Connor
bc9fd03dab
atsamd: Use enumerations for buses and reserve pins
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-04-04 18:29:31 -04:00
Kevin O'Connor
7e8ecfe177
atsam: Use enumerations for buses and reserve pins
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-04-04 18:29:31 -04:00
Kevin O'Connor
7765653d83
avr: Use enumerations for buses and reserve pins
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-04-04 18:29:31 -04:00
Kevin O'Connor
4c3d50693e
bus: Change bus parameter in config_spi/config_i2c
...
Be explicit when using an spi_bus vs i2c_bus in the parameter name.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-04-04 18:29:31 -04:00
Kevin O'Connor
2c851e1621
avr: Add enumerations for the atmega168/328 analog only pins
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-31 21:47:27 -04:00
smark-
eedc773d69
stm32f1: Fix ADC ( #1474 )
...
The sampling time of the ADC was too slow (239 ADC clock cycles), causing the reading of the next ADC channel to have cross talk as per issue #1261 . Sampling time updated to 41 ADC clock cycles.
Signed-off-by: Marco D'Alessio <marco@wrecklab.com>
2019-03-31 14:32:27 -04:00
Kevin O'Connor
d1eefba453
pru: The TMR_CNT is cleared by writing all ones
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-31 13:48:50 -04:00
Kevin O'Connor
72d0c770d3
pru: Avoid using a timer wake time of exactly zero
...
It appears the PRU timer will not trigger on a match of exactly zero.
If the next timer happened to be set to exactly zero, it could cause
software timers to get stuck and result in "move queue empty" errors.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-31 13:37:05 -04:00
Kevin O'Connor
fbbe2cf9d6
lpc176x: Explicitly disconnect USB on a bootloader request
...
It appears some host machines may not recognize that the USB device
has disconnected upon start of bootloader mode. Explicitly disable
USB and add a 5ms delay to help signal the host of the upcoming
change.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-31 13:37:01 -04:00
Eugene Krashtan
8c7f1546ab
stm32f0: Wrong port definition for GPIOF ( #1463 )
...
Signed-off-by: Eugene Krashtan <eug.krashtan@gmail.com>
2019-03-29 09:41:05 -04:00
Eugene Krashtan
5913170b6b
stm32f0: minor i2c bugfix ( #1461 )
...
Signed-off-by: Eugene Krashtan <eug.krashtan@gmail.com>
2019-03-28 12:27:57 -04:00
Eugene Krashtan
c7330e07a4
stm32f0: Various fixes according to comment: ( #1453 )
...
* Copyright in log.c
* GPIO check completely removed
* generic/timer_irq added
* Change in doc section
Signed-off-by: Eugene Krashtan <eug.krashtan@gmail.com>
2019-03-28 10:21:51 -04:00
Eugene Krashtan
45f0ea29a6
stm32f0: SPI and i2c interfaces added
...
Signed-off-by: Eugene Krashtan <eug.krashtan@gmail.com>
2019-03-24 12:10:19 -04:00
Eugene Krashtan
b822f38923
stm32f0: New target STM32F0 added.
...
Signed-off-by: Eugene Krashtan <Eugene.Krashtan@opensynergy.com>
2019-03-24 12:10:11 -04:00
Kevin O'Connor
d76658756e
stepper: Fix reset_step_clock corruption due to bitset typo
...
Commit b9b03dd0
had a typo in the flag updating. The typo could
result in corruption of the stepper state.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-19 20:57:17 -04:00
Kevin O'Connor
746a378c18
endstop: Use "pin_value" instead of "pin" when querying endstop state
...
Now that enumerations are available, any variable named "pin" can only
be used to describe a gpio pin. Rename the end_stop_state "pin"
parameter to "pin_value". Also, rename "end_stop_query" command to
"end_stop_query_state" to notify users to upgrade both host and mcu
code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-19 10:48:33 -04:00
Kevin O'Connor
4a35f927fc
initial_pins: Add ability to configure output pins at mcu startup
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-17 20:56:25 -04:00
Kevin O'Connor
0af89e4766
thermocouple: Define thermocouple types using enumerations
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-17 19:38:18 -04:00
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
Kevin O'Connor
0da65bf6b0
atsam: Fix hard pwm cycle divider calculation
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-13 18:18:12 -05:00
Kevin O'Connor
98ed462865
spi_software: Implementation of software spi
...
Signed-off-by: Matt Janus <FragginRight@variabl.es>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-13 11:52:20 -05:00
Kevin O'Connor
090cd930d9
atsam: Add support for hard pwm via PWM controller
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-13 11:15:24 -05:00
Kevin O'Connor
d1d19d03f3
atsamd: Fix typo in header guard
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-13 09:32:06 -05:00
Florian Heilmann
af0d292e23
atsamd: Enable ADC support for samd51 devices ( #1204 )
...
* adc: Enable ADC support for samd51 devices
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
2019-02-08 12:02:32 -05:00
Kevin O'Connor
74c216543c
atsam: Configure the atsam sram matrix register
...
The sram matrix configuration is, bizarrely, configured with a slow
default. It will typically add an extra wait state to every memory
access. Set the matrix sram controller to improve the performance.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-07 13:12:35 -05:00
Kevin O'Connor
af8376e203
debugcmds: Add support for reading/writing 32bit values
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-07 11:50:14 -05:00
Kevin O'Connor
9f3517fdc7
stm32f1: Convert code to use armcm_timer
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-06 22:03:09 -05:00
Kevin O'Connor
eb8db46ca3
stm32f1: Use internal functions for early USB gpio toggle
...
Avoid using the "low-level" library timing utilities. This is in
preparation for using SysTick as part of the timer implementation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-06 22:03:09 -05:00
Kevin O'Connor
1096075d9b
lpc176x: Convert code to use armcm_timer
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-06 22:03:09 -05:00
Kevin O'Connor
77db1aa379
atsam: Convert code to use armcm_timer
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-06 22:03:09 -05:00
Kevin O'Connor
26fb421d59
atsamd: Convert SAMD51 to use armcm_timer
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-06 22:03:09 -05:00
Kevin O'Connor
55df8bf55f
armcm_timer: Add a generic timer mechanism for ARM CortexM3/M4 chips
...
The ARM CortexM3 (and later) chips almost always have a 32bit timer in
the "Debug and Watch Trace" (DWT) unit which resides within the cpu
core itself. This timer is generally faster to access than timers
located on the chip's peripheral bus. When combined with the standard
ARM SysTick timer it provides a (generally) portable mechanism to
implement Klipper's software timer mechanism. It's generally also
faster than using the vendor specific timers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-06 22:03:09 -05:00
Kevin O'Connor
8cd83b4c2d
atsamd: Initial support for SAMD51
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-28 20:02:16 -05:00
Kevin O'Connor
c5fc264a07
atsamd: Add a get_pclock_frequency() helper function
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-28 20:02:16 -05:00
Kevin O'Connor
8f763d80b7
atsamd: Select the 8K bootloader by default
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-28 20:02:16 -05:00
Kevin O'Connor
40b5de1680
atsamd: Pass the power management id to enable_pclock()
...
Pass the power management id instead of the APBCMASK bit to the
enable_pclock() function.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-28 20:02:16 -05:00
Kevin O'Connor
ed1334c24b
atsamd: Clarify clock generation code
...
Implement gen_clock() and route_pclock() helpers in an effort to make
the code more readable.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-28 20:02:16 -05:00
Kevin O'Connor
932acd3048
usbserial: Allow USB ids to be specified via Kconfig
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-25 19:04:14 -05:00
Kevin O'Connor
1ad1ed573a
simulator: Fix simulator build
...
Commit b6ccd268
inadvertently broke the simulator build - fix it.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-25 18:23:27 -05:00
Kevin O'Connor
ee86463ed2
avr: Only prompt for CLEAR_PRESCALER and SIMULAVR with LOW_LEVEL_OPTIONS
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-25 18:07:31 -05:00
Kevin O'Connor
b6ccd2682c
Kconfig: Move SERIAL_BAUD to src/Kconfig and show with LOW_LEVEL_OPTIONS
...
Move the definition of SERIAL_BAUD to the main src/Kconfig file. Only
show this as an option if the user selects the ability to configure
low-level options.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-25 18:02:03 -05:00
Kevin O'Connor
4fec225115
avr: Rename AVR_SERIAL and AVR_USBSERIAL to SERIAL and USBSERIAL
...
Rename the config options to be more consistent with other
architectures.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-25 17:52:09 -05:00
Kevin O'Connor
eb7842c221
atsam: Add support for the SAM3X8C micro-controller
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-22 09:07:12 -05:00
Kevin O'Connor
efd1bf5e04
atsam: Add support for USB on SAM3X
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-19 22:32:28 -05:00
Kevin O'Connor
d4790356da
atsam: Add MACH_SAM3X, MACH_SAM4, MACH_SAM4E, MACH_SAM4S definitions
...
Add additional Kconfig definitions to make it easier to select the
correct code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-18 09:56:24 -05:00
Kevin O'Connor
d3ec103816
lpc176x: Implement a median filter on ADC readings
...
The lpc176x ADC is extremely noisy. Implement a 5 order median filter
on each ADC read to weed out obviously incorrect readings.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-14 13:08:45 -05:00
Kevin O'Connor
078a03dc21
lpc176x: Add mechanism for entering the bootloader from a USB signal
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-13 12:25:58 -05:00
Kevin O'Connor
093512b971
adccmds: Run gpio_adc_setup() before oid_alloc()
...
Order the adc config code so that a shutdown from gpio_adc_setup()
doesn't result in analog_in_shutdown() running on a 'struct analog_in'
that hasn't yet been configured.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-13 11:03:30 -05:00
Florian Heilmann
6256599a6d
src: Rename source folders for atsam and atsamd architectures
...
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
2019-01-12 20:14:50 -05:00
Kevin O'Connor
8a6125c81c
stepper: Fix bug when using a non-zero CONFIG_STEP_DELAY on AVR
...
Make sure to explicitly cast to 32bit integers when doing math on
16bit integers that require the extra precision as the AVR uses a
16bit int.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-11 12:04:03 -05:00
Kevin O'Connor
2ea7c97bbd
stepper: Support configuring the stepper pulse length from Kconfig
...
Allow the stepper pulse length to be configured at compile time from
the Kconfig menu system.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-09 13:16:42 -05:00
Kevin O'Connor
e26d1a3567
i2ccmds: Pass the i2c address as a 7-bit number (0-127)
...
The sam3 i2c code and the linux code use a 7-bit i2c address, while
the avr, lpc176x, and samd21 i2c code uses an 8-bit address with the
least significant bit always zero. A similar issue occurred in the
host code (sx1509.py and replicape.py use 7-bit addresses while
uc1701.py and mcp4451.py use 8-bit addresses).
Consistently use 7-bit addresses in all the code. This breaks
compatibility between host and mcu software, so make a change to the
config_i2c command to force users to synchronize software updates.
This also breaks common Smoothieboard configs, so update the mcp4451
code to validate the i2c_address.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 20:00:44 -05:00
Kevin O'Connor
8e0eb0d574
sam3: Implement board reset via SAM RSTC hardware
...
Use the RSTC hardware block to perform a full reset on a "reset"
command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:34:31 -05:00
Kevin O'Connor
02c558652f
sam3: Add USB support for the SAM4 "UDP" hardware
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:34:31 -05:00
Kevin O'Connor
75ad16ea1a
sam3: Add support for sam4s8c chips
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:34:31 -05:00
Kevin O'Connor
bf196c3028
sam3: Add additional SPI and USART buses to spi.c
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:34:04 -05:00
Kevin O'Connor
212813906a
sam3: Merge sam4e_spi.c into spi.c
...
Determine at runtime if the SPI or USART devices should be used.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:33:26 -05:00
Kevin O'Connor
4683036f98
sam3: Add enable_pclock() helper function
...
Add a helper function to enable peripheral clocks.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:33:26 -05:00
Kevin O'Connor
b4baabe408
sam3: Enable i2c on sam3x8e
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:33:26 -05:00
Kevin O'Connor
94c86d6c6c
sam3: Merge sam4e8e support into sam3 code
...
Most of the peripherals on the sam4e8e are similar to the ones on the
sam3x8e mcu. Merge the code together and use just one code directory.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:33:26 -05:00
Kevin O'Connor
e278552d44
lib: Rename lib/cmsis-sam4e/ to lib/sam4e/
...
This is in preparation for merging the sam3 and sam4 code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:33:26 -05:00
Kevin O'Connor
70bbdf9334
sam3: Rename src/sam3x8e to src/sam3
...
This is in preparation for merging sam3 and sam4 code into one
directory.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:33:26 -05:00
Kevin O'Connor
e70b70fb75
sam4e8e: Move the sam4 cache setup to its own sam4_cache.c file
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:30:17 -05:00
Kevin O'Connor
a978167e39
sam4e8e: Use just a single 'chan' member in 'struct gpio_adc'
...
Remove the 'pin' and 'afec' variables from 'struct gpio_adc'. This is
in preparation to merge the sam3x8e and sam4e8e code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:30:17 -05:00
Kevin O'Connor
8e2c1a4ab2
sam4e8e: Move ADC code to new file afec.c
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:30:17 -05:00
Kevin O'Connor
7707d5a74e
sam4e8e: Rename gpio_set_peripheral() to gpio_peripheral()
...
Use the same definition for gpio_peripheral() that the sam3x8e code
uses.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:30:17 -05:00
Kevin O'Connor
f0715de004
sam4e8e: Move gpio_set_peripheral() definition from gpio.h to internal.h
...
Use internal.h in a similar way to the internal.h in sam3x8e. Also,
move the twi pin definitions from internal.h to i2c.c (as they are only
used there).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:30:17 -05:00
Kevin O'Connor
9a2160f660
sam3x8e: Move adc support to a new adc.c file
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:30:17 -05:00
Kevin O'Connor
5b91c7a68d
sam3x8e: Pass the gpio id directly to gpio_peripheral()
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:30:17 -05:00
Kevin O'Connor
ecba3e9a19
sam3x8e: Add an internal.h header file with local definitions
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:30:17 -05:00
Kevin O'Connor
c3a2fc981d
lib: Remove sam4e sam.h and component-version.h files
...
These two files from atmel have different licenses than the other
files. Neither files provide any real value, so just remove them to
avoid any confusion.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:30:17 -05:00
Kevin O'Connor
22da8ca39c
usb_cdc: Notify both the bulk_in and bulk_out tasks on a configure
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:30:17 -05:00
Kevin O'Connor
6e18af7057
stm32f1: It's only necessary to program the CR1 register during SPI init
...
Only set the CR1 register during spi_prepare().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-07 19:22:14 -05:00
Kevin O'Connor
277a8185e1
lpc176x: Pass gpio id to gpio_peripheral()
...
Pass the gpio id instead of the bank/pin to gpio_peripheral(). This
is in keeping with other ARM ports.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-04 11:07:22 -05:00
Kevin O'Connor
a40df4b6f7
lpc176x: Move enable_peripheral_clock to main.c
...
Move and rename function to enable_pclock() - in keeping with other
ARM ports.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-04 11:00:09 -05:00
Kevin O'Connor
8f7fc4e6a9
lpc176x: Move ADC code to new adc.c file
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-04 10:42:36 -05:00
Kevin O'Connor
62fc5dc288
samd21: Add support for entering Arduino bootloader via USB
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-12-24 11:43:11 -05:00
Kevin O'Connor
b84ecebf8f
usb_cdc: Add support for detecting a USB level Arduino bootloader request
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-12-24 11:42:19 -05:00
Kevin O'Connor
2a74ffdb95
samd21: Add support for ADC
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-12-22 10:58:04 -05:00
Yannic Schroeder
f100d75c19
stm32f1: Always read SPI receive buffer
...
Otherwise the first byte read via SPI may be the last byte
of the previous transfer
Signed-off-by: Yannic Schroeder <schroeder@ibr.cs.tu-bs.de>
2018-12-14 12:25:35 -05:00
Kevin O'Connor
6df7356baa
samd21: Fix gpio in support
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-30 23:10:23 -05:00
Kevin O'Connor
e505ab0df1
samd21: Add support for flashing an application via the bossac tool
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-30 22:22:42 -05:00
Kevin O'Connor
f2179da8ad
samd21: Add support for hardware pwm
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-30 20:00:59 -05:00
Kevin O'Connor
0fd2dd7c11
samd21: Minor simplification to timer init code
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-30 11:50:50 -05:00
Kevin O'Connor
d6f3f6b664
samd21: Add support for SPI
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-30 11:50:50 -05:00
Kevin O'Connor
58d61c7887
samd21: Add support for basic i2c support (write only)
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-30 11:50:50 -05:00
Kevin O'Connor
6d90ebe6f8
samd21: Use GPIO() macro when calling gpio_peripheral()
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-30 11:50:50 -05:00
Kevin O'Connor
0af0bc946e
samd21: Enable watchdog
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-30 11:50:50 -05:00
Kevin O'Connor
afa58de014
samd21: Try to clarify the "generic clock generator" configuration
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-30 11:50:50 -05:00
Kevin O'Connor
3a47d972db
i2ccmds: Validate the i2c address
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-30 11:50:50 -05:00
Kevin O'Connor
db4f0c24cd
spicmds: Check for an incorrect mode in spicmds.c
...
Check the mode parameter in spicmds.c so that the mcu code does not
need to check it.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-30 11:50:48 -05:00
Kevin O'Connor
6b108aa885
stm32f1: Move ADC and SPI code from gpio.c to spi.c and adc.c
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-30 11:42:54 -05:00
Kevin O'Connor
729a2e8306
avr: Add support for sending I2C messages
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-23 23:49:26 -05:00
Kevin O'Connor
043170265b
i2ccmds: Minor whitespace changes
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-23 21:36:44 -05:00
Kevin O'Connor
cbbc6801a0
lpc176x: Enable full speed peripheral clocks on SPI and I2C
...
Scale the bus speed within the peripheral instead of on the system bus
as scaling on the system bus slows down general register access to the
peripheral.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-21 20:44:39 -05:00
Kevin O'Connor
4bbd631086
lpc176x: Add an enable_peripheral_clock() helper function
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-21 20:44:18 -05:00
Kevin O'Connor
7bb9ce8436
avr: Minor comment update in hard_pwm.c
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-20 13:14:53 -05:00
Kevin O'Connor
7c65e76ad0
avr: Rework hardware pwm pin definitions
...
Simultaneously define the hardware pin and the timer registers. This
makes the table a little easier to understand.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-20 12:58:33 -05:00
Kevin O'Connor
bf92ffb5bf
avr: Split gpio.c into gpio.c, adc.c, hard_pwm.c, and spi.c
...
Split up gpio.c into multiple files in an effort to make the code a
little more understandable.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-20 12:58:33 -05:00
Kevin O'Connor
2cc0313b72
avr: Add initial support for atmega32u4 chips
...
Signed-off-by: Trevor Jones <trevorjones141@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-20 12:58:33 -05:00
Kevin O'Connor
31687bc009
avr: Minor update to help text in Kconfig
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-19 22:05:26 -05:00
Kevin O'Connor
b161a69e98
timer_irq: Increase maximum busy wait time to 2us
...
Increase the amount of time to "busy wait" in the timer dispatch loop
to 2 micro-seconds. This, in practice, causes stepper step and unstep
events to occur within a single hardware interrupt. Doing that helps
stabilize the single active stepper performance benchmarks.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-16 17:16:50 -05:00
Kevin O'Connor
f3c4deb1ab
lpc176x: Convert i2c code to use standard i2ccmds.c
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-14 10:23:56 -05:00
Kevin O'Connor
8432f6f40c
avr: Add support for atmega328p
...
The atmega328p is basically the same as the atmega328 - add explicit
support for it so that avrdude doesn't complain while flashing.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-10-29 11:55:15 -04:00
Florian.Heilmann
99989a668f
Implement I2C support in the SAM4E8E port
...
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
2018-10-27 10:34:28 -04:00
Florian.Heilmann
5a919c892a
Add generic i2c interface
...
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
2018-10-27 10:34:28 -04:00