aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32f1
Commit message (Collapse)AuthorAgeFilesLines
* stm32f1: Use __always_inline on timer_read_timeKevin O'Connor2018-10-111-1/+1
| | | | | | | | Some older versions of gcc need the __always_inline directive in order to inline timer_read_time. Inlining that function is important for performance on the stm32f1. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32f1: Use -O2 optimization and inline timer_read_time()Kevin O'Connor2018-10-112-2/+1
| | | | | | | | As long as timer_read_time() is inlined, I get better performance with gcc -O2 optimization. The binary is also dramatically smaller and O2 better matches the other platforms. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32f1: Use the main lib/cmsis-core directory for cmsis includesKevin O'Connor2018-10-111-2/+2
| | | | | | Use the main cmsis header files with stm32f1. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32f1: Add support for building with bootloader supportKevin O'Connor2018-10-114-2/+136
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32f1: Move assembler build rules togetherKevin O'Connor2018-10-111-10/+9
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32f1: Pull the USB D+ line low briefly to signal a device connectKevin O'Connor2018-10-111-0/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32f1: Initial support for serial over USBKevin O'Connor2018-10-113-1/+286
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32f1: Serial should have a higher irq priority than timersKevin O'Connor2018-10-112-3/+2
| | | | | | | | | It's possible for the code to stay in the timer irq for up to 100ms, so serial irqs should have a higher irq priority to prevent them from being starved. (The timer code disables irqs during event dispatch, so serial irqs would only be permitted between events anyway.) Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32f1: Add support for gpio_x_reset()Kevin O'Connor2018-08-272-12/+28
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Kconfig: Rename HAVE_USER_INTERFACE to HAVE_GPIO_BITBANGINGKevin O'Connor2018-08-271-1/+1
| | | | | | | Rename the HAVE_USER_INTERFACE definition in preparation for other "bit banging" interfaces. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32f1: implement spi_prepareGrigori Goronzy2018-07-081-3/+2
| | | | | | | | | | | | | | | | | | Implement spi_prepare to fix the undefined behavior on SPI transaction start. Tested with the following command sequence: allocate_oids count=2 config_spi oid=0 bus=0 pin=PA8 mode=3 rate=1000000 shutdown_msg= config_spi oid=1 bus=0 pin=PA8 mode=1 rate=1000000 shutdown_msg= spi_send oid=0 data=30313233343536373839 spi_transfer oid=1 data=3031 Discussion about this here: https://github.com/KevinOConnor/klipper/pull/453#issuecomment-403131149 Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
* SPI: introduce spi_prepare functionGrigori Goronzy2018-07-082-0/+6
| | | | | | | | | | | | | | | | The SPI interface needs to be enabled and configured to the correct settings of a given oid before CS is asserted. The new function spi_prepare() allows ports to do that. This port only introduces the new function in all ports with no implementation and adds the call to the Klipper generic firmware code. That means everything still works as before. Ports need to be changed to fix the underlying issue. Discussion about the motivation here: https://github.com/KevinOConnor/klipper/pull/453#issuecomment-403131149 Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
* stm32f1: add SPI supportGrigori Goronzy2018-07-074-0/+118
| | | | | | | | | Add basic SPI support and associated documentation. v2: remove baud rate check, fix baud rate calculations v3: finish transaction with BSY check, disable SPI when not in use Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
* stm32f1: fix ADC pin listGrigori Goronzy2018-06-271-1/+1
| | | | | | | For some reason, the upper two pin definitions were missing. Found while writing the port documentation. Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
* stepper: Introduce and use gpio_out_toggle_noirq()Kevin O'Connor2018-05-152-1/+10
| | | | | | | | | | | | | | | The gpio_out_toggle() function in the sam3x8e and stm32f1 code was only valid if it was called with irqs disabled. Commits 018c5daa and 9c52ad43 enabled the lcd code which called gpio_out_toggle() with irqs enabled. This could cause corruption of the gpio state. Introduce a gpio_out_toggle_noirq() function that will only be invoked with irqs disabled, and fix gpio_out_toggle() on sam3x8e and stm32f1 so that it safe to call even if irqs are enabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32f1: Enable lcd chip supportKevin O'Connor2018-05-071-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serial_irq: Add new generic/serial_irq.c codeKevin O'Connor2018-04-202-115/+13
| | | | | | | Extract out common code from avr/serial.c, sam3x8e/serial.c, and stm32f1/serial.c into a new generic/serial_irq.c file. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32f1: Use generic timer_irq.c dispatch codeKevin O'Connor2018-04-201-62/+3
| | | | | | | | | With the optimized timer_read_time() it is no longer necessary to implement custom timer dispatch code - use the generic mechanism in timer_irq.c. This simplifies the code and provides a small performance increase. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32f1: Use different method for handling 16bit -> 32bit timer conversionKevin O'Connor2018-04-201-47/+39
| | | | | | | Implement 32bit timer conversion without disabling interrupts. This uses the 16th bit of timer_high as a rollover detection flag. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32f1: Prefer uint32_t over uint16_t in timer.cKevin O'Connor2018-04-201-6/+6
| | | | | | | The ARM architecture handles 32bit values faster than 16bit values - use uint32_t where possible. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Add STM32F103 portGrigori Goronzy2018-04-097-0/+808
Add a fully functional STM32F1 port, currently mostly targeting STM32F103 microcontrollers. This requires an 8 MHz XTAL. The maximum possible step rate is around 282K steps per second. This uses stm32flash to burn the firmware. The bootloader needs to be started by setting BOOT0 to 1 and resetting the MCU. There is no automatic bootloader, unlike on Arduino. Signed-off-by: Grigori Goronzy <greg@kinoho.net>