Go Down

Topic: Arduino Due pins for SoftwareSerial (Read 8269 times) previous topic - next topic

bikas

What are the pins I can use as Tx & Rx in Arduino Due using SoftwareSerial library.I checked the SoftwareSerial library page but it only talked about Arduino Mega.Any help is appreciated.

Thanks,
Bikash

Dande80

Due has 4 hardware serial ports. Do you really need more then 4 ports? If you really need it search this forum there were threads regarding this topic.

bikas

I will be using five Reaction Wheel,and need 10 pairs of Tx & Rx,apart from ports needed to communicate with PC.

antodom

Hi there bikas,

I have just published a post in the Arduino DUE libraries thread about a software serial library I have developed. You have the post here:

  http://forum.arduino.cc/index.php?topic=144446.msg2335415#msg2335415

The library is called soft_uart. With it, you can have up to nine software serial objects associated to the timer/counter module channels available on the Arduino DUE's ATSAM3X8E micro-controller. As RX and TX pin for each object you might use the I/O pins you want.

I hope it can be useful.
----
antodom
------------
antodom

bikas

@antodom thanks for your input.I will use your library and keep you informed about its performance.
thanks

bikas

@antodom i tried to use the example in your  software serial library but it throws up an error

Quote
"request for member 'begin' in 'serial_tc4',which is of non-class type 'int'
The error starts from serial_tc4.begin .

antodom

#6
Sep 16, 2015, 12:51 pm Last Edit: Sep 16, 2015, 03:31 pm by antodom
Hi there @bikas,

Please, can you provide more information?. The example should compile and run correctly, it seems that serial_tc4 is not correctly interpreted as an arduino_due::soft_uart::serial class.

A few of a priori hypotheses that maybe can cause the error ...

- Flag gnu++11. Take into account that flag -std=gnu++11 is necessary for compiling. Add -std=gnu++11 to the platform.txt file, concretely to compiler.cpp.flags (more detailed instructions in README.nd).

- Maybe library soft_uart has been not added correctly to the Arduino IDE (??).

- Have you changed the example's code in some sense?, if that is the case, can you provide the code?.




------------
antodom

bikas

@antodom..
Quote
Have you changed the example's code in some sense?, if that is the case, can you provide the code?
i did not changed the example code.

Quote
Maybe library soft_uart has been not added correctly to the Arduino IDE (??)
i can see the library in my sketch,when i import i get
Quote
#include <fifo.h>
#include <soft_uart.h>
i think the error was because of compiler which i did not set to -std=gnu++11
Did you meant to say adding compiler.cpp.flags -std=gnu++11 in the platform.txt file?

i see another option with compiler.cpp.flags
Quote
compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD
Also i see no arduino/hardware/sam folder,i expected the platform.txt file to be on that folder.So i instead added compiler.cpp.flags -std=gnu++11 in arduino/hardware/avr/platform.txt and getting the same error.

i am attaching the error report

thanks,
bikash

antodom

Hi again @bikas,

File "arduino/hardware/avr/platform.txt" is not the corresponding one for the Arduino DUE, it is the platform file for AVR platforms (Arduino UNO, etc.).

According to my experience the root directory for the Arduino DUE platform on Linux is "$HOME/.arduino15" (I´m using Arduino IDE 1.6.5), and in windows "C:\Users\<your-user-name>\AppData\Roaming".

In fact, if you have a look to the error file you have included, in your computer the directory is "c:\users\bikash\appdata\roaming\arduino15\packages\arduino\hardware\sam\1.6.4 (or 1.6.3)". There, you should find the platform.txt corresponding tothe DUE.

The problem you have is that the -std=gnu++11 flag is missing:

Quote
Arduino: 1.6.5 (Windows 8.1), Board: "Arduino Due (Programming Port)"

In file included from c:\users\bikash\appdata\roaming\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\c++\4.8.3\cstdint:35:0,
                 from C:\Users\bikash\Documents\Arduino\libraries\soft_uart/soft_uart.h:40,
                 from soft_uart_serial_test.ino:39:
c:\users\bikash\appdata\roaming\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\c++\4.8.3\bits\c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
...
As I mentioned previously, just add that flag to the DUE's platform file:

Quote
compiler.cpp.flags=-c -g -Os -std=gnu++11 {compiler.warning_flags} -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -Dprintf=iprintf -MMD
Best.






------------
antodom

bikas

@antodom,
Many thanks for your help,right now i am testing my device at 115200bps.Next week i will put my results here. Hopeful of getting positive results with your library.

regards,
bikash

bikas

@antodom,

So i tested the library,and following are the results,
Quote
1). Serial Protocol 8E1
      -works upto 57600 baud rate.
2). Serial Protocol 8E2
      -works upto 57600 baud rate.
3). Serial Protocol 8N1
      -works upto 38400 baud rate.
4). Serial Protocol 8N2
      -works upto 57600 baud rate.
Since my system serial communication protocol requires 8N1 @115200 baud rate so i am unable to use your library.

bikas
     

antodom

Hi again @bikas,

With the example provided with soft_uart you can get up to 115200 without errors using the WInterrupts.c file I modifiied which is available on this post:

http://forum.arduino.cc/index.php?topic=144446.msg2336042#msg2336042

And using 8E2 (or 8O2). The example is a very simple one, with no other things running, just serial communications. So, surely, you will not get to that baud rate in a more complex application.

One question, do you need 8N1 115200 bps imperiously for your application?. Is it not possible to change the baud rate of the devices you have to communicate with?.
------------
antodom

bikas

#12
Sep 18, 2015, 02:37 pm Last Edit: Sep 18, 2015, 02:40 pm by bikas
@antodom,
Unfortunately the device i am using http://www.astrofein.com/2728/dwnld/admin/Datenblatt_RW90.pdf
communicates in 8N1 115200 bps,its the only protocol they mentioned in their datasheet.I checked with lower baud rate and it does not respond.
bikas

holmes4

The data sheet you linked to says RS485, which is a multi drop (bus) system so you only need one serial port.

It says nothing about the baud rate or the number of start/stop bit etc so where did you get that info from?

Mark

bikas

@holmes4
i have the full datasheet from the manufacturer which i did not posted here since i am not sure if its violating their terms.There it gave full details about baud rate and start/stop bit.
bikas

Go Up