Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot configure latest espsoftwareserial to work with V9261F device #224

Closed
Demonic098 opened this issue Oct 28, 2021 · 18 comments
Closed

Comments

@Demonic098
Copy link

Older commit (git checkout f4f8fcf ) works without problem with V9261F device
older working serial init:

#define V9261F_BAUDRATE                 4800 
SoftwareSerial * _serial = NULL;
 . . .
 . . . 
  _serial = new SoftwareSerial(4, SW_SERIAL_UNUSED_PIN, true, 256);
  _serial->begin(V9261F_BAUDRATE);

But newer version doesn't work no matter how to configure :

            _serial = new SoftwareSerial(4, -1, true);
            _serial->enableIntTx(false);
            _serial->begin(V9261F_BAUDRATE, SWSERIAL_8O1);

I also tried 8O2, 8N1, 8N2, 8E1, 8E2
but according to V9261F manual

 -  A 11-bit byte, composed of 1-bit Start bit, 8-bit Data bits, 1-bit Parity bit (Odd), and 1-bit Stop bit
 -  Least significant bit (lsb) shifted in or out firstly when the chip receives or transmits a byte
@Demonic098 Demonic098 changed the title Cannot configure espsoftwareserial to work with V9261F device Cannot configure latest espsoftwareserial to work with V9261F device Oct 28, 2021
@dok-net
Copy link
Collaborator

dok-net commented Oct 28, 2021

Why are you driving the lines in inverted logic?

@Demonic098
Copy link
Author

Demonic098 commented Oct 29, 2021

because this is how it is physically connected

@Demonic098
Copy link
Author

Demonic098 commented Oct 29, 2021

https://github.com/iotfridgesaver/WiFiPowerSensor/blob/master/PowerMeter.pdf
i use the following schematic and use gpio4 instead of gpio2

@svdrummer
Copy link

I checked the input current. Seems okay. Your drawing shows you are using an esp01. The RX pin is IO3. You said you are using io4

@Demonic098
Copy link
Author

Its not my drawing. And i am using ESP-12E

@Demonic098
Copy link
Author

and yes i am using GPIO04

@svdrummer
Copy link

Helps if we have the basics :)

@Demonic098
Copy link
Author

v9261f sensor connected thru the optocoupler

@Demonic098
Copy link
Author

http://www.vangotech.com/uploadpic/151321699962.pdf
UART configuration at page 53

@Demonic098
Copy link
Author

if it really helps i can redraw the schematics according to my wiring diagram. I am using ESP-12E GPIO04 pin to read data from V9261F sensor thru optocoupler in inverted configuration.

@dok-net
Copy link
Collaborator

dok-net commented Oct 30, 2021

@Demonic098 Thanks for providing your hardware diagrams. There may be an issue with the altered pullup states since the three year old release you were using until now. Please carefully inspect the README, to setup you build environment correctly, and try out the latest EspSoftwareSerial release 6.14.0 that is part of ESP8266 Arduino Core's master branch.
Call this to disable internal pullup of the Rx pin, probably before calling begin():

    _serial->enableRxGPIOPullup(false);

@Demonic098
Copy link
Author

@dok-net ok i'll do that but i don't think internal pullup resistor has any impact on anything since optocoupler on active high connects pin directly to ground.

@Demonic098
Copy link
Author

what other setting should i use SWSERIAL_8O1 ?

@dok-net
Copy link
Collaborator

dok-net commented Oct 30, 2021

I am wondering how the old EspSoftwareSerial, which only supported 8N1, was ever able to communicate with the device that is documented as using 8O1. But yes, you should select the parity that your device requires, which is supposed to be odd, at 8 data bits and one stop bit.

@dok-net
Copy link
Collaborator

dok-net commented Nov 6, 2021

@Demonic098 Have you been able to implement the suggestions, can you report any latest findings?

@Demonic098
Copy link
Author

Sorry for late reply. Was busy lately.
That is how correct data packet should look

-skip-> FE 11 01 04 00 02 04 18 
-data-> FE 11 04 22 D6 FF FF CC CE FF FF C0 BD 89 36 C0 10 02 00 83 
_voltage 219.92
_current 0.00
_active 0.00
_reactive 0.00
_apparent 0.00
-skip-> FE 11 01 04 00 00 04 1A 
-data-> FE 11 04 54 D6 FF FF 17 C8 FF FF 10 F7 91 36 90 21 02 00 99 
_voltage 220.05
_current 0.00
_active 0.00
_reactive 0.00
_apparent 0.00
-skip-> FE 11 01 04 00 00 04 1A 
-data-> FE 11 04 21 D6 FF FF 45 C9 FF FF 50 47 BA 36 70 1C 02 00 09 
_voltage 220.68
_current 0.00
_active 0.00
_reactive 0.00
_apparent 0.00
-skip-> FE 11 01 04 00 02 04 18 
-data-> FE 11 04 21 D6 FF FF 45 C9 FF FF 50 47 BA 36 70 1C 02 00 09 
_voltage 220.68
_current 0.00
_active 0.00
_reactive 0.00
_apparent 0.00
-skip-> FE 11 01 04 00 00 04 1A 
-data-> FE 11 04 12 D4 FF FF 59 CB FF FF D0 D3 CA 36 30 1A 02 00 2A 
_voltage 220.94
_current 0.00
_active 0.00
_reactive 0.00
_apparent 0.00

skip and data is a raw data from sensor and if CRC is correct then data decoded and printed as well.

@Demonic098
Copy link
Author

Demonic098 commented Nov 8, 2021

Strange thing. By default Arduino board manager install ESP8266 Arduino Core v3.0.2 with EspSoftwareSerial 6.12.7 so I have to manualy update to latest.

@Demonic098
Copy link
Author

Yes latest version with enableRxGPIOPullup(false) works flawlessly.
Thx.

@dok-net dok-net closed this as completed Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants