Jump to content

Communication via RS485 does not work


Recommended Posts

Hello everyone,

i'm trying a first test to communicate with an Arduino Mega and an Arduino Nano via MAX487 chip. Unfortunately I can't get it there at the moment.

I want to control the MasterCausion button and the MasterCaution LED as a test.

 

have built the following circuit: --> see attached picture.

 

I767718835_ArduinoSchaltung.thumb.JPG.511737de27284caa132e9e6a191bbb4d.JPG

 

On the Adruino Mega I have uploaded the following sketch:

 

/*

Tell DCS-BIOS this is a RS-485 Master.

You will need to flash this to a Mega 2560.

*/

#define DCSBIOS_RS485_MASTER

 

/*

Define where the TX_ENABLE signals are connected.

You can connect up to three half-duplex RS-485 transceivers.

 

Arduino Pin RS-485 Transceiver Pin

TXn ------------------- DI (driver input)

RXn ------------------- RO (Receiver Output)

UARTn_TXENABLE_PIN ---- /RE, DE (active low receiver enable, driver enable)

 

If you have less than three transceivers connected, comment out the corresponding

#define UARTn_TEXENABLE_PIN lines for receivers that are not present.

*/

#define UART1_TXENABLE_PIN 2

//#define UART2_TXENABLE_PIN 3

//#define UART3_TXENABLE_PIN 4

 

#include "DcsBios.h"

 

void setup() {

DcsBios::setup();

}

 

void loop() {

DcsBios::loop();

}

 

On the Arduino Nano I have uploaded the following sketch:

 

/*

The following #define tells DCS-BIOS that this is a RS-485 slave device.

It also sets the address of this slave device. The slave address should be

between 1 and 126 and must be unique among all devices on the same bus.

*/

#define DCSBIOS_RS485_SLAVE 126

 

/*

The Arduino pin that is connected to the

/RE and DE pins on the RS-485 transceiver.

*/

#define TXENABLE_PIN 2

 

#include "DcsBios.h"

 

/* paste code snippets from the reference documentation here */

DcsBios::Switch2Pos masterCautionResetSw("MASTER_CAUTION_RESET_SW", 8;

DcsBios::LED masterCautionLt(0x7408, 0x0200, 13);

 

void setup() {

DcsBios::setup();

}

 

void loop() {

DcsBios::loop();

}

 

the whole thing does not work. As soon as I connect the COM port in DCS-BIOS the RX LED on the Arduino Mega flashes very fast.

 

The LED on the Nano does not turn on when the MasterCaution LED in DCS is on.

When I press the PushButton in the circuit, nothing happens in DCS.

 

DCS-BIOS communicates with DCS without problems.

 

Does anyone have a tip for me?

Link to post
Share on other sites

So 1. mistake... Max487 need 12V supply.

But the problems starts earlier.

When i try just the boards to communicate with DCS BIOS. Just the Arduino UNO and Arduino Nano can communicate with DCS BIOS. I have two MEGA boards. They dont work. I Can upload the Sketch. But nothing happen when connect to DCS BIOS.

Any idea?

Link to post
Share on other sites

Max487 only needs 5v. From your pic i see you connect 5v out from mega (master) to v-in on nano. V-in needs at least 6v (up to 12v) because of conversion loss. Maybe this is your problem?

 

Edit: Have a look here:

https://forums.eagle.ru/forum/english/dcs-world-topics/input-and-output/home-cockpits/245244-dcs-bios-over-rs485

 


Edited by crash test pilot
Link to post
Share on other sites
Max487 only needs 5v. From your pic i see you connect 5v out from mega (master) to v-in on nano. V-in needs at least 6v (up to 12v) because of conversion loss. Maybe this is your problem?

 

Edit: Have a look here:

https://forums.eagle.ru/forum/englis...ios-over-rs485

 

you are right with 7V for the Nano.

I know the thread from Hans - thanks.

But why are the Mega's not able go communicate with DCS BIOS? I thinkna have to solve this Problem first.

Any idea?

Link to post
Share on other sites

You have me slightly confused here. In the original post you use the Nano as Slave, but in post #5 you have the push button attached to the Mega? The Mega running as Master cannot hold any other code than just the Master code.

 

DCS-BIOS makes internal pull-up when you define a switch. If you have loaded the correct Master code to the Mega then it doesn't have any switches thus you do not have any internal pull up.

 

It looks like you are missing the end backet in the Nano code. Should be this:

DcsBios::Switch2Pos masterCautionResetSw("MASTER_CAUTION_RESET_SW", 8);

 

Instead of this:

DcsBios::Switch2Pos masterCautionResetSw("MASTER_CAUTION_RESET_SW", 8;

 

 

Cheers

Hans

Link to post
Share on other sites
You have me slightly confused here. In the original post you use the Nano as Slave, but in post #5 you have the push button attached to the Mega? The Mega running as Master cannot hold any other code than just the Master code.

 

DCS-BIOS makes internal pull-up when you define a switch. If you have loaded the correct Master code to the Mega then it doesn't have any switches thus you do not have any internal pull up.

 

It looks like you are missing the end backet in the Nano code. Should be this:

DcsBios::Switch2Pos masterCautionResetSw("MASTER_CAUTION_RESET_SW", 8);

 

Instead of this:

DcsBios::Switch2Pos masterCautionResetSw("MASTER_CAUTION_RESET_SW", 8;

 

 

Cheers

Hans

 

Hi Hans,

 

When the RS485 network did not work, I first tested the individual components. Therefore I tested the NANO and the MEGA board separately. I noticed that the same circuit and the same code does not work with the MEGA board. When I used a PullUp resistor this board worked. The Post#5 referred to this separate test.

 

i just checked the sketch. There is the end bracket. Probably it got lost when copying here in the forum.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...