Commit Graph

393 Commits

Author SHA1 Message Date
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