-
Notifications
You must be signed in to change notification settings - Fork 16
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
Nasty edge case with timer and memory load via UART #62
Comments
Just a guess: Could it be the UART FIFO that overflows ? |
@MJoergen Yes, might be. I wrote in my hypotheses section:
😃 |
A similar issue is seen on the latest Steps to reproduce:
The last step fails in different ways each time. |
@MJoergen Regarding your comment about the emulator: I guess this has nothing todo with the timer interrupt: Can you please make a new issue, for now I would say tag it with V1.6, provide the
|
P.S. Here is a workaround for you, so that you can still load large programs in the emulator: After having started the VGA emulator with |
Indeed, this works. I guess the calculation is wrong, since each word requires transferring approximately 16 characters: " I tried that and it solves my problem! Is this how we should fix it? I mean, is there any downside (I'm thinking about Emscripten / WebAssembly, which I have no knowledge of) to allocating a 1 MB buffer for the UART FIFO ? |
Hi Michael, thank you for your feedback. I fixed it and checked in the fix in Your point with Emscripten/WASM is very valid. Furtheron, we do not do copy/paste in WASM. We use FAT32 disk images and - yet to be developed - other means of transferring data from the PC to the emulator. Therefore, we must not "spam" WASM with a too big FIFO and therefore I decided to go the #ifdef route as you can see here:
|
The INCRB/DECRB of the timer ISRs might collide so this might be related to #135 and should be retested then |
We should change the timer_test to adhere to the ISR best practice ( EDIT: SYSCALL(puts, 1) might be safe to use - to be checked - otherwise the timer_test ISR needs to save/restore the device's state to make it safe. |
This is a nasty edge case that is not "urgent" in the sense that it is not happening too often in real life: I can only reproduce it from time to time when I really stress out the system 😈
So I tagged it with V1.7. And I assigned it (for now) to all of us, because I will happily accept any debugging help :-) And because this is really an interessting case just from the perspective of looking at nasty edge cases. So here we go:
PROBLEM:
When uploading a large program via STDIN, i.e. by using any serial program via UART and using Monitor's "Memory/Load" and copy/paste of the
.out
file whiletest_programs/timer_test.asm
is doing its 2-way multitasking magic (output text to STDOUT and let a ball bounce on VGA) THEN the loading process of the large program will be SOMETIMES corrupted in the sense that some (not all) words are corrupted and therefore the program will not run. For example QNICE (which is "green") will load and show some red colored garbage on the screen. But sometimes, everything works just fine.REPRODUCTION:
/qbin
folder on your SD card by pulling from thedevelop
branch; insert the SD card into the hardware.F
R
qbin/timer_test.out
Timer 0 has issued interrupt request #0001
and so on and the ball will bounce on VGA. => SO FAR, SO GOOD!M
andL
in the terminal window to bring the monitor into the load-modecd demos;../assembler/asm q-tris.asm
while being in the Q-TRIS root folder, then you have it in the clipboard, then paste into the terminal)C
R
8000
in the terminalYou might need to repeat this process a few times, because it does not always happen.
What is also strange, that I could not reproduce it using
qtransfer
but only using a terminal program and doing copy/paste.HYPOTHESES:
P.S. It might be helpful when debugging this, to enhance the monitor, so that it can compare a memory range, e.g. 0x8000 to 0x9193 with a file such as qbin/q-tris.out. When then might see patterns and or "how corrupt" everything is.
The text was updated successfully, but these errors were encountered: