-
Notifications
You must be signed in to change notification settings - Fork 35
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
WIP: Modifications for Teensy 2.0 on Linux #24
base: master
Are you sure you want to change the base?
Conversation
Many thanks Niclas for your contribution and time put down for this board, it's appreciated and I will do my best to get in the master. I will try to digest these changes, I have very quickly had a look now. About the timing, yes, if there is a caching story in the teensy board I would expect there are places where "flushing" is needed. But otherwise, this simple messaging protocol is just more or less a ping pong game between the pc and arduino/teensy side. There are states on both sides, but I am not sure anything would timeout? Ok, I need to check for thorough your changes, that way I can extract the things that made it work. I need to be careful not to break other boards. I see there are some pin changes (led I can understand, I would have to add that to configurable pins). But I hope you are aware that all other pins are configurable from the pc side. So default ones is not really needed to change. |
Regarding the line endings, I'm with you, as long as the Qt program and the avr firmware use the same character it shouldn't matter. I did not understand it either, because the first error messages I got were on connection, like in #22. Then I threw in a bunch of debug logs (as you can see) that logged all communication and some extra hints (like the connection string). I think the buffering on the com port has a special role here, because without changing everything to
I really don't know if the buffer / usb serial firmware or QtSerial changed the line endings in the received message. As you can see one read in the host program returns three actual messages from the mcu, even with flushing on the mcu side. So maybe QtSerial has a buffer, too? Regarding the timing issue, what I think happens is the following. The mcu sends a command, e.g. COMPORT.write('L'); // initiate request.
COMPORT.send_now();
COMPORT.flush();
COMPORT.readBytes(serCmdIOBuf, 2); As far as I understood the usb/serial implementation using 12MB/s is so fast that even when flushing everything COMPORT.write('L'); // initiate request.
COMPORT.send_now();
COMPORT.flush();
while (COMPORT.available() == 0);
COMPORT.readBytes(serCmdIOBuf, 2); After that change I finally got the message The last thing that prevented sending the floppy image successfully where some buffer issues. I saw that the constant Also sorry for the wrong indentation. It was way past midnight yesterday and I just wanted to get it working 🎢 I just bought my C64 two days ago and needed something until I get hold of some real floppy disks 💾 I'm happy to test anything if you have changes ready. |
These are my modifications to get the emulator running on Linux with a Teensy 2.0 board (which was used as a cheap XUM1541 / ZoomFloppy before).
The first thing I noticed is that all line endings in the communication with a Linux device are
\n
, so I had to replace every\r
with\n
to get the initial connection / version string working.The second big problem with a Teensy board is that the internal serial port via USB always uses 12 MB/s baud rate and thus is really really fast and also buffered by the USB chip. It breaks several timing write/read cycles, because after sending e.g. an
L
command there are simply no bytes to read. I had to add several while loops to wait for data usingSerial.available
.Please take this as a hint. I just hacked this together to get it working, hence the
WIP
prefix. Maybe it is helpful to others.