Commit Graph

636 Commits

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