Retromaster’s Electronics Projects

…related to old computers and other assorted stuff…

Posts Tagged ‘SDRAM’

UFE ADF Read Emulation Working

Posted by retromaster on May 10, 2010

UFE firmware development is going strong. Now, floppy read emulation and on-board MFM encoding of ADF files work. The ADF file chosen by the user is loaded from the SD Card and converted on-the-fly to MFM and results are written to SDRAM, from where the floppy data is served. This is in contrast to the original TFE/TFE+, for which the ADFs had to be converted on the PC beforehand. Thanks to the raw speed of the PIC32, the loading and conversion process takes about 3 seconds.  There is still room for improvement there, but I’ve decided to move on to implementing write emulation before focusing on that.

Since I haven’t built the Amiga keyboard control daughterboard yet, I’ve hooked up a few buttons to the interface connector so that I can control the user interface during testing. I’ve also disconnected the clock input from the host system and tried using the built-in oscillator of the PIC32, which seems to have worked fine. This also has the nice side effect of a slight increase in PIC32 speed.

Now that the basic functionality has started to come together, I’ve also started making notes about the changes for the next PCB revision. Here is the current list:

  1. Checkout the general purpose PIC32 variants, as the USB versions are not really required here.
  2. Remove the host clock input, as it does not seem to be absolutely necessary.
  3. Add standalone video output capability (as opposed to overlay-only).
  4. Better allocation of SDRAM lines to PIC32 pins, to increase SDRAM throughput slightly.
  5. Rework the placement of interface and programming connectors.

Also, now that I’ve tested to SDRAM code quite a bit and got it to work in a real situation, I am soon going to release source code for the SDRAM interface in the hope that it can be useful to others.


Posted in Projects, Retrocomputing | Tagged: , , , , , , | Leave a Comment »


Posted by retromaster on May 6, 2010

After some intense debugging, I managed to get the SDRAM on the UFE board to work.

First, I replaced the SDRAM chip with another one from the same module. At the same time, I also reworked the PIC32 solder connections. Unfortunately, that wasn’t enough. Then, I decided to make use of the logic analyzer on my oscilloscope. Lacking the proper means to attach the probes to the signal lines, I had to employ a little trick. I soldered very thin enameled magnet wire to the SDRAM pins. I soldered the other ends of the wires to a header, to which I attached the logic analyzer probes. I also had to slow the PIC32 clock quite a bit so that my 40Mhz oscilloscope would be able to show what was going on.

The oscilloscope shot shows the moment when I realised where my mistake was. The upper four signals are the SDRAM control lines, the red one is the clock, and the analog signal is the DQ0 line. It seems that the “read” command was registering with the SDRAM, but I was reading the data lines too early, I needed to wait for another clock edge to read it. Fixing that in the code gave me the right result. What a relief!

Anyway, several bug fixes later, now I am able to read and write the whole SDRAM chip without any apparent problems. I can fill the whole memory with a pseudo-random pattern and I am able to read it back. I haven’t really measured the throughput yet, but I am quite sure that it will be more than enough for my application. The SDRAM is clocked at close to 20Mhz (sysclk/4) and I use a burst size of 8. It could be clocked faster, even at sysclk perhaps with a slightly different design. The throughput would not increase as much though, since there would be more NOP cycles while the PIC32 is preparing data, etc. Anyway, there is even a little room for optimization in my current design. For example, my arrangement of the address lines turned out to be suboptimal, so I plan to fix that in the next PCB revision, to provide a slight increase in throughput.

I plan to test the SDRAM access functionality some more and implement some missing features such as the self refresh mode. Afterwards, my intention is to release source code so that it can provide an example for those who would like to interface SDRAM to a PIC32 (or any other microcontroller without a built-in SDRAM interface for that matter).

Posted in Projects, Retrocomputing | Tagged: , , , , | Leave a Comment »

UFE SD Card Access Working

Posted by retromaster on May 3, 2010

I’ve managed to get the SD card access working with the new UFE board. It was a mostly straightforward port from the TFE firmware, except for changing a few bits here and there related to the underlying SPI module usage. I have not implemented DMA yet, but I do not think that is going to be a big deal.

It is probably not clear from the photo above, but I also fixed the video flickering issue I mentioned in my previous post. It turns out that the SPI clock is free-running and SPI output gets synchronized to that clock and that made the video output start a pixel late sometimes. Reinitializing the SPI module on each video line did the trick. I chose to have 72 text columns per line this time, as that seems to be achieve a good balance between readability and amount of text shown, at least on my screen. I also implemented DMA for video output, lowering the CPU load. The CPU is not completely freed of video generation tasks however as it needs to prepare the data for the next line while DMA is outputting the current line.

Getting those out of the way, I’ve spent most of the weekend on getting the SDRAM to work. Unfortunately, I haven’t had any success. There are still a few things I would like to try with the software, before I take the drastic step of replacing the chip itself. I desoldered the chip from a SDRAM module that I know to be working beforehand. I might try soldering the chip back to the module just to try if it would still work on a PC. This way I would know at least if the chip is still intact.

Posted in Projects, Retrocomputing | Tagged: , , , , , , | Leave a Comment »

New UFE Design Ready

Posted by retromaster on April 19, 2010

As I’ve indicated in my previous post, I’ve been working on a new floppy emulator design, and it’s ready.

The main idea is to implement (hopefully) fool-proof write support by including enough memory to store at least one MFM-decoded floppy image on board. Obviously, your average 40-pin MCU will not be able to access that much external memory, so it was necessary to switch to a more powerful MCU with more pins (in this case, a PIC32). Although static RAM would be simplest to use, they either do not come in the size required or when they do, they are too expensive. So I decided to use SDRAM instead, as there is still a lot of them out there available cheaply in the form of memory modules.

The PIC32 does not have a built-in SDRAM controller, which makes things a little complicated. Luckily, in this project, the external RAM is used like a fast storage area rather than being randomly accessed. So, the plan is to emulate the SDRAM controller in software. It will be accessed quite a bit slower than the usual 100/133Mhz which makes this somewhat easier. In theory, the PIC32 should be able to handle this task, as in comes with a lot of extra computing power, including a built-in DMA controller.

Besides the addition of memory, this new design is a hybrid between the TFE+ design and the older UFE design in terms of features. It features video output for the user interface, just like in the TFE+. The host system’s keyboard will be used to control the emulator, but the keyboard interface is moved to a daughterboard to make the base design host independent. The basic design elements in the original UFE design are in place (PIC32, SDRAM), but SD card is the disk image storage medium instead of a USB flash drive, mainly to reduce complexity of the firmware and simplify PCB layout a bit.

I’ve already started building the PCB for this design and it’s nearing completion. If all goes well, I may soon have another post with the pictures of the actual board.

Posted in Projects, Retrocomputing | Tagged: , , , , , , | Leave a Comment »

UFE Revision A PCB

Posted by retromaster on August 24, 2009


For a while now, I’ve been working on UFE, which is the successor to the TFE. It will be considerably more advanced than TFE and (inevitably) more complex and more expensive to manufacture. Some of the planned features are: Full-Speed USB embedded host (enabling use of flash drives as storage instead of SD-MMC card), touch-panel QVGA color LCD user interface (see previous post), read and write support for multiple drives on the same floppy bus, on-board image MFM conversion (using on-board SDRAM).

The picture above shows my first attempt at designing a PCB for the UFE. The main components are a PIC32 microcontroller and a 128Mbit SDRAM chip. The SDRAM is connected directly to the PIC32. The PIC32 has no on-board SDRAM controller, so I plan to emulate it using some software tricks. The same goes for handling of the floppy bus with the SEL lines. If this approach fails, plan B will be to add a flash CPLD to the board to offload some of these tasks to. In this case, I’ll have to redo the design of course,  but this first revision will still give me ample opportunity to experiment with the main system components.

The header on the right is for the LCD module daughterboard. The daughterboard will contain the actual socket for the LCD as well as some additional circuitry such as backlight LED drivers. Decoupling these functions from the main board allows me to maintain a degree of independence from the actual LCD module used, and remove some of the associated complexity from the mainboard.

To be honest, I am not entirely sure that I’ll be able to manufacture this board at home. The reason is mainly the 8/6 rules (8 mil trace width, 6 mil clearance) I had to use in the design due to the PIC32, and the high density of the top layer. My previous experiences tell me that 8 mil traces should not be a problem, but I am not sure about the 6 mil clearance.

Posted in Homebrew PCBs, Projects | Tagged: , , , , , | Leave a Comment »