Saturday, November 14, 2020

Raspberry Pi 400 audio issues update

Bluetooth remains still unsolved beyond what I was writing earlier.

In order to get some sort of audio output, I changed back to the only HDMI monitor having speakers in my possession. After the removal of pulseaudio (apt remove pulseaudio), the monitor is perfectly fine to use for sound playback, however, the audio from those tiny speakers is pretty poor. I guess, it is what it is.

Hopefully the Raspberry Pi Foundation will solve the Bluetooth issues with the RPi400 as soon as possible.

Friday, November 13, 2020

Raspberry Pi 400 audio problems - USB not the solution

In my earlier post, I as speculating if the use of a USB sound card would be a possible solution to the audio problems of the Raspberry Pi 400.
Well, it is not!
The audio was playing, however, at a terrible quality, not worth further talking about.

While the RPi400 was never meant to be used in my amateur radio setting, it now shows clearly to not be suitable for such use at all. The only thing still untested would be SDR devices such as the SDR-Play RSP1A.
Seen that a simple audio dongle does not work well, I have serious doubts about any of the SDRs being better supported,

If the Raspberry Pi Foundation is reading, please consider adding an AV jack to a future version of the RPi400. The form-factor of the device is excellent, having it performing similar to a RPi3B+ in respect to audio would make this device usable for not just the ham radio community but also so many more folks looking for some audio abilities of a device.

Raspberry Pi 400 (audio issues)

So, the RPi400 came in. First of all, is it worth the money? Yes it is. The device itself has a good, i.e. reasonable, weight to it, thanks to the internal heat-sink. The keys feel very good and typing is on those is a pleasure. The mouse, meeeeh, well, feels a bit cheap, works well though. In my view, the cheap feel of the mouse comes from its lack of weight. Reducing the mouse acceleration to 3 already helped a lot. I might be temped to open the mouse up and add some weight to it, e.g. by gluing steel nuts to the inside of the case.
I love the size of the device, just perfect. Have a look at my before (Raspberry Pi 3B+) and after setup.

The old and the new

The photographs show my old RPi3B+ setup with a 3.5" external mechanical 320GB USB2 HDD and the RPi400 with a 128GB Kingston SSD in a USB3 enclosure.

The RPi400, having USB3 ports, can benefit from the SSD in a USB3 enclosure. Further, the RPi400 can boot from USB devices. Therefore, the speed of the combination is really close to a decent desktop PC. 

Now, I am appear to be full of praise for the new device. However, beyond the disappointment with the mouse, there is something else which is close to being a deal breaker, at least when running Raspberry Pi OS. That deal breaker being the difficulties of connecting audio output devices, aka speakers.
The RPi400 does not have an analog AV output, which all the other Raspberry Pis have. Hence, there is not way of connecting a wired audio connection, e.g. active speakers, to the RPi400. Lets forget about HDMI for a minute... Well, no problem, you may think, the RPi400 got Bluetooth... RIGHT! Yes, it got Bluetooth, however, the implementation in Raspberry Pi OS does not connect to BT audio sinks as easily.
It took me the better part of the evening, despite the posts about the issue I found on divers fora, to get a BT speaker connected. And even then, the result is less than perfect. My way is sufficiently satisfying to me, however, this might not be the case for someone expecting an OOB experience.

Here is what I had to do to get to the point of semi-happiness:
  1. in a terminal type: sudo apt install pulseaudio-bluetooth-module
  2. add "Volume Control" to the TaskBar, next to "Volume Control (ALSA/BT)" 
Item 1 will add all the necessary programs and drivers to the system.
Item 2 will give you control over the volume of the audio played out. Somehow, the ALSA/BT panel item does no longer function with BT devices, however, it is necessary to select a BT device as an audio sink. Controlling the volume itself is now done with the 'other' volume control icon, but not in a way that is desirable... Right click on the icon and " Launch Mixer". This will open a terminal with alsamixer. While this works, perfect it is not.

A possible solution could be using a different OS. However, this comes with some drawbacks itself. Raspberry Pi OS is optimized for the hardware and comes with some very interesting software packages, e.g. Mathematica or the RPi Bookshelf.

Another solution would be to add a USB sound card to the mix. However, the RPi400 only having 3 available USB ports, of which one might be used for the mouse and another one for the USB-boot-device, there isn't a lot of wiggle room, unless adding a USB-hub. 

In the near future, I will have a look at other operation systems on the RPi400. One of my present favorites might be Ubuntu Mate 20.10.


Wednesday, November 11, 2020

Raspberry Pi 3B+ USB Boot

Earlier, I describe the use of BerryBoot with an external USB HDD with a RPi (1) B+. To be honest, this was a terrible user experience. While everything worked, this setup was tantalisingly slow. I mean really really slow. 
My assumption is that the USB2 implementation of the RPi1B+ does not reach USB2 speeds, not even close. Presumably the USB ports a run by the CPU, which in itself is relatively low power already. Consequently, I abandoned the idea of running the RPi1B+ from a USB drive.

As an experiment, I used the exact same external USB-HDD and microSD-card with my RPi3B+. What a difference! This setup really resembles a usable desktop computer. 
In my experience, the Raspberry Pi 3 B+ appears to be able to run the USB2 ports at USB2 speeds.
While booting and running of the microSD-card appears to be a little bit more snappy, the combo of BerryBoot and the externally powered 3.5" HDD on USB2 delivers an acceptable user experience.

The obvious advantage of this particular install is the amount of storage available, in my case more than 300GB.  The amount is only dependent on the HDD in the enclosure.


Monday, November 9, 2020

Raspberry Pi OS on USB

Lately, for various reasons, I got into using Raspberry Pis, in particular in combination with the GPIO.
What puts me off by a bit is the fact that the regular RPis used (micro) SD cards. While reading from an SD card might not be that bad, but writing to it, over and over again, will destroy over a short period of time. Thereby destroying the data you stored on it.

For my projects, therefore, another solution had to be found.

In this series of posts, I will document my experiences using various methods and devices to avoid the wear and tear of an SD card.

This first episode reflects on using BerryBoot to boot from and load the OS from USB connected devices.

Using and installing BerryBoot is very simple. Download the archive provided in the above mention link. Make sure you picked the file that fits your Raspberry Pi. 
During writing this article, it appears that the BerryBoot image now changed to a single archive for all variants of the RPi. I have not tested this, since I just a few hours prior to the writing of this post, downloaded the archive for Pi0 to Pi3+ boards.
Anyway, I stick with what I have and what worked for me earlier.

In my present test, I am using a Raspberry Pi 1 B+ with a 2GB micro-SD card as a boot device and a USB-2 HDD enclosure with a 320GB 3.5" hard-disk. The enclosure came with a 2TB disk, which is used in something else by now.
Further, the enclosure is powered externally by a 12V wall-ward. This, of course, is important, since a Raspberry Pi would never be able to provide the power for any HDD.

Following the procedure as set out on the BerryBoot page, an OS will be written to the USB attached device. I opted for a full install of Raspberry Pi OS, as it is presently called.
After having booted "into" the HDD, the experience is certainly less snappy, compared to running the OS from the SD card. However, the mere difference is storage space should put up some questions: 8GB SD card vs. 320GB HDD.
Initially, no swap space was created. So, I decided for creating a swap-file on the root directory of the hard-drive. That did not work. It appears that under BerryBoot, using a swap file is impossible.

A solution to the missing swap-file is to install zram-tools, which will enable a virtual swap into compressed memory.

In following posts, I will discuss various other options for booting a Raspberry Pi from USB devices.





Wednesday, July 15, 2020

Microsoft Fortran quirks

F0RTRAN is the one language closest to me, apparently. Hence, my attention to get compilers going.
In a previous post, I covered how to install Watcom F0RTRAN on FreeDOS. Eventually, this might be my compiler of choice anyway.

However, this post is dedicated to Microsoft Fortran and the bad memories about it returning.
Fist of all, there are some abandoned DOS versions of the compiler on the internet. I wont provide any links, since I am not aware of Microsoft officially abandoning this compiler.

I tested the following version on my genuine FreeDOS netbook
MS Fortran 2.0
MS Fortran 3.2
MS Fortran 5.0

First of all, have a look at this F0RTRAN77 code:
      I=3
      WRITE(6,100) I
 100  FORMAT (I3.3)
This should be pretty straight forward, in terms of F0RTRAN77, you might think... not according to Microsoft though.
This code should produce an output like this:
003

All compilers had the same fault, which drive me crazy 30 years ago.
If you code:
      I=3
      WRITE(6,100) I
 100  FORMAT (I3.3)
You would expect the compiler to print on the STDOUT an integer of 3 ciphers filled with 0. Something like:
003
Microsoft thinks differently!

MS Fortran 2.0 does not recognize this format at all. While the compiler in passes 1 and 2 wont create any errors, nor will the linker, the executable wont run.
You need to code:
      I=3
      WRITE(6,100) I
 100  FORMAT (1X,I3)
which will create:
__3

coding
      I=3
      WRITE(6,100) I
 100  FORMAT (I3)
will create:
_3

In fact,  that is not what we ordered!

MS Fortran 3.2 will compile and execute the code,
      I=3
      WRITE(6,100) I
 100  FORMAT (I3.3)
The above code will not produce any reasonable output. This drove me nuts, a few decades ago!
This is what Microsoft thinks the output should look like, when compiling with MS Fortran 5.0:
03
I am not joking. decades ago, it took me days to understand that Microsoft starts counting at 0, while the rest of the F0RTRAN world uses 1 for the first character in a line.
So, contrary to all other F0RTRAN compilers, for MS, one needs to code
      I=3
      WRITE(6,100) I
 100  FORMAT (1X,I3.3)
in order to obtain
003

Of course, this makes no sense at all, and it did not many years ago!


MS Fortran 2.0 does not accept this type of F0RTRAN77 FORMAT.
MS Fortran 3.2 does accept it... and so does MS Fortran 5.0.





The old router to the rescue

This is an interesting one, in my mind.
Some years ago, many actually, I got a router of the brand Sweex. This brand is/was lower end gear for the Dutch market. The router did OK-ish, however, I was not so convinced, so, at some stage, a got another one. No, I wont mention the brand here, since this was the real disappointment.
Anyway, the Sweex LW310V2 did serve a few years, and ended up in storage for a few years.
Finally, lately, I remembered that there was something concerning a "bridge" in this very inexpensive router. I checked my expensive (not to be named) present device, and there was no bridge option. Bummer! Some further giveaway, the company of said more expensive device recently removed the feature of a free dynamic DNS.
So, what was keeping me using the device? Nothing!
Back to the Sweex. It turned out that, while there is a bridge mode present, this is not what I need/ The big deal on this WiFi router is that has a WAN medium option which allows for wireless LAN.
Hence, I had to set my cable modem to allow bridge mode on WiFi and the Sweex WLAN router to wireless WAN mode. Both had to be set on the same channel And there we go.
The Sweex now offers its own WiFi and Ethernet LAN bridged from my cable modem.
Yep, that's what we want.
My old Sweex LW310V2 is back in service, after a break of many years. Glad I did not through it in the garbage, which I intended before.