Go Down

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

tiopac

#15
Sep 20, 2016, 09:40 am Last Edit: Sep 20, 2016, 10:06 am by tiopac
Hi @antodom.

I am working with Arduino Due and ESP8266 WiFi Shield which forces me to use pins 8 and 9 as software serial pins and I need a library like soft_uart.

I download and extract soft_uart.git in C:\Program Files (x86)\Arduino\libraries. Arduino IDE recognises the library and I have tested the first example (basic_test). I can see properly the communication in the serial monitor.

But when I try to compile the second one (soft_uart_serial_test) I get a problem in the line:

void receive_tc(serial_tc_t& serial_tc,unsigned long timeout)

The error is: variable or field 'receive_tc' declared void

I am working now with Arduino IDE 1.6.11 buit I also got that error in a previous one 1.6.9 I think.

May you help me?

Thank you in advance.

oqibidipo

#16
Sep 20, 2016, 04:36 pm Last Edit: Sep 20, 2016, 04:38 pm by oqibidipo
Just another prototype generator failure...

Code: [Select]
template<typename serial_tc_t>
void receive_tc(serial_tc_t& serial_tc,unsigned long timeout)
{ ...


Generated prototype:
Code: [Select]
void receive_tc(serial_tc_t& serial_tc,unsigned long timeout);
No mention of of the template or serial_tc_t there --> error.

Works OK if they are on the same line:
Code: [Select]
template<typename serial_tc_t> void receive_tc(serial_tc_t& serial_tc,unsigned long timeout)
{ ...

Palliser

Hi @antodom.

I am working with Arduino Due and ESP8266 WiFi Shield which forces me to use pins 8 and 9 as software serial pins and I need a library like soft_uart.

I download and extract soft_uart.git in C:\Program Files (x86)\Arduino\libraries. Arduino IDE recognises the library and I have tested the first example (basic_test). I can see properly the communication in the serial monitor.

But when I try to compile the second one (soft_uart_serial_test) I get a problem in the line:

void receive_tc(serial_tc_t& serial_tc,unsigned long timeout)

The error is: variable or field 'receive_tc' declared void

I am working now with Arduino IDE 1.6.11 buit I also got that error in a previous one 1.6.9 I think.

May you help me?

Thank you in advance.
SoftwareSerial library was created as a serial crutch given Arduino UNO scarcity of serial ports. Due contains four (4) serial ports, thus, no need for crutches.
Due's core is SAM which is different from UNO's AVR. That means to tweak the code like oqibidipo just showed.

Notice that most of the time three of Due's serials are exposed when stacked with UNO's shileds. The picture below shows an easy and  simple solution that fix your problem.

Of course, you have to replace the SS lines from code with the correspondent SerialX.xxx



-p

antodom

Hi there @tiopac and @oqibidipo,

This compiler error appears when you have a C++ template function definition in an .ino file. When the IDE collects function profiles from all .ino files, it does not differentiate template functions. I had the same problem with the examples of other of my libraries: tc_lib.

Well, the problem is already fixed in all examples, so @tiopac, just update soft_uart and test again. It should work. Just tell me if everything was ok.

I hope it helps.
------------
antodom

tiopac

Thank you for the quick responses :)

I had already tried your solution @Palliser, and it worked. But I don't want to have additional external wires.

Thank you @oqibidipo and @antodom. I have downloaded the updated examples and now they work properly.

Go Up