pythings / Drivers

Some drivers for MicroPython
Apache License 2.0
63 stars 22 forks source link

RX and TX wrong way around #8

Closed MightySCollins closed 4 years ago

MightySCollins commented 4 years ago

This might be for a reason I don't understand but at https://github.com/pythings/Drivers/blob/master/SIM800L.py#L77 is the below line:

self.uart = UART(1, 9600, timeout=1000, rx=self.MODEM_TX_PIN, tx=self.MODEM_RX_PIN)

Should the TX and RX be swapped?

sarusso commented 4 years ago

It drove me crazy at the beginning, but it is actually right. The transmission over the tx of the uart is received by the rx of the modem, and vice-versa. This is why I named the rx and tx pins as MODEM_TX_PIN and MODEM_RX_PIN, hoping to make this distinction more clear, but it is counter-intuitive for anyone at first sight I guess..

MightySCollins commented 4 years ago

Ahh ok interesting. What confused me even more is I was copying pins from a TinyGSM sketch which seemed to list them the "correct" but incorrect way. It took about an hour of my life... Might be worth sticking a comment or something above that line.

sarusso commented 3 years ago

I guess we should have added such a comment.. (See #15)