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

Changes for RS485 mode #1826

Merged
merged 6 commits into from
Jan 8, 2021
Merged

Changes for RS485 mode #1826

merged 6 commits into from
Jan 8, 2021

Conversation

AdrianSoundy
Copy link
Member

@AdrianSoundy AdrianSoundy commented Jan 5, 2021

Description

Add RS485 for ESP32 only

Motivation and Context

How Has This Been Tested?

Simple test program to send data and check results on logic analyser

`

                    Configuration.SetPinFunction(34, DeviceFunction.COM2_RX);
		Configuration.SetPinFunction(13, DeviceFunction.COM2_TX);
		Configuration.SetPinFunction(12, DeviceFunction.COM2_RTS);

		sd = SerialDevice.FromId("COM2");

		sd.BaudRate = 230400;

		sd.DataBits = 8;
		sd.Parity = SerialParity.None;
		sd.StopBits = SerialStopBitCount.One;

		sd.Mode = SerialMode.RS485;

		inputDataReader = new DataReader(sd.InputStream);
		inputDataReader.InputStreamOptions = InputStreamOptions.Partial;

		sd.DataReceived += Sd_DataReceived;

		DataWriter outputDataWriter = new DataWriter(sd.OutputStream);

		while (true)
		{

			outputDataWriter.WriteString("abc\n");
			outputDataWriter.Store();


			Thread.Sleep(5);
		}

`

TX & RTS
RTS does seem to stay on a little longer than expected after last byte sent but that's done by ESP IDF

rs485_2

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Config and build (change in the configuration and build system, has no impact on code or features)
  • Dependencies (update dependencies and changes associated, has no impact on code or features)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Automated fixes for code style.
@nfbot
Copy link
Member

nfbot commented Jan 5, 2021

@AdrianSoundy there are issues with the code style on the source files.
A PR was submitted with the code style fixes. Please review and merge the changes. See https://github.com/AdrianSoundy/nf-interpreter/pull/26.

Make sure you are using the project code style. Check the details here.

…2-7cca-4fb0-90c1-e66b12312990' into serial-rs485
@josesimoes josesimoes added the Series: ESP32 Everything related specifically with ESP32 series targets label Jan 6, 2021
Copy link
Member

@josesimoes josesimoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Can you please add a check to the other platforms to throw an NOT IMPLEMENTED exception when the SerialMode is set to RS485? That will make it clear to developers trying to use this feature on platforms that don't support or don't have this feature available.

Give error if RS485 mode selected
@AdrianSoundy
Copy link
Member Author

AdrianSoundy commented Jan 8, 2021

Tested on 469 Discovery and give not implemented exception

Automated fixes for code style.
@nfbot
Copy link
Member

nfbot commented Jan 8, 2021

@AdrianSoundy there are issues with the code style on the source files.
A PR was submitted with the code style fixes. Please review and merge the changes. See https://github.com/AdrianSoundy/nf-interpreter/pull/27.

Make sure you are using the project code style. Check the details here.

…c-683e-4427-8017-6a58e21b0120' into serial-rs485
@AdrianSoundy AdrianSoundy merged commit 729142f into nanoframework:develop Jan 8, 2021
@AdrianSoundy AdrianSoundy deleted the serial-rs485 branch January 8, 2021 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Series: ESP32 Everything related specifically with ESP32 series targets Type: enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for RS485 on ESP32
3 participants