serial.rs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. //! # Serial Communication (USART)
  2. //!
  3. //! This module contains the functions to utilize the USART (Universal
  4. //! synchronous asynchronous receiver transmitter)
  5. //!
  6. //! ## Example usage:
  7. //!
  8. //! ```rust
  9. //! // prelude: create handles to the peripherals and registers
  10. //! let p = crate::pac::Peripherals::take().unwrap();
  11. //! let cp = cortex_m::Peripherals::take().unwrap();
  12. //! let mut flash = p.FLASH.constrain();
  13. //! let mut rcc = p.RCC.constrain();
  14. //! let clocks = rcc.cfgr.freeze(&mut flash.acr);
  15. //! let mut afio = p.AFIO.constrain(&mut rcc.apb2);
  16. //! let mut gpioa = p.GPIOA.split(&mut rcc.apb2);
  17. //!
  18. //! // USART1 on Pins A9 and A10
  19. //! let pin_tx = gpioa.pa9.into_alternate_push_pull(&mut gpioa.crh);
  20. //! let pin_rx = gpioa.pa10;
  21. //! // Create an interface struct for USART1 with 9600 Baud
  22. //! let serial = Serial::usart1(
  23. //! p.USART1,
  24. //! (pin_tx, pin_rx),
  25. //! &mut afio.mapr,
  26. //! Config::default().baudrate(9_600.bps()),
  27. //! clocks,
  28. //! &mut rcc.apb2,
  29. //! );
  30. //!
  31. //! // separate into tx and rx channels
  32. //! let (mut tx, mut rx) = serial.split();
  33. //!
  34. //! // Write 'R' to the USART
  35. //! block!(tx.write(b'R')).ok();
  36. //! // Receive a byte from the USART and store it in "received"
  37. //! let received = block!(rx.read()).unwrap();
  38. //! ```
  39. use core::marker::PhantomData;
  40. use core::ptr;
  41. use core::sync::atomic::{self, Ordering};
  42. use core::ops::Deref;
  43. use nb;
  44. use crate::pac::{USART1, USART2, USART3};
  45. use core::convert::Infallible;
  46. use embedded_hal::serial::Write;
  47. use crate::afio::MAPR;
  48. use crate::dma::{dma1, CircBuffer, Static, Transfer, R, W, RxDma, TxDma};
  49. use crate::gpio::gpioa::{PA10, PA2, PA3, PA9};
  50. use crate::gpio::gpiob::{PB10, PB11, PB6, PB7};
  51. use crate::gpio::gpioc::{PC10, PC11};
  52. use crate::gpio::gpiod::{PD5, PD6, PD8, PD9};
  53. use crate::gpio::{Alternate, Floating, Input, PushPull};
  54. use crate::rcc::{sealed::RccBus, Clocks, Enable, Reset, GetBusFreq};
  55. use crate::time::{U32Ext, Bps};
  56. /// Interrupt event
  57. pub enum Event {
  58. /// New data has been received
  59. Rxne,
  60. /// New data can be sent
  61. Txe,
  62. }
  63. /// Serial error
  64. #[derive(Debug)]
  65. pub enum Error {
  66. /// Framing error
  67. Framing,
  68. /// Noise error
  69. Noise,
  70. /// RX buffer overrun
  71. Overrun,
  72. /// Parity check error
  73. Parity,
  74. #[doc(hidden)]
  75. _Extensible,
  76. }
  77. // USART REMAPPING, see: https://www.st.com/content/ccc/resource/technical/document/reference_manual/59/b9/ba/7f/11/af/43/d5/CD00171190.pdf/files/CD00171190.pdf/jcr:content/translations/en.CD00171190.pdf
  78. // Section 9.3.8
  79. pub trait Pins<USART> {
  80. const REMAP: u8;
  81. }
  82. impl Pins<USART1> for (PA9<Alternate<PushPull>>, PA10<Input<Floating>>) {
  83. const REMAP: u8 = 0;
  84. }
  85. impl Pins<USART1> for (PB6<Alternate<PushPull>>, PB7<Input<Floating>>) {
  86. const REMAP: u8 = 1;
  87. }
  88. impl Pins<USART2> for (PA2<Alternate<PushPull>>, PA3<Input<Floating>>) {
  89. const REMAP: u8 = 0;
  90. }
  91. impl Pins<USART2> for (PD5<Alternate<PushPull>>, PD6<Input<Floating>>) {
  92. const REMAP: u8 = 0;
  93. }
  94. impl Pins<USART3> for (PB10<Alternate<PushPull>>, PB11<Input<Floating>>) {
  95. const REMAP: u8 = 0;
  96. }
  97. impl Pins<USART3> for (PC10<Alternate<PushPull>>, PC11<Input<Floating>>) {
  98. const REMAP: u8 = 1;
  99. }
  100. impl Pins<USART3> for (PD8<Alternate<PushPull>>, PD9<Input<Floating>>) {
  101. const REMAP: u8 = 0b11;
  102. }
  103. pub enum Parity {
  104. ParityNone,
  105. ParityEven,
  106. ParityOdd,
  107. }
  108. pub enum StopBits {
  109. #[doc = "1 stop bit"]
  110. STOP1,
  111. #[doc = "0.5 stop bits"]
  112. STOP0P5,
  113. #[doc = "2 stop bits"]
  114. STOP2,
  115. #[doc = "1.5 stop bits"]
  116. STOP1P5,
  117. }
  118. pub struct Config {
  119. pub baudrate: Bps,
  120. pub parity: Parity,
  121. pub stopbits: StopBits,
  122. }
  123. impl Config {
  124. pub fn baudrate(mut self, baudrate: Bps) -> Self {
  125. self.baudrate = baudrate;
  126. self
  127. }
  128. pub fn parity_none(mut self) -> Self {
  129. self.parity = Parity::ParityNone;
  130. self
  131. }
  132. pub fn parity_even(mut self) -> Self {
  133. self.parity = Parity::ParityEven;
  134. self
  135. }
  136. pub fn parity_odd(mut self) -> Self {
  137. self.parity = Parity::ParityOdd;
  138. self
  139. }
  140. pub fn stopbits(mut self, stopbits: StopBits) -> Self {
  141. self.stopbits = stopbits;
  142. self
  143. }
  144. }
  145. impl Default for Config {
  146. fn default() -> Config {
  147. let baudrate = 115_200_u32.bps();
  148. Config {
  149. baudrate,
  150. parity: Parity::ParityNone,
  151. stopbits: StopBits::STOP1,
  152. }
  153. }
  154. }
  155. /// Serial abstraction
  156. pub struct Serial<USART, PINS> {
  157. usart: USART,
  158. pins: PINS,
  159. }
  160. /// Serial receiver
  161. pub struct Rx<USART> {
  162. _usart: PhantomData<USART>,
  163. }
  164. /// Serial transmitter
  165. pub struct Tx<USART> {
  166. _usart: PhantomData<USART>,
  167. }
  168. /// Internal trait for the serial read / write logic.
  169. trait UsartReadWrite: Deref<Target=crate::pac::usart1::RegisterBlock> {
  170. fn read(&self) -> nb::Result<u8, Error> {
  171. let sr = self.sr.read();
  172. // Check for any errors
  173. let err = if sr.pe().bit_is_set() {
  174. Some(Error::Parity)
  175. } else if sr.fe().bit_is_set() {
  176. Some(Error::Framing)
  177. } else if sr.ne().bit_is_set() {
  178. Some(Error::Noise)
  179. } else if sr.ore().bit_is_set() {
  180. Some(Error::Overrun)
  181. } else {
  182. None
  183. };
  184. if let Some(err) = err {
  185. // Some error occurred. In order to clear that error flag, you have to
  186. // do a read from the sr register followed by a read from the dr
  187. // register
  188. // NOTE(read_volatile) see `write_volatile` below
  189. unsafe {
  190. ptr::read_volatile(&self.sr as *const _ as *const _);
  191. ptr::read_volatile(&self.dr as *const _ as *const _);
  192. }
  193. Err(nb::Error::Other(err))
  194. } else {
  195. // Check if a byte is available
  196. if sr.rxne().bit_is_set() {
  197. // Read the received byte
  198. // NOTE(read_volatile) see `write_volatile` below
  199. Ok(unsafe {
  200. ptr::read_volatile(&self.dr as *const _ as *const _)
  201. })
  202. } else {
  203. Err(nb::Error::WouldBlock)
  204. }
  205. }
  206. }
  207. fn write(&self, byte: u8) -> nb::Result<(), Infallible> {
  208. let sr = self.sr.read();
  209. if sr.txe().bit_is_set() {
  210. // NOTE(unsafe) atomic write to stateless register
  211. // NOTE(write_volatile) 8-bit write that's not possible through the svd2rust API
  212. unsafe {
  213. ptr::write_volatile(&self.dr as *const _ as *mut _, byte)
  214. }
  215. Ok(())
  216. } else {
  217. Err(nb::Error::WouldBlock)
  218. }
  219. }
  220. fn flush(&self) -> nb::Result<(), Infallible> {
  221. let sr = self.sr.read();
  222. if sr.tc().bit_is_set() {
  223. Ok(())
  224. } else {
  225. Err(nb::Error::WouldBlock)
  226. }
  227. }
  228. }
  229. impl UsartReadWrite for &crate::pac::usart1::RegisterBlock {}
  230. macro_rules! hal {
  231. ($(
  232. $(#[$meta:meta])*
  233. $USARTX:ident: (
  234. $usartX:ident,
  235. $usartX_remap:ident,
  236. $bit:ident,
  237. $closure:expr,
  238. ),
  239. )+) => {
  240. $(
  241. $(#[$meta])*
  242. /// The behaviour of the functions is equal for all three USARTs.
  243. /// Except that they are using the corresponding USART hardware and pins.
  244. impl<PINS> Serial<$USARTX, PINS> {
  245. /// Configures the serial interface and creates the interface
  246. /// struct.
  247. ///
  248. /// `Bps` is the baud rate of the interface.
  249. ///
  250. /// `Clocks` passes information about the current frequencies of
  251. /// the clocks. The existence of the struct ensures that the
  252. /// clock settings are fixed.
  253. ///
  254. /// The `serial` struct takes ownership over the `USARTX` device
  255. /// registers and the specified `PINS`
  256. ///
  257. /// `MAPR` and `APBX` are register handles which are passed for
  258. /// configuration. (`MAPR` is used to map the USART to the
  259. /// corresponding pins. `APBX` is used to reset the USART.)
  260. pub fn $usartX(
  261. usart: $USARTX,
  262. pins: PINS,
  263. mapr: &mut MAPR,
  264. config: Config,
  265. clocks: Clocks,
  266. apb: &mut <$USARTX as RccBus>::Bus,
  267. ) -> Self
  268. where
  269. PINS: Pins<$USARTX>,
  270. {
  271. // enable and reset $USARTX
  272. $USARTX::enable(apb);
  273. $USARTX::reset(apb);
  274. #[allow(unused_unsafe)]
  275. mapr.modify_mapr(|_, w| unsafe{
  276. w.$usartX_remap().$bit(($closure)(PINS::REMAP))
  277. });
  278. // enable DMA transfers
  279. usart.cr3.write(|w| w.dmat().set_bit().dmar().set_bit());
  280. // Configure baud rate
  281. let brr = <$USARTX as RccBus>::Bus::get_frequency(&clocks).0 / config.baudrate.0;
  282. assert!(brr >= 16, "impossible baud rate");
  283. usart.brr.write(|w| unsafe { w.bits(brr) });
  284. // Configure parity and word length
  285. // Unlike most uart devices, the "word length" of this usart device refers to
  286. // the size of the data plus the parity bit. I.e. "word length"=8, parity=even
  287. // results in 7 bits of data. Therefore, in order to get 8 bits and one parity
  288. // bit, we need to set the "word" length to 9 when using parity bits.
  289. let (word_length, parity_control_enable, parity) = match config.parity {
  290. Parity::ParityNone => (false, false, false),
  291. Parity::ParityEven => (true, true, false),
  292. Parity::ParityOdd => (true, true, true),
  293. };
  294. usart.cr1.modify(|_r, w| {
  295. w
  296. .m().bit(word_length)
  297. .ps().bit(parity)
  298. .pce().bit(parity_control_enable)
  299. });
  300. // Configure stop bits
  301. let stop_bits = match config.stopbits {
  302. StopBits::STOP1 => 0b00,
  303. StopBits::STOP0P5 => 0b01,
  304. StopBits::STOP2 => 0b10,
  305. StopBits::STOP1P5 => 0b11,
  306. };
  307. usart.cr2.modify(|_r, w| {
  308. w.stop().bits(stop_bits)
  309. });
  310. // UE: enable USART
  311. // RE: enable receiver
  312. // TE: enable transceiver
  313. usart
  314. .cr1
  315. .modify(|_r, w| w.ue().set_bit().re().set_bit().te().set_bit());
  316. Serial { usart, pins }
  317. }
  318. /// Starts listening to the USART by enabling the _Received data
  319. /// ready to be read (RXNE)_ interrupt and _Transmit data
  320. /// register empty (TXE)_ interrupt
  321. pub fn listen(&mut self, event: Event) {
  322. match event {
  323. Event::Rxne => self.usart.cr1.modify(|_, w| w.rxneie().set_bit()),
  324. Event::Txe => self.usart.cr1.modify(|_, w| w.txeie().set_bit()),
  325. }
  326. }
  327. /// Stops listening to the USART by disabling the _Received data
  328. /// ready to be read (RXNE)_ interrupt and _Transmit data
  329. /// register empty (TXE)_ interrupt
  330. pub fn unlisten(&mut self, event: Event) {
  331. match event {
  332. Event::Rxne => self.usart.cr1.modify(|_, w| w.rxneie().clear_bit()),
  333. Event::Txe => self.usart.cr1.modify(|_, w| w.txeie().clear_bit()),
  334. }
  335. }
  336. /// Returns ownership of the borrowed register handles
  337. pub fn release(self) -> ($USARTX, PINS) {
  338. (self.usart, self.pins)
  339. }
  340. /// Separates the serial struct into separate channel objects for sending (Tx) and
  341. /// receiving (Rx)
  342. pub fn split(self) -> (Tx<$USARTX>, Rx<$USARTX>) {
  343. (
  344. Tx {
  345. _usart: PhantomData,
  346. },
  347. Rx {
  348. _usart: PhantomData,
  349. },
  350. )
  351. }
  352. }
  353. impl Tx<$USARTX> {
  354. pub fn listen(&mut self) {
  355. unsafe { (*$USARTX::ptr()).cr1.modify(|_, w| w.txeie().set_bit()) };
  356. }
  357. pub fn unlisten(&mut self) {
  358. unsafe { (*$USARTX::ptr()).cr1.modify(|_, w| w.txeie().clear_bit()) };
  359. }
  360. }
  361. impl Rx<$USARTX> {
  362. pub fn listen(&mut self) {
  363. unsafe { (*$USARTX::ptr()).cr1.modify(|_, w| w.rxneie().set_bit()) };
  364. }
  365. pub fn unlisten(&mut self) {
  366. unsafe { (*$USARTX::ptr()).cr1.modify(|_, w| w.rxneie().clear_bit()) };
  367. }
  368. }
  369. impl crate::hal::serial::Read<u8> for Rx<$USARTX> {
  370. type Error = Error;
  371. fn read(&mut self) -> nb::Result<u8, Error> {
  372. unsafe { &*$USARTX::ptr() }.read()
  373. }
  374. }
  375. impl crate::hal::serial::Write<u8> for Tx<$USARTX> {
  376. type Error = Infallible;
  377. fn flush(&mut self) -> nb::Result<(), Self::Error> {
  378. unsafe { &*$USARTX::ptr() }.flush()
  379. }
  380. fn write(&mut self, byte: u8) -> nb::Result<(), Self::Error> {
  381. unsafe { &*$USARTX::ptr() }.write(byte)
  382. }
  383. }
  384. impl<PINS> crate::hal::serial::Read<u8> for Serial<$USARTX, PINS> {
  385. type Error = Error;
  386. fn read(&mut self) -> nb::Result<u8, Error> {
  387. self.usart.deref().read()
  388. }
  389. }
  390. impl<PINS> crate::hal::serial::Write<u8> for Serial<$USARTX, PINS> {
  391. type Error = Infallible;
  392. fn flush(&mut self) -> nb::Result<(), Self::Error> {
  393. self.usart.deref().flush()
  394. }
  395. fn write(&mut self, byte: u8) -> nb::Result<(), Self::Error> {
  396. self.usart.deref().write(byte)
  397. }
  398. }
  399. )+
  400. }
  401. }
  402. impl<USART> core::fmt::Write for Tx<USART>
  403. where
  404. Tx<USART>: embedded_hal::serial::Write<u8>,
  405. {
  406. fn write_str(&mut self, s: &str) -> core::fmt::Result {
  407. s.as_bytes()
  408. .iter()
  409. .try_for_each(|c| nb::block!(self.write(*c)))
  410. .map_err(|_| core::fmt::Error)
  411. }
  412. }
  413. hal! {
  414. /// # USART1 functions
  415. USART1: (
  416. usart1,
  417. usart1_remap,
  418. bit,
  419. |remap| remap == 1,
  420. ),
  421. /// # USART2 functions
  422. USART2: (
  423. usart2,
  424. usart2_remap,
  425. bit,
  426. |remap| remap == 1,
  427. ),
  428. /// # USART3 functions
  429. USART3: (
  430. usart3,
  431. usart3_remap,
  432. bits,
  433. |remap| remap,
  434. ),
  435. }
  436. pub type Rx1 = Rx<USART1>;
  437. pub type Tx1 = Tx<USART1>;
  438. pub type Rx2 = Rx<USART2>;
  439. pub type Tx2 = Tx<USART2>;
  440. pub type Rx3 = Rx<USART3>;
  441. pub type Tx3 = Tx<USART3>;
  442. use crate::dma::{Transmit, Receive, TransferPayload};
  443. macro_rules! serialdma {
  444. ($(
  445. $USARTX:ident: (
  446. $rxdma:ident,
  447. $txdma:ident,
  448. $dmarxch:ty,
  449. $dmatxch:ty,
  450. ),
  451. )+) => {
  452. $(
  453. pub type $rxdma = RxDma<Rx<$USARTX>, $dmarxch>;
  454. pub type $txdma = TxDma<Tx<$USARTX>, $dmatxch>;
  455. impl Receive for $rxdma {
  456. type RxChannel = $dmarxch;
  457. type TransmittedWord = u8;
  458. }
  459. impl Transmit for $txdma {
  460. type TxChannel = $dmatxch;
  461. type ReceivedWord = u8;
  462. }
  463. impl TransferPayload for $rxdma {
  464. fn start(&mut self) {
  465. self.channel.start();
  466. }
  467. fn stop(&mut self) {
  468. self.channel.stop();
  469. }
  470. }
  471. impl TransferPayload for $txdma {
  472. fn start(&mut self) {
  473. self.channel.start();
  474. }
  475. fn stop(&mut self) {
  476. self.channel.stop();
  477. }
  478. }
  479. impl Rx<$USARTX> {
  480. pub fn with_dma(self, channel: $dmarxch) -> $rxdma {
  481. RxDma {
  482. payload: self,
  483. channel,
  484. }
  485. }
  486. }
  487. impl Tx<$USARTX> {
  488. pub fn with_dma(self, channel: $dmatxch) -> $txdma {
  489. TxDma {
  490. payload: self,
  491. channel,
  492. }
  493. }
  494. }
  495. impl $rxdma {
  496. pub fn split(mut self) -> (Rx<$USARTX>, $dmarxch) {
  497. self.stop();
  498. let RxDma {payload, channel} = self;
  499. (
  500. payload,
  501. channel
  502. )
  503. }
  504. }
  505. impl $txdma {
  506. pub fn split(mut self) -> (Tx<$USARTX>, $dmatxch) {
  507. self.stop();
  508. let TxDma {payload, channel} = self;
  509. (
  510. payload,
  511. channel,
  512. )
  513. }
  514. }
  515. impl<B> crate::dma::CircReadDma<B, u8> for $rxdma where B: as_slice::AsMutSlice<Element=u8> {
  516. fn circ_read(mut self, buffer: &'static mut [B; 2],
  517. ) -> CircBuffer<B, Self>
  518. {
  519. {
  520. let buffer = buffer[0].as_mut_slice();
  521. self.channel.set_peripheral_address(unsafe{ &(*$USARTX::ptr()).dr as *const _ as u32 }, false);
  522. self.channel.set_memory_address(buffer.as_ptr() as u32, true);
  523. self.channel.set_transfer_length(buffer.len() * 2);
  524. atomic::compiler_fence(Ordering::Release);
  525. self.channel.ch().cr.modify(|_, w| { w
  526. .mem2mem() .clear_bit()
  527. .pl() .medium()
  528. .msize() .bits8()
  529. .psize() .bits8()
  530. .circ() .set_bit()
  531. .dir() .clear_bit()
  532. });
  533. }
  534. self.start();
  535. CircBuffer::new(buffer, self)
  536. }
  537. }
  538. impl<B> crate::dma::ReadDma<B, u8> for $rxdma where B: as_slice::AsMutSlice<Element=u8> {
  539. fn read(mut self, buffer: &'static mut B,
  540. ) -> Transfer<W, &'static mut B, Self>
  541. {
  542. {
  543. let buffer = buffer.as_mut_slice();
  544. self.channel.set_peripheral_address(unsafe{ &(*$USARTX::ptr()).dr as *const _ as u32 }, false);
  545. self.channel.set_memory_address(buffer.as_ptr() as u32, true);
  546. self.channel.set_transfer_length(buffer.len());
  547. }
  548. atomic::compiler_fence(Ordering::Release);
  549. self.channel.ch().cr.modify(|_, w| { w
  550. .mem2mem() .clear_bit()
  551. .pl() .medium()
  552. .msize() .bits8()
  553. .psize() .bits8()
  554. .circ() .clear_bit()
  555. .dir() .clear_bit()
  556. });
  557. self.start();
  558. Transfer::w(buffer, self)
  559. }
  560. }
  561. impl<A, B> crate::dma::WriteDma<A, B, u8> for $txdma where A: as_slice::AsSlice<Element=u8>, B: Static<A> {
  562. fn write(mut self, buffer: B
  563. ) -> Transfer<R, B, Self>
  564. {
  565. {
  566. let buffer = buffer.borrow().as_slice();
  567. self.channel.set_peripheral_address(unsafe{ &(*$USARTX::ptr()).dr as *const _ as u32 }, false);
  568. self.channel.set_memory_address(buffer.as_ptr() as u32, true);
  569. self.channel.set_transfer_length(buffer.len());
  570. }
  571. atomic::compiler_fence(Ordering::Release);
  572. self.channel.ch().cr.modify(|_, w| { w
  573. .mem2mem() .clear_bit()
  574. .pl() .medium()
  575. .msize() .bits8()
  576. .psize() .bits8()
  577. .circ() .clear_bit()
  578. .dir() .set_bit()
  579. });
  580. self.start();
  581. Transfer::r(buffer, self)
  582. }
  583. }
  584. )+
  585. }
  586. }
  587. serialdma! {
  588. USART1: (
  589. RxDma1,
  590. TxDma1,
  591. dma1::C5,
  592. dma1::C4,
  593. ),
  594. USART2: (
  595. RxDma2,
  596. TxDma2,
  597. dma1::C6,
  598. dma1::C7,
  599. ),
  600. USART3: (
  601. RxDma3,
  602. TxDma3,
  603. dma1::C3,
  604. dma1::C2,
  605. ),
  606. }