(SofwaareSerial comunication)invalid conversion from 'int' to 'SoftwareSerialConfig' [-fpermissive]

hi there,all...in this project i use ESP32 as receiver data from uno.here,i am using RX,TX in ESP32 at pin 16 and 17 and make it global .but i want calling it in another finction but by its inilitation name.i try to use SofwareSerial and declare at pin 16(Rx),and (17(Tx). and sudenly this problem happen.how to solve this?.........i think there is no mistake when i declare UART pin with SofwareSerial.

this is my code:


//#define RXp2 16
//#define TXp2 17
#include <WiFi.h>
#include <SoftwareSerial.h>
// membaca pinout RX,Tx
SoftwareSerial Seriala2(16, 17);
//#include "CTBot.h"
////variabel untuk bot telegram
//CTBot myBot;
////konfigurasi koneksi ke wifi
//const char* ssid = "Ngaji sam";
//const char* pass = "dikunci1";
////variabel token id telegram
//String token = 
String dataIn;
String dt[10];
int i;
int rpm = 0;
float cadence = 0;
float Odo = 0;
float Trip = 0;
float Speed = 0;
float torsi = 0;
float batt = 0;
float TripNow = 0;
float OdoNow = 0.0;
boolean parsing=false;
float keliling = 1.57;
int a;
int b;
float c;
int   d;
float e;
float f;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Seriala2.begin (9600, SERIAL_8N1, 16, 17);
  dataIn="";
///////////////////////telegram bot/////////////////////
//  Serial.println("memulai telegram bot koneksi ke wifi");
////koneksi ke wifi
//myBot.wifiConnect(ssid,pass);
//
////set token telegram
//myBot.setTelegramToken(token);
////cek koneksiwifi
//
//if(myBot.testConnection())
//    Serial.println("koneksi berhasil");
// else
// Serial.println("koneksi gagal");
}
////////////////////////////////////////////////////////////////
//////////////////**LOOPING PROGRAM!!*//////////////////////////
///////////////////////////////////////////////////////////////
void loop() {
  //   Serial.println("Message Received: ");
  if(Seriala2.available()>0) {
    char inChar = (char)Seriala2.read();
    dataIn += inChar;
    if (inChar == '\n') {
    parsing = true;
  }
}
 
if(parsing){
    parsingData();
    parsing=false;
    dataIn="";
  }
  delay(500);
//    Serial.println(Seriala2.readString());
    
}

 void serialtersedia(){
  
 }

////////////////////////////////////////////////////////////////
//////////************ PARSING DATA***********//////////////////
////////////////////////////////////////////////////////////////
void parsingData(){
int j=0;
 
//kirim data yang telah diterima sebelumnya
Serial.print("data masuk : ");
Serial.print(dataIn);
Serial.print("\n");
 
//inisialisasi variabel, (reset isi variabel)
dt[j]="";
//proses parsing data
for(i=1;i<dataIn.length();i++){
//pengecekan tiap karakter dengan karakter (#) dan (,)
if ((dataIn[i] == '#') || (dataIn[i] == ','))
{
//increment variabel j, digunakan untuk merubah index array penampung
j++;
dt[j]="";       //inisialisasi variabel array dt[j]
}
else
{
//proses tampung data saat pengecekan karakter selesai.
dt[j] = dt[j] + dataIn[i];
}
}
a = dt[0].toInt();
b = dt[1].toInt();
c = dt[2].toFloat();
d = dt[3].toInt();
e = dt[4].toFloat();
f = dt[5].toFloat();
 
  rpm = d / 360;
  cadence = b / 1920;
  batt = ((f*0.00489)*16.03);
  Speed = rpm * keliling * 3.6 / 60; //Sudah KM/H
  
  Trip = d / 6 * keliling / 1000 / 3600;
  TripNow  = TripNow + Trip;
  OdoNow = OdoNow + Trip;
  torsi = c / 3.3 * 80;
//kirim data hasil parsing
//Serial.print("PWM Motor : ");
//Serial.println(dt[0].toInt());
//Serial.print("\n");
//Serial.print("pedal count : ");
//Serial.print(dt[1].toInt());
//Serial.print("\n");
//Serial.print("torsi pedal : ");
//Serial.print(dt[2].toFloat());
//Serial.print("\n\n");
//Serial.print("Kecepatan : ");
//Serial.print(dt[3].toInt());
//Serial.print("\n\n");
//Serial.print("Arus baterai : ");
//Serial.print(dt[4].toInt());
//Serial.print("\n\n");
//Serial.print("Voltase baterai : ");
//Serial.print(dt[5].toInt());
//Serial.print("\n\n");
//delay(1500);
}


this is an error in arduino monitor.:

this is my error massage:

Compiling sketch...

"C:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\tools\\xtensa-esp32-elf-gcc\\1.22.0-97-gc752ad5-5.2.0/bin/xtensa-esp32-elf-g++" -DESP_PLATFORM "-DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\"" -DHAVE_CONFIG_H -DGCC_NOT_5_2_0=0 -DWITH_POSIX "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/config" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/app_trace" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/app_update" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/asio" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/bootloader_support" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/bt" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/coap" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/console" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/driver" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/efuse" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/esp-tls" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/esp32" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/esp_adc_cal" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/esp_event" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/esp_http_client" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/esp_http_server" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/esp_https_ota" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/esp_https_server" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/esp_ringbuf" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/esp_websocket_client" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/espcoredump" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/ethernet" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/expat" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/fatfs" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/freemodbus" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/freertos" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/heap" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/idf_test" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/jsmn" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/json" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/libsodium" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/log" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/lwip" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/mbedtls" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/mdns" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/micro-ecc" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/mqtt" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/newlib" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/nghttp" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/nvs_flash" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/openssl" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/protobuf-c" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/protocomm" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/pthread" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/sdmmc" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/smartconfig_ack" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/soc" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/spi_flash" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/spiffs" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/tcp_transport" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/tcpip_adapter" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/ulp" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/unity" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/vfs" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/wear_levelling" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/wifi_provisioning" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/wpa_supplicant" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/xtensa-debug-module" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/esp-face" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/esp32-camera" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/esp-face" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6/tools/sdk/include/fb_gfx" -std=gnu++11 -Os -g3 -Wpointer-arith -fexceptions -fstack-protector -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib -w -Wno-error=maybe-uninitialized -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-unused-but-set-parameter -Wno-missing-field-initializers -Wno-sign-compare -fno-rtti -MMD -c -DF_CPU=240000000L -DARDUINO=10815 -DARDUINO_ESP32_DEV -DARDUINO_ARCH_ESP32 "-DARDUINO_BOARD=\"ESP32_DEV\"" "-DARDUINO_VARIANT=\"esp32\"" -DESP32 -DCORE_DEBUG_LEVEL=0 "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6\\cores\\esp32" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6\\variants\\esp32" "-IC:\\Users\\ridho\\Documents\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6\\libraries\\WiFi\\src" "-IC:\\Users\\ridho\\Documents\\Arduino\\libraries\\EspSoftwareSerial\\src" "C:\\Users\\ridho\\AppData\\Local\\Temp\\arduino_build_119365\\sketch\\esp32_reciever.ino.cpp" -o "C:\\Users\\ridho\\AppData\\Local\\Temp\\arduino_build_119365\\sketch\\esp32_reciever.ino.cpp.o"

C:\Users\ridho\Documents\Arduino\esp32_reciever\esp32_reciever.ino: In function 'void setup()':

esp32_reciever:40:43: error: invalid conversion from 'int' to 'SoftwareSerialConfig' [-fpermissive]

   Seriala2.begin (9600, SERIAL_8N1, 16, 17);

                                           ^

In file included from C:\Users\ridho\Documents\Arduino\esp32_reciever\esp32_reciever.ino:5:0:

C:\Users\ridho\Documents\Arduino\libraries\EspSoftwareSerial\src/SoftwareSerial.h:110:10: note:   initializing argument 2 of 'void SoftwareSerial::begin(uint32_t, SoftwareSerialConfig, int8_t, int8_t)'

     void begin(uint32_t baud, SoftwareSerialConfig config,

          ^

Multiple libraries were found for "WiFi.h"

 Used: C:\Users\ridho\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.6\libraries\WiFi

 Not used: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.49.0_x86__mdqgnx93n4wtt\libraries\WiFi

Using library WiFi at version 1.0 in folder: C:\Users\ridho\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.6\libraries\WiFi 

Using library EspSoftwareSerial at version 6.12.6 in folder: C:\Users\ridho\Documents\Arduino\libraries\EspSoftwareSerial 

exit status 1

invalid conversion from 'int' to 'SoftwareSerialConfig' [-fpermissive]

thanks
megantara

in this line

begin (9600, SERIAL_8N1, 16, 17);

may be you want SWSERIAL_8N1 instead

The ESP32 has more than one Serial interface so do you really need to use SoftwareSerial ?

The serial config is limited to 8N1.
ref:

:+1: :+1: :+1:

that's not applicable for EspSoftwareSerial which @ridhoazhar313 is using

SoftwareSerialConfig and parity

The configuration of the data stream is done via a SoftwareSerialConfig argument to begin(). Word lengths can be set to between 5 and 8 bits, parity can be N(one), O(dd) or E(ven) and 1 or 2 stop bits can be used. The default isSWSERIAL_8N1 using 8 bits, no parity and 1 stop bit but any combination can be used, e.g. SWSERIAL_7E2. If using EVEN or ODD parity, any parity errors can be detected with the readParity() and parityEven() or parityOdd() functions respectively. Note that the result of readParity() always applies to the preceding read() or peek() call, and is undefined if they report no data or an error.

To allow flexible 9-bit and data/addressing protocols, the additional parity modes MARK and SPACE are also available. Furthermore, the parity mode can be individually set in each call to write().

This allows a simple implementation of protocols where the parity bit is used to distinguish between data and addresses/commands ("9-bit" protocols). First set up SoftwareSerial with parity mode SPACE, e.g. SWSERIAL_8S1. This will add a parity bit to every byte sent, setting it to logical zero (SPACE parity).

To detect incoming bytes with the parity bit set (MARK parity), use the readParity() function. To send a byte with the parity bit set, just add MARK as the second argument when writing, e.g. write(ch, SWSERIAL_PARITY_MARK).

that being said, yes, 100% in favour of going to hardware serial if it's available

@J-M-L
tks

Just to point out the actual problem, in case someone did not notice from post #5, with the esp8266 version of SoftwareSerial, the correct term for the call to begin() is SWSERIAL_8N1, not SERIAL_8N1.

I proposed this in the first answer...

Oops, sorry I missed that since there was so much discussion afterwards.

it's OK, it seems @ridhoazhar313 missed it too :slight_smile:

A post was split to a new topic: SoftwareSerial parameters