Skip to content

New serial Rx buffer causes wdt on data recieve using bauds over 115200. #2353

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

Closed
sticilface opened this issue Jul 31, 2016 · 3 comments · Fixed by #2355
Closed

New serial Rx buffer causes wdt on data recieve using bauds over 115200. #2353

sticilface opened this issue Jul 31, 2016 · 3 comments · Fixed by #2355
Assignees
Milestone

Comments

@sticilface
Copy link
Contributor

Basic Infos

Hardware

Hardware: any esp8266
Core Version: since #2239

Description

Since this change i've not managed to get serial receive to work without a wdt using bauds above 115200. The application is an Adalight implementation, that takes Serial data and pushes it out over WS2812s. Reproducing it has been extremely difficult as it has been part of a very large sketch, with lots going on, but i have distilled it down to an example that reproduces it every time using a baud of 1,000,000. This example does not reproduce it at lower speeds but it is hard to simulate adalight.... on my adalight set up, i get resets at 230400 and above.

I should stress that prior to this it worked fine. It also worked fine with the software implementation that was used prior to the hardware only (e255f25).

Things I know

  1. Occurs without driving WS2812
  2. Occurs at 80 and 160Mhz
  3. seems to require a few things in loop.. if getFreeHeap() is removed it works. ?wierd
    requires OTA in loop.
  4. Whereas before the data would be passed in 12 chunks, now it is in 3... might be significant..might not be.

Settings in IDE

Module: Generic ESP8266 Module
Flash Size: 4MB
CPU Frequency: ?80Mhz?
Flash Mode: qio
Flash Frequency: 80Mhz
Upload Using: OTA or SERIAL
Reset Method: na

Sketch

https://gist.github.com/sticilface/bab7cfeb6096efaed76269b265c4d296

Debug Messages

@me-no-dev
Copy link
Collaborator

chunk size comes from RX FIFO THRESHOLD value which was set to 128 and I have now lowered to 64. Should maybe even up to 110-ish as that will make the isr be called less often on large packets. When packet is shorter than the full threshold, timeout flag is set after a few bytes time without data.

@sticilface
Copy link
Contributor Author

sticilface commented Aug 23, 2016

I'm afraid to say that this problem has not entirely gone away. It is a lot more stable at 115200, but still crashes occasionally. And still very unstable at bauds above that. I'm still getting crashes on what was an entirely stable code base. Would it be possible to implement a version of Serial where the RX buffer is disabled entirely, giving functionality similar to before with just raw hardware.

The odd thing is that all my code worked before Serial was changed to hardware only, so it is only the mix of hardware and software serial buffers that seems to be a problem.

@danriches
Copy link

I'm sorry to say that I also get crashes at 115200 baud. My application streams serial data from a serial port, incoming only no reply to serial device, and via a W5100 on Ethernet it works flawlessly. Via WiFi it's still a big issue whereas in the office where the WiFi is better it's nowhere near as frequent but still happens. I had to change the HardwareSerial class to use a larger 4096 byte buffer to get this working at all at this baud rate.

Anyone have any ideas what might be causing this as it's a massive problem for me. I can post parts of the loop in the sketch if that helps?!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants