tenbaht / sduino

An Arduino-like programming API for the STM8
http://tenbaht.github.io/sduino/
GNU Lesser General Public License v2.1
349 stars 213 forks source link

[Help] Single wire half duplex mode #94

Closed JyeSmith closed 4 years ago

JyeSmith commented 4 years ago

Hey,

I see in the datasheet uart1 supports single wire half duplex mode. After a poke around I couldn't see if it is currently support in sduino.

Any suggestions if it is possible and how to implement it? Or has anyone done a hacky resistor mod to connect the rx and tx pins?

Cheers


EDIT 3

Below in setup() got it work... thanks for the help guys :)

UART1_HalfDuplexCmd(ENABLE);
pinMode(PD5, INPUT_PULLUP);

EDIT 2

I found UART1_HalfDuplexCmd(ENABLE); and will try it...


EDIT 1

So from the reference manual I found that it can be turned on via the below register.

As a quick hack I will try setting UART1->CR5 = UART1_CR5_HDSEL;

Standby...

RM0016 Reference manual STM8S Series and STM8AF Series 8-bit microcontrollers https://www.st.com/content/ccc/resource/technical/document/reference_manual/9a/1b/85/07/ca/eb/4f/dd/CD00190271.pdf/files/CD00190271.pdf/jcr:content/translations/en.CD00190271.pdf

image

image