RS485 linking two Feather RP2040 using CircuitPython

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
William8
 
Posts: 29
Joined: Thu Jul 14, 2022 4:00 pm

RS485 linking two Feather RP2040 using CircuitPython

Post by William8 »

How can I use the Feather RP2040, Product ID: 4884, on chip RP2040 hardware UART0 (and same for UART1) on RS485 with Maxim MAX485 chip in a half duplex 2-wires RS485 configuration between two or more Feather RP2040?

I try my best to read doc but need help as new to this. With reference to the CircuitPython doc as link below for class busio.UART:

1. Is it correct that Feather board will make RTS HIGH before sending single or multiple byte data on TX pin of UART and will make RTS LOW after all data have finished sending?

2. It is correct that I can assign any GPIO pin as RTS in the Class API and connect to the DE pin of MAX485 chip?

3. It is correct that CTS in the API can be left blank (not used in my case)?

4. What is rs485_dir (Pin) and rs485_invert in the API? Should I left both blank (not used in my case)?

5. What should I be careful as the doc says, "Limitations: Raspberry Pi RP2040 support is implemented in software: The timing for the rs485_dir pin signal is done on a best-effort basis, and may not meet RS485 specifications intermittently." I do not need the rs485_dir, right?

6. Is it correct that if MAX485 !RE pin is connected to RTS and DE, I will NOT receive the sent data (from this Feather) on the UART RX?

If I connect MAX485 !RE permanantly to LOW, UART will receive the data that was sent out by THIS Feather RP2040 and also from other Feather RP2040 (assume not two Feather TALKS as same time).

7. I am not familar to read the API doc in this format. Appreciate please provide two examples for use of UART0 and UART1 (how to write pin number for RX0, TX0 and RX1 and TX1, RTS, etc) in "object definition" class busio.UART

8. Please provide example for readline and write

9. What is NONE is the API doc when NONE is an input to API, as in cts (Pin) – the pin for cts, or None if cts not in use.

What is NONE as return TYPE (byte or NONE) from API, as in
readline() → bytes
Read a line, ending in a newline character, or return None if a timeout occurs sooner, or return everything readable if no newline is found and timeout=0
Returns
the line read
Return type
bytes or None

Many thanks for helping.

https://datasheets.maximintegrated.com/ ... MAX491.pdf

https://docs.circuitpython.org/en/lates ... UART.write

class busio.UART(tx: microcontroller.Pin, rx: microcontroller.Pin, *, baudrate: int = 9600, bits: int = 8, parity: Optional[Parity] = None, stop: int = 1, timeout: float = 1, receiver_buffer_size: int = 64)

A bidirectional serial protocol

A common bidirectional serial protocol that uses an an agreed upon speed rather than a shared clock line.

Parameters

tx (Pin) – the pin to transmit with, or None if this UART is receive-only.

rx (Pin) – the pin to receive on, or None if this UART is transmit-only.

rts (Pin) – the pin for rts, or None if rts not in use.

cts (Pin) – the pin for cts, or None if cts not in use.

rs485_dir (Pin) – the output pin for rs485 direction setting, or None if rs485 not in use.

rs485_invert (bool) – rs485_dir pin active high when set. Active low otherwise.

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”