Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for max485 #17247

Closed

Conversation

iosifnicolae2
Copy link

@iosifnicolae2 iosifnicolae2 commented Dec 3, 2022

Description:

How to use it

Add the following lines to user_config_override.h:

#ifndef USE_MAX485
#define USE_MAX485
#endif

#ifndef MAX485_DE_PIN
// GPIO 0 = D3
#define MAX485_DE_PIN 0
#endif

Wiring

  • MAX 485 DI -> ESP RX
  • MAX 485 RO -> ESP TX
  • MAX DE -> D3 (GPIO 0)
  • MAX RE -> D3 (GPIO 0)

Related issue (if applicable):

Checklist:

  • The pull request is done against the latest development branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP8266 V.2.7.4.9
  • The code change is tested and works with Tasmota core ESP32 V.2.0.5 (I didn't tested it)
  • I accept the CLA.

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass

@arendst
Copy link
Owner

arendst commented Dec 3, 2022

Thx.

The solution resembles the software serial setTransmitEnablePin() function. Your implemntation adds a lot of code duplication AND compile time GPIO defines.

This won't be merged as is.

Considering the demand I will implement setTransmitEnablePin() in the smallest foodprint possible. Once implemented the calling driver will need to be changed for accessing the TransmitEnable GPIO.

@arendst arendst added the on hold by dev team Result - Feature request put on hold by member of development team label Dec 3, 2022
@arendst arendst self-assigned this Dec 3, 2022
arendst added a commit that referenced this pull request Dec 3, 2022
Add serial Modbus transmit enable GPIOs to all modbus energy drivers and modbus bridge (#17247)
@arendst
Copy link
Owner

arendst commented Dec 3, 2022

Implemented in all generic tasmota drivers.

SML driver is a special project from @gemu2015 and uses a mix of TasmotaSerial, SoftwareSerial and hardware serial and currently does not support the new TasmotaSerial setTransmitEnablePin() feature.

This should be fixed by @gemu2015.

@arendst arendst closed this Dec 3, 2022
@nunojpg
Copy link

nunojpg commented Mar 13, 2023

@arendst this is not working for me and after reviewing the code I don't think it can work at all with hardware ports, since the transmit enable pin stays up just for the time you take to queue the bytes, the transmission then is async.

@arendst
Copy link
Owner

arendst commented Mar 13, 2023

Using latest Dev branches I can assure you it works as designed

@nunojpg
Copy link

nunojpg commented Mar 13, 2023

@arendst using ESP32 (m_hardserial = true), then m_tx_enable_pin stays high for about 250us, while the bits then take much longer to come out from the hardware serial port.
I am sure it works fine with a soft serial port, but not with hardware serial port.
I am using 12.4.0.2.

@nunojpg
Copy link

nunojpg commented Mar 13, 2023

SML implementation works because it correctly flush the fifo before disabling the TX EN pin.

@arendst
Copy link
Owner

arendst commented Mar 13, 2023

Ok so I just need to add the flush on esp32 hardware serial before disabling.

arendst added a commit that referenced this pull request Mar 14, 2023
@arendst
Copy link
Owner

arendst commented Mar 14, 2023

Try latest dev and let me know if it fixes your issue.

@nunojpg
Copy link

nunojpg commented Mar 14, 2023

Works great. Thanks for doing it so fast!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on hold by dev team Result - Feature request put on hold by member of development team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RS485 suport for modbus over MAX485
3 participants