Arduino Forum

Using Arduino => Networking, Protocols, and Devices => Topic started by: alibabzo on Mar 10, 2019, 09:19 pm

Title: Can't seem to enable MAX485 receive mode
Post by: alibabzo on Mar 10, 2019, 09:19 pm
Hi all - I'm trying to communicate with a solar panel charge controller via Modbus/RS485. I'm hooking up a common LCTech MAX485 serial adapter to my Uno. Transmitting seems to work fine, but I can't seem to make the module receive properly.

Here are my logic analyzer traces
(D0: Uno RX <-> MAX485 RO
 D1: Uno TX <-> MAX485 DI
 D2: RS485 A
 D3: RS485 B
 D4: MAX485 DE/RE)
Sending a Modbus request:
(https://i.imgur.com/3QLi2u6.png)

Response from slave:
(https://i.imgur.com/iUZSt6j.png)

I'd expect there to be activity on the Uno RX pin when RS485 A and B are wiggling and DE/RE on the MAX485 is being pulled low. Does anyone know what am I doing wrong?

(I should mention I've already tried removing the 10k pullup resistors R1-R4 on the LCTech module)
Thanks
Alistair
Title: Re: Can't seem to enable MAX485 receive mode
Post by: Harifa on Mar 10, 2019, 09:54 pm
Hi.

My first bid is that, you transfer an uart based ascii chars with start-stop bits, but the answer seems not a valid byte series with start 0 and stop 1 bit for every byte.
Maybe that is an encoded value? But seems not a valid string.

Okay, second checking the pictures, there are start-stop bits, but it is more shorter.
What is the time scale? I have to ask the actual serial speed, and the required serial speed is the same?
Thanks.
Title: Re: Can't seem to enable MAX485 receive mode
Post by: alibabzo on Mar 12, 2019, 12:07 am
Hi Harifa, thanks for your reply:

- As mentioned I'm sending Modbus data over serial and I'm getting what looks like a valid response back, so I don't think it's a problem with the request format

- Both devices are running at 115200 baud

Thanks
Alistair
Title: Re: Can't seem to enable MAX485 receive mode
Post by: WattsThat on Mar 12, 2019, 01:36 am
Did you try swapping A and B? The standard for polarity seems to be lacking. FWIW, I never bother with capturing A/B with the analyzer since there is little usable info due to its differential nature.
Title: Re: Can't seem to enable MAX485 receive mode
Post by: alibabzo on Mar 16, 2019, 04:46 pm
Hi WattsThat -

I don't think that's the problem as the slave is sending data back, but it's not getting through the adapter.

I tried swapping A and B anyway and the slave doesn't respond at all.

Thanks
Alistair
Title: Re: Can't seem to enable MAX485 receive mode
Post by: Riva on Mar 16, 2019, 05:49 pm
Are you having the same problem Monkey3 had in this (http://forum.arduino.cc/index.php?topic=564171.msg3953295#msg3953295) thread where the MAX485 is not releasing the bus properly when the RE/DE is set in receive mode.
Title: Re: Can't seem to enable MAX485 receive mode
Post by: WattsThat on Mar 16, 2019, 11:48 pm
I know this may seem like a dumb question but have you verified that your wiring does in fact connect the pins DE and RE/ together? Or, asked another way, have you scoped the actual pin 2 on the MAX485 to confirm it is low when receiving?

I don't know if you've seen the schematic:

(http://yourduino.com/docs/MAX485-Module-Sch1.jpg)
Title: Re: Can't seem to enable MAX485 receive mode
Post by: alibabzo on Mar 21, 2019, 06:16 pm
Hi all -

I solved the problem by switching to a MAX1348 board.

Thanks
Alistair
Title: Re: Can't seem to enable MAX485 receive mode
Post by: adwsystems on Mar 21, 2019, 08:18 pm
Hi all -

I solved the problem by switching to a MAX1348 board.

Thanks
Alistair
I would have suggested to use two MAX485 boards hardwiring one to transmit and one to receive (leaving the opposite data line floating). Works great for debugging.

But since you got the MAX1348 analog-to-digital converter to work in its place, I guess you are all set.