aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* avr: enable small code size options for 328 and 328p (#6411)CODeRUS2023-11-291-1/+1
| | | Signed-off-by: Andrei Kozhevnikov <coderusinbox@gmail.com>
* stm32: enable 64KiB bootloader offset for all F4docgalaxyblock2023-11-161-1/+1
| | | | Signed-off-by: Joshua Schlicker <potter-91@web.de>
* atsam: Add support for CAN on atsame70 (#6366)Luke V2023-10-196-5/+359
| | | Signed-off-by: Luke Vuksta <wulfstawulfsta@gmail.com>
* atsam: Remove USB endpoint header (#6365)Alex Maclean2023-10-121-10/+0
| | | | | | | | | | The atsam USB hardware only requires that the ACM endpoint be endpoint 3. As of commit 11828387 the atsam chips can therefore use the default USB endpoints. This will allow CAN bridge support for the SAME70 to function (upstream host driver has hardcoded endpoints). Signed-off-by: Alex Maclean <monkeh@monkeh.net>
* stm32: Make sure to limit tx during usbfs startupKevin O'Connor2023-10-051-1/+2
| | | | | | | Wait for two tx packets before startup, and make sure one of those packets is acked before sending a third tx packet. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Fix usbfs spurious USB packet transmit on startupKevin O'Connor2023-10-041-6/+16
| | | | | | | | | | | Commit cd8d57c2 added USB double buffering mode on transmits. However, when enabling double buffering mode, the hardware seems to always send at least two packets. Spurious transmissions could cause the Linux gs_usb driver to get confused, which could lead to the can0 device becoming unavailable on restarts. Fix by waiting for two USB packets to be available before enabling the endpoint. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Only enable one direction on usbfs double buffered end pointsKevin O'Connor2023-10-041-2/+2
| | | | | | | The bulk out endpoint should not be enabled in tx mode, and the bulk in endpoint should not be enabled in rx mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb_canbus: Prioritize local response sending over new host messagesKevin O'Connor2023-10-031-2/+4
| | | | | | | | Prioritize sending responses back to the host over transmitting new messages from the host. Otherwise, the gs_usb host usb acknowledgments could saturate the usb bandwidth for extended periods. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb_canbus: Add a local queue for USB messages received from hostKevin O'Connor2023-10-031-15/+38
| | | | | | | | Read USB messages arriving from the host into a queue. This makes it less likely that USB "bulk out" packets will be NAK'ed on the USB bus, which improves USB bus utilization. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb_canbus: Rename UsbCan.queue to UsbCan.canhw_queueKevin O'Connor2023-10-031-14/+14
| | | | | | | Rename the internal variable names. This is in preparation for support of a USB message queue. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Add support for double buffering on USB bulk tx packetsKevin O'Connor2023-10-031-4/+10
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Add support for double buffering on USB bulk rx packetsKevin O'Connor2023-10-031-6/+15
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Open code usb_read_packet() and usb_write_packet() in callersKevin O'Connor2023-10-031-36/+58
| | | | | | | Copy the code for these two functions to their respective callers. This is in preparation for double buffer support. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Add helper functions to usbserial.cKevin O'Connor2023-10-031-20/+56
| | | | | | | Add helper functions for manipulating the buffer memory and packet control registers. This is in preparation for double buffer support. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Add usbfs double buffer support for bulk tx messagesKevin O'Connor2023-10-031-8/+28
| | | | | | | | Implement the usbfs fast buffer switching mechanism on the "bulk in" endpoint. This can improve the overall USB throughput and bus utilization. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Add usbfs double buffer support for bulk rx messagesKevin O'Connor2023-10-031-14/+49
| | | | | | | | Implement the usbfs fast buffer switching mechanism on the "bulk out" endpoint. This can improve the overall USB throughput and bus utilization. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Update usbfs to support setting both buffers for each endpointKevin O'Connor2023-10-031-35/+37
| | | | | | | | | The usbfs device supports two buffers for each endpoint - typically one for rx and one for tx. Add support for explicit handling of both buffers. This is in preparation for improved "double buffering" support. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Improve usbfs epr register handlingKevin O'Connor2023-10-031-40/+41
| | | | | | | | Replace the set_stat_x_bits() functions with a single calc_epr_bits() function. This new function supports setting bits other than the stat field in the epr register. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Kconfig: Support Enable/Disable lis2dw on chips with small flash sizebigtreetech2023-08-212-1/+9
| | | | Signed-off-by: Alan.Ma from BigTreeTech tech@biqu3d.com
* lis2dw12: Add support for lis2dw12 accelerometerbigtreetech2023-08-212-1/+222
| | | | | | | | lis2dw12 is an accelerometer from STMicroelectronics(https://www.st.com/resource/en/datasheet/lis2dw12.pdf) With better performance than the ADXL345 according to the datasheet. Signed-off-by: XM.Zhou from BigTreeTech zhouxm@biqu3d.com Signed-off-by: Alan.Ma from BigTreeTech tech@biqu3d.com
* hc32f460: Add app address 0x10000Falk Höppner2023-08-131-6/+9
| | | | | | Required for the Anycubic Kobra 2. Signed-off-by: Falk Höppner <falk@hoppner.se>
* atsamd: Add support for SAMD21J18 (Minitronics v2)Bart Meijer2023-07-051-2/+6
| | | | | | Adds a menu entry in menuconfig, allowing you to select the SAMD21J18 as mcu. Signed-off-by: Bart Meijer <brupje@gmail.com>
* hc32f460: Disable JTAG/SWD on pins so they can be used for GPIO/serialBoris-Chengbiao Zhou2023-06-201-0/+6
| | | | | | | | | | | | | This change is required to sucessfully use PA13/PA14 for UART. Otherwise they function as SWDIO/SWCLK. Relevant excerpt from the reference manual (translated): The initial state of PA13, PA14, PA15, PB3, and PB4 ports is that the JTAG/SWD function is valid after reset. When configuring FSEL[5:0] to select the function, you need to write 0 to the corresponding bit of the register PSPCR to invalidate the JTAG/SWD function. Signed-off-by: Boris-Chengbiao Zhou <bobo1239@web.de>
* hc32f460: Use correct USART for PH2/PB10 pinsBoris-Chengbiao Zhou2023-06-201-9/+28
| | | | | | | | | | | This fixes serial communication when selecting the PH2/PB10 pins. The chip datasheet (not reference manual) assigns pins to one of two communication function groups (`Func_Grp1/2`). Pins in group 1 have access to USART1/2 while group 2 has access to USART3/4. PH2/PB10 belong to group 2 so we now correctly use USART3 for them. Signed-off-by: Boris-Chengbiao Zhou <bobo1239@web.de>
* atsamd: Fixes for samc21 and compiler optimizations (#6198)Luke V2023-06-162-4/+26
| | | Signed-off-by: Luke Vuksta <wulfstawulfsta@gmail.com>
* Kconfig: Support selecting optional features on chips with small flash sizeKevin O'Connor2023-06-0815-36/+70
| | | | | | | | | | | | | Add a new HAVE_LIMITED_CODE_SIZE symbol that enables a menu to select optional features. This symbol is enabled on chips with small build sizes. Replace the HAVE_GPIO_BITBANGING with four new symbols: WANT_GPIO_BITBANGING, WANT_DISPLAYS, WANT_SENSORS, WANT_SOFTWARE_SPI, and WANT_SOFTWARE_I2C. This allows users a little more flexibility when selecting features they need. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* i2c_software: Implementation of software i2c (#6141)BIGTREETECH2023-06-076-10/+246
| | | Signed-off-by: Alan.Ma from BigTreeTech <tech@biqu3d.com>
* hc32f460: update for HC32F460 - clock, flash add, serial (#6235)Steve Gotthardt2023-06-062-9/+44
| | | | | | | | | Add clock speed selection Add Flash App Address selection Add alternate serial connection and remove company specific names Signed-off-by: Steven Gotthardt <gotthardt@gmail.com>
* Kconfig: Change default CANbus frequency to 1000000Kevin O'Connor2023-05-301-1/+1
| | | | | | | | Change the default CANbus frequency from 500000 to 1000000. A higher frequency allows for greater data transfer rates, lower latency of messages, and should overall be more robust. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: add PB5/PB6 as CAN pins - required for BTT U2C v2.xStefan Dej2023-05-202-2/+6
| | | | Signed-off-by: Stefan Dej <meteyou@gmail.com>
* stm32f7: add support for stm32f7 and remram boardFrederic Morin2023-05-0710-11/+217
| | | | Signed-off-by: Frederic Morin <frederic.morin.8@gmail.com>
* atsamd: Add support for SAMC21Wulfsta2023-05-0113-31/+311
| | | | Signed-off-by: Luke Vuksta <wulfstawulfsta@gmail.com>
* rp2040: Handle USB resetsKevin O'Connor2023-04-251-4/+9
| | | | | | | | | | | | On a USB bus reset the controller address needs to be reset to zero. Otherwise, the device becomes unresponsive after a USB reset and will remain unresponsive until a power cycle. This often shows up in the Linux system logs as "device descriptor read/64, error -32" messages. Make sure USB_INTE_BUS_RESET_BITS is enabled and clear the USB address on a bus reset. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb_canbus: Rework USB message transmit prioritizationKevin O'Connor2023-04-241-38/+38
| | | | | | | | | | | There is no need to heavily prioritize the sending of canbus packets over USB. A single check to flush the incoming canbus packets is sufficient. Also, be sure to wake up canserial_notify_tx() even if canhw_send() blocks. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb_canbus: No need to check if canserial can accept a packetKevin O'Connor2023-04-243-13/+8
| | | | | | | | The canserial code already advertizes a receive window, so the host should never flood the canserial code. Remove the extra scheduling checks to simplify the usb_canbus code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb_canbus: Minor code reformatting of drain_hw_queue()Kevin O'Connor2023-04-241-10/+10
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb_canbus: Increase rx canbus packet buffer to 32Kevin O'Connor2023-04-241-1/+1
| | | | | | | | A buffer of only 8 canbus packets is only 64 bytes of data, which could be exceeded if the usb-to-canbus mcu gets busy doing other work. Increase the buffer to 32 packets. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Fix usbotg irq wakeup notificationKevin O'Connor2023-04-241-4/+4
| | | | | | | | The DAINTMSK prevents irqs but does not prevent the status reporting in the GINTSTS and DAINT fields. Thus, the mask bits should be checked prior to sending a wakeup notification. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sensor_mpu9250: Fix or improve reliability (#6170)Dr. Matthew Swabey2023-04-191-48/+54
| | | | | | | | | | | | | | | | | | | Fixes common MPU-9250 accelerometer issues for RPi Linux MCU and improves reliability on all other architectures by adjusting the MPU-* reading algorithm to only read whole Klipper messages' worth of data from MPU-* and eliminating many unnecessary checks of the MPU FIFO fill-level that consumed bus bandwidth needed for data transfer. Fixes intermittent "Lost communication with MCU 'rpi'" due to "Timer too close" and transposed / corrupted data due to FIFO overrun/data loss when using MPU-* accelerometers. In addition FIFO overrun checks are performed by testing the MPU interrupt flag vs. inferring from the FIFO fill level. Stress tested for 13hrs with two MPU-6500 attached to one I2C bus on RPi and one on a PR2040 Stress tested for 23hrs with two MPU-6500 attached to one I2C bus on RPi and one on a ATmega328P (Seeduino Nano) Signed-off-by: Matthew Swabey <matthew@swabey.org>
* stm32: Support for USART5 on STM32G0B1 (#6105)Florin Popescu2023-04-193-0/+23
| | | | | | | Support for USART5 on PD2,3 Add exception on RCC bits for USART5&6 Signed-off-by: Florin Popescu <florinsgpopescu@gmail.com>
* scripts: Fix flash linux when OUT argument provided (#6133)visilya2023-04-071-1/+1
| | | Signed-off-by: Ilya Vislotsky <write2ilya@gmail.com>
* stm32: Improve ifdef indent in hard_pwm.cKevin O'Connor2023-04-071-4/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Prefer "MACH_STM32F1" test over "MACH_STM32F103 || MACH_N32G45x"Kevin O'Connor2023-04-072-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Add support for Nation N32G45x mcus (#6116)Alexey2023-04-075-10/+215
| | | | | N32G452/G455 are mostly compatible with STM32F103 but have M4 core and different ADC. Signed-off-by: Alexey Golyshin <stas2z@gmail.com>
* linux: Lock Memory and Increase Priority (#6131)Dr. Matthew Swabey2023-03-271-2/+9
| | | | | | | | | | | | | | | | | Realtime programming best practice is to lock realtime code memory to prevent paging which will lead to unbounded latencies. The Linux MCU process has well bounded memory and small RAM footprint so locking the entire process' RAM has no downsides and will improve behavior when the system comes under memory pressure. (See bootlin training and Linux Foundation documentation linked below.) RT process priority ranges from 0-99 (although POSIX only requires 32), boost MCU process priority to half the max/2 to improve robustness when the system comes under pressure from other RT Kernel or user processes. Reference links: bootlin: https://bootlin.com/doc/training/preempt-rt/preempt-rt-slides.pdf Linux Foundation: https://wiki.linuxfoundation.org/realtime/documentation/howto/applications/application_base#howto_build_a_simple_rt_application Signed-off-by: Matthew Swabey <matthew@swabey.org>
* stm32: Enable I2C on stm32h7 (#6130)BIGTREETECH2023-03-273-1/+13
| | | Signed-off-by: Alan.Ma from BigTreeTech <tech@biqu3d.com>
* avr: Allow I2C bus speed to be set by Klipper (#6111)Dr. Matthew Swabey2023-03-211-20/+16
| | | | | Allow I2C bus speed to be set by appropriate Klipper commands. Signed-off-by: Matthew Swabey <matthew@swabey.org>
* linux: Fast Linux MCU i2c_read() with I2C_RDRW (#6101)Dr. Matthew Swabey2023-03-142-8/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | Reading an I2C device from the Linux MCU used a separate write(2) to select the target register & read(2) to get the value(s). This implementation uses ioctl(file, I2C_RDWR, ...) to skip a large bus idle period and extra process sleep by combining them like the stm32. I2C_RDRW requires I2C_FUNC_I2C flag in the I2C driver. I2C_FUNC_I2C is defined in: BCM2835: Pi 1 Models A, A+, B, B+, the Raspberry Pi Zero, the Raspberry Pi Zero W, and the Raspberry Pi Compute Module 1 BCM2836: Pi 2 Model B Identical to BCM2835 except Cortex BCM2837: Pi 3 Model B, later models of the Raspberry Pi 2 Model B, and the Raspberry Pi Compute Module 3 BCM2837B0: Pi 3 Models A+, B+, and the Raspberry Pi Compute Module 3+ BCM2711: Pi 4 Model B, the Raspberry Pi 400, and the Raspberry Pi Compute Module 4 RK3xxx: Rockchips SoCs NanoPi, RockPi, Tinker, etc. SUNXI: H2, H3, etc. Orange Pi AMLOGIC: S905x, Banana Pi, Odroid, etc. TEGRA: NVidia Jetson etc. MediaTek: Several SBCs in other ranges Signed-off-by: Matthew Swabey <matthew@swabey.org>
* stm32h7: Restore the RCC set in the bootloader to the default value (#6092)BIGTREETECH2023-03-061-0/+6
| | | Signed-off-by: Alan.Ma from BigTreeTech <tech@biqu3d.com>
* ar100: Support for ar100 (#6054)Elias Bakken2023-02-2014-0/+706
| | | | | Add files to support AR100 Signed-off-by: Elias Bakken <elias@iagent.no>