Hardware Serial only in RX (or TX) #2841
Replies: 6 comments 4 replies
-
|
Hi @luca-stm32 |
Beta Was this translation helpful? Give feedback.
-
|
Hi @fpistm. So, if I understood well, you suggested me to configure USART2 in Half Duplex mode (for this configuration, I need to configure USART2 TX pin PA2 in declaration) and then swap RX to TX pin in order to use PA3, correct? I was wondering what happen to PA2 (USART2 TX PIN) when I declare Serial2 in Half Duplex mode as it is connected to an op-amp output: is PA2 in high impedance mode after Serial2 initialization? Thanks. |
Beta Was this translation helpful? Give feedback.
-
|
Ok, thanks fpistm. |
Beta Was this translation helpful? Give feedback.
-
|
Excuse me fpistm, I know that my request is out of Arduino API concern, the request could interest few people and unfortunately I can't be of any help for it, and please don't think I have any respect of your hard (really very hard!) work, but I rather think it could be very difficult to implement (and expecially time consuming). #define USART_MODE_RX ((uint32_t)USART_CR1_RE) This declaration make me think that technically RX (or TX) only mode could be implemented. But maybe I missed a detail that makes this truly impossible to implement. |
Beta Was this translation helpful? Give feedback.
-
|
Hi fpistm. and Line 406: It seems to me like U(S)ARTS could be only initialized if TX pin is defined and only in RX AND TX mode. I tried to comment lines near 141 in order to skip TX pin definition control and modify lines near 406 as follow: /* Configure uart */ I tried to initialize Serial2 forcing TX pin as NC: So my question is: why U(S)ARTs could be initialized ONLY in RX AND TX mode? Is something else to modify in uart.c file in order to be able to initialize U(S)ARTs only in RX OR TX mode? Thanks again for your time. Regards. |
Beta Was this translation helpful? Give feedback.
-
|
Hi fpistm. To manage RX only mode, I declared UART2 as follow: // RX TX or Serial2.setRx(PA3); Both cases work. In case someone need only TX mode, half duplex mode can be enabled: user must remember to set UART in TX. Attached, I send my uart.c modified file (I'm not very keen on github...) I hope it could help to improve this fantastic core. Thanks again. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to ask if it could be possible to implement hardware serial peripheral only in RX (or TX) mode.
I searched in Wiki and I found that I could use hardware serial declaring RX and TX pins (both) or in halfduplex mode declaring only TX pin.
I thinked a declaration like this:
HardwareSerial Serial1(PA10, NC);for only RX mode or:
HardwareSerial Serial1(NC, PA9);for TX mode.
This could be very useful expecially when you need only RX (for example GPS serial data) using a micro with a little number of pins.
I prefer not to use Softwareserial if micro has hardware serial lines available.
I know that I can use Hardware Serial declaring RX and TX pins withiut conneting TX (or RX) pins, but I think it is a "waste" or resources and sometimes it is not possible expecially if you are using a small micro with a little number of pins.
Thanks for your great work!
Regards.
Luca
Beta Was this translation helpful? Give feedback.
All reactions