building a little home/game computer from a HiFive-1?


(cjmaverickforever) #1

hi,

a while ago i bought a HiFive-1. a development board with fairly fast risc-v microcontroller and very little ram, but i can’t think of much to do with it. except for trying to turn it into a little home computer or game console. something like a UzeBox or Propintosh.

i don’t really know much electronics stuff, or low level programming for that matter. but perhaps it’s an opportunity to learn…?

i would like to get some (low resolution) pixel display, but i think this could be really hard to drive, so to speak. could i conceivably connect the io-pins to DVI-display? or maybe i could use the PWM pins for analog video…? and then there are those little Arduino displays, no idea how these work but probably worth looking into. there are also character displays of course, but that doesn’t sound like much fun to play with.123Movies

otherwhise… connecting a ps/2 keyboard should not be that hard… right? and i heard snes game pads are easy to deal with but they have quite a few pins. (eh, nevermind)

i’m not even sure how to program it. it supports Arduino stuff, but that’s C-based and C scares me. i think there should be a version of Forth available, and maybe it can even run a Forth repl? (kinda like basic on old home computers).
Rufus

anyway. have you folks any ideas on that? how feasible is it as a project and what can/should i look into?


(Bruce Hoult) #2

It’s definitely a great device to learn these things on!

The HiFive1 is a lot faster and has a lot more program space and RAM than the most common Arduinos, but works in the same kind of way. The only major difference is it doesn’t have any built in analogue-to-digital inputs.

Most user programs and libraries for Arduinos should Just Work if they are written in C. Some many need some minor adjustments to alter I/O pin assignments. If they contain AVR assembly language then more extensive changes and deeper knowledge will be needed to convert it to RISC-V assembly language.

You won’t be able to interface to VGA or DVI or the like, at least not unless you hook up an external FPGA and learn how to program that too.

LCD displays are easy. You can get small cheap ones or large expensive ones, but they all have similar interfaces. There are plenty of tutorials about how to drive LCD displays from Arduinos (which the HiFive1 is). The Nokia 5110 LCD is a small (84 pixels x 48 pixels) but useful display that is cheap ($3) and easy to find and is from the phone with the same name.

Here’s a tutorial on using it http://www.electronics-lab.com/project/drive-nokia-5110-84x48-lcd-display-arduino/

PS/2 keyboards are easy too. You just use two wires to power it from GND and +5V and two wires from the KB to the Arduino, one for clock (which it’s usually best to connect to cause an interrupt, but it would be easier to get going initially by polling it) and one for the actual data.

There are some instructions here https://playground.arduino.cc/Main/PS2Keyboard

I’m afraid all the examples you’re going to find will be in C. You could certainly translate them to Forth, but then you’d have to know both languages very well!

There are some instructions for a Forth that apparently works on HiFive1 here:

(I haven’t tried it)

But my suggestion would be to get more familiar with C.