Dasduino Core RS485 serial communication not working with Modbus RTU code

Customer:

I purchased two Dasduino Core microcontrollers to build a Modbus RTU 2 TCP gateway (https://github.com/budulynek/arduino-modbus-rtu-tcp-gateway). According to the documentation, Dasduino Core is identical to Arduino Nano, but when I compile this code, I get the error “error: ‘class Print’ has no member named ‘availableForWrite’”. The same code compiles and runs without problems on an Arduino Nano. When I select Arduino Nano as the board and try to upload to Dasduino Core, compilation succeeds but upload fails with a programmer error:

Sketch uses 30478 bytes (99%) of program storage space. Maximum is 30720 bytes.

Global variables use 1513 bytes (73%) of dynamic memory, leaving 535 bytes for local variables. Maximum is 2048 bytes.

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x49

avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x50

avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x20

avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x41

avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x64

avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x64

avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x72

avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x65

avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x73

avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x73

Failed uploading: uploading error: exit status 1

Original message (Croatian)

Kupio sam kod vas dva Dasduino Core miktrokontrolera kako bi napravio Modbus RTU 2 TCP gateway (GitHub - budulinek/arduino-modbus-rtu-tcp-gateway: Arduino-based Modbus RTU to Modbus TCP/UDP gateway with web interface. Allows you to connect Modbus RTU slaves (such as sensors, energy meters, HVAC devices) to Modbus TCP/UDP masters (such as home automation systems). You can adjust settings through web interface. · GitHub). Prema uputama, Dasduino Core je identičan kao i Arduino Nano, ali prilikom kompajliranja ovog koda, dobijem grešku “error: ‘class Print’ has no member named ‘availableForWrite’”. S druge strane, isti code bez problema se kompajlira i instalira na Arduino Nano uređaju. Ako odaberem Arduino Nano pločicu i pokušam instalirai code na Dasduino Core, kompajliranje prođe bez problema, ali upload ne. Dobijem grešku za programmer:

Sketch uses 30478 bytes (99%) of program storage space. Maximum is 30720 bytes.

Global variables use 1513 bytes (73%) of dynamic memory, leaving 535 bytes for local variables. Maximum is 2048 bytes.

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x49

avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x50

avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x20

avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x41

avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x64

avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x64

avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x72

avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x65

avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x73

avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x73

Failed uploading: uploading error: exit status 1

Imate li ikakav savjet da ne moram kupovati ponovo Arduino Nano?

Hvala,

[name removed]

Originally submitted via email support on 19 May 2023. Migrated to the forum for community visibility.

Soldered Support:

Have you installed the latest version of the Dasduino Board Definitions? You can download them from GitHub - SolderedElectronics/Dasduino-Board-Definitions-for-Arduino-IDE · GitHub - the README has detailed instructions.

In this repository you can search for the ‘availableForWrite’ function and see that for the AVR core (ATMega328p) this function exists and is implemented, so compilation should pass.

If you’ve already done this, another suggestion is to try using the ‘ATMega328p (old bootloader)’ option in the Tools board menu during upload.

Original message (Croatian)

Jesi li instalirao zadnju verziju Dasduino Board definitiona? Ovdje je link odakle ih se može povući, u README-ju dolje imaš detaljnije upute GitHub - SolderedElectronics/Dasduino-Board-Definitions-for-Arduino-IDE · GitHub

U ovom repozitoriju je moguće pretražiti funkciju ‘availableForWrite’ i vidjeti da za AVR core (što je ATMega328p) ova funkcija postoji i implementirana je, pa bi compile trebao proći.

Ako si ovo već napravio, još jedan prijedlog je da pri uploadu probaš koristiti opciju za board u tools izborniku ‘ATMega328p (old bootloader)’ pri uploadu.

Customer:

I tried the old bootloader option and was able to upload the sketch, but for some reason RS485 doesn’t work. Ethernet works, RS485 doesn’t. To verify it wasn’t a code issue, I uploaded the same sketch to an Arduino Nano and connected the same pins (at least by designation) and it works normally on the Arduino Nano. I think it’s a problem with serial communication, but I can’t determine the exact issue. Is there any difference between Nano and Dasduino in terms of serial communication?

Original message (Croatian)

hvala na odgovoru. Pokušao sam sa odabirom Old Bootloadera i onda mogu uploadati sketch, ali iz nekog razloga RS485 ne radi. Ethernet radi, RS485 ne radi. Da bi bio siguran da nije u pitanju kod, uploadao sam isti sketch na arduino nano i spojio iste pinove (barem po oznakama) i arduino nano normalno radi. Mislim da se radi o problemu sa serijskom komunikacijom, ali ne mogu utvrditi točni problem. Da li postoji ikakva razlika između Nano i Dasduino uređaja u pogledu serijske komunikacije?
Hvala, Niko

Soldered Support:

Can you tell me which pins you connected the RS485 to on the Dasduino and which pins on the Arduino Nano? Serial communication should work the same way; I believe it’s a matter of pins.

Just a note: you’re now using a board definition that isn’t specifically designed for Dasduino Core on it, which shouldn’t be a problem since it’s the same microcontroller, and if you’re just making a gateway and won’t modify it further. However, when adding components and more code later, a different board definition could cause issues - for example, differences in pin naming as we see here. For now, tell me the pins and we can work from there. I’ll also check with colleagues about what can be done to get this working with the proper Dasduino Core board definition.

Original message (Croatian)

možeš li mi reći na kojim pinovima si spojio RS485 na Dasduinu a na koje na Arduino Nano-u? Serijska komunikacija bi trebala raditi isto, vjerujem da je stvar u pinovima.

Samo napomena, sada pokrećeš board definition koji nije isključivo namijenjen za Dasduino Core na njemu, što ne bi trebao biti problem, pogotovo jer je isti mikrouptavljač i ako ćeš samo napraviti gateway i ne dirati ga, ali pri dodavanju komponenti i još koda uvijek se može javiti neki feature kojemu će smetati drugačiji board definition - zbog npr. kao ovdje, razlike u nazivu pinova i slično.

Za sad mi reci pinove, pa ćemo probati tako. Provjerim još s kolegama što se može napraviti da se ovo pokreće sa baš pravim Dasduino Core board definitionom.

Customer:

RS485 has 4 pins. Vcc and GND I connected directly to power (5v) in both cases. The other two pins are Rx and Tx and were connected as follows:

Dasduino Core: RS485 RxD to Rx, TxD to Tx
Arduino Nano: RS485 Rx0 to Rx, Tx1 to Tx

Original message (Croatian)

RS485 ima 4 pina. Vcc i GND sam u oba slučaja spojio direktno na napjaanje (5v). Ostala dva pina su Rx i Tx i ovako su bili spojeni na Dasduino Core i na Arduino Nano.
Dasduino Core | RS485 RxD | Rx TxD | Tx
Arduino Nano | RS485 Rx0 | Rx Tx1 | Tx
Hvala, Niko

Soldered Support:

Try swapping the RX and TX pins and report the results.

During code upload, disconnect the RX and TX pins because they can cause problems during the upload process (RX and TX are used over USB for code transfer).

For now, keep using the Arduino Nano board definition as we can’t yet support that function, but we’re working on it. I think the Arduino Nano board definition should be good enough for your project.

Original message (Croatian)

probaj zamijeniti RX i TX pinove, pa javi rezultate.

Pri uploadu koda odspoji RX i TX pinove jer tijekom uploada to može praviti probleme (RX i TX se koriste preko USB-a za prijenos koda).

Zasad ostavi Arduino Nano board definition jer mi tu funkciju ne možemo još podržati, ali raditi ćemo na tome. Mislim da će ti Arduino Nano board definition biti dovoljno dobar za tvoj projekt.