serial.rs 21 KB

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