-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
USTX in U0S/U1S is broken #7256
Comments
I read through that. Please edit your op and add the MCVE, and also explain what you expect to happen and what actually happens. We can discuss further at that point. |
I've added the MCVE from the forum post I've linked. I'm not interested in the uart tx queue or if the buffer is empty, because I don't use uart1 to send serial data. I just use it to create a timed low pulse. |
I'm not convinced that what you observe is a hardware bug. It could be that. Or it could be our core has some wrong register definition. Or our core has some bug in the init of serial1. Or there could be some assumption that isn't being met with your code. Or something else. That is why I suggested looking at what we do in our uart code.
Some notes about your apparent need for accuracy/cpu load/whatever
|
Possible, but I've checked all bits of U0S/U1S. If the TX level is mirrored in a register, then it's not in U0S/U1S.
I've tested
Well, my only assumption is that
I did, e.g. to find out how to replace Serial1.begin with pinMode.
I guess I'm the first one using it then ;)
I'm sure it does not, but I'm not using uart for communication, so why would I?
Yes
USS(x) is just an alias for UxS. And I'm pretty sure you are not interested in the level of the tx line if you want to know if the uart is ready for communication etc. You are not reading the tx level.
No, I'm not sure. Can you point me to better documentation? ;)
this is just a demo code, I don't rely on ticker for precise timing.
right, but that's the case in my application an the demo code. This is not relevant to the issue. |
Our core is built on Espressif's SDK, and does weird things to accomodate. A whole lot of our code comes from extracts found elsewhere and reverse engineering done by others. Our docs and core code has been found to have fundamental issues in the past. That means don't necessarily take our code/docs/comments at face value in cases like these, but compare against pure-sdk applications out there and notes written by others, and Do Your Research. Having said that, I suspect you've already done so. I did a quick search and didn't find anything worthwhile for the Tx level. //Doesn't seem to work, always reads as 0 for both uarts. HW bug? Possible workaround: Enable loopback UxC0 |= 1<<UCLBE and read USRXD, see https://github.com/esp8266/Arduino/issues/7256 for discussion. and then mention the bit 31 at USS, U0S and U1S, something like:
|
I know that the code and documentation is mainly reverse engineering, so I'm not blaming you at all for the "bad" documentation. I'm quite happy it exists :) After spending many days on this, I came to the conclusion that the bit is not doing what it should do. But sure, this is open for discussion. Until then, any comment in the header file that helps others so they don't have to spend as many hours scratching their head about this, like I did, is appreciated. Thx :) |
Do you want to make the PR? |
Sure, can do that. But do you really also want a comment on USS, U0S and U1S? I don't think anyone will use these registers without reading the bit definitions. I think the comment on USTX should be enough. Or what do you think may be the benefit of a comment on USS etc? |
Documentation that bit USTX in UART status register USS(u) / U0S / U1S is not mirroring TX level as expected but always reads 0, see issue esp8266#7256
Documentation that bit USTX in UART status register USS(u) / U0S / U1S is not mirroring TX level as expected but always reads 0, see issue #7256 Co-authored-by: Develo <deveyes@gmail.com>
Closed via #7265. |
Hi,
I found
USTX
in registersU0S
/U1S
to be broken. It's always 0.You can read about how I tested it here: https://www.esp8266.com/viewtopic.php?f=13&t=21169
I've also reported it here: https://bbs.espressif.com/viewtopic.php?f=66&t=56814
However, nobody confirmed it so far.
What's the best way to document this? I've used https://github.com/esp8266/Arduino/blob/master/cores/esp8266/esp8266_peri.h#L252 a lot as reference for developing, so I'd appreciate a comment there.
A possible workaround is to enable Loopback mode and read
USRXD
instead.MCVE
The text was updated successfully, but these errors were encountered: