Jump to content

Recommended Posts

Posted

Ok, it has defeated me. After having multiple gauges running simultaneously, multiple LCD devices running simultaneously all over RS485, I now cannot get a single one to function.

 

I have tried replacement Nanos, Max487 chips, two different Megas, different wires, setting up a test circuit with all new components, and it simply will not function any more for even one item.

 

I used independent grounds, common grounds, separate power source for the Nanos, common power source for the Nanos, different USB connections all to no avail. My biggest problem is that nothing ever seems to behave the same way twice, and that is impossible to troubleshoot logically without specialist knowledge and equipment

 

So after wasting months with it, it is now going to be shelved. I am interested in any alternatives to get the gauges running simultaneously

 

Les

Posted

This is hard to trouble shoot without further info.

If the problem has occured suddenly it looks like a very small hickup.

I encountered similar phenomena sometimes.

It could be everything.

 

Gesendet von meinem TA-1020 mit Tapatalk

Manual for my version of RS485-Hardware, contact: tekkx@dresi.de

Please do not PM me with DCS-BIOS-related questions. If the answer might also be useful to someone else, it belongs in a public thread where it can be discovered by everyone using the search function. Thank You.

Posted

The problem with further info is that every time I tried something, something different happened, so you were never troubleshooting the same problem, or multiple problems at once.

 

Maybe I will come back to it one day, but in the meantime I will get all the physical stuff done, and just use the USB based outputs to get all the individual gauges and displays working. Maybe by the time I've finished that there will be an alternative or I find someone versed in electronics to work with me here to resolve it.

 

The rest of the rig is looking and working great, and the potential is clearly there, but I have definitely concluded that I would have been a lot further forward had I not wasted such a huge amount of time and effort on RS485!

 

Cheers

 

Les

Posted (edited)

Hi Vinc, yes I did try them, I actually did a test after everything stopped working with one of them (actually a pair ) using new wires and known good nano / easydriver / stepper. It didn't work, the only common parts that I couldn't test were the mega boards, and I tried both to check. If both mega boards are dud, that means a fairly expensive outcome if they are going to fail at that rate☺

 

Cheers

 

Les

Edited by lesthegrngo
  • 3 months later...
Posted

Guys, I've come back to looking at this, as my CNC router spindle motor has burned out, and I have to wait for the replacement to arrive.

 

I went through HanSolo's great sticky and although I am not using the same expansion shields as he uses there, I sat with the whole lot on a table and went through one by one with everything verifying and reverifying the connections, I used new Max 487 chips and a new RS485 breakout board like those suggested above.

 

The only parts of this that are not new are the two Megas I am using.

 

First, I set up a known good working LCD display unit, programmed the Nano with the non-slave version and ran it connected via USB to ensure the basic sketch works, obviously without the MAX487 chip installed. I then installed the MAX487 chip ( new one straight out of packaging), reprogrammed the nano with the Slave version of the sketch, programmed the Mega with the master sketch, and connected it all up.

 

I could see the Mega RX light flashing away, the Mega TX light was off and the Nano RX and TX lights are off. The light on the RS485 breakout board was on and steady, not blinking. Of course, it doesn't work.

 

As a double check I connected up the other Mega, this being the one with the reversed TX and RX pins. With all else being the same, this time the Mega TX light was flashing away, while the Mega RX light and the nano RX and TX lights were off. The light on the RS485 breakout board was on and steady, not blinking.

 

So yet again, even with simple stuff, no two things turn out the same, apart from one. It doesn't work.

 

So as a starting point, can someone please confirm what lights should be on / blinking / off on what units when this is working?

 

For reference these are the three sketches I used, test non-slave, Master sketch, slave sketch

 

#include <Wire.h>
#include <LiquidCrystal_PCF8574.h>
#define DCSBIOS_IRQ_SERIAL

#include <DcsBios.h>

LiquidCrystal_PCF8574 lcd0(0x27);  // set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_PCF8574 lcd1(0x26);
LiquidCrystal_PCF8574 lcd2(0x25);
int show;



void onCmscTxtJmrChange(char* newValue) {
lcd0.setCursor(0, 0);
lcd0.print(newValue);
}
DcsBios::StringBuffer<8> cmscTxtJmrBuffer(0x1096, onCmscTxtJmrChange);

void onCmscTxtChaffFlareChange(char* newValue) {
lcd1.setCursor(0, 0);
lcd1.print(newValue);
}
DcsBios::StringBuffer<8> cmscTxtChaffFlareBuffer(0x108e, onCmscTxtChaffFlareChange);

void onCmscTxtMwsChange(char* newValue) {
lcd2.setCursor(0, 0);
lcd2.print(newValue);
}
DcsBios::StringBuffer<8> cmscTxtMwsBuffer(0x12b0, onCmscTxtMwsChange);

void setup() {
 lcd0.begin(16, 2);
 lcd1.begin(16, 2);
 lcd2.begin(16, 2);
 DcsBios::setup();
 
}

void loop() {
 DcsBios::loop();
lcd0.setBacklight(5);
lcd1.setBacklight(5);
lcd2.setBacklight(5);
}

 

/*
 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();
}

 

/*
 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 94

/*
 The Arduino pin that is connected to the
 /RE and DE pins on the RS-485 transceiver.
*/
#define TXENABLE_PIN 2

#include <Wire.h>
#include <LiquidCrystal_PCF8574.h>


#include <DcsBios.h>

LiquidCrystal_PCF8574 lcd0(0x27);  // set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_PCF8574 lcd1(0x26);
LiquidCrystal_PCF8574 lcd2(0x25);
int show;



void onCmscTxtJmrChange(char* newValue) {
lcd0.setCursor(0, 0);
lcd0.print(newValue);
}
DcsBios::StringBuffer<8> cmscTxtJmrBuffer(0x1096, onCmscTxtJmrChange);

void onCmscTxtChaffFlareChange(char* newValue) {
lcd1.setCursor(0, 0);
lcd1.print(newValue);
}
DcsBios::StringBuffer<8> cmscTxtChaffFlareBuffer(0x108e, onCmscTxtChaffFlareChange);

void onCmscTxtMwsChange(char* newValue) {
lcd2.setCursor(0, 0);
lcd2.print(newValue);
}
DcsBios::StringBuffer<8> cmscTxtMwsBuffer(0x12b0, onCmscTxtMwsChange);

void setup() {
 lcd0.begin(16, 2);
 lcd1.begin(16, 2);
 lcd2.begin(16, 2);
 DcsBios::setup();
 
}

void loop() {
 DcsBios::loop();
lcd0.setBacklight(5);
lcd1.setBacklight(5);
lcd2.setBacklight(5);
}

 

Maybe having an idea of what should be happening can help me work out which part is the stopper

 

Cheers

 

Les

Posted (edited)

Ok, I spent the entire day from 7:00 o'clock this morning on this. I have done literally nothing else today. I't's now gone 5:30 pm, and I still cannot get one single unit to function.

 

I ordered a new Mega, which arrived yesterday evening, an Elegoo R3. I also got a brand new Nano, still in its packaging, two new RS485 modules still attached to each other, made new contact boards to connect the RE / DE pins together and connect to the D2 pins, I printed out Hansolo's sticky in its entirety (a lot of pages), got a load of wires and 0.1'' headers and then I went through, bit by bit, double and triple checking every connection and every wire, using a multimeter to check that there were no disconnected joints or short circuits.

 

I put it all on a tray so that there was no relative movement of anything, I used a USB charger to power the Nano, loaded up the test sketches on Hansolo's sticky and....

 

Nothing.

 

I checked the wiring another five times, and please remember that compared to a lot of the stuff that I have made on this project, the wiring for this is very simple . The parts are all wired up correctly, there simply is no doubt now. I was prepared, no, I would have been happy, ecstatic even, if I suddenly realised that there were some transposed wires or some other stupid error. But no, and frankly with the number of times that I have made and remade this circuitry I would have randomly got it right once by pure chance.

 

I also am starting to come back to how unreliable it was when back last year I had it working. That in itself, the fact that I had it working, demonstrates that I do have the ability to put the circuitry together. It got me thinking.

 

Is it possible that something has corrupted the way that the information is being sent from the computer such that it is not the hardware that is the issue. The hardware has been changed enough times, and independently I have tested the nanos, megas, I have replaced the MAX487 chips with new (I literally have a box of forty or so that I have condemned because I don't know if they are any good or not and can't test them), and the only other things are the wires, USB cables and power supplies (where applicable) and since they are used on other bits and bobs, surely they can't all be defective? Are we really going to believe that 3 Megas, 18 nanos, forty odd Max487 IC's and various RS485 modules are all defective?

 

My Sim rig PC is the only one in the house that has DCS world on it, and DCS BIOS. Is it possible that there is something interfering with the RS485 signal? The stuff I'm making all works over USB, although there are some issues in getting them to connect to DCS BIOS sometimes - normally changing the USB port cures that.

 

I would be the happiest person on this site if someone could point to a basic error in what I have done, but I really really don't believe it's the hardware any more. There has to be something else

 

cheers

 

Les

Edited by lesthegrngo
Posted

I've had an interesting, productive and revealing day.

 

I have all 12 engine gauges running off one arduino. I wondered whether the RS485 was the only way and so I bashed out a sketch that runs all 12 gauges on one Mega board - the cheap chinese one with the transposed TX and RX pin markings. To my utter delight it works perfectly.

 

I have individual calibration for each gauge, and through one USB connection I believe that I can connect up to another 10 stepper motor drivers, therefore gauges.

 

The wiring is simple, just two wires to each stepper driver, to the step and direction pins. No other connection is necessary. Additionally, it can run some LCD displays and OLED's.

 

I will still need to keep some other Nano's for some of the units. not least because it would be too much work to have to redo a load of the bits. However I will have vastly reduced the number of USB connections needed to the point where it is now practicable to run the whole lot using USB, so right now, RS485 will take a back seat.

 

I still believe that RS485 would be good to have, it clearly works well for some people and conceptually it is simple. If I eventually am able to get it working I do believe it has a place on my rig. But for now, all my MAX487 chips, RS485 modules and all the other bits and bobs will be put in a box on the back of a shelf in a dark cupboard!

 

I have run the gauges loads of times, they are reliable, it connects every time without fail and I see absolutely no difference in the way that they move and operate from 12 individually connected USB nano boards apart from one very minor point - the initial stepper start up calibration where the stepper goes full scale in both directions takes longer. Once that finishes, you would not know the difference.

 

The other encouraging point is that from initial tests, I think you can reliably run up to six stepper drivers from one Nano board.

 

And yes, once I have polished the sketch, I will definitely post it here for you all. Let me verify a few things first, including the ability to run off a nano

 

Cheers

 

Les

Posted (edited)

Just a short question: The 487 bus needs on both ends terminal resistors to keep the line. More than two are bad, no one is also bad. Do you have an oszilloscope for watching the signals on the 487 bus? If you use the MAX487 modules - they've all resistors, but only one is allowed. May be there is your problem?

Another thing is, the Arduino mega carring the master must not have any other inputs or outputs than the Max487.

See https://en.wikipedia.org/wiki/RS-485

Edited by Heling
Posted

Hi Heling

 

As far as I can tell, I replicated the schematics called out in Hansolos' great thread accurately. It may be an issue that is specific to the PC I am using, after all it is possible for stuff to have conflicts.

 

I have stopped work on RS485 now that I have established a way of achieving what I need without it. I will need more USB connections than if I had an RS485 setup, but it will be a manageable number that I think will work fine. maybe it isn't everyone's ideal solution, but for me it is workable, plus I finally can take my brain off that cooker!

 

Cheers

 

Les

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...