Tuesday, 2 July 2019

Last day of current MEGA65 development sprint

Okay, so today is the last day of the current MEGA65 sprint.  I am currently trying to get the following things working:

1. UUID serial EEPROM for MAC address etc
2. Real-Time Clock + onboard SRAM
3. Ethernet
4. HyperRAM

And currently having only limited luck with most of them.

The UUID EEPROM has 256 bytes of memory, the first 128 are writable, and the last 8 provide a globally unique identifier that can be used for generating a MAC address for ethernet. This was the easy one: Adapt the I2C peripheral code I wrote for the MEGAphone, and change the I2C addresses, and voila*, I was able to read it.

* Where voila actually means synthesising probably 3 or 4 times to track down all the little errors.

Then it's currently all a bit down-hill.

The real-time clock and its SRAM I have also mapped, and I can read and write the SRAM, which is great, and I can read and write MOST of the RTC registers, which is not so great. Specifically, I can do anything I like, except for set the clock.  Now, there is a register that controls this, and a WRTC bit that must be 1, before the registers can be written to.  And I know I can write to this device, because I can set the register with that bit, and I can even set the RTC alarm, and all sorts of other things -- but what I cannot get it to do, is to set the actual time.  The only clue I have found so far is in an example driver, which sets all 6 bytes at the same time.  So I might have to modify my code so that it does the same, to see if it helps.


Then we have the ethernet adapter.  Ethernet really shouldn't be a problem, as we have had it working in the past.  What I can confirm so far, is that the reset line works, because I can stop and start the ethernet, in so far as I can make the link LED go away, and then when I start it again, it reappears after a couple of seconds.  However, there is no hint whatsoever that the ethernet is actually transmitting or receiving anything to/from the FPGA.  Again, there really aren't any good places to probe with the oscilloscope, to see what is going on.  I'll have to keep thinking about it.
 
Then finally we have the 8MB HyperRAM that will be the expansion RAM of the MEGA65. The HyperRAM is not responding to read requests, and I am not yet sure why. I have switched to using a known-working open-source HyperRAM driver, and have it synthesising (which was a bit of an adventure due to a silly mistake on my part).  It is just timing out when reading, which could mean one of many things.  The chip is a little BGA, so I can't easily probe its pins to see what is happening.  So that's currently stuck.


So the current situation is quite frustrating. I guess I will start with trying to get the RTC working, and think about the others at the same time.

But, the day has got away from us, so these will have to wait until I am home in Australia, and have time to attack them.  But even with these little frustrating bits at the end, it is really pleasing just how much we have managed to achieve: the MEGA65 now runs on real hardware, and is super fun and pleasing to use.  We are currently making a series of short show-and-tell videos showing off the system, which can be found at:

https://www.youtube.com/playlist?list=PLPehmjqZolWDKTSE_cc_ft9jgYQyKZP_f

They are well worth the look, so hop on over and have a look!

Monday, 1 July 2019

Internal floppy drive now working on the R2 PCB, and various other bits and pieces

Oh my, it is already 11pm! So this will just be a short summary of what we have achieved today.


Most of the progress was getting the internal floppy drive working.  We had some more forgotten pull-up resistors that had to be added to the boards, and then to the schematic for the future R3 PCB.  So now you can happily use the MEGA65 CONFIGURE program, which works a bit like an old PC BIOS, to select the real disk drive or disk image to be used on power-up ... and it works!



We wrote a 1581 disk using a PC transfer program, and we can read it happily.  One funny thing we found, was that the drive refuses to read 720K data from a 1.44MB disk, even if the disk has tape over the HD hole.  We have no idea why this is, but for now it just means using real 720KB media.



Anyway, with the disk image, we are able to get a directory and load programs from the drive quite happily.  It could be my imagination, but I think it loads faster than my original C65 did. If so, it is probably due to our floppy controller perhaps being a bit faster.  Not sure. Not that important.  I did time loading a 161 block file, and it took 19.5 seconds, so about 8 blocks / second = ~2KB / second.  That does sound faster to me than the original, which I recall in C64 mode (which is how I ran this test just now) loaded at ~1.3 - 1.5 KB / sec. It could also be luck of the sector order on the disk, too.



Apart from that, we also updated the boot rom to set the audio mixer levels more sensibly, so now the SID audio that was super quiet is now quite loud.  We also fixed the audio channel control settings there, so that you can choose mono (both SIDs on both left and right channels), stereo, and stereo with swapped channels. At some point we will also add these (and the "use real floppy drive" to the freeze menu, so that you can easily change them at run-time.