As the weeks go by it seems we have an ever increasing amount content to add to these posts. I had to actually select which content to include this week to keep it to a manageable read! So, here is the latest issue of TWiP!

Use of Sudo

The “sudo” prefix for commands in Linux basically says “run this as a superuser” and it can be extremely tempting to do all the time just so that you don’t hit any problems. Unfortunately the overuse of this is causing problems for some users. So, here is some handy pointers of where you do and do not need to use sudo:

Do NOT

You should not use sudo when doing:

  • git commands
  • make commands
  • Running the firmware flash commands

If you use “sudo” for any of the above you may end up with files owned by the superuser which cannot be accessed correctly by your user. If this happens you can cd into your PiStorm directory and run:

sudo chown -R pi .

This will change the ownership of all files for PiStorm back to the pi user.

Do

You should run sudo when doing the following:

  • apt commands
  • Running the ./emulator directly
  • Copying files to /etc such as the systemd start script

The emulator (for now) requires superuser access for the GPIO communication. Since apt makes system changes this requires roots and /etc files are typically superuser owned (or owned by a system user).

Optional

You can use sudo for systemctl [action] pistorm but this isn’t required. If you execute it without sudo then it will ask for your user password.

Throttling

The Pi, like most modern computers, takes certain measures to protect itself so that it doesn’t crash all the time. One of the measures that PiStorm users regularly see is throttling. The Pi’s throttling typically comes in two types: thermal and voltage.

Voltage

You may see a lightning spark icon flash up on your Pi’s HDMI indicating this and in the OS logs a message warning of “under voltage detected”. The Pi senses the incoming 5V for itself and if this dips below 4.65V then the warning is triggered and the Pi can throttle itself, sometimes quite drastically. The reason for this is if the voltage dips too low then the Pi could become unstable, so it is a way of trying to stay stable whilst the voltage dips.

Unfortunately the Pi has no way of telling the user what the actual voltage is, just when it has dropped below a threshold. The reasons why this can happen are often confusing so I’ll dig into it a little here.

First let’s talk about power supplies. Some people choose to use beefy PC ATX power supplies for their Amiga 500s because it can provide all the power their accelerators need. Unfortunately most ATX power supplies regulate themselves on the 12V rail, not the 5V one. Since the Amiga draws very little current on the 12V rail it means the 5V line becomes a little unstable. This is probably fine for older Amiga hardware, but the Pi is a little too sensitive for that.

Next up is the weird things that happen with power in circuit boards and load. If you unplug your PSU from your Amiga and read the voltage, it may show a perfect 5V, or maybe even a little more. Unfortunately there is no load on the PSU at the time and it can be harder for the PSU to regulate when there is actual load on it. In most cases it is not enough to get a reading from the PSU whilst it is unplugged from a machine.

Even when plugged into an Amiga you may be reading a perfect 5V coming into the Amiga at the power socket. But that still doesn’t mean every part of the Amiga is getting 5V. Certain components can draw spikes of power at certain times which can cause dips in other places, this is in fact why there are so many capacitors on an Amiga motherboard, to deal with those potential losses. The can also be an issue where the contacts in the socket between the PiStorm and the Amiga are not good enough. The Pi and PiStorm tries to draw enough power to run, if there is resistance due to the contact then there can be a real voltage drop.

If you wish to measure whether or not your Pi really is getting 5V, you should do it (carefully) at the Pi’s GPIO and maybe compare it to other parts of the board, such as the floppy drive power connector.

It is possible to power the Pi from the power input micro-USB port on it if you find for example that the floppy drive power connector has a more stable voltage. But there are caveats to this. The 5V must come from the same source as the the rest of the motherboard, or you can cause some very bad issues with the machine. Ideally you should isolate the Pi and/or PiStorm from the socket 5V when doing this. You also need to be careful because on some Amiga motherboards the floppy power connector is not keyed, it is very easy to put it in backwards and nuke your entire Amiga with 12V down the 5V rail.

Members of the PiStorm community are working on solutions to this, but it is a tricky one to solve permanently whilst also being safe for your Amiga and PiStorm. In the mean time, if you are using a CPU relocator, this might actually cause some problems, many don’t have traces wide enough for PiStorm’s power requirements so actually turn into resistors. You should also consider cleaning the CPU socket as best you can, corrosion and dirt can also cause issues.

Thermal

The next enemy is “thermal throttling”. Basically the Pi is designed to slow down when it reaches 60°C so that it doesn’t overheat and crash (or worse still, get way too hot and desolder its own CPU). Heatsinks can help with this, but right now your Pi is going to run hot running the PiStorm software. A mini fan can help bring the temperature down. I’m playing with a Noctua 40mm USB powered fan combined with a heatsink for this right now and it is keeping the temperature at a stable 42-43°C.

To help you get a temperature reading for your Pi’s CPU I’ve modified the PiStorm GUI in wip-crap to show the CPU temperature in the status bar, as can be seen below:

Whilst thermal throttling doesn’t slow things down too much (typically around 10%), it is useful to know that it happens.

Setting up RTG

One of the cool things PiStorm brings to the table is RTG graphics through the Pi’s HDMI socket. I quickly set this up in the week and ran ADoom as a demo of it running:

After seeing this, several people asked me how to set this up. So, I figured I would use today’s post to quickly go over how I did it:

  1. Get the P96 RTG software from Individual Computers. You need to be logged into their site to be able to see their shop page for this. It is a “pay what you want” with a recommended price of €12.96. Once you have paid you’ll find the LHA and ADF download in your orders page.
  2. Edit your PiStorm configuration file and uncomment setvar rtg.
  3. Use sudo raspi-config (yes, this one does require sudo), go into “Display Options”, select “Resolution” and choose a resolution that suits. We recommend 1280×720. Note that if you don’t have /boot automounted due to a performance guide please do sudo mount /boot first, this modified boot time configuration files.
  4. Reboot your Raspberry Pi (raspi-config will give you the option to do this).
  5. On the Amiga, install the P96 software you downloaded. You will be asked which graphics driver you want, “Picasso IV” works fine here. Keep the installation directory for now as you’ll need it for the next step.
  6. In the PiStorm drive on the Amiga go into the “rtg” directory and run “PiGFX Installer”. This will walk you through everything and will ask you where to find the original installation files for the P96 used in the previous step. This is so that it can patch them to be compatible with PiStorm’s RTG.
  7. Reboot your Amiga.
  8. Go into the “Screenmode” application on your Amiga and you should see a bunch of “PiStorm RTG” entries. I use 1280×720 16bit. Remember that the higher you go, the more work the Pi has to do.

From here I just ran ADoom as normal, it detected the RTG and I used the 320×200 8bit option. Higher resolutions in ADoom appeared to have scaling issues with the RTG on my machine, YMMV.

Massive thanks go to _Bnu and Lemaru on Discord for making this much simpler to setup.

Compute Module 4 Testing

Raffles on the PiStorm Discord notified us of a quality complaint about his PiStorms, the PCB manufacturer appeared to have added a bunch more components. It turns out that the boards are very early prototypes he designed for a Pi Compute Module 4 compatible version of PiStorm.

Before people get too excited there are several things to note here:

  1. This is using an unstable, unreleased test version of the firmware that is not available yet (please don’t ask).
  2. Just because this exists does not mean that the CM4 will not be able to be used with a regular PiStorm, that will be a future option (pending a good compatible carrier board).
  3. This is an early prototype, it is not available yet, it probably won’t even be available soon. Just a tease of a potential future idea. There are already several major changes to be made.
  4. When it is available there will likely be group-buys opened up for it. But as with the main group-buy, you can expect this to run slowly whilst the world chip shortage hits PCB manufacturers.

MAX V Firmware

An alpha version of a proof of concept for firmware for the MAX V 240 CPLD has been released to the main tree. This currently works by essentially overclocking the CPLD significantly beyond its designed limits. It requires a lot of testing before it can be deemed stable and may not ever see a final stable release.

This should not be an indication that MAX V will be supported, this is just an attempt to see if support with Proto 3 is even possible.

The ./flash.sh tool has been modified to detect a MAX V 240 (not 570 yet) and flash appropriately.

The End

Did I miss anything? Or is there anything that you want covered next week? Let me know! I can be found as LinuxJedi on the PiStorm Discord or LinuxJedi on Twitter.

3 responses to “This Week in PiStorm 2021-07-18”

  1. I just realised, that sometimes I get obsessed buying… it turns out that together with the pistorm, I installed a RGB2HDMI in the Denise socket with a Pi zero, my question is if now you can activate the hdmi of the pistorm, does it make sense to leave the RGB2HDMI installed?

    thanks for your time and work linuxjedi !

    1. Yes it does. the HDMI on the PiStorm for the moment is for RTG graphics, basically like adding a graphics card to the Amiga. Most games are not designed with RTG in mind, so Denise would be used for these. If you search for Retro Recipes on YouTube they have a video of using both with an HDMI switch (it is a Vampire instead of a PiStorm but the same principal applies).

Leave a Reply

Your email address will not be published. Required fields are marked *