Commit Graph

893 Commits

Author SHA1 Message Date
Kevin O'Connor a7f7cc5075 neopixel: Use names for key timing values
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-15 12:11:57 -04:00
Kevin O'Connor 91a27ef083 stm32: Add support for 64KiB bootloader on stm32f103
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-24 10:02:21 -04:00
Kevin O'Connor 886530e777 stm32: Explicitly reset peripheral clocks on stm32f1
It appears some bootloaders do not properly reset some peripherals.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-24 10:00:45 -04:00
clearchris f87e29c775 armcm_boot: Additional code for broken bootloaders
Explicitly disable the SysTick interrupt and explicitly set the stack
pointer, as some bootloaders aren't handling this correctly.

Signed-off-by: Chris Lombardi <clearchris@hotmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-04 19:50:56 -05:00
Kevin O'Connor 79e2376993 stm32: Add support for a bootloader on stm32f0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-04 19:50:56 -05:00
Kevin O'Connor 121249c999 stm32: Revert "stm32: performance improvement for spi on stm32f0"
This reverts commit a2c309a2b0.

The above commit is causing crashes on the stm32f103xb chip when spi
is in use.  It's unclear what the cause of the regression is, but the
optimization isn't required so revert it until the root cause can be
determined.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-04 18:33:34 -05:00
Kevin O'Connor e9e0f59204 stepper: Add some comments on s->position tracking
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-04 14:30:41 -05:00
Kevin O'Connor 31b2c3ea7a stm32: Fix broken clock setup on stm32f1
Commit bd6c25c9 introduced a typo that caused the clock divisors to
not be set correctly on stm32f1.

Reported by @brianrjones69.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-29 13:14:12 -05:00
Kevin O'Connor 98c7c7603e basecmd: No need for finalize_config command to send "config" response
The host code always issues a get_config command immediately after
finalize_config, so there is no need to send the two config response
messages.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-20 12:01:21 -05:00
Kevin O'Connor b5c967acd8 stm32: The stm32f1 can only reach 64Mhz when using an internal clock
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-14 12:11:50 -05:00
Kevin O'Connor 6f4822fe96 stm32: Fix typo that broke selection of alternate serial port pin
Fix a typo in commit aea15250.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-09 12:01:43 -05:00
Kevin O'Connor 502e83725b stm32: Reset adc calibration prior to starting calibration
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-25 11:23:58 -05:00
Kevin O'Connor bf3fa979f9 stm32: Increase adc sample time
Increase the sample time register from 3 to 4 (which adds about ~1.5us
to each adc sample).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-25 10:50:29 -05:00
Kevin O'Connor aea15250ae stm32: Only declare alternate usart2 on stm32f0
Also, try to improve the structure of the #if/#else/#endif layout in
serial.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-23 11:39:40 -05:00
Kevin O'Connor c8a93cb3bf stm32: Don't export spi1a/spi2a on stm32f1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-23 11:36:28 -05:00
Arne Jansen 0cd4d5d5ea stm32: add alternate pinout for USART2
Added to both generic stm32 and stm32f0

Signed-off-by: Arne Jansen <arne@die-jansens.de>
2020-01-23 11:10:39 -05:00
Arne Jansen 5ce86bd005 stm32: add alternate pinouts for spi1/2
In addition to spi3, spi1 and spi2 also have alternate pins. Add them as
spi1a and spi2a, similar to spi3.

Signed-off-by: Arne Jansen <arne@die-jansens.de>
2020-01-23 11:10:39 -05:00
Arne Jansen a2c309a2b0 stm32: performance improvement for spi on stm32f0
The stm32 has a small queue for spi tx/rx. The current code only uses the
spi with a single byte buffer, effectively waiting for each byte to complete
before starting the next transfer.
This patch changes the structure of spi_transfer() to make use of the queue
and achieve back-to-back transfer of bytes on spi.

Signed-off-by: Arne Jansen <arne@die-jansens.de>
2020-01-23 11:10:39 -05:00
Arne Jansen ce35ee45d6 stm32: fix spi_transfer for stm32f0
The current code accesses the DR as 32 bit. This enabled data packing mode,
effectively adding a 00 byte between each sent byte. The receive side had
similar problems.
To prevent this, all accesses are 8 bit now, even though this is not
necessary on stmf[14].

Signed-off-by: Arne Jansen <arne@die-jansens.de>
2020-01-23 11:10:39 -05:00
akatik b3c3b61387 lpc176x: Add support for ssp1 (#2393)
Signed-off-by: Andrey Kovalev <aka@pxe.ru>
2020-01-14 22:06:29 -05:00
Eug Krashtan b70416167b stm32f0: Remove hal based stm32f0 implementation
Signed-off-by: Eug Krashtan <eug.krashtan@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-14 17:08:01 -05:00
Eug Krashtan a34dbc7029 stm32: STM32F0 CAN feature
Signed-off-by: Eug Krashtan <eug.krashtan@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-14 17:05:28 -05:00
Eug Krashtan 5238c3f872 stm32: HSI selection fix; Pin swap rename; Add CAN selection
Signed-off-by: Eug Krashtan <eug.krashtan@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-14 17:05:28 -05:00
Arksine 20ba396466 linux: implement i2c
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-13 22:29:50 -05:00
Arksine 5fe9dd5a50 avr: implement i2c_read
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-13 22:29:50 -05:00
Tobias Weiß 58abd2925e config: Fysetc S6 generic configuration (#2220)
Signed-off-by: Tobias Weiß <t.weiss@bk.ru>
2019-12-18 11:13:25 -05:00
Kevin O'Connor 73e84abaff atsam: Fix typo causing chipid to not be fully read
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-27 14:33:20 -05:00
Kevin O'Connor ef2c7cb363 stm32: Fix typo in setting of SMPR1 register on stm32f103
Only the stm32f4 has a SMP18 field; it's not present on the stm32f103.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-27 11:26:17 -05:00
Kevin O'Connor fc476f22b6 stm32: Fix typo in adc startup delay
Fix (harmless) typo and add comments on adc timing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-27 11:16:41 -05:00
Kevin O'Connor 43dfb3c9ad lcd_hd44780: Minor change to timing delays
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-26 09:49:43 -05:00
Kevin O'Connor fb485e862d lcd_hd44780: Add proper timing delays around gpio updates
A fast micro-controller may update the gpio pins faster than the
hd44780 chip can handle.  Add in the appropriate delays.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-26 09:37:30 -05:00
Kevin O'Connor 35de9b8e55 lpc176x: Move chip id code from usbserial.c to new file chipid.c
Add a chipid.c file - this makes the code layout more similar to the
other arm boards.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-26 08:54:40 -05:00
Kevin O'Connor e80ced5568 usb_cdc: Report MCU type on all boards
Always report the "product id" as the MCU type (instead of as "Klipper
firmware").

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-26 08:45:20 -05:00
Kevin O'Connor 401f7a879c atsam: Enable chipid as usb serial number
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-26 08:42:14 -05:00
Kevin O'Connor d7ec5505a6 atsamd: Enable chipid as usb serial number
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-25 19:30:31 -05:00
Kevin O'Connor 8f6efe5a7b stm32: Enable chipid as usb serial number
Signed-off-by: Matt Baker <baker.matt.j@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-25 19:30:31 -05:00
Kevin O'Connor f76cb92b15 usb_cdc: Add a usb_fill_serial() helper function
Add a helper function to fill the usb serial string descriptor.  Use
it in the lpc176x code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-25 18:32:52 -05:00
Kevin O'Connor bd6c25c9f8 stm32: Allow external crystal speed to be customized in Kconfig
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-25 14:04:26 -05:00
Kevin O'Connor 430b8d0e52 usb_cdc: Report the MCU name instead of "Klipper firmware"
Change the "product id" from the redundant "Klipper firmware" to the
CONFIG_MCU value.  For now, only make this change on boards that have
CONFIG_HAVE_CHIPID set.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-21 11:56:31 -05:00
Kevin O'Connor d8b6ff5c5e lpc176x: Minor rework of HAVE_CHIPID kconfig
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-21 11:54:46 -05:00
Matt Baker bab27651a1 lpc176x: read chip id and use as usb serial. (#2184)
Signed-off-by: Matt Baker <baker.matt.j@gmail.com>
2019-11-21 11:54:20 -05:00
Lars R. Hansen 524ebbc7b3 atsamd: Add support for SAMD51 overclocking
Signed-off-by: Lars R. Hansen <popshansen@hotmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-18 12:39:04 -05:00
Kevin O'Connor 9ff4f1bb2f stm32f0: Initial support for i2c on stm32f0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-14 15:54:28 -05:00
clearchris 009d14fc3e stm32: adc for new stm32f0 common code (#2120)
Derived from stm32/adc.c and stm32f0/adc.c with additional changes.

Tested on Monoprice Mini Delta (malyan) stm32f070xb board.

Signed-off-by: Chris Lombardi <clearchris@hotmail.com>
2019-11-05 10:08:32 -05:00
Kevin O'Connor cf6e8a2eee stm32: Define PGx pins on stm32f103
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-02 11:35:27 -04:00
Kevin O'Connor 1a69f38e6e flash_usb: Pass -t $CONFIG_MCU to flash_usb on all targets
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-26 18:48:00 -04:00
Kevin O'Connor 538d6ac3a2 flash_usb: Use "-s" option to specify flash offset on atsamd
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-26 18:33:00 -04:00
Kevin O'Connor 5131ec5eb0 stm32: Add support for flashing over usb on stm32f042
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-26 17:11:04 -04:00
Kevin O'Connor 2ecc8d8f62 stm32: stm32f4 usb boot check only needed when CONFIG_USBSERIAL
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-26 16:56:33 -04:00
Kevin O'Connor 5da6a62759 stm32f4: Add support for flashing over USB
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-26 13:24:59 -04:00
Kevin O'Connor 081c24326d atsam: sysio support is only available on sam4s
Fix sam4e build error introduced in commit f723a314.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-24 22:21:47 -04:00
Kevin O'Connor f723a3141e atsam: Allow PB4-PB7,PB10-PB12 to be used as gpio on sam4
A separate "sysio" register must be set in order to use some port B
pins on the sam4 mcu.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-24 22:02:29 -04:00
Kevin O'Connor 9a11286327 stm32: Implement armcm_main() in arch specific code
Move armcm_main() to stm32f0.c, stm32f1.c, and stm32f4.c.  This gives
the arch specific code more control on the early boot setup.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-24 11:35:18 -04:00
Kevin O'Connor faeaa54925 armcm_boot: Use armcm_main() instead of main() to start board code
The main() function has a special meaning to gcc and using it can
result in different code generation.  Use armcm_main() to avoid that.

Also, invoke SystemInit() from the board specific armcm_main() code.
This gives the board code more control over board initialization.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-24 11:16:10 -04:00
Kevin O'Connor 0b0c47c566 stm32: Support PA11/PA12 pin remap on stm32f042 tsop20 chip
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-23 21:34:48 -04:00
Kevin O'Connor a6d90bb95e stm32: Support stm32f042 build from stm32/ directory
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-23 21:34:48 -04:00
Kevin O'Connor 2c535106ee stm32: Initial support for stm32f070
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-23 21:19:03 -04:00
Kevin O'Connor 7b792e40d5 stm32f0: Rename internal build symbol from MACH_STM32F0 to MACH_STM32F0_HAL
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-23 21:16:35 -04:00
Kevin O'Connor a46244057c stm32: Support 16bit packet memory access on usbfs controller
The stm32f0 line uses 16bit packet memory reads/writes (as opposed to
the goofy 32bit accesses required on the stm32f103).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-23 21:16:35 -04:00
Kevin O'Connor c2881f7d15 stm32: Be explicit in layout of gpio banks in digital_regs variable
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-23 21:16:35 -04:00
Kevin O'Connor 40d076cce5 stm32: Use stm32f103xe header for stm32f103 line
Use the "e" revision so that the SPI3 device is available for use.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-23 15:49:00 -04:00
Kevin O'Connor 1e8582e3f6 stm32: Make sure to turn on the usb clock before writing to the packet memory
The USB clock needs to be enabled prior to writing to the USB packet
memory.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-13 14:33:23 -04:00
Kevin O'Connor bbf6f87de0 avr: List 20Mhz option below 16Mhz option in Kconfig
When enabling "low level options" in Kconfig, selecting a chip that is
20Mhz capable would result in 20Mhz being the default.  A 16Mhz speed
is the preferred default, so list that first in the menu.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-30 10:05:02 -04:00
Kevin O'Connor e90d9c33eb lpc176x: Use FIOPIN to set start value on gpio_out_reset()
The FIOSET and FIOCLR registers may not set an initial value if the
pin is not in an output mode.  So, use FIOPIN to set the initial
value.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-29 17:02:39 -04:00
Kevin O'Connor 626cb71428 stm32: Only prompt for a bootloader on stm32f103 and stm32f407
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-18 12:11:52 -04:00
Kevin O'Connor 9e2c17f468 atsam: No need to call SystemInit() from main()
The SystemInit() is already called from armcm_boot.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-18 11:59:43 -04:00
Kevin O'Connor 9b70c052cc armcm_boot: Export MCU definition from armcm_boot
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-18 11:59:43 -04:00
Kevin O'Connor 1c6a8267f9 armcm_reset: Add a new helper file defining command_reset()
Add a generic ARM Cortex-M implementation of the "reset" command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-18 11:59:43 -04:00
Kevin O'Connor 80e17b1e53 stm32: Move VTOR fixup from main() to chip specific code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-18 11:59:43 -04:00
Kevin O'Connor 8cb3d09484 stm32: Move usb_request_bootloader() to chip specific code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-18 11:59:43 -04:00
Kevin O'Connor 4f889ecd93 stm32: Fix usbfs rx buffer sizing
The usbfs receive buffers must also have space for the 2 byte crc at
the end of a transmission.  This fixes an error that could lead to
lost messages from mcu to host (resulting in bytes_invalid increasing
in stats) on the stm32f103.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-16 19:33:06 -04:00
Kevin O'Connor 045c938a61 stm32: Use official defines for EPR bits
Use the standard definitions for the endpoint register bits.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-16 18:39:54 -04:00
Kevin O'Connor 86cf361486 stm32: Rename USB_BTABLE to EPM in usbfs.c
Rename the internal definition so it isn't in conflict with the
USB_BTABLE register.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-16 18:39:47 -04:00
Kevin O'Connor c780537c57 atsam: Add missing PB21 pin to ADC module
Reported by @mental405.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-16 10:50:24 -04:00
Kevin O'Connor 60ae92d143 stm32: Disable usb irqs in usbotg handlers
It appears the usbotg controller can get confused if the usb irq
handler runs while processing a usb request.  Disable usb irqs during
usb processing to avoid this.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-12 08:12:51 -04:00
Kevin O'Connor 8d4a5c16be atsam: Enable flash loop caching optimization on sam4s
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-08 09:11:41 -04:00
Kevin O'Connor 4fa41d9c61 stm32: Rework usbotg transmit interrupts
Use the XFRC interrupt instead of TXFE.  Don't mask/unmask the tx
interrupts during runtime.  This fixes some race conditions where a tx
notification may have previously gotten lost.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-08 00:07:16 -04:00
Kevin O'Connor dc9f9ea1d6 stm32: Add support for SPI3 bus on alternate PC11,PC12,PC10 pins
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-05 22:42:48 -04:00
Kevin O'Connor 4097a02585 tmcuart: Fix typo in function name
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-01 14:56:09 -04:00
Kevin O'Connor 7031202e7c stm32: Add support for SPI1 and SPI3 busses
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-31 19:55:30 -04:00
Kevin O'Connor 017a4d8321 stm32: Fix gpio enumerations (each bank has 16 pins, not 32)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-31 18:35:01 -04:00
Kevin O'Connor c380d4639b stm32: Work around stm32f407 usbotg chip errata
It appears bogus entries can get placed on the rxqueue - detect and
clear them.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-31 15:16:46 -04:00
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