Saturday, 3 November 2018

Firewire audio interfaces (hardware)



After my slightly disappointing experience with the Soundblaster Audigy 2 ZS I decided to step up a bit with my "project". In the past was or maybe still is an external firewire audio interface considered the best performance. The clock for audio stream is supposedly more stable than with USB and external is there less noise than inside of computer case. Therefore are all the external devices considered semi professional and come with at least 24bit and 96kHz sample rates in combination with balanced and unbalanced signal inputs and outputs to reduce noise.

The support for Firewire devices under linux is a bit sketchy:
  1. As usual are manufactures of such devices not releasing drivers and or documentation to make (open source) drivers.
  2. From 2007 and on went firewire the way of the dodo in favorite of USB; less computers got firewire buses (Apple stopped supporting it) and more equipment (audio, camera etc.) switched to USB as interface.
  3. The ffado project is providing out of kernel drivers.
  4. The Alsa sound system started to supports also a few firewire interfaces.

The second point makes that it is now a days not so "meaningful" anymore to spend a lot of time in making new or improved drivers for Firewire equipment. At the other hand this makes that it it is possible to buy fairly cheaply old firewire equipment.

I looked a bit on the ffado supported hardware and I found the following three interfaces relative cheaply (<<50 euro) on ebay.
  • Terratec Producer Phase 24 FW
  • Edirol FA-66
  • M-Audio Firewire 410

The front and back of the three boxes are visible in the following picture:
Three (semi professional) Firewire audio interfaces

The following table gives an overview of the analogue interface functionality of the three boxes:
Brand Type Input Output
Mic Line Bits Sample rate Headphone Line Bits Sample rate
Terratec Producer Phase 24 0 2 24 192kHz 2 2 24 192kHz
Edirol (Roland) FA-66 2 2 24 192kHz [2] 4 24 192kHz
M-audio Firewire 410 2 [2] 24 96kHz 2x2 8 24 96kHz

Some notes to the above shown table:
  • The signal level of the headphone output of the Terratec Producer Phase 24 can be changed to line level which results in 4 line outputs.
  • The headphone output of the Edirol FA-66 interface is not independent but always connected with the first two analogue line outputs.
  • The M-audo Firewire 410 interface has not really 4 inputs it can use the 2 microphone inputs or the two line inputs at the back but not both at the same time.   And the two headphone outputs have independent volume control but have both the same signal.
The microphone inputs have the option to enable a 48V phantom power supply for microphones. The have a signal gain control and/or limiter. Both balanced (differential) and unbalanced (single ended) signals can be used as XLR connector or 1/4" jack plug.
At the digital side are there also some differences between the three boxes:
Brand Type Input Output
Midi SPDIF Optical MIDI SPDIF Optical
Terratec Producer Phase 24 [1] [1] 0 [1] [1] 0
Edirol (Roland) FA-66 1 0 1 1 0 1
M-audio Firewire 410 1 1 1 1 1 1
/>
Some notes to the above shown table:
  • For the Phase 24 interface box are the signals available on the 9 pin sub-d connector. Unfortunately I did not get this breakout cable, but I could find the connections by some measuring. See this blog post for more information.
  • The SPDIF and Optical input of the Firewire 410 cannot be used at the same time. They both are used as one data stream.
  • The Firewire 410 box can use ADAT signals on the digital input which would result in 8 channels more. However I have not tried this yet.
The difference between the three audio interfaces is also very much visible when looked at the mixer possibilities. The next figure shows the three "mixer" views of ffado-mixer.
The ffado mixer interface for the Phase 24 (left), Edirol FA66 (middle) and Firewire 410 (right).
  The Phase 24 interface offers a simple mixer for the 2 inputs and the 3 output signals. This mixer can be mapped to one of the output channels. Furthermore is it possible to select the signal level of the headphone output (line or headphone), select the synchronisation source (internal or spdif) and a kind of 5 level signal gain on the analogue input.
The FA66 interface has an even simpler interface; all the options have buttons at the box itself and cannot configured over software. Only the mixer for the 4 analogue and spdif signal is left in software.
The Firewire 410 interface has the most complex mixing function to match the 2 analogue input, 2 digital input and 8 audio stream signals to the 8 analogue, 2 digital and 2 headphone output signals.
This makes it clear that the M-audio Firewire 410 box is the more "professional" one of the three interfaces. It is a pity that this specific box has only 2 analogue inputs, other, more expensive, versions have more analogue inputs but are in general not well supported by the linux software.
However with firewire and ffado is this not a real issue; as long as the interfaces are on the same bus and the clock is synchronised is it possible to stitch them together as one big audio interface. This give the possibility to sample 8 analogue inputs at the same time. More about this in the software part.

Wednesday, 31 October 2018

Soundblaster Audigy 2 ZS and Linux

I started recently to look a bit around for a good audio card to get to a "studio" quality recordings under Linux. I didn't want to invest much money so I decided to buy something on ebay.

A short investigation pointed me in the direction of the Audigy 2 ZS sound card. A Creative product with interesting specifications:
  • 24bit 96kHz sampling (in and out)
  • 108dB signal noise ratio
  • EMU10K1/2 processor
  • Hardware wavetable synthesizer (4x 16 channel polyphony)
  • Firewire interface (which became the best feature of this card)
And that all in an attractive package for only 10.50 Euro:
A2zs002.jpg
Creative SoundBlaster Audigy 2 ZS
By The original uploader was Swaaye at English Wikipedia. - Transferred from en.wikipedia to Commons by Lockal using CommonsHelper., CC BY-SA 3.0, Link

The mixer options look great:
Alsamixer for Audigy 2 ZS

Reality


While a quick scan suggested that this card is supported under linux is the reality rather disappointing.  The Alsa page gives some information.

It looks that this card is in practice only supported for  44.1kHz or 48kHz sample rate. And the playback and capturing is mainly 16bits with some support for 24bits. This is an alsa limitation and in that sense is the card not really an upgrade from the "crapy" audio of a normal main-board.

This forces me to look a  further for a new solution that does deliver 24bit at a high 96kHz or 192kHz sample rate.

Wavetable synthesizer


This part has some hardware limitations.  According to alsa information page is the address bus only 31bits, which gives problems with a 64bit operating system and more than 4 Gigabyte memory. When this card was released was this probably a none issue, but now with only 64bit Operating systems and 16Gbyte of memory is this a bit of pity.
A work arround is saving some bigger memory block by using the following kernel parameter within the grub2 boot menu:
memmap=2048M\$6144M
It can be unfortunately necessary to play a bit with single (\), double (\\) or triple (\\\) to escape the $ sign within grub2 config file to make this work correctly automatically on boot time.
Furthermore can it be necessary to increase the normal 128MByte memory for the wave table to 200MByte to make the FluidR3_GM.sf2 sound font fit. This can be done by using the following kernel module parameter:
options snd-emu10k1 max_buffer_size=<size_in_MB>
This parameter can be put in the /etc/modprobe.d/alsa-base.conf file.

If this is correctly working can be checked with the following commands:
hansan@Desk-computer:~/Music/mid$ cat /proc/asound/cards
0 [FW             ]: BeBoB - PHASE 24 FW
                      TerraTec Electronic Gmb PHASE 24 FW (id:4, rev:1), GUID 000aac0400239b18 at fw2 
1 [PCH            ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0xef410000 irq 30 
2 [HDMI           ]: HDA-Intel - HDA ATI HDMI
                      HDA ATI HDMI at 0xef360000 irq 31 
3 [Audigy2        ]: Audigy2 - SB Audigy 2 ZS [SB0350]
                      SB Audigy 2 ZS [SB0350] (rev.4, serial:0x20021102) at 0xc000, irq 16 
4 [U0x46d0x9a2    ]: USB-Audio - USB Device 0x46d:0x9a2
                      USB Device 0x46d:0x9a2 at usb-0000:00:14.0-3, high speed
And to check the status of the synthesizer:
hansan@Desk-computer:~/Music/mid$ cat /proc/asound/card3/wavetableD1
Device: Emu10k1
Ports: 4
Addresses: 29:0 29:1 29:2 29:3
Use Counter: 0
Max Voices: 64
Allocated Voices: 0
Memory Size: 134217728
Memory Available: 103062476
Allocated Blocks: 866
SoundFonts: 1
Instruments: 14491
Samples: 864
Locked Instruments: 14491
Locked Samples: 864
A new sound font can be loaded with:
hansan@Desk-computer:~/work/sf2$ asfxload  "GeneralUser GS Live-Audigy v1.44.sf2"
hansan@Desk-computer:~/work/sf2$ asfxload -M
DRAM memory left = 100714 kB
And a midi file can be played with:
hansan@Desk-computer:~/work/sf2$ aplaymidi -l
 Port    Client name                      Port name
 14:0    Midi Through                     Midi Through Port-0
 16:0    PHASE 24 FW                      PHASE 24 FW MIDI 1
 28:0    SB Audigy 2 ZS [SB0350]          Audigy MPU-401 (UART)
 28:32   SB Audigy 2 ZS [SB0350]          Audigy MPU-401 #2
 29:0    Emu10k1 WaveTable                Emu10k1 Port 0
 29:1    Emu10k1 WaveTable                Emu10k1 Port 1
 29:2    Emu10k1 WaveTable                Emu10k1 Port 2
 29:3    Emu10k1 WaveTable                Emu10k1 Port 3
hansan@Desk-computer:~/work/sf2$ aplaymidi -p 29.0  test.mid
This does works at least.... But I have say that fluidsynth is maybe an even better solution, given the performance of modern processors.

Conclusion


All with all this was not really a good very invested 10.50 Euro. The selling features like the high bit rate and resolution are not really delivered on the linux platform.
The only good item is a firewire interface, which enables me to look into a different class of audio cards.


(updated and corrected a few items on 3/11/2018)

Saturday, 27 October 2018

Terratec Producer Phase 24FW digital / midi connector pin-out.

I started recently to look into "professional" audio interfaces for Linux. As part of this I have picked up from ebay a Terratec Producer Phase 24 FW in my quest for decent equipment . This is a fairly simple interface with 2 analogue inputs and 4 analogue outputs of which 2 are used for the headpones output at the front of the box.  There are two nice things of this box:
  • Fully supported by the FFADO project.
  • 24bit resolution with 192kHz sample rate.
There is now-a-days not much information to find about this box. There are some old reviews, but the normal website of Terratec is not showing much anymore. However there is a kind of manual archive with some good information and software. This can be found here. The software is of course MAC and windows only and therefore not so important.

Unfortunately the box came without the adapter cable for the digital connector.  This connector contains S/PDIF signals and MIDI signals in and out.  I thought I was fine; I don't have MIDI equipment and I did not want to experiment with SPIDF. However at the time I didn't realize that the S/PDIF signal is mandatory to synchronize multiple interfaces together on one master clock.  Some audio interfaces can even use a world clock signal, but most use the optical or coax S/PDIF or ADAT signal for this purpose.

The missing digital and MIDI signal cable as shown on the advertisement material of the manufacturer
Therefore It was necessary to find out the pin-out of the digital 9 pin sub-d connector.  It was fairly easy to guess the function of the pins on the connector by looking at the more or less standard circuits for S/PDIF and MIDI interfaces and by some poking around with a multimeter.

Based on the measurements and the standard schematics I was able to get to the following schematic / cable diagram of a part of the inside of the Phase 24 FW box and the resulting breakout cable:
Terratec Phase 24 FW breakout cable
Schematic of the digital / midi connector and the breakout cable

The inside of the Phase 24 FW part is not very accurate but simplified to understand the way the breakout cable should be connected. There are much more components on the PCB than showed in the above schematic. Interestingly not only the Midi-in is isolated, but also the SPDIF-out is more or less floating. This is probably to prevent ground loops. The suppressor diode tries to keep the excessive voltages under control.

The following table gives an quick overview of the pinning of the 9 pin female sub-d connector on the box:

Signal group
Pin
Description
MID out
1
+5V out through 220Ohm
2
Out signal
3
Gnd
S/PDIF out
4
Signal out
5
Suppressor diode to GND
Midi in
6
LED (diode in parallel with LED) through 220Ohm
7
Return
S/PDIF in
8
82Ohm input
9
Gnd

Looking at the website and other old data of Terratec I expect that the Phase 22 has the same adapter cable for the digital signals.  And it is very well possible that more products use the same pin out for this 9pin sub-d connector.

Now I have to solder a cable and synchronise my audio interfaces.

Tuesday, 2 October 2018

Insulation tester HP-6688F

I had recently again problems with my Dishwasher. For some reason it was tripping the FI-main switch.  I decided to need an insulation tester to investigate this further.  A short search on internet pointed me to this HP-8866F insulation tester.

This is a fairly reasonable low cost tester with a 2500V range. This high voltage range is on most lower cost instruments not available. There is not that much information available on this instrument, but here is a review with tear-down on youtube.
The specification for this instrument is as follows (copied from the manual)

Insulation tester
2500V
Test voltage / Minimum resistance to keep voltage 250V 1MΩ
500V 1MΩ
1000V 2MΩ
2500V 2MΩ
Output voltage 90 – 110% of the test voltage
Measurement range 1MΩ – 20GΩ
Resolution 0.01MΩ
Accuracy 1MΩ – 200MΩ ±(3.0%+5)
200MΩ – 10GΩ ±(5.0%+5)
10GΩ – 200GΩ ±(10.0%+5)
AC voltage range 1V – 750V ±(2.0%+5)
Frequency range 1V 40 – 400Hz


It is of course typical a measurement tool that you need only once a year and therefore I didn't want to spend too much on such instrument. I have bought the instrument at Komerci, but it can also be purchased on ebay, Amazon or Aliexpress.

For my purpose to find a short in the heater of the dishwasher did this instrument do a good job. However I would not depend my life on it; the professionals can better buy a Fluke or other name instrument. The voltages are a bit off and the youtube review shows quite some overshoot. Testing motors, heaters and other "passive" components will be no problem, but testing some active semiconductor circuit can be a problem.

For this blog I made a few experiments with 10 x 1MΩ resistors in series.  My small multimeter is measuring the voltage over the last resistor, which makes that it shows the measurement voltage divided by 10. This gives the following results:
Fluke
Resistance: 10.16MΩ
Voltage: 2.489V
Old Multimeter
Resistance: 10.07MΩ
Voltage: 0.508V

Interesting difference in measurement voltage between my fluke and my old multimeter of 25 years ago.
250V
Resistance: 9.98MΩ
Voltage: 208.7V
(Too low!!)
500V
Resistance: 10.01MΩ
Voltage: 456.9V
1000V
Resistance: 9.95MΩ
Voltage: 909.9V
2500V
Resistance: 9.88MΩ
Voltage: 2262V


The results are not too bad, however the voltage on the 250V range is a bit too low according to the specification.

This instrument was anyhow useful to find the short in the heater of the dishwasher.

Saturday, 11 August 2018

Powerbook G4 - part 1 - IDE converter fun

Since, by now, about six months, I am the proud owner of an original 2004 Apple PowerBook G4 1.5 15" (Al). I got this one for cheap together with some other bits that I will talk about in another post.


After spending some time with the thing I pronounced it to be in good health generally, with exceptions for the harddrive, the battery and some minor cosmetic issues. As is to be expected, the battery did no longer keep a charge and there are some minor scratches and spots on the case. The harddrive however, had died completely. All it did at boot was making some rattling noises. It was not detected by the firmware nor the operating system.

To be able to test the machine beyond the boot error, I dug up an old 2.5" 40G Toshiba PATA ("IDE") drive from my pile-of-parts, to replace the broken one. Together with the laptop, I got a DVD with MacOS Leopard, so I installed that first, and gave it a try. This OS worked fine, and reported all hardware, battery excepted, to be in working order. I could even burn a DVD!

My end-goal was to install Linux on it. Unfortunately, while most current distributions still support PowerPC, all of them are working on ending support for the 32-bit variant. The only distro that still seems to be committed is Gentoo. And as I had read, and confirmed, that there are some problems with video support, I figured Gentoo would be a nice thing to try. Its source-based nature should make debugging easier.

For installing this, a faster hard would be nice, so I looked at using an SSD. As the Powerbook lacks a SATA interface, the SSD  needs to fit a PATA interface. While these exist, they are expensive, and I did not want to invest more money than necessary in this endeavour.  The obvious alternative would be a SATA SSD together with a SATA-PATA converter. So I went looking for such a converter on EBay, and found and ordered an 2.5" converter that should work. Next step was for a cheap ~120Gb  SSD. As luck would have it, I found a cheap deal on a Kingspec Q180 180GB SSD on a webshop in the Netherlands.

While I was waiting 3 weeks for the converter to arrive, I ordered 2Gb of Samsung DDR ram via Aliexpress (8 euros delivered!) to max out the system, and this worked perfectly. And taking the Aliexpress experience even a bit further, I also spent 17 euros for a replacement battery. I have no idea what the original battery was capable of, but the replacement gives me a few hours before I need to find a wall socket, and that is good enough for my purposes.

When the converter arrived, I set out to fit everything into the machine. As the SSD is the same physical size as a normal harddrive, there was no room left for the PATA-SATA converter. But at least for small capacity SSDs, the PCB inside the housing is much smaller than the housing itself.

So I took the PCB out, plugged it into the converter, plugged the converter into the PowerBook's PATA port, and ...success! That is to say, everything worked. But because the connectors on the converter were perpendicular to the board, it did not really fit well in the chassis, and I could not screw things down. All that was securing the SSD to the converter was the friction in the SATA connector, and both were dangling on the little flex-cable that connected to the PowerBook PCB.

The SATA-PATA converter, with the perpendicular connectors. The SATA connector is visible, but the PATA one is on the other side.
Not happy about this, I made another search on EBay, and found basically the same converter, but with different connectors that were oriented parallel to the PCB. So I splashed out another 3 euros and ordered one.

Another 3 weeks later, the next converter arrived. Determined to make everything fit nicely this time, I modified the SSD housing to move the original PCB and make room for the converter. Physically, this went really well, but it turned out that with the new converter, the SSD was not working reliable. Both with Linux and MacOS, the SSD would drop of the IDE bus after some time, and would not recover.
Fitting everything inside the original SSD housing.
As I could not see an obvious flaw in the converter, and, except for the connectors, also no difference with the working original one, I concluded that some component was malfunctioning, and that the easiest solution was to order yet another one from a different supplier.

My SATA SSD pretending to be a PATA disk.
Another 3 weeks later the new converter ("#3") arrived. By then I had setup an Intel Atom system that has a 2.5" PATA connector so I could test things outside of the PowerBook, to eliminate the system itself as a cause of problems. Putting the SSD and new converter in this system allowed me to verify that it was working. I could read the entire SSD multiple times without problem, while the #2 converter would never reach more than about 12GB.

Feeling happy and confident, I put the SSD and new converter into the PowerBook and went to work.

For a while...

Until the SSD stopped working again!

And now putting it back into the Atom system also exhibited the same problems. So by then I had three 3 2.5" SATA-PATA converters: #1 - working, but with the wrong connector orientation. #2 - not working, but with the right connectors. And #3 - until recently working, and with the right connectors. My solution to this was to remove the connectors from #1, and replace them with the ones of #2. This took some challenging soldering, but in the end I got it to work.

Almost...

Again, the SSD stopped working, just less frequently than before. Strangely enough, I could not reproduce the problem on my Atom system, so it seemed specific to the PowerBook.

The only thing I could imagine was that the G4's power supply somehow was not stable enough. This could explain the difference between the Atom and the PowerBook. However, this did not explain why the old 40G drive worked fine, as that one should need even more power than my SSD. Also, while the computer supplies 5V, it is immediately regulated down to 3.3V and 1.8V, the voltages that are actually used by the SSD chips. So a slight voltage drop on the 5V supply should probably not be this fatal. In fact, the AMS1117 regulator claims to work with a voltage difference down to 1V, so even if my supply would drop all the way to 4.3V, it should still be okay.

Clutching at straws however, I soldered a 220 μF capacitor between the 5V and ground, to see if that would help. Unsurprisingly, it did not.

Then I took another look at my connector soldering, and noticed that the SATA data connector could use a bit more solder on one side of the converter board. Unfortunately I did not take a picture at the time, but about 120° of the solder-pad around the hole did not connect to the pin of the connector. The other 240° looked fine, but I added some solder just in case.

To make a long story short: after fixing this, the problem was gone, and so far I've not encountered any drive trouble anymore. More interestingly, a closer look revealed that converter #3 has some similar shoddy solder joints (from "factory"!), so on my to-do list is cleaning these up as well, and seeing what improvement that brings.

Finally everything fits nicely in the PowerBook. And works!!!
With a reliable storage device as a basis, I was able to install a dual-boot configuration of MacOS Leopard and Gentoo Linux. As reported above, the latter is not entirely stable in graphics mode. Digging into this will be the subject of a next post.



Tuesday, 25 April 2017

Lab power supply

My new power supply.

For quite some time I have been wanting an adjustable power supply. Both for convenience and hacker credits. Unfortunately, a really good one with all the goodies that I would like to have (multiple outputs, measurements, current limiting, computer control) is somewhere in the €4-to-500 range, which I find a bit too much.

But I still want my fancy power supply!! So I started thinking about making my own. Unfortunately I have no real experience with designing these things. Because of that it seemed a good idea to start with building some kind of kit. This would give me some experience, and possibly give me something to tinker with to see what works and what not.

After some browsing on the Internet I found this kit. It had favourable reviews, and a nice set of features: 0-28V, 0.01-2A, current limiting, short circuit protection,  digital display, current and voltage measurements, all for less than €20!

Of course, I needed to add some other stuff to make it a fully working PSU. A case, heat-sink, fan and banana plug terminals I found on eBay, and a mains switch, mains connector, knobs and a toroidal transformer I bought on-line.  A fuse holder, stand-offs and miscellaneous bits of wire and fasteners came from the well-known pile-of-stuff-that-I-might-need-in-the-future.

Assembling the actual kit was the most straightforward part of the exercise. All parts where there, all through-hole, so no worries at all. The design consists of two boards: an analog board that contains the rectifier, filters and power transistor, and a digital board that has an ATMEGA8, LCD, and two rotary encoders. A ribbon cable connects the two boards, and carries power, two voltage signals coming from the analog board that represent the output current and voltage, and one voltage signal going into the other direction that controls the power transistor. All regulation is done in software, so the ATMEGA monitors the output voltage and current, and adjusts the signal to the power transistor to maintain the correct output. The concept seems very similar to this.

The more involved part of the built actually was the mechanics. Getting a proper case for it, making the right holes in the case, and finding a way to mount everything safely and securely inside. The first case I bought turned out to be a bit too small, so I had to order a new one. As it turned out, that one was actually the same model as in the pictures of the seller of the kit.
First attempt at mounting stuff. In the end I added some stand-offs to the fuse-holder, so it no longer sits directly against the back panel. And I put a bit of anti-slip netting for the transformer to help it to stay put.

For mounting I tried to limit the number of holes in case, for looks, but also very much because any metal parts sticking through the case could potentially carry a large potential in the electrical sense. So I glued some stand-offs behind the front panel of the case to attach the digital board and display. To fix the transformer to the case, I stuck a metal bolt through the plastic lid (of a peanut butter jar), and glued that to the bottom. For glue I used two-component epoxy, which seemed to work reasonably well on the materials involved.

On the back of the case I added a mains connector, and a fuse holder on the inside. The fuse itself caused me some problems. I initially figured that a ~200mA slow fuse should be sufficient. Unfortunately, even 500mA fuses kept blowing during power-up, most likely because the large filter capacitor draws quite some current initially when charging. At the moment, I am using a 1A fuse, which should be good enough to prevent fire, but might not be good enough to prevent the transformer from getting damaged if ever the electronics fail catastrophically.
Everything on the inside. The digital board sits in front, the analog board on the left side, and the transformer on the right.The fan on the heat-sink is triggered by a temperature sensor, and draws air through in the bottom of the case. 

The power supply is able to deliver up to 2A at up to 28V, and can be used in voltage limiting or current limiting mode. It constantly shows the set maximum voltage and current, and what is currently actually delivered. The two rotary knobs change the voltage and current set-points, and pressing a knob stores the set-point as a default. The fan occasionally switches on (triggered by a temperature sensor on the heat-sink), but at least during my typical usage it is hardly ever  needed. So far I am very happy with the power supply. It is especially convenient to be able to see the output current when powering something.

As the ATMEGA8 had two unused pins, it should be possible, in principle, to add a serial interface for controlling it from a computer. This would involve moving some signals around to free up the UART pins, but that is hardly a problem.  Other things on my wish list would be a output enable/disable switch, a mode where the supply switches off when exceeding the current or voltage set-point, and set/used power  (in Watts) on the display, next to current and voltage. I think most of this could be implemented in software, but I would have to start from scratch. Unfortunately, the AVR came already programmed, and the flash memory was locked, so I could not download the software for hacking. I decided to leave these possible improvements for another day,

Anyhow, at the moment I am more than happy enough with the supply as it is. So for now I will spent my time on other projects.


Another view from the top.

Sunday, 16 April 2017

Resurrection of a Lenovo Ideapad K1: to neon or not to neon

In my previous post here I discussed my struggle with flashing my wife’s Lenovo Ideapad K1. And in the end I had to conclude that I could not conclude that I have bad flash or bad memory. This all was interesting, but not so helpful to get the tablet back to usable again.

When I install my images:
  • First: CM10.1_Wifi_Kaschemme_v1 or K1_CM10_JB_Starter_v2 with the nvflash tool.
  • Second: cm-10.1.3-RELEASE-k1-wifi.zip or cm-10.1-20130916-NIGHTLY-k1.zip with the recovery firmware CWM6.0.x.x.
I don't have any problems. The problems start after installing the gapps that are missing in these CyanogenMod android 4.1 / 4.2 images.  I use for that the file gapps-jb-20130427-nonneon-tonyp-keyboard.zip

I did a bit more research on my problems. There are a few elements to my "not working" tablet which helped me to narrow down the issue:
  • Messages that various google services have stopped or are not working any more.
  • Programs like youtube that not start or google play that gives [RH01] errors.
  • Logfile that gets filled with SIGILL errors and register dumps.
The last symptom  helped me most. After some time spend with google search I started to understand that I am hitting here an essential Tegra 2 vs Android 3.2+ issue.

The Tegra 2 T20 was at the time a relative advanced dual core Cortex A9 processor with a very good GPU so that it could do video decoding and encoding in the GPU. The Arm part is good but the GPU was the more advanced Nvidia item. A bit similar situation like the BCM2835 SoC processor of the Raspberry pi. Only is this not an ARMv6 but real ARMv7-A architecture, but to reduce some costs/complexity they have not implemented all the typical Cortex-A9 functions like the Advanced SIMD (NEON) extension. Probably Nvidia expected not to need this because the GPU could do the multimedia power lifting much better. From Tegra 3 Nvidia starts to support the full "instruction set".

The SIGILL error happens when a program is trying to execute a NEON instruction on a not NEON processor.  In the past, older than Android 4.1, was the assumption that most processors were ARMv5 and did programs not use NEON instructions, also not for AMRv7A.  In the SDK was it also explicitly asked for to have libraries for ARMv5 and ARMv7A with and without NEON or other extensions.

The issue I now have in 2017 looks to be two fold:
  • Google started to ship APK packages optimized for NEON, maybe on purpose, maybe by accident or maybe the compiler starts to optimize more/better in this direction.
  • For higher android versions is NEON compatibility of the ARMv7A architecture assumed.
This means that when a newer Android is installed on a tegra 2 platform we will hit the lack of NEON support. The program or parts of it will crash when there are no backup libraries for NEON emulation. All the google service packages and programs such as the google play, youtube etc. have this (potential) problem. My issue is that this "newer" is already by the Android 4.2 from the CM10 images and that the gapps package is pulling in a lot of newer versions of the libraries to support certain API's to talk back to Google and the Android universe.

It must be possible to keep and skip to the correct versions of the google apps to keep them working. However that is not so easy. There is always the danger that a new installed app is bringing the system down.

At this moment I see as only option to stay at android 3.2 and not to update too much. I have installed the old not rooted official Lenovo image: K1_A301_11_11_111108_US.zip and with that older outdated version is for the last hours youtube and the web browser working.

Case closed: a working tablet with obsolete Android 3.2 and an odd ball ARM device in my collection.

A side note: this tablet went obsolete in early 2012 and therefore there are still some people working on it up to late 2013. There are quite some messages in the XDA and Lenove forums from that time, but nowadays are all links in the posts to file sharing servers dead. It is very difficult to find various images back. Therefore it is not really possible to have a long life on this kind devices in terms of (software) support. The PC is in that way a much durable concept.

Short update: Improved Android 3.2.1 image

I searched a bit longer and found here the following thread with a better Android 3.2.1. image for this tablet. This image has the following improvements:
  • Newer version of the root file system: 14_14_120109 build
  • Recovery image / bootloader
  • No levono market and other not working apps
  • Rooted
The original image name is: K1_Stock_120109_nvflash_R2.zip but it can also be found as honeycomb.zip