REOPENED - How to debug the serial gateway (Arduino UNO) connected to a controller using SoftwareSerial



  • Hello ,

    I have readed the FAQ and made a search in the forum unsuccessfully in order to know how to get debug informations at the serial gateway side.

    This an Arduino board with 1 usb port connected to the controller and there is no other usb port (serial monitor) to get the serial.print informations witha PC at least for the UNO and NANO.

    1. In a testing phase , it is mandatory to get these serial.print informations at serial GW level . So what are the possible solutions ?

    2. Or Is there a method to sniff the messages exchanged between the controller and the serial gateway at the usb level or at the plugin level in the Vera controller in my case ?

    This exemple shows infos at the plugin level but the serial GW part would be necessary

    luup_log:27: Arduino: Trying for a serial connection <0x2c49b680>
    luup_log:27: Arduino: Serial port is connected <0x2c49b680>
    luup_log:27: Arduino: Baud is 115200 <0x2c49b680>
    luup_log:27: Arduino: urn:upnp-arduino-cc:serviceId:arduino1,GWAddress, 31(115200), 27 <0x2c49b680>
    luup_log:27: Arduino: Sending: 0;0;3;0;2;Get Version <0x2c49b680>

    => Then no reply from the serial GW from controller pointofview



  • Sounds like a 2nd usb port is required on the NANO or UNO using the SofwareSerial library to connect a PC to the serial GW via a 2nd virtual port connected to 2 digital pins in order to receive the debug messages in the serial monitor ( as these Arduino boards have only 1 USB port connected to the controller)

    For example to connect the USB PC cable to pin 10 (Txd) , pin 11 (Rxd) and GND on Arduino UNO side



  • So first I have connected an USB cable from my PC to the Arduino UNO USB port to load the serial GW sketch successfully as per the log in the serial monitor

    0;255;3;0;9;MCO:BGN:INIT GW,CP=R-NGA--,VER=2.0.1-beta
    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;17;2.0.1-beta
    0;255;3;0;9;MCO:REG:NOT NEEDED
    0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:BGN:INIT OK,ID=0,PAR=0,DIS=0,REG=1

    Then I connected the 2nd USB cable to the virtual port "software serial pin10/pin11/GND" to the Arduino UNO , without USB to TTL serial convertor , and to the windows 10 PC ... but the virtual USB port is not recognized by the PC (USB device unknown).

    --- code ----------
    #include <MySensors.h>
    #include <SoftwareSerial.h>

    SoftwareSerial mySerial(10, 11); // RX, TX

    void setup() {

    // set the data rate for the SoftwareSerial port
    mySerial.begin(9600);
    mySerial.println("Hello, SoftwareSerial?");

    An USB to TTL serial convertor is required on Arduino Uno side in such configuration and it has been ordered.

    => Waiting for the shipment



  • I have received the FOCA FTDI-based USB to Serial converter USB as per this datasheet

    ftp://imall.iteadstudio.com/Modules/IM120525005_Foca/SCH_IM120525005_Foca.pdf

    This USB Seral converter is connected to pin 10,11,GND on Arduino UNO side as SoftwareSerial and is connected to the PC side via the USB connector.

    1. The USB port on PC side is shown as USB Serial Converter = OK

    2. The serial GW sketch is loaded in the Arduino UNO withSoftwareSerial (9600) added but no printout in "myserial" monitor (9600) = NOK

    3. On the USB to Serial board , the LED PWR is ON

    4. The serialGW is running

    0;255;3;0;9;MCO:BGN:INIT GW,CP=R-NGA--,VER=2.0.1-beta
    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;17;2.0.1-beta
    0;255;3;0;9;MCO:REG:NOT NEEDED
    0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:BGN:INIT OK,ID=0,PAR=0,DIS=0,REG=1

    1. The LED RX on the USB Serial adapter is flashing OK as a "SoftwareSerial.print" has been added in the loop of the sketch ( every 5s)

    2. No output on the SoftwareSerial monitor .

    Please , can you advice how to track the issue between the USB Serial converter and the Arduino monitor ?



  • Hi ,

    Found the problem .... my mistake

    The Serial monitor COM port in the IDE was wrongly assigned to the USB port "USB serial converter "

    So this point about setup of Software Serial is closed.



  • But now the Debug messages are still sent to serial monitor over the serial port which has to be changed to the SoftwareSerial port .
    Only the "SoftwareSerial.print " messages are sent to SoftwareSerial port .

    How can i change this configuration ( where ) ?

    => Variable MY_SERIALDEVICE in MyHwSAMD.h file ?

    #define MY_SERIALDEVICE SerialUSB

    Thank you


Log in to reply
 

Suggested Topics

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts