Jul 15

Memory controllers in FPGAs are the bane of my existence, help needed

I want to put together a softcore 68K computer system, just something simple.

I’ve purchased, but not yet received, the Terasic Cyclone V GX Starter Kit, an Altera FPGA eval board.

It looks pretty sweet and includes some fun stuff I’ve never done like HDMI connectors, has some easy to access onboard SRAM, has built in FTDI USB support, built in programmer, built-in flash for non-volatile storage, 77K logic elements, and the list goes on.¬† Looks like a really sweet board EXCEPT for one line on the datasheet:

4Gb LPDDR2 x32 bits data bus

“Oh no! Not yet a different memory chip or interface”

What’s nice is that there are (2) HARD memory controllers built-in to the FPGA, and so you don’t have to waste logic elements for defining your own. While I’m not sure what I was thinking, I really expected the interface to the memory to be very simple…. You know something like a FIFO-front end where you’d specific address, read/write, data, and then throw some read_data_valid switch and voila. Well, of course, I’m wrong.

Again, I’m in the middle of a memory controller nightmare.

For my Altera DE0, I modified the memory controller found here. It works like a champ, and the interface is pretty darn simple.

I could really use some help putting together a simple to use DDR2 controller to access this chip:

MT42L128M32D1LF-25 WT

It’s configured like this: 16 Meg x 32 x 8 banks x 1 die. Rows are addressed like this “16K (A[13:0])” and columns “1K (A[9:0])” using Single Channel Addressing. Cycle Time is “-25 = 2.5ns, tCK RL = 6″

What I don’t know is whether I can even start with a SDRAM controller and then expand on that, or if a completely different approach is warranted. I know that DDR2 is still SDRAM, and the interface to the new memory chip is very similar. I don’t really need the double-pumping or the increased data rate — I’d take anything to get off the ground.

Ideally, I’d find a verilog module for a controller with an example module that instantiates it, writes to some addresses, and then reads them back and verifies them.

A google search, as well as investigation on OpenCores hasn’t yielded much. This Altera youtube video is promising, but it stopped short on showing the HDL-specific details on how to instantiate it, and how to actually USE the module that gets created. This is assuming that everything goes swimmingly during the fairly complicated MegaWizard process.

If you’ve got any experience or helpful tips, I’d appreciate it.

Jun 26

$28 Gonbes GBS8200 Scandoubler for use with Commodore Amiga

amiga_thru_gbs8200_1500

While I probably would have preferred to order an Indivision ECS scan doubler, a really nice alternative is a Gonbes GBS8200 video converter off of ebay. I had bought version 2.0 sometime in 2010 or 2011, and could not make it work in any fashion. I think, at the time, the limitation was the ability to handle a combined horizontal and vertical (composite) sync signal at a low refresh rate ~15khz, like the Amiga puts out.

I decided to try a new version, version 4.0, from the first quarter of 2014. I bought this on ebay for $28.00 shipped which is an awesome deal. I received the board three days later in the mail, which is impressive for free shipping!

Here’s the ebay item number and description in the case where the number will change:

Genuine Gonbes GBS8200 CGA/EGA/YUV/RGB To VGA Arcade Game Video Converter Latest

Luckily, I already had “stock” at my house of DB23F connectors, and I’m glad I bought some extra when I did. It seems there are still some sources around (in mid-2015) for some connectors, although prices seem to be going up. Worst case, you could hack an existing cable, or buy a replacement video cable off ebay, and use that.

For pinouts, you only have to connect (5) wires to get this working:

DB23 pin to VGA converter wire color

3 to RED

4 to GREEN

5 to BLUE

10 to GRAY (Composite Sync signal)

16 to BLACK (GND)

When the video converter powers up, press DOWN/AUTO button to get the unit to sync up. You may need to modify the horizontal position(I needed X position: 57) or adjust the zoom.

My unit powered up in Chinese. You need to select option 4 (bottom option) for language, and then choose English on the next menu.

unit_wcablex1500cable_closeupx1500

I powered this with my Rigol DP832 power supply and measured the current draw at various voltages. Note that you should NOT power this thing off of the Amiga’s DB23 video port. It simply can’t support the current draw.

Current draw in idle mode(no video): uses about 1.6 watts or +12v 133ma, +8.5v 180ma, +5v 300ma

Current Draw in active mode: uses about 2.4 watts or +12v 200ma, +8.5v 276ma, +5v 468ma.

So if you use a +5v regulated power supply, you need to be at least 625ma if you wanted a 25% safety margin. A 1 amp supply would probably be better. Note that the official specs call for 2 amps of current at +5v. My field testing doesn’t really prove that number out. I’ll keep it running for awhile, maybe something goofy happens like as it heats up, it draws more current, or something.

This blog here helped me, but remember, it’s not safe to power it off the video port!

Update: I’ve tested this on two different models, a Widescreen Samsung S22C300 monitor, and an older square Samsung SyncMaster 204B.

May 26

DIY 115 watt flexible LED Task Lamp

 

ledtask_headSo I wanted a very bright flexible LED task Lamp that didn’t break the budget. I had a few feet of 7020 LED strip lighting left over from my undershelf LED lights, so I decided to put those to the task. These LEDs give off about 33-35 lumen per LED, and I’m using 54 LEDs for the task. That’s about 1836 lumen which translates to roughly 115 watts of light. The best part is that it’s very efficient, only using under 20 watts of power, including power supply losses, measured by kill-a-watt.

Shopping list:

  • 120mm x 100mm x 18mm Heat Sink: The mounting base for the LEDs is an aluminum heat sink. All these LEDs give off a bunch of heat in a small space, so a heat sink is crucial. While I could have done the thermal calculations to determine exactly which heat sink to buy, I had a hard time even finding a suitable size and shape of heat sink I wanted, that could be delivered in a reasonable time frame. $12 prime-shipped.
  • The 7020 LED strip lights from ebay and China: These things are freakin’ awesome. Really bright, really easy to use. You power them with +12v using a regular off the shelf adapter. The LEDs feature a positive and negative rail that runs down the length of the super flexible PCB. They include adhesive on the back. $23 for (16) feet of the stuff shipped from China, via the slow boat, seriously.
  • 18″ flexible gooseneck and desk clamp: I could have ordered a 24″ for just about the same price, and I think that would have been the better choice. This gooseneck is really high quality and the stiffness makes me think it will last a long time before I need to replace it. This is NOT the cheap quality stuff you get on IKEA/Walmart/Target lamps. This company’s website is a little hokey and my order errored out the first time I placed it. About $32 plus shipping is fixed around $13 for the two items, which is sort of ridic, but whatever. The most expensive part of the lamp.
  • A cheap 12v power supply: Provides +12v at 5 amp which is more than enough. This lamp only draws about 1.3 amps, so you could get something smaller. $8 prime-shipped.

 Installation Notes:

  • Notice that there is a positive and negative rail that runs lengthwise down the strip. On one side, notice that I cut the negative rail short, and on the other side, I cut the positive rail short. This is so I could run my own power bus straight down and connect all the strips together. +12v rail on one side, GND on the other.
  • Both the center of the strips and the edges are insulated off of the aluminum heat sink. While there is some separation with the adhesive, I wanted to make sure this stuff didn’t short!
  • I used a smaller stranded wire (24 gauge) to connect the strips but only for 6 or 7 inches. I convert quickly to 18 gauge which should be much more sufficient.
  • I used heat shrink tubing extensively to add better protection for the wires.
  • I drilled a 3/8″ hole in the bottom of the heatsink to mount the gooseneck. The gooseneck didn’t have much metal to “grab” so I used two different JBWELD products. Their stuff is awesome. I used SteelStik (soft, flexible, steel-fiber, epoxy putty) to form a top cap. I also used their ClearWeld at the base of heatsink which rests on the top lip of the gooseneck. Is this overkill? Probably. Will this connection break in my lifetime, almost certainly not! See pictures below.
  • I added an inline switch to the AC side of the power supply figure-8 cable.
  • These LEDs are on the blue end of the spectrum and produce a very very white light. This is completely different from Incandescent light, and you if you photograph under it, make sure to adjust your white balance accordingly.
  • I’ve made a huge leap of faith with this heat sink. I could be entirely underestimating the amount of heat dissipation required. I can tell you that after an hour of running, some parts of the LEDs are close to their maximum operating temperature(170F), while the rear of the heatsink (average temperature) is around 85F. The fins are much hotter.

ledtask_fullledtask_backledtask_litledtask_action

May 03

migrated website to a new host

Over the last week, I migrated this blog to a new hosting provider. GoDaddy was such a pig and the site just ran like molasses when hosted by them. I couldn’t be happier with the switch that I’ve made, but I could very well have broke something that I haven’t realized yet. If there were resources that you were using but are no longer available, please leave a comment, and I’ll fix them up.

Thanks

 

Apr 25

Reading Amiga Kickstart ROMs with a TL866A reader

I recently bought a TL866A from ebay with a bunch of adapters for a little under $100 shipped. Seems like a decent programmer except for the fact that it doesn’t support the 27C200/27C400 mask ROMs that hold Kickstart. Some alternatives floating around seemed to indicate that the 27C240 was pretty close, but the pinout was different.

I created an adapter to convert the pinouts.

The parts I used were:

While I love Emulation Technology’s stuff, their shit is never in-stock and it’s always so damn expensive. They make a $93 adapter for just this purpose, and thankfully provide the pinout. I downloaded the datasheets for the two ROM chips, and came up with exactly what they did, so I used theirs as the source for the pinout.(PDF linked datasheet). Local Pinout if their link goes down.

Here’s the finished result. Lots of patience was required to wire-wrap this. (80) connections is no joke!

mountedboard_DSC6964

romboard_back

In Minipro, the TL866A programmer software, I selected “INTEL 27C240″ and this seemed to work, although “Check ID” feature didn’t work, because the chip is identifying itself as something different.

 

reading_rom

I still want to compare my read with some other files, and check that it worked 100%, but the initial results look fine to me!

A couple things to note:

  • I’m not focusing on whether I can BURN 27C200/400’s yet, I just wanted to read them. I’d THINK this would work, but this would need verified before I’d try it.
  • There is a reverse problem that would require a different solution, and that is using newer/alternative roms IN THE AMIGA ROM SOCKET. Remember, this adapts the amiga rom chip to be readable in the programmer. Nothing more!!

Update: I verified my ROM read 100% correct by comparing the CRC32 checksum to one on the Cloanto ROMS page found here.

Apr 18

Update to Rigol CSV to OLS file conversion post

A couple years ago I posted some information on how to convert a Rigol CSV to an OLS File.

I recently got a request for some more information.

So let’s look at the two files

First twenty lines of the Rigol CSV

X,D15-D8,D7-D0,
Second,
-2.61762e-03,30,c0,
-2.61761e-03,30,c0,
-2.61760e-03,30,c0,
-2.61759e-03,30,c0,
-2.61758e-03,30,c0,
-2.61757e-03,30,c0,
-2.61756e-03,30,c0,
-2.61755e-03,30,c0,
-2.61754e-03,30,c0,
-2.61753e-03,30,f0,
-2.61752e-03,30,f0,
-2.61751e-03,38,f0,
-2.61750e-03,38,f0,
-2.61749e-03,38,f0,
-2.61748e-03,38,f0,
-2.61747e-03,3e,f0,
-2.61746e-03,3e,f0,
-2.61745e-03,3e,f0,

First twenty lines of the OLS ouput file

;Rate: 100000000
;channels: 16
0000@1
0000@2
30c0@3
30c0@4
30c0@5
30c0@6
30c0@7
30c0@8
30c0@9
30c0@10
30c0@11
30f0@12
30f0@13
38f0@14
38f0@15
38f0@16
38f0@17
3ef0@18

So you should be able to visibly see the differences without even looking at the specs

  • Headers are different
  • Rigol has a time stamp as the first column of the CSV (relative to the trigger point)
  • Rigol has comma-separated columns
  • OLS has an “@<samplenumber> at the end

So as you can see, this is a simply moving text around and putting it in the right place. Linux is especially suited to these types of tasks, which is why I chose it over Windows. Right OS for the right job. There’s no perfect OS.

Linux is suited because of it’s excellent set of individual tools that can be chained together using pipes to achieve multiple transformations, all on the same line.

So let’s look at the linux commands and “take it apaaaaaarrrt.” (for you eevblog’ers)

cat NewFile0.csv:¬†Use the NewFile0.csv as the starting point aka input file, let’s look at one line at time.

cut -d , -f 2,3 -s: Use a comma to delineate the columns, and output just columns 2 and 3 (ie the high order byte, and low order byte). The “-s” tells us to not include lines not containing commas.

nawk ‘{print $0″@”FNR}':¬†This gets us the “@” sample number, which is just a constantly increasing number.

tr -d ‘\r’ | tr -d ‘,': Remove the carriage returns, and the still remaining commas produced from the “cut” above.

sed -e “s/ 0/00/” >NewFile0.ols: Replace ‘ 0′ with ’00’ because that’s how OLS needs them. Output the results to a file called .ols. The space before the first zero is very important because it could modify other lines unintentionally!

Example without the “sed” above: “3e 0@662
Example with:”3e00@662

I welcome comments below!

 

 

Mar 24

Commodore Amiga Floppy Analyzer

amiga_fl_analyzer

So I’ve toyed with the idea for quite some time about having a tool that was a little more “data” centric for analyzing floppy data. The Amiga Floppy Project Nostalgia client(which was the main Java client for the project) had fairly limited analysis capabilities. It was more ADF-generation tool than anything.

So I spent a couple nights on slapping something together, and this is what it looks like.

It does a bunch of things:

  • The input file is a “Delta T” file which contains time between pulses which are nominally 4us, 6us, and 8us for a LD amiga floppy. This can be generated a bunch of ways.
  • It identifies in range and out range values.
  • It plots all the values in the file on the top chart. Ideally, a really clean floppy read will have three distinct bands. I call these bands clusters. It shouldn’t have many values (outside of the track gap) far from the center line.
  • It locates these starting and ending boundary for each cluster using an adaptive read algorithm which removes things like motor speed variation from being an issue. It automatically adjusts the reading based on the form of the data!
  • It calculates an average for each cluster and displays it as a horizontal red-line on the graph.
  • It finds the magic 0x44894489 sync value and plots it as a green vertical line. Those are the start lines of each sector.
  • The top graph functions as a way to look at all ~50k delta T values and spot the outliers.
  • Next, bottom left, it plots a histogram showing the number of values in each cluster.
  • The bottom center has a text output display that gives cold hard numbers and resulting analysis like standard deviation for each cluster. Lower standard deviation values means a cleaner disk.
  • It decodes MFM using the adaptive cluster boundaries, and then calculates header checksums and datachecksums.
  • It performs (6) different tests on the data and you receive a bright green checkmark if all PASS.
  • If there’s a corrupted sector, then you can drill down into each sector

bad_sector

The above example shows you that Sector 5 is bad, clicking the RED sector number takes you here

sector_view

Where now your presented with a hex editor, and a copy of the Delta T’s restricted to just that sector.

Now I have very little time so far put into this application, and so it’s not even close to be ready for more-than-me consumption. Things that need to be done are:

  • It handles one track at a time, obviously, it has to handle a whole floppy at a time.
  • There’s no ability fix bad data values.
  • There needs to be an automatic mode where educated guesses can be plugged in, and re attempt the checksums. The problem is that the lousy 32-bit XOR checksum used has a potential false positive rate of 1/32. IE, you can’t brute force it because multiple values will work. (See my post on this topic)

I have some fairly unique methods in mind for fixing this data, but some details still need to be worked out.

Please feel free to comment below about the software.

Mar 24

New 3M, now Desco SCS, antistatic mats arrived today

deskwmat1600

Before today, I was using a “field anti-static mat” on my HP Logic Analyzer cart. This was the cart that I built from scratch, and I think it did the trick for the most part.

But the more and more I started watching videos, and talking with people, there were much higher quality two-layer mats available. The two layers are the top (dissipative) and the bottom layer (conductive). The wrist straps (through a 10M ohm resistor, for safety) grounds to the conductive layer which is hooked up to an earth ground.

Here’s an image of my new soldering station decked out in 3M blue. I used the 3M 8831 series, and bought them from digi-key, with the datasheet here. I also bought the 2272 and 2224 wrist straps.

These mats are really high quality. Thick, smooth silky surface, great bottom layer. Comes with a dual-port wrist strap system and grounding cable. Note you do have buy the wrist straps separately.

I also bought a mat for my LA cart, but I still have to fit that one.

In the top of the picture, were my new built from scatch shelves that I just installed this weekend. Really getting the man cave outfitted properly, better organized, etc.

Visible on the right is the Rigol DS1102D and the Rigol DP832.

Feb 22

Trying to use mini-box picoPSU-120 to power Amiga but -12v rail is out of ATX compliance

So I purchased a mini-box picoPSU-120 kit which is in essence a very very small power supply that provides multiple regulated voltages. I want to power my Commodore Amiga 500 with the tiny power supply but there’s potentially a big problem with using it out of the box: the -12v rail seems to be out of spec. It’s not being properly regulated to -12v.

I have no problems with the +5v rail or the +12v rail, both measure around +/-1%, or +/-4%, respectively. I haven’t even looked at the +3.3v rail, because the Amiga doesn’t need it.

Their specs are located here.

With their critical specs being outlined here

picopsu_specs

I wasn’t a math major, but I think this means that the voltages should be between -11.4v and -12.6v. And remember, with load regulation, even without a load, the voltage should be within this range.

But, alas, it’s not:

picoPSU-120_problem_680

So I’m getting -13.8v on the -12v rail, which is a solid 15% off target.

Since the PicoPSU is actually a DC->DC converter, it requires 12v input, but I bought their kit, so they are also providing the normal AC to 12v DC conversion with an EDACPOWER ELEC Model EA11203A. The output of this measures +12.49v which is within the the +/- 5% specified on their spec sheet. So this means that the input is ok. And given that it’s unloaded, the voltage sitting high(er) doesn’t concern me at all.

The ATX Specification states that the regulation can be +/- 10% for the -12v rail is allowed, but on the high(low?) side this is still -13.20v. (Section 3.2.1 DC Voltage Regulation (which is a required section) Table 5.)

I double-checked every measurement with another multimeter to ensure that I’m getting decent numbers.

Some others have mentioned that there’s a few things I can do to solve the problem:

  • Use voltage regulation, likely with a 7912, which would handle the negative rail, but I’d have to be sure to get a LDO one. I ordered an LM2990T-12 today.
  • Use two diodes in series for a 1.2v to 1.4v drop. There’s low currents involved on this rail, perhaps 20 or 25ma. So my voltage drop would likely be 1.2v, which would take me from -13.8v to -12.6v. Much more palatable 5% difference
  • Try testing the Amiga at -13.8v by slowing deviating from -12v using my lab bench supply, the Rigol DP832.

In any event, I wish this would have just worked out of the box.

Perhaps it’s me? Perhaps I’m doing something wrong? What do you think?