lesthegrngo Posted April 29, 2023 Posted April 29, 2023 Guys, is the Nano Every compatible with RS485? Cheers Les
Vinc_Vega Posted April 29, 2023 Posted April 29, 2023 (edited) Hi Les, first impression from here https://store.arduino.cc/products/arduino-nano-every They say: pin compatible and code will still work. I try to get one or two for experiments. Regards, Vinc Edited April 29, 2023 by Vinc_Vega Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
lesthegrngo Posted April 29, 2023 Posted April 29, 2023 Thanks - the reason for looking is the greater memory, which means better performance for some of the graphics stuff like the OLEDs Les
outbaxx Posted April 29, 2023 Posted April 29, 2023 I didn’t get them to work, can’t remember why, compiling error I think.
lesthegrngo Posted April 29, 2023 Posted April 29, 2023 How curious - was it more than one unit that you tried? Cheers Les
outbaxx Posted April 29, 2023 Posted April 29, 2023 I believe so, but I can try tomorrow and compile a working sketch to one of them and see what it says./F
outbaxx Posted April 30, 2023 Posted April 30, 2023 There is an issue with SPI.h that says it’s for megaAVR architecture and not avr architecture.I get a lot of errors concerning RX & TX too pointing to the DCS-bios library.Maybe it’s fixable but my brain just said “no thanks” and back to the nanoV3 I went. 1
lesthegrngo Posted May 10, 2023 Posted May 10, 2023 (edited) Hi again all - I know that I have asked this before and after about half an hour of unsuccessful searching I've decided to just ask the question again - what TX RX pins on a Mega are used for DCS Bios as a slave? I believe it is TX0 and RX0 Cheers Les Edited May 10, 2023 by lesthegrngo
Vinc_Vega Posted May 10, 2023 Posted May 10, 2023 You are right! Regards, Vinc Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
No1sonuk Posted May 10, 2023 Posted May 10, 2023 ISTR there were problems with using a Mega as a slave?
lesthegrngo Posted May 11, 2023 Posted May 11, 2023 Thanks Vinc - I knew I had, as well as being a coding wizz you also clearly know how to use the search function better than I do! @No1sonukAs for problems with the Mega as a slave, you are correct in that there were issues when I tried to use it for the A10-C warning light panel. In USB guise the sketch was running all the lights perfectly, whereas with the RS485 it would only illuminate a percentage of them at a time. You put it down to possible 'bit-banging' My intention is to use a spare mega for switch inputs only as I imagine there is less processing needed and so it won't have the issues that I got with the WLP. I'm redoing my CDU so that all the main panel buttons are operated by the Mega Only one way to find out.... Les
lesthegrngo Posted October 8, 2023 Posted October 8, 2023 For completeness, I can confirm that I was able to use a Mega for all the switch inputs for the A10 CDU in RS485 slave mode. All are simple two position switch callouts and bar one duff SMD switch that seemed to have partial contact even when unpressed it worked straight away Les 1
rosariovw Posted October 10, 2023 Posted October 10, 2023 Hey guys, i have trouble with my RS485 connection. I'm trying to get it sorted out for 2 weeks now. To start, if i connect a mega and a Uno the Rx light flashes on both boards. When i put an LED in the A and B i got flashing. So there is some data flowing. I made a sketch with the ladder light at pin 13 (for the F-14) and even that one doesn't light on the UNO. Second part is a switch, and even if i press it, there is no response on DCS. Any tips, cause i'm at the verge of going to straight USB connections via USB Hub. This is the first problem i have the second is, i don't get my 3pos switches working
lesthegrngo Posted October 11, 2023 Posted October 11, 2023 Hi there, let us see your sketch to see if there is something wrong with it as a starting point. Use the code brackets above (the symbol that looks like <> ) and put it in there. It will also let us se how you should be wiring up your circuit Cheers Les
rosariovw Posted October 11, 2023 Posted October 11, 2023 Here are my scripts: Master; /* 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 #include "DcsBios.h" void setup() { DcsBios::setup(); } void loop() { DcsBios::loop(); } Slave; /* 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 1 /* 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 pltHudDeclutter("PLT_HUD_DECLUTTER", 4); DcsBios::LED pltWarnLadder(0x12dc, 0x8000, 13); void setup() { DcsBios::setup(); } void loop() { DcsBios::loop(); }
lesthegrngo Posted October 11, 2023 Posted October 11, 2023 Try the following, I think you should include the wire command /* 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 1 /* The Arduino pin that is connected to the /RE and DE pins on the RS-485 transceiver. */ #define TXENABLE_PIN 2 #include "DcsBios.h" #include <Wire.h> /* paste code snippets from the reference documentation here */ DcsBios::Switch2Pos pltHudDeclutter("PLT_HUD_DECLUTTER", 4); DcsBios::LED pltWarnLadder(0x12dc, 0x8000, 13); void setup() { DcsBios::setup(); } void loop() { DcsBios::loop(); } Les
rosariovw Posted October 11, 2023 Posted October 11, 2023 3 hours ago, lesthegrngo said: Try the following, I think you should include the wire command /* 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 1 /* The Arduino pin that is connected to the /RE and DE pins on the RS-485 transceiver. */ #define TXENABLE_PIN 2 #include "DcsBios.h" #include <Wire.h> /* paste code snippets from the reference documentation here */ DcsBios::Switch2Pos pltHudDeclutter("PLT_HUD_DECLUTTER", 4); DcsBios::LED pltWarnLadder(0x12dc, 0x8000, 13); void setup() { DcsBios::setup(); } void loop() { DcsBios::loop(); } Les Sorry, doesn't help, still i have no data flow from the slave
lesthegrngo Posted October 11, 2023 Posted October 11, 2023 your Arduino IDE is up to date? I know that screwed me for at least a year. Plus make sure you are using the Flightpanels DSC bios Fork Cheers Les
lt.shifty Posted February 10, 2024 Posted February 10, 2024 (edited) nullCan anyone help me please. I've been trying for a couple weeks to get this circuit working and just can't for the life of me. I've attached pics of my circuit, it's wired exactly the same as the diagram on the OP. And I'm using these MAX487CPA chips. I've basically tried replacing every part, so I've ruled out faulty components. I've tried powering the slave Arduino (Nano) (master is a mega 2560) using an external 12v power supply, or as shown in the pic via USB (using a phone charger) because I wondered if using USB to the PC was causing the RX/TX lines to get tied up and unavailable to the nano for RS485. I've checked the datasheet for the chips, although this is a guess tbh who knows from AliExpress, and I'm sure I'm using the correct pins. I've also switched to the Skunkworks DCS-BIOS fork as that was suggested in this thread. I've also verified with a multi-meter that all connections are fine. I do notice that when the A-B lines are attached, the led on the nano is constantly flashing very quickly, so it's like there is something transferring data. Serial Monitor on the Mega doesn't show anything. Edit1) Added a screenshot of what DCS-BIOS Serial shows with DCS running, this doesn't appear to change if I disconnect the slave.null Sketches for reference: Master: /* 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 1 /* The Arduino pin that is connected to the /RE and DE pins on the RS-485 transceiver. */ #define TXENABLE_PIN 2 #include "DcsBios.h" DcsBios::Switch2Pos engContSw("ENG_CONT_SW", 3); void setup() { DcsBios::setup(); } void loop() { DcsBios::loop(); } null Edited February 10, 2024 by lt.shifty
Vinc_Vega Posted February 10, 2024 Posted February 10, 2024 (edited) Hi there, sorry, I can't see a pic of your circuit but only a link to aliexpress , Master and Slave sketches and the screenshot of the serial protocol. Btw. you will not see any RS485 events on the Serial Monitor. Please tell us first if you ever have successfully connected the switch in question to DcsBios via an USB interface. A working sketch easily may be "converted" to RS485 by commenting the line #define DCSBIOS_IRQ_SERIAL and including #define DCSBIOS_RS485_SLAVE 1 (or the number of the respective slave) and #define TXENABLE_PIN 2. The rest of the sketch normally should be untouched. Second, please post a schematic of your circuit, if you are not sure of the wiring. TX (transmit to the bus)-> DI (driver in) RX (receive from bus)-> RO (receiver out) D2 -> DE (driver enable) and RE (receiver enable) Third, use TX1 (pin 18) and RX1 (pin 19) of the Master (Mega) for the first RS485 bus. If that doesn't work, swap the pins (18 and 19) of the master, as you may have a Mega clone and not an original. If all won't work, try to use the second RS485 bus with pins 16 and 17: #define UART2_TXENABLE_PIN 3 Edit: Thereby, the Master (Mega) is not powered by 12V but only by the USB port. A slave must not be connected to RS485 and USB at the same time! Powering a Nano via USB will limit the current to a max of 0.5 A by it's internal fuse and the voltage to 5 V. It's better to use the VIN pin, that tolerates up to 12 Volts and uses the internal regulator to supply (and protect) the microcontroller. For the wiring, I personally use something like the second sketch from here. Kind Regards, Vinc Edited February 10, 2024 by Vinc_Vega Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
lt.shifty Posted February 12, 2024 Posted February 12, 2024 Thanks Vinc, I figured that might be the case for the slave, I'll try powering both Arduinos with an external PSU and see if that kicks it in to life. I have got DCS Bios working with a single Arduino (nano, pro micro and mega all working fine standalone. *I'm aware pro micro doesn't work for rs485 with dcs-bios). I did a bit more fiddling with the multimeter last night, and I noticed the 5v out from the nano is only 4v, guessing that's because it's currently powered by USB? Or just a bad Chinese clone? I've tried swapping the Rx/tx on the master, and using all of the Rx/tx pins and with each way around. Pretty sure now though it's because I'm using USB to power the nano.
ramzessii Posted March 28, 2024 Posted March 28, 2024 Hi Hansolo, Thank you for the incredible tutorial. It is ever so valuable, especially for newbies like me. Frankly, it is not just you but many others sharing their knowledge, who also need to be thanked. Question - which connection(s) between the MAX487 and the Arduino Nano on a slave unit has to be broken to allow programming the Arduino via USB? Is it TX, RX or both? I want to put a jumper on my PCB board to make my life easier when/if uploading an Arduino sketch is needed. Once I'm finished designing both the schematic and PCB, I'll upload the photos here. Hopefully, it will inspire someone... or more likely will draw someone's attention to some mistakes I've made Thank you. Regards, Janis
ramzessii Posted March 28, 2024 Posted March 28, 2024 Hi all, I guess, I've figured it out by reading some of Vinc_Vega's posts. This is my first-ever schematic. Please let me know if it's not right. Thank you. I've also noticed that many PCBs have large copper ground fills - is this necessary and what is the benefit? Can it not be just nets with the rest of the copper being etched away?
Vinc_Vega Posted March 28, 2024 Posted March 28, 2024 My latest board design also features jumpers on both lines (RX and TX) leaving me the opoprtunity to programm a chip without removal. It works good. Regards, Vinc Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
Recommended Posts