arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
21.93k stars 4.76k forks source link

software serial missing RX bytes #5745

Closed boaschti closed 5 years ago

boaschti commented 5 years ago

BUG DESCRIPTION

I started to implement a Fingerprint Sensor which communicates via uart 57600baud. In Tasmota I selected SW serial on pin 4,5. The Adafruit Fingerprint lib sends a ccommand to the sensor, the sensor answers and in Tasmota I get only the last byte. See screenshot last byte 0x1D and the print in Tasmota console below.

ersten bytes verschwinden

Thats the current code: https://github.com/boaschti/Sonoff-Tasmota/tree/Add_AS608_Fingerprint/sonoff

The uart buffer is read in Adafruit_Fingerprint.cpp Line 309-377 per byte = mySerial->read(); I print the RX data in XSNS_43_AS608.ino with: if (finger.verifyPassword()){ snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_LOG " AS608x found")); }else{ snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_LOG " AS608x not found %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X"), finger.mydata[0], finger.mydata[1], finger.mydata[2], finger.mydata[3], finger.mydata[4], finger.mydata[5], finger.mydata[6], finger.mydata[7], finger.mydata[8], finger.mydata[9], finger.mydata[10], finger.mydata[11]); } AddLog(LOG_LEVEL_INFO);

Has anybody a idea what happens here? Is it a timing problem (sensor response too fast)?

REQUESTED INFORMATION

Make sure these boxes are checked before submitting your issue. Thank you

FAILURE TO COMPLETE THE REQUESTED INFORMATION WILL RESULT IN YOUR ISSUE BEING CLOSED

platformio run --target upload Processing sonoff (framework: arduino; platform: espressif8266@1.5.0; board: esp01_1m)

Verbose mode can be enabled via -v, --verbose option CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp01_1m.html PLATFORM: Espressif 8266 > Espressif Generic ESP8266 ESP-01 1M HARDWARE: ESP8266 80MHz 80KB RAM (1MB Flash) Converting sonoff.ino Library Dependency Finder -> http://bit.ly/configure-pio-ldf LDF MODES: FINDER(chain) COMPATIBILITY(soft) Collected 51 compatible libraries Scanning dependencies... Dependency Graph |-- | |-- | | |-- 1.0 |-- 1.1 | |-- 1.1 | | |-- 1.0 | |-- 1.0 |-- 1.0 |-- |-- 1.2.9 | |-- 1.0 |-- 1.1.6 | |-- 1.2.9 | | |-- 1.0 | |-- 1.0 |-- 2.6.2 |-- 1.1 | |-- 1.0 |-- 1.0.0 | |-- 1.0

|-- | |-- 1.0 |-- 1.1.2 | |-- 2.3.0 |-- 2.2.9 | |-- 1.0 |-- 1.0.0 |-- 1.0 |-- | |-- 1.0 |-- <Waveshare esp 2.9 inch e-paper display driver> 1.0 | |-- 1.0 |-- 1.1.0 | |-- 2.3.0 |-- | |-- | | |-- 1.0 |-- 1.0 |-- | |-- 1.0 |-- 1.0 | |-- 1.0 | |-- | | |-- 1.0 |-- 2.3.2 |-- 2.0.7 | |-- 1.0 |-- 5.13.4

|-- 1.0 | |-- 1.0 |-- 0.5.1 | |-- 1.0 | | |-- 1.0 | |-- 1.0 | |-- 1.0 |-- 2.3.0 |-- 1.2.0 | |-- 1.0 | |-- 1.2.9 | | |-- 1.0 |-- 1.0.2 | |-- 1.0 |-- 1.1.0 | |-- 1.0 |-- 0.0.1 | |-- 1.0 |-- 1.1.2 | |-- 1.0 | |-- 1.2.9 | | |-- 1.0 | |-- 1.0 |-- |-- 1.0 |-- 2.5.2 |-- 2.6 |--

| |-- 1.0 |-- 1.9.1 Compiling .pioenvs\sonoff\src\sonoff.ino.cpp.o Compiling .pioenvs\sonoff\lib5fe\Adafruit_Fingerprint_Sensor_Library\Adafruit_Fingerprint.cpp.o lib\Adafruit_Fingerprint_Sensor_Library\Adafruit_Fingerprint.cpp: In member function 'uint8_t Adafruit_Fingerprint::setPassword(uint32_t)': lib\Adafruit_Fingerprint_Sensor_Library\Adafruit_Fingerprint.cpp:269:54: warning: narrowing conversion of '(password >> 24)' from 'uint32_t {aka unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing] SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16), (password >> 8), password); ^ lib\Adafruit_Fingerprint_Sensor_Library\Adafruit_Fingerprint.cpp:31:21: note: in definition of macro 'GET_CMD_PACKET' uint8_t data[] = {VA_ARGS__}; \ ^ lib\Adafruit_Fingerprint_Sensor_Library\Adafruit_Fingerprint.cpp:269:3: note: in expansion of macro 'SEND_CMD_PACKET' SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16), (password >> 8), password); ^ lib\Adafruit_Fingerprint_Sensor_Library\Adafruit_Fingerprint.cpp:269:72: warning: narrowing conversion of '(password >> 16)' from 'uint32_t {aka unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing] SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16), (password >> 8), password); ^ lib\Adafruit_Fingerprint_Sensor_Library\Adafruit_Fingerprint.cpp:31:21: note: in definition of macro 'GET_CMD_PACKET' uint8_t data[] = {VA_ARGS}; \ ^ lib\Adafruit_Fingerprint_Sensor_Library\Adafruit_Fingerprint.cpp:269:3: note: in expansion of macro 'SEND_CMD_PACKET' SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16), (password >> 8), password); ^ lib\Adafruit_Fingerprint_Sensor_Library\Adafruit_Fingerprint.cpp:269:90: warning: narrowing conversion of '(password >> 8)' from 'uint32_t {aka unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing] SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16), (password >> 8), password); ^ lib\Adafruit_Fingerprint_Sensor_Library\Adafruit_Fingerprint.cpp:31:21: note: in definition of macro 'GET_CMD_PACKET' uint8_t data[] = {__VA_ARGS}; \ ^ lib\Adafruit_Fingerprint_Sensor_Library\Adafruit_Fingerprint.cpp:269:3: note: in expansion of macro 'SEND_CMD_PACKET'

SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16), (password >> 8), password); ^ Archiving .pioenvs\sonoff\lib5fe\libAdafruit_Fingerprint_Sensor_Library.a Linking .pioenvs\sonoff\firmware.elf Checking size .pioenvs\sonoff\firmware.elf Building .pioenvs\sonoff\firmware.bin Memory Usage -> http://bit.ly/pio-memory-usage DATA: [======= ] 67.7% (used 55420 bytes from 81920 bytes) PROGRAM: [===== ] 49.5% (used 518807 bytes from 1048576 bytes) Configuring upload protocol... Looking for upload port... Use manually specified: COM2 Uploading .pioenvs\sonoff\firmware.bin warning: espcomm_send_command: wrong direction/command: 0x01 0x00, expected 0x01 0x08 warning: espcomm_send_command: wrong direction/command: 0x01 0x00, expected 0x01 0x08 warning: espcomm_send_command: wrong direction/command: 0x01 0x00, expected 0x01 0x08 warning: espcomm_send_command: wrong direction/command: 0x01 0x00, expected 0x01 0x08 Uploading 522960 bytes from .pioenvs\sonoff\firmware.bin to flash at 0x00000000 ................................................................................ [ 15% ] ................................................................................ [ 31% ] ................................................................................ [ 46% ] ................................................................................ [ 62% ] ................................................................................ [ 78% ] ................................................................................ [ 93% ] ............................... [ 100% ] [SUCCESS] Took 48.46 seconds

[SUMMARY] Environment sonoff [SUCCESS] Environment sonoff-minimal [SKIP] Linter Severity Provider Description Line PIO Buildsonoff\xsns_43_as608.ino2111038:1(6, 523) CRLFUTF-8C++ Add_AS608_FingerprintFetchGitHubGit (3)10 updates

Jason2866 commented 5 years ago

Please provide Status 0 output

boaschti commented 5 years ago

Correct output?

Jason2866 commented 5 years ago

No, you have to open webfrontend and from there click Button "Console" now type in Console Command Status 0 Post the output generated in conesole from this here. Please us function "Insert code" this can be reachec via the symbol "<>"

Jason2866 commented 5 years ago

Just take a look at your branch. You use not the actual version. Please update to latest dev branch. And please use latest platformio.ini file Anyway if you use Core 2.3.0 you will have problems with software serial. See https://github.com/arendst/Sonoff-Tasmota/wiki/Troubleshooting#arduino-core-differences Switch to core 2.4.2 or latest core 2.5.x feature/stage

Jason2866 commented 5 years ago

You can take a look in driver https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/xsns_40_pn532.ino how software serial can be implemented in a custom driver. This driver works very reliable with core > 2.3.0

ascillato2 commented 5 years ago

Closing this issue as it has been answered.


Support Information (Guide)

See Wiki for more information. See Chat for more user experience. See Community for forum. See Code of Conduct

boaschti commented 5 years ago

Newest dev branch works great! Much Thanks.