USB to RS485 with a MAX485 and MCU/FT232

Thread Starter

Alextrical

Joined May 5, 2022
18
I'm currently trying to reprogram a WIZ108SR which needs to communicate over RS458 serial, however I don't have any adapters at hand. However I have a fair few Arduino, Wemod D1 mini, BlackPill and Usb to 3.3/5v serial adapters.

The device I'm trying to reprogram https://docs.wiznet.io/Product/S2E-Module/WIZ108SR
Using the following MAX485 module https://www.ebay.co.uk/itm/381374599127

However my issue is this module doesn't have hardware flow control, what is the easiest way to bridge USB to communicate? (With the following hardware)
https://kunkune.co.uk/shop/kunkune-...ft232rl-ftdi-serial-adapter-converter-module/
Which according to the data sheet would work, but I'm not sure if it needs to be reprogrammed to support this, or if the board I have breaks out the 2 required pins? https://ftdichip.com/wp-content/uploads/2020/08/DS_FT232R.pdf
1704636284908.jpeg








sukra_ft232_1.jpg


Alternatively are there any sketches to turn an Arduino Uno into a Serial Bridge with flow control?

Alternatively ESP-Link could be an option, though I can't seem to find if it can support flow control of a MAX485

Kind regards
Ben
 
Last edited:

nsaspook

Joined Aug 27, 2009
16,250
Why do you need hardware flow control? That's usually a requirement when using unstable RF links to transfer data so we stop during carrier drop-outs.
 

Thread Starter

Alextrical

Joined May 5, 2022
18
Why do you need hardware flow control? That's usually a requirement when using unstable RF links to transfer data so we stop during carrier drop-outs.
I'm new to RS485 and the MAX485, but from what I have read so far, I believe that it's a half-duplex transceiver, that needs to be told by the communicatin device/MCU to be in a transmit or a receive state.
Hardware flow control is probably the wrong terminology, but the DE and RE pins need to be in one state when sending, and in another when recieving.

It also seems that my 12 year old toy pocket oscilloscope is starting to act up.

1704691146359.png
 

nsaspook

Joined Aug 27, 2009
16,250
I'm new to RS485 and the MAX485, but from what I have read so far, I believe that it's a half-duplex transceiver, that needs to be told by the communicatin device/MCU to be in a transmit or a receive state.
Hardware flow control is probably the wrong terminology, but the DE and RE pins need to be in one state when sending, and in another when recieving.

It also seems that my 12 year old toy pocket oscilloscope is starting to act up.

View attachment 312070
That's normally just set with a gpio pin(s) in the software with a controller.

For a system with separate DE/RE enable pins
C:
#ifdef LOCAL_ECHO
            RE_ = 0; // keep receiver active
#else
            RE_ = 1; // shutdown receiver
#endif
            DE = 1; // enable transmitter
            V.send_count = 0;
            V.recv_count = 0;
            cstate = SEND;
            clear_500hz();
        }
        break;
    case SEND:
        if (get_500hz(FALSE) > TDELAY) {
            do {
                while (BusyUSART()); // wait for each byte
                TXREG = cc_buffer[V.send_count];
            } while (++V.send_count < req_length);
            while (BusyUSART()); // wait for the last byte
            cstate = RECV;
            clear_500hz();
        }
        break;
    case RECV:
        if (get_500hz(FALSE) > TDELAY) {
            uint16_t c_crc, c_crc_rec;

            DE = 0;
            RE_ = 0;

            /*
             * check received response data for size and format for each command sent
             */
 

Sensacell

Joined Jun 19, 2012
3,768
RS-485 is half-duplex, yes, the TX enable and RX enable need to be switched at the correct time to enable two-way coms.
Depending on the baud rate, this can be a tricky, non-trivial affair.

I always leave the RX permanently enabled, then you can use the RX buffer full flag to tell you when the last character finishes sending, time to shutdown the TX.
You always receive what you send. Some UARTS don't have flags that really indicate when the stop bit finishes, so this TX-RX loopback trick is useful for that problem.
 

Ya’akov

Joined Jan 27, 2019
10,226
The FT232 has a TXDEN signal that goes high one bit period before it sends data to turn on the transmitter and a PWREN# to turn on the receiver. (pins 13 & 14)

1704715941190.png

These can also be used to ignore the transmitted data in hardware, as the datasheet explains,
…by logically OR’ing the FT232R TXDEN and the SP481 receiver output and connecting the output of the OR gate to the RXD of the FT232R.

 
Top