You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
3.0 KiB

  1. # 'serial' Driver
  2. This driver powers the [Split Keyboard](feature_split_keyboard.md) feature.
  3. ?> Serial in this context should be read as **sending information one bit at a time**, rather than implementing UART/USART/RS485/RS232 standards.
  4. All drivers in this category have the following characteristics:
  5. * Provides data and signaling over a single conductor
  6. * Limited to single master, single slave
  7. ## Supported Driver Types
  8. | | AVR | ARM |
  9. |-------------------|--------------------|--------------------|
  10. | bit bang | :heavy_check_mark: | :heavy_check_mark: |
  11. | USART Half-duplex | | :heavy_check_mark: |
  12. ## Driver configuration
  13. ### Bitbang
  14. Default driver, the absence of configuration assumes this driver. To configure it, add this to your rules.mk:
  15. ```make
  16. SERIAL_DRIVER = bitbang
  17. ```
  18. Configure the driver via your config.h:
  19. ```c
  20. #define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
  21. #define SELECT_SOFT_SERIAL_SPEED 1 // or 0, 2, 3, 4, 5
  22. // 0: about 189kbps (Experimental only)
  23. // 1: about 137kbps (default)
  24. // 2: about 75kbps
  25. // 3: about 39kbps
  26. // 4: about 26kbps
  27. // 5: about 20kbps
  28. ```
  29. #### ARM
  30. !> The bitbang driver causes connection issues with bitbang WS2812 driver
  31. Along with the generic options above, you must also turn on the `PAL_USE_CALLBACKS` feature in your halconf.h.
  32. ### USART Half-duplex
  33. Targeting STM32 boards where communication is offloaded to a USART hardware device. The advantage is that this provides fast and accurate timings. `SOFT_SERIAL_PIN` for this driver is the configured USART TX pin. **The TX pin must have appropriate pull-up resistors**. To configure it, add this to your rules.mk:
  34. ```make
  35. SERIAL_DRIVER = usart
  36. ```
  37. Configure the hardware via your config.h:
  38. ```c
  39. #define SOFT_SERIAL_PIN B6 // USART TX pin
  40. #define SELECT_SOFT_SERIAL_SPEED 1 // or 0, 2, 3, 4, 5
  41. // 0: about 460800 baud
  42. // 1: about 230400 baud (default)
  43. // 2: about 115200 baud
  44. // 3: about 57600 baud
  45. // 4: about 38400 baud
  46. // 5: about 19200 baud
  47. #define SERIAL_USART_DRIVER SD1 // USART driver of TX pin. default: SD1
  48. #define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7
  49. ```
  50. You must also enable the ChibiOS `SERIAL` feature:
  51. * In your board's halconf.h: `#define HAL_USE_SERIAL TRUE`
  52. * In your board's mcuconf.h: `#define STM32_SERIAL_USE_USARTn TRUE` (where 'n' matches the peripheral number of your selected USART on the MCU)
  53. Do note that the configuration required is for the `SERIAL` peripheral, not the `UART` peripheral.