-
Notifications
You must be signed in to change notification settings - Fork 7.5k
uart: Problems with interrupt-driven UART in QEMU and some hw boards #8869
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
Comments
I cannot reproduce this. For me, samples/subsys/console/echo works as expected for BOARD=qemy_x86 - echoes character immediately after key press, without any changes, and worked like that all the time. My setup: Zephyr rev 3161617, Zephyr SDK 0.9.3. I don't have quark_se_c1000_devboard, so can't test with it. @nniranjhana, feel free to provide details of your setup, build steps, and any other info which may help shed some light on what may be wrong on your side. |
How does samples/subsys/console/getchar work for you on qemu_x86? |
echo sample does not work for me in qemu. |
please do not remove priorities, you can argue to lower or raise it, but do not remove it. |
Ok, so I have to news, good and bad, and actually I don't know which of them is which:
So, this "something" behaves in following way: a) I do the usual "make run"; b) now I start typing "1", "2", "3", etc. in sequence. So, on typing "1", nothing happens. On typing "2", the "1" is shown on the screen, then on typing "3" - "2" is show, etc. I.e. output legs behind by one character from input. For reference, qemu_cortex_m3 works w/o issue for me, the same as qemu_x86. I'm getting back to this because after #10923, this issue (or issues) are going to affect Zephyr shell too. Actually, it does for me for mps2_an385, and the behavior with shell seems to be even more erratic as described above. @jarz-nordic, @nordic-krch: Please join the fun of testing this! |
you can disable interrupt uart driver (thanks to
And again, it's not our fault that bug are discovered. It's rather the opposit, it's fame and glory. Same story was with complaints about shell not working well with STM devices. We ended up getting those boards and @jarz-nordic found a bug in ST uart implementation (#11039). |
Continuing from #10923 (comment):
So, now you know that you can't. Actually I thought you guys are well aware of that, and that's why there's e.g. #10820. So, just to avoid any future confusion, let me share another best kept secret: there're many parts in Zephyr which can't be relied upon. That's because Zephyr is so far developed in extensive (vs intensive) growth, and is effectively a frankenstein system collected from kinda-randomly put together parts. We need to mend its design, replace bad parts with better parts, and actually make sure that they are better. That's why you see a lot of scrutiny like in #10820.
Well, nobody says it's your fault. If there're any implications you can make out of it all, it would be:
Right. So: Step 0: Let's join the forces, as finally there's more than just me playing well with uart in interrupt mode, but you too. Step 1: Can you please test scenarios with samples/subsys/console/echo as described above, and share your results, so we better understand how inconsistent patterns we see. Step 2: Likewise, should test/describe behavior of Z shell as of the current master. Feel free to swap steps 1 and 2 ;-). |
Absolutely. I for one was locked in that tower waiting for you guys to come and help me fight the dragon. ;-). So, let's get to it.
Again, don't discount bugs in QEMU UART emulation. We likely have both bugs in Zephyr drivers, and bugs in QEMU emulation, in arbitrary combinations for a particular target. |
For shell, apparently makes sense to standardize on samples/subsys/shell/shell_module for testing. Here's the behavior I see with
|
And hypothesis we follow here is "shell may be broken for some user in qemu_x86". The logic here is: @nniranjhana, @nashif previously reported that samples/subsys/console/echo didn't work for them in qemu -> Z shell now uses about the same interrupt-driven UART access method as console/echo -> hence, there's a possibility that shell won't work for the users who were initially affected. So, @nniranjhana, @nashif, can you please how Also, can you retest Thanks. |
@galak, Do you have that physical MPS2 board? If so, can you help us to decide whether it's Zephyr-side driver problem, or QEMU problem? Just run |
Two line feeds are first characters send by the shell before promt is printed.
|
Absolutely. Again, to get to the bottom of it, we first need to compare, exactly, what behavior each us see. I described mine. Now your call guys. Do you see |
Well, that's not what I think. I think we should have a switch to disable interrupt-based UART support on shell level. Let me know if you disagree. (And I again would point out that if already had common console layer, we'd need to apply that in one place, now we need to apply it in 2). In that regard, |
I have tested:
I did not observe any problems using example: |
I disagree, if we have board/platform which has bugs in interrupt version of uart driver (or qemu error) we should disable that on that platform and not in shell. We don't want other modules to use uart interrupts there only to find out again that it does not work. |
@jarz-nordic, Cool, thanks, so what about |
Then I have bad news for you, e.g. #8187 . Per my hypothesis, QEMU serial emulations is always broken, the question is how much, i.e. error rate. It may be 1 char per million, or 1 char per thousand, or maybe every other char. You say that we should not QEMU serial at all (== not use QEMU at all), and I say that we should be more flexible than that, it devise a set of workarounds for particular cases of adverse bahavior, until we understood it better and fix it (be it on QEMU level or otherwise). |
i'm only saying to not use serial with interrupts on qemu ( |
@nordic-krch : And I'm saying that interrupts should work on qemu, and So, instead IMHO we should stick around warning posts like SHELL_DISABLE_UART_INTERRUPT, so it was clear to everyone that it's ugly workaround until a better solution is found. |
@pfalcon |
@jarz-nordic : Thanks for confirming! Oh, btw: #11202 |
Yes I saw that. It looks like a problem with serial interrupt API. |
Shell module works good for me on QEMU, able to use all modules which are enabled.
Yes, it does persist with the latest commits on Zephyr and with the newest version of Zephyr SDK too. Again, if I add another Some info on my environment, and console log:
Zephyr SDK version 0.9.5 On QEMU emulator version 2.9.1(qemu-2.9.1-2.fc26) Let me know if you need any further information |
@nniranjhana: Thanks for re-testing and additional info!
Well, sorry, if you use that, then it's not supported for Zephyr. You should use qemu from Zephyr SDK 0.9.5, which is:
In #11314, I modify the console/echo sample to provide additional output to hint want may be wrong. When it's merged, I would ask you to re-run it. |
status on this? |
not able to reproduce. |
The echo test in zephyr/samples/subsys/console/ does not print back characters to console.
Platforms: qemu_x86, quark_se_c1000_devboard
In the test,
console_getchar
gets input from user, andconsole_putchar
should post characters got to the console. But it doesn't, and only on adding twoconsole_putchar
instead of one, prints back the character.The text was updated successfully, but these errors were encountered: