Fixing Windows 10 Boot Problems

June 29, 2018 at 9:19 pm (computers, Uncategorized) (, , , )

Had an issue with a Windows 10 laptop where it stopped booting.  It was failing at the flashing cursor on a black screen, which to me looked like either a disk failure or some odd boot loop.  It wasn’t registering that there wasn’t an OS and it wasn’t trying to boot an OS and finding errors.

Booting off a Windows repair CD didn’t get anywhere with startup repair either, so into the command line I had to go.

There are a number of Windows commands that relate to boot that came into play:

diskpart – to look at disks and partitions to work out how it is configured (using the commands “list disk”, “select disk 0”, “list partition”, “list volume”, etc)

bootsect – to fix the boot sector (in this case, I used “bootsect /nt60 sys”)

bootrec – to fix various boot and boot record issues – “bootrec /fixmbr”, “bootrec /fixboot”, and finally “bootrec /rebuildbcd”.

Unfortunately rebuildbcd (bcd = boot configuration data) generated an error, “the file or directory is corrupted and unreadable”.  So after a bit of Googling, then also found bcdboot.  This is supposed to setup the boot environment by copying the relevant files form the Windows installation over to the boot area.  Running that though, came up with more errors, so poking around in the two areas, the PC had a boot partition on C: and the system drive was D:.  It was attempting to copy from d:\windows\boot\pcat to c:\boot and failing for some reason.

So at this point, I thought a chkdsk might have been in order – so “chkdsk /f c:” came up with a load of index errors related to all the language files which it seemed to fix.  bcdboot was still struggling, so I manually copied the rest of the files over.

At this point bcdboot largely succeeded, but still had one error, so running it in verbose mode highlighted a problem accessing the bcd catalogue from the d:/windows/system32/config area.  But not really knowing what it was trying to do with it, in the end I just ran “bootrec /rebuildbcd” and that seemed to work fine this time.

At this point, we felt it worth attempting a boot again, and thankfully at this point.  It all worked.  Windows did its own chkdsk again whilst starting up and we were finally in once again.

Kevin

 

 

Advertisements

Permalink Leave a Comment

Arduino, ATtiny85, and Timers

April 29, 2018 at 2:57 pm (computers, Uncategorized) (, )

I’m still playing around with using the ATtiny85 as the basis for a synthesizer, using a range of code and circuits from the Internet, but had an irritating problem today with some open code.  The author describes complete build instructions for their code and circuit for v1.5.7 of the Arduino environment and the arduino-tiny library, which as far as I can see was last updated in 2013 from its google code repository.

But I have v1.8.5 and the now easy to use, built-in support for the ATtiny85 from David Mellis (https://github.com/damellis/attiny).

So when it comes to build it on my system I get the following error:

wiring.c.o (symbol from plugin): In function `delayMicroseconds':

(.text+0x0): multiple definition of `__vector_5'

Which is obviously a linker error, but it has proven quite difficult to find a detailed hint as to what the actual problem is.  It says that it has redefined in my .ino file, but wasn’t immediately obvious this related to interrupt routines (although the word vector should have been a clue I guess).

Well it turns out that this is a problem you get if you attempt to defined an interrupt service routine twice.  The code in question had defined

ISR(TIMER0_OVF_vect)

And in any modern Arduino core timer 0 is used for the millisecond timer, as defined in hardware/arduino/avr/cores/arduino/wiring.c.  This is indeed vector 5 (see http://ee-classes.usc.edu/ee459/library/documents/avr_intr_vectors/).  This is defined in wiring.c, but not directly related to the delayMicroseconds function (oh the joys of tracing C linker errors).

I’m skipping over the part where I was attempting to work out where the actual source code being built was stored – not in <program files>\Arduino; not in my own Arduino source area; no it was finding mention of <user>\AppData\Local\Arduino15 that found any ATtiny support in my installation at all.

There seems quite a lot of confusion online (at least from the searching I was doing) about timers on the ATtiny85 and the Arduino environment.  It looks like an earlier version of the Arduino core (although not obviously in the v1.5.7 suggested by the author of the code I was using, so that is still a puzzle) had a method for changing the timer usage for different microcontrollers.

The arduino-tiny library uses a core_build_options.h options file and uses it to set the following:

#if defined( __AVR_ATtiny25__ ) || defined( __AVR_ATtiny45__ ) || defined( __AVR_ATtiny85__ )
#define __AVR_ATtinyX5__
#endif

#if defined( __AVR_ATtinyX5__ )

/*
 For various reasons, Timer 1 is a better choice for the millis timer on the
 '85 processor.
*/
#define TIMER_TO_USE_FOR_MILLIS 1

However, this isn’t in the latest builds of the core or in the version of the ATtiny core support I’m using, which doesn’t seem to have the option to change which timer is used for the delay functions.  In fact, I couldn’t quite pin down when the use of this header file disappeared from the Arduino builds, but to be honest I didn’t spend ages looking.

The code I’m trying to use needs the use of both timers, and as there are only two timers on the attiny85, hence the clash.  I’m not totally clear why it builds when the delay timer is swapped to use timer1 (as in the older arduino-tiny core), but I guess the code isn’t hanging an ISR of the other timer.

Interestingly in other code by the same author, does build ok, but in that case, even though it is installing an ISR for timer0, it is using a different vector, so it doesn’t seem to clash:

ISR(TIMER0_COMPA_vect)

So whilst you can completely mess up the functioning of the timers in your own sketch, by changing the control registers and so on directly, I haven’t found a way to clear and attach a new ISR to the interrupt.

I need to dig around a bit more now into the internals of the ATtiny timers to see how the code might be modified to support timer 1 instead of timer 0, but that will have to be a job for another day now.

Some possible options might include forgoing the use of ‘setup’ and ‘loop’ in the sketch; integrating it better alongside its use with delay; attempting to port over from triggering on overflow to triggering on compare; or I may end up trying to reverse the timer usage in the sketch (but I read somewhere that the two ATtiny85 timers are quite different, so that might not be possible).   I may end up with a special ‘hacked’ core board definition to re-specify the use of timer1 rather than 0 as per the older library, but that would be a bit of a mess…

Anyway, the upshot of all this is that this took quite a lot of untangling and googling and following dead-ends, so if you know of a definitive resource or document that details the history of ATtiny85 support within Arduino and when this changed, I’d like to hear about it!

Update: In my case it turned out that I was pretty much able to replace the use of the Timer 0 overflow interrupt with the Timer 0 compare A interrupt and get largely the same thing.  I don’t know if the two use of the different timers needs to be swapped though, but as far as I can tell right now, changing interrupt does remove the clash.

So in my case, I did this:

#ifdef ORIGINAL_CODE_
 TIMSK = (1 << TOIE0); // Interrupt on overflow
#else
 // Set compare value to same that would trigger overflow
 // of the 8-bit counter (pretty much)
 OCR0A = 0xff;
 TIMSK = (1 << OCIE0A); // Interrupt on compare with OCR0A
#endif

and then later on, when defining the ISR:

#ifdef ORIGINAL_CODE_
ISR(TIMER0_OVF_vect) {
#else
ISR(TIMER0_COMPA_vect) {
#endif

Of course there may still be other side effects, but I need to dig into the details to see.

Kevin

Permalink Leave a Comment

ATtiny85 Synth from Jan Ostman

March 31, 2018 at 3:38 pm (computers, music) (, , , )

I’ve wanted to make a simple synth for a while and stumbled across the excellent DSPSynth site from Jan Ostman, which provides a range of designs for Euro-module compatible synthesizer modules.  One thing that really caught my eye was the CZ1 chip which implements the Casio Phase Distortion method of sound synthesis (I used to have a Casio CZ synth).  The chip is based on an ATtiny85 and the code is available as open source along with a circuit design here: https://janostman.wordpress.com/the-3hp-paperface-euro-modules/

Unfortunately, being a bit of an ATtiny85 novice, it wasn’t totally clear to me quite how to put this together from the bits and pieces I had lying around.  So this is by way of documenting how I got this doing based on the circuits and code from dspsynth.eu.

Note you can buy pre-built modules and kits from the site with proper pcbs and “paperface” front modules which all look very smart.  But as I was just tinkering I wanted to see how much I could get going myself.

And of course massive thanks to Jan Ostman for doing all the hard work and publishing the designs in the first place.

Building the Synth

Parts list for me:

I originally grabbed a couple of very cheap “ATtiny85 devboards” off ebay that include a micro-USB connection, but these turned out just to be a way of powering the boards, not programming them.  I tried using an Arduino as an in-circuit programmer, but in the end the Sparkfun programmer was so easy to use, I just use that now all the time.

dspsynth provides two circuits related to the CZ1 chip.  On the main HP3 paperface module page is a complete euro-module compatible circuit including power regulator and jacks for inputs and outpus.  In the “CZ1 manual” is a much simpler circuit that just shows a simple output stage as follows:

dsp-cz1

So I used this as my output side.  For the inputs, I took two 10k pots connected to the input pins via a 22k resistor each as shown in the full dsp paperface circuit (but without the jack connectors).

The whole thing was powered using the 5v and GND pins from one of those cheap USB “devboards” I mentioned, although I didn’t use that to host the ATtiny85 itself as they aren’t really breadboard friendly.  I did need a simple 8-pin socket adaptor to breadboard adaptor to seat the ATtiny85 nicely though.  Pics below.

2018-03-31 16.04.292018-03-31 16.05.112018-03-31 16.05.17

2018-03-31 16.03.58

Programming the ATTiny85

The source code is provided here: http://www.dspsynth.eu/files/code/pdvco.ino.  The official module uses the TinyAudioBoot system which allows you to upload firmware over one of the audio inputs.  I didn’t bother with that for my tinkering, so I was just loading the pdvco.ino source directly using the Arduino IDE and the Sparkfun programmer.

One thing that had to be done was “set the fuses”.  As I say, as a ATTiny85 novice, this took a bit of googling.  But it turns out all I really needed was to set the internal clock for the device to 16MHz (I uploaded the code without this step and there were some very interesting audio effects coming out of the thing – as you’d expect the digital to analogue conversion was all off sync).

If you select the right parameters in the Arduino IDE (ATtiny85; Clock: Internal 16MHz) and then select “burn bootloader” this has the effect of setting the fuses for the clock speed.  At this point, when the code fired up it all seemed to work and sounded a lot better.

Next Steps

Now I’ve had a bit of a play and an see what the ATtiny85 can do, I plan to explore some more of his designs.  Of particular interest is seeing if I can create a MIDI in to CV module using the principles in his USB MIDI to CV interface. But I want real MIDI so will be experimenting with the serial ports on the ATTIny85 (and worrying about getting MIDI to 5v input levels).

Once again, many thanks to Jan Ostman for publishing these designs and letting people like me have a play with DSP synthesis with such a cheap and available microcontroller from a starting point of relatively little knowledge about such things.

Kevin

 

Permalink Leave a Comment

Repeated iPad Activation Requests

July 30, 2017 at 2:54 pm (computers) (, , , , )

I had a recent problem with an iPad.  It was asking to be activated, yet when you walk through the menus, it wouldn’t connect to the Apple servers and activate, it would only get kicked back into action when connected to a PC running iTunes.

Once activated, all was fine – Internet fine, browsing and apps, fine – apart from iTunes itself.  For some reason it was never able to get in touch with the App Store from the iPad itself.  After a while, it would then get stuck back in the ‘your iPad requires activation’ loop.  This could take a few hours or it might be after a day.

Typical error messages included: “activation error”, “ipad could not contact activation server”, “ipad could not connect to iTunes”.

The one that usually came up once trying to activate the device manually was “Your iPad could not be activated because the activation server is temporarily unavailable. Try connecting your iPad to iTunes to activate it, or try again in a couple of minutes”.

The Internet has various reasons for this – the server really is unavailable, your Internet connection isn’t working, and in some cases there was a report of activation problems after an iOS update.  There are various suggested solutions too – reboot, connect using a PC (which solves it in my case but only temporarily), remove the account from your iPad and add it back in, or even factory reset and restore from backup.  Nothing worked for me.

As I was contemplating a factory reset, I noticed that the clock on the iPad was out.  For some reason automatic updating of the clock from the Internet was turned off and the iPad was a hour out compared to the actual time.  Once the time synchronisation was turned back on and the clock updated, it all worked again.

I know that many cryptographic protocols can be time sensitive – if the clocks are out by too much between the two devices trying to communicate securely then the connection can not be established.  This is a problem I had with a Windows machine once – when the clock out of sync it wouldn’t ever update.  Looks like the same was probably happening here.

So if you are having odd activation errors on your i-device that keep reoccurring, check your clock settings and make sure it is telling the right time and in the right time zone.  This isn’t something I’ve seen mentioned anywhere in response to activation problems.

Kevin.

 

Permalink 2 Comments

Creating a wireless Pi-LITE from a XinoRF and LoLShield

January 2, 2017 at 11:22 pm (computers) (, , , , )

I have a few of the neat 868MHz radio modules from, what I still think of as, Nottingham based Ciseco (who became WirelessThings, who got acquired and then unfortunately ceased to be).  These are really simple serial-to-sub GHz radio modules that were available in a range of form factors based around their SRF module.  I particularly liked the RasWIK kit, which made a wireless link between a Raspberry Pi and their Arduino-based XinoRF board absolutely trivial using their Slice of Radio daughter card for the original RPi.  It came with components and tutorials to get you started with simple wireless I/O.  I also supported their kickstarter for the very easy to use SRF Shield for the Arduino and before that for the Pi-LITE.

You can still find some documentation for their modules on GitHub, under Ciseco and later WirelessThings, but most of the information about their modules seems to have disappeared with the company.  It isn’t even in Google’s cache anymore and archive.org didn’t mirror the site due to their robots.txt configuration.

If you are interesting in sharing what you do know about the modules, then there is an OpenPI Google Group where people have come together to share what information they have about the Open PI product aimed at simple wireless sensor applications.  I’ve also managed to track down as much as I can myself from the far-flung corners of the Internet, so I’m still able to tinker with their modules.

One product that was fun to use was the Pi-LITE, a Raspberry Pi GPIO board (for the original Pi) that had an on-board Arduino controlling a matrix of 126 LEDs.  It even made TheRegister.  It is basically an implementation of Jimmie P Rogers LoLShield for Raspberry Pi.  They also provided a LoLShield themselves for the Arduino alongside a version of the original LolShield library.

The Pi-LITE has a simple serial-port interface that displays anything you type as scrolling text on the LEDs. You can also send commands to set pixels as required.  You can run the Pi-LITE code on an Arduino with a LoLShield and poke it via the serial port, so I wanted to see if I could combine it with a XinoRF and get a wireless link running to it.

2017-01-02 18.40.54.jpg

The XinoRF is basically Ciseco’s Arduino Uno clone with a built-in SRF radio module.  This means that if you enable the radio (by setting D8 HIGH) then anything sent over the serial port automatically gets sent over the SRF radio too.  So if you have another SRF radio at the other end, e.g. the Slice of Radio module for the Raspberry Pi, or the SRF Stick USB for a PC, then you should be able to send commands to the Pi-LITE too.  But there are a few problems getting to this point, due mainly to the unavailability of the Ciseco documentation now, and due to the fact that the original LoLShield, on which the Ciseco board is based, is hosted on a site that Google tells you is hosting malware.  So information was a little hard to come by!

Issues:

  • The USB SRF Stick apparently has a driver, yet any site still selling them links back to the original Ciseco site, which is no more.  Solution: turns out Windows 10 is quite happy with recognising the CC1110 USB interface supported by the SRF Stick as a serial port.  If this had failed, I was going to try to find a copy of usb_cdc_driver_cc1111.inf, which seems to be all the actual “driver” really consists of.  I betting on this being a generic TI CC1110 device driver or something and google does return a few of them kicking around … your mileage may vary on this one – as I say, I didn’t need it!
  • A key tool for talking to and configuring the SRF Stick, or in fact any SRF based radio, is the XRF Configuration Manager tool from Ciseco.  Again, their site is no more, and whilst the XCM source is available on GitHub, the tool itself is not.  S0lution: As luck would have it, at the time of writing, there is still a live download link on the original ciseco site for this, see: http://www.ciseco.co.uk/downloads/XCM/install.htm
  • The XinoRF uses the UART and D8 to control the radio.  What is the LoLShield using and will they clash?  It is hard to find out as all implementations of this shield from Ciseco, Adafruit and others all refer to the original apparently-malware-ridden site.  Solution: using a web2pdf converter, I was able to read the original design documentation and schematic and found that yes, the LoLShield using Charlieplexing for the LEDs, does use all digital pins apart from 0 and 1 (the UART) so there is a clash with D8.

lol_shield_schematic.png

  • Is there an alternative to using D8 to control the radio on the XinoRF?  Well there is very little that I’ve been able to find about the SRF configuration and XinoRF, but there was an obscure reference in an index file of an archive site that captured snippets of a bit of discussion about this from the original openmicros.org forums:

“Pin 8 conflict – OpenMicros.org
Hi It s possible to move the radio enable pin from pin 8 to another pin youll need a soldering iron Looking at mine I think it s the RF EN pad I cant find mention of it in the docs and I m not familiar with how Matt do you know what the procedure is Hi On our shop advert is the link to the schematic hope this helps.  Hi Does that imply that the XinoRF won t work with your LED Matrix Shield I went through the docs for the shield before ordering one today and there it said Arduino R3 and Xino but looking at the rest of the docs it seems pin 8 would be required for it as well Does the documentation refer to an older Xino model then.  The LED Matrix docs will be talking about the Xino Basic not the XinoRF You can modify the XinoRF s radio enable pin to use something other that pin 8 Just to the left of the ATMega chip are two gold pads under the RF EN label Between the pads is a very small trace cut this with a Stanley blade use a continuity meter to check that there is no connection between the pads Solder a length of wire to the”

I doesn’t complete the sentence however.  The XinoRF schematic shows this RF-EN tag, which connects D8 from the Atmega328 to the SRF module via a resistor:

io8_iso-io8

And this can clearly be seen on the board:

2017-01-02 18.41.50.jpg

Solution: break the link between the tag as hinted in the forum post and solder a link wire to the left hand side (SRF-side) to connect to a stray +5v source on the board somewhere else (e.g. the IOREF pin or +5v from the ICSP header).  This will enable the radio by default.  Even though the SRF is a 3.3v module, the tags are on the 5v logic Atmega side (and from what I’ve read, the CC1110 has “5v tolerant” I/O pins even though it uses 3v power?  Not totally sure about that and haven’t dug out the data sheet to check, as it doesn’t seem necessary in this case anyway as in use, the tags can be measured as +5v regardless).

2017-01-02 21.18.15.jpg

At this point, downloading the Pi-LITE Arduino sketch to the XinoRF and plugging in the LoLShield is all that is required to get a wireless Pi-LITE.  To test, I used the serial monitor from the Arduino IDE to show what the XinoRF is doing directly using serial-over-USB, and I used the XCM serial monitor via the SRF Stick to show the same is happening over the wireless serial link.

Attached is a copy of the Pi-LITE users guide (B040 PiLite User Guide.pdf).  I’ve collected a number of documents about the Ciseco radio products, from cached or archived versions of their pages or from old ‘saved webpages’.  Hopefully some of this information will resurface over time.  It would be a shame to lose it.

Kevin

 

Permalink Leave a Comment

Updating Windows Update when Windows Update Won’t Update

December 21, 2016 at 9:39 pm (computers) (, , , , )

I’ve recently picked up a reconditioned Acer Iconia W510 Windows 8 Tablet PC with a docking keyboard, and to be honest, I actually quite like it.  But it is proving a bit of a trial to get going.

First, I found that it wouldn’t activate or start updating at all.  No matter what I did, it wasn’t happy.  Reading that Windows 8 is no longer supported, and I’d have to update to Windows 8.1, I looked for it in the Windows store.  But it won’t install from there without a pile of recent updates being installed first, but updates were having problems too.  Worried that I might have to reinstall from installation media, I set about looking for the Windows Product Code, but it was nowhere to be found.  Nothing on the box, nothing on the device, nothing with the installation and recovery media.

It turns out that many modern devices just come with a Windows Product Key in the BIOS itself.  There isn’t an obvious way through the standard Windows interface to find out what it is either. It might be in the BIOS, I don’t know I didn’t get that far.  This simple utility from nirsoft will dig out any product keys on a running system and tell you what they are.

Before all the pain of a reinstall though, I wondered if Windows Update might kick the activation off, so tried that a last time.  But that was still failing consistently with error 80072F8F.  Apparently you might get this if your PC clock is too far out of sync with Microsoft’s update servers.  Sure enough, even though the time and date were correct, the year was 2012 not 2016.  Fixing that kicked off both activation and updates, so all was looking good.

Sure enough, post first bought of updates I could now install Windows 8.1 from the Windows Store, which went through successfully.  I did wonder about skipping ahead to Windows 10, but Microsoft now want around £90 for the upgrade, which is a bit mad on a device like this.

At this point though, I soon hit another problem.  Windows Updates kept stalling permanently “checking for updates”.  There isn’t a clear “this is how you fix this” on the Internet, but the general Wisdom seems to be that there is an issue with high CPU usage and hangs of the Windows Update service on Windows 8.1 that needs the Windows Update service components themselves to be updated.

So, in short I tried all the following to no avail:

  1. Just leaving it running.  Some people suggest it might perk up after 20 hours.  Some say leave it 24 hours.  I left it running for around 30 hours (after realising I needed to change the power settings to stop the device auto sleeping after 10 minutes) and still nothing.
  2. Resetting Windows updates by stopping bits, wuauserv, cruptsvr; renaming the c:\windows\SoftwareDistribution directory; running the Troubleshooter to Troubleshoot issues with Windows Updates; then rebooting.  No effect.
  3. Tried booting into safe mode to see if that helps.  Note to self: Before trying Safe Mode for a Windows tablet, check that the docked keyboard and touch screen will still function when in Safe Mode.  For the Acer, they only way to interact with it was via an external USB keyboard (using the micro-USB socket too)!! Doh!
  4. I found that KB3102812 claims to fix it, but this relies on installing KB2919355 which itself seems to rely on KB2919442.  Downloading and running these separately invokes the wusa.exe executable, but this too hangs on the “searching the PC for updates” stage.  I left one of these going for around 6 hours.
  5. During the course of my travels I also stumbled across KB2950153, which describes a problem with wusa.exe freezing, but once again trying to install this isn’t trivial without wusa.exe which itself still hangs.  At this point I was running the Performance Monitor to spot disk activity and sure enough you can see the svchost hosting the Windows Update service trawl through the SoftwareDistribution area, updating logs, caches, db files and so on – but eventually all disk activity just stops and the check is still not complete.
  6. Next on the hitlist was finding a way to install an update manually without relying on the Windows Update GUI or wusa.exe.  One promising avenue is the PSWindowsUpdate module for PowerShell.  This gives  fairly comprehensive access to Windows Update from PowerShell.  Following the instructions here, but using the Get-WUInstall -Verbose command to see what is actually going on, this never seemed to get past the “Trying to connect to Windows Update Server” stage (I tried with both -WindowsUpdate and -MicrosoftUpdate options).

Finally, before seriously considering a reinstall, I looked up any other way possible to install a Windows update without needing wusa.exe.  Eventually I found this site which shows how you can expand a .msu file and use Pkgmgr to install the .cab file directly.  Now this is not without its risks – this is bypassing all the good configuration and dependency management that the Windows Update service does behind the scenes, but things were getting desperate.

To be sure, I started looking at the versions of some of the files on the system, so I could which updates might already be installed.  I was looking at the version of wusa.exe and wups2.dll files in c:\windows\system32.  From what I could see, I think I must have already included the two dependent installs from KB2919422 and KB2919355, so I figured I might be able to get away with installing KB3102812 directly, which is supposed to fix the performance issues.  As I say, this is not without risk, but the chances were looking good that if I could just force the update of the Windows Update Service, I might be on to something.  So the steps eventually were:

  1. Check versions of the files to give some assurance that older, dependent service updates where probably already included in my Windows 8.1 installation.
  2. Download the (in my case) x86 version of KB3102812.
  3. Open a command line (using the “Run as Administrator” option).
  4. run the following commands:
cd \Users\me\Downloads
mkdir temp
expand -f:* “Windows8.1-KB3102812-x86.msu” temp
cd temp
start /w Pkgmgr /ip /m:Windows8.1-KB3102812-x86.cab

This took a few minutes, but eventually looked like it had done something and told me I had to reboot to finish the installation (after also telling me that use of pkgmgr was deprecated).  Sure enough, on rebooting I got the familiar “Configuring Windows” display and once running again, I could see from the dates in the c:\windows\system32 that quite a few Windows Updates related files had been updated.  Curiously not wusa.exe though …

At this point, I ran Windows Update as normal, whilst watching disk activity again using the Performance Monitor, and yes, after quite a few minutes, it finally declared I had 213 updates to install and proceeded to download and install them.

Phew!

Fingers crossed, this has now got me up and running and past the irritating, Microsoft-acknowledged bug, that exists in Windows Update for Win 8.1 that, infuriatingly, they only seem to provide a fix that requires installing via said problematic Windows Update.  Talk about chicken-and-egg!

Update on the updates: once all 213 were installed successfully, there were 7 additional updates and 10 optional updates. Thought I’d get it fully up to date so selected all 17. Turns out that one of the optional updates causes a perpetual shutdown-reboot cycle.  Also turns out that it is nigh on impossible to use F8 on a Windows 8 PC to enter safe mode – hence I guess why you set it using msconfig.  Thankfully I was able to use the Acer boot menu to start the troubleshooter and restore from a system restore point. Unfortunately it was the restore point prior to the 213 and the manual fix … Off we go one more time then … But really, an update that shuts down before you can even type CTRL-R msconfig?  Really Microsoft??  Moral of the tale-once it’s running ok, create a manual restore point and create a system image backup pretty quickly!

Update on the update on the updates: Of course Microsoft removed the backup and restore options from Windows 8 that let you create a system image so you have to use the command line wbadmin tool …

Kevin

 

Permalink 1 Comment

Long playing for 1000 years

December 10, 2016 at 6:29 pm (computers, music) (, )

I first stumbled across the Longplayer project when I saw a mention of their Longplayer for Voices on Kickstarter.  Then I completely forgot about it until Christian Payne (Documentally) mentioned that he’d caught up with the originator of the project on his long-form, email newsletter, ‘Backchannel’ at which point I looked it up again.

The project is great – a very long-term musical project (a bit like As Slow as Possible) conceived and composed by Jem Finer.  The one line summary is that he has recorded a sequence of music for some ‘singing bowls’ and the project combines various processed versions of this 20 minute piece in a range of different ways, resulting in a piece of music that will play continuously for 1000 years without repeat.  The long version can be found on the about page for the project (its worth a read).

To listen along, there is a live stream available from the website or listening stations in a couple of locations in London and San Francisco.  There are a series of live performances too where players play extracts of the piece.

And more recently there is now an iOS app that uses the same 20 minute piece, the same time-driven algorithm and a sense of shared time via the Internet to make the app play exactly the same part of the music available in the physical spaces and via the web.

The ‘score’ is a simple representation, with six concentric rings showing the sounds in six variations of the 20 minute piece.  But the algorithm behind Longplayer will play each ring at different speeds – with one of the rings taking 1000 years to complete.

There is a visual representation of the score with an indication of which part of each ring is currently playing.  This is available via the web and the iOS app.  The following show four stages of the app over a 24 hour or so period.

Notice how the second ring progresses the quickest, but some of the others hardly at all.  The third ring is the 1000 year ring, so over 24 hours there is no movement at all

2016-05-06 21.00.352016-05-06 23.15.362016-05-07 06.15.482016-05-07 13.13.332016-05-07 17.27.24

A great app, a great project and fascinating music!

Kevin

 

Permalink Leave a Comment

Custom Blockly Block “does not know how to generate code”

March 8, 2016 at 10:56 pm (computers, kids) (, )

I’m playing around with my Espruino board (embedded board, programmed with JavaScript) as part of my quest to find a kid-friendly embedded controller.  One of the nice things about Esruino is that it comes with a Web-based IDE that provides a terminal console that allows you to write JavaScript directly onto the board or allows you to programme it using Blockly.

I want to write some custom blocks, so downloaded the source for the EspruinoWebIDE and did the following:

  • Created a new file “EspruinoWebIDE\blockly\blockly_myfile.js”
  • Included this file in a SCRIPT tag in the top of “EspruinoWebIDE\blockly\blockly.html”
  • Proceeded to create my blocks – initially as defined using the Google BlockFactory and then added to blockly.html to present them in the UI

There are already a few files defining extra blocks – blockly_espruino.js is the main one and blockly_robots.js is a simpler one, that actually makes quite a good example to follow if you are doing your own.

The basic idea is that there is a ‘toolbox’ definition for your block in the blockly.html file (which makes it appear in the menu of blocks in the user interface), supported with a block-definition file detailing the physical appearance of the block and what it needs to connect to within the user interface (Blockly.Blocks.mycategory_myblock) with an accompanying code-generation block.  In this case, generating JavaScript via Blockly.JavaScript.mycategory_myblock that uses the Blockly API to get what it needs from the user interface and returns a string that contains the corresponding generated code.

There is a setting in the EspruinoWebIDE – Settings->General->Overwrite JavaScript with Graphical Editor – which is quite handy at this point, as it means that every time you hit ‘Send to Espruino’ in the graphical editor, the JavaScript window is updated with the generated code.

Except when it isn’t.  There were no obvious errors, and the ‘Send to Espruino’ always said ‘Sent’ but there was no outward sign that anything had happened.

If you use the Inspect option of the Chrome browser then it was apparent that there was a JavaScript error:

Language “JavaScript” does not know how to generate code for block type “mycategory_myblock”

This hidden message indicates that there is a miss-match between the Blockly.Blocks.mycategory_myblock function and the Blockly.JavaScript.mycategory_myblock function and even though the block is available through the user interface, Blockly doesn’t know how to generate code for it.

Except in my case, no matter how it was written, generated, typed or checked, it was ignoring my code and I just could not spot what the error was.  Eventually, I changed the order of the SCRIPT statements in blockly.html, wondering if there was some kind of load-order issue and it suddenly started working.  Once I changed the order back again, it kept on working – so unfortunately I have no idea what was causing the problem, but just guessing some weird local caching issue or something not picking up my changes.

But if you are finding things aren’t working but there are no visible errors, definitely try Inspect and look for JavaScript errors and see if you can somehow force the application to re-load all files from scratch to make sure you aren’t working with an old version or something similar.  I still don’t know why it started working, but at least it works now.

The only reason I’ve written this is that Googling for various hints as to what might cause the issue was failing me – even once I knew what the error was.  So thought I’d write it down myself in case others have a similar issue – this might give someone else a clue.

Despite this rather irritating issue, I actually quite like Blockly.

In a future post, I’ll talk a bit more about what I’m actually doing with all this.

Kevin

 

 

 

Permalink Leave a Comment

Codebugs, Glowbugs and DIY Tails

February 20, 2016 at 11:21 pm (computers, kids) (, , , , )

We got a couple of Codebugs just before Christmas and have been having quite a good time playing with them so far.  You write code for them using an online IDE based on Google Blockly and the device itself has two buttons, a 5×5 grid of LEDs and 4 GPIO ports with nice croc-clip friendly contacts on it so you can straight away start playing with linking code to the physical world.   It also has an expansion connector (the ‘Tail’) and when you connect it to a PC via USB it comes up as a mass storage device and you drag code across to it to run it.

We’ve done the obligatory “scroll your name” across the LEDs, hooked up fruit to create a fruit ‘touch’ keyboard and have started exploring some of the projects available via the online community.

My only slight gripe is that the mechanism for getting code on it isn’t quite as intuitive as it might be.  We’ve largely got the hang of holding buttons down whilst powering it up.  although, when trying out code, it tends to stay plugged in, so we use the ‘reset’ then ‘hold’ technique designed for when it is powered by battery most of the time.  However sometimes the buttons aren’t held quite long enough for it to register.  Also, every time it comes up in mass storage mode, the previous programme is erased.  If you are not careful you end up with lots of “compiled” Codebug programmes lying around your browser’s download directory.  Seeing as all projects are managed by the online IDE it would be nice if there was a neater way to send the code straight to the Codebug without copying between directories.

That aside, its a great device and has generated lots of interest with the kids and I’ve recently purchased a set of Glowbugs.  These are WS2812 based RGB LEDs with simple croc-friendly (of course) contacts that you connect to the Codebug using the GPIO, configure and off you go.

For our next project however, we quite wanted to use all 4 GPIO as inputs and I know that the Glowbugs can be driven directly via the expansion header, so I set about seeing if I could create a DIY ‘tail’ connector to breakout the CS, +5v and GND connectors, as used by the Colourtail, to something that would accept croc clips.

I also have a cheap, purchased from China, 24-LED WS2812 pixel ring with the same +5, GND, DIN, DOUT interface as Neopixels and the Glowbugs that I wanted to use.  I’ve already connected this up via the Codebug Tail, but again wanted something croc-clip friendly that the kids could use.

So armed with a 20x80cm prototyping board and some right-angled headers, I set about making a simple DIY tail adaptor and connector for the LED ring.  Warning – massively dodgy soldering coming up.

fig1.png

As a major goal was to make this easy for the kids to use, I wanted the connectors to break out in the same order as the Glowbugs – so (with all boards face down) this means from left to right, GND, DIN, +5v.  However the tail connectors are CS, GND, three not required for this application, and VCC, so I needed a wire link to get CS (for the data) from the left-most pin to a central spot.

fig2.png

With a small portion of board cut and smoothed ready for headers, I decided to use crude solder blobs as a simple way to create croc-friendly pads and connections, as can be seen via the very dodgy soldering going on in the following!  In case you can’t quite make it out, the ‘circuit’ is highlighted in the last pic.

fig3.png

So after adding another three ‘pads’ on the other side, the final thing looks like this.

fig4.png

In order to be able to easily use the LED pixel ring, I decided on a similar approach to add some ‘pads’ to the ring.  Once again I wanted the pads in the same order as a Glowbug.  I could have added both an ‘in’ and ‘out’ connector, but decided for simplicity only to create an ‘in’ – so the ring will always be the last thing in the chain.  In the following, the wires are coloured as follows: green is GND, blue is DIN and red is VCC.

fig5.png

The biggest problem with just connecting the pixel ring directly to the Tail connector was the poor physical connection of the wires to the ring itself, so this time to give it a degree of kid-robustness, I used a hot-glue gun to stick the pads to the ring and protect the solder links.

fig6.png

With a final blob of glue over the top of the solder connections to the ring, everything is ready to go.

fig7.png

So to use the Glowbugs connected via the DIY tail, you have to use the configuration blog to enable the ‘Colourtail’ rather than ‘Glowbug’, but otherwise, everything else is just the same.  And of course, the ring is just treated as a set of additional 24 Glowbugs added on the end of the chain.

So crude, and soldering that will definitely not be winning any prizes, but it works, and passes first contact with the kids.

fig8.png

Kevin

 

Permalink Leave a Comment

How much? I could buy a computer for that!

January 18, 2016 at 9:17 pm (computers, internet) (, , )

First there was the C.H.I.P. – the $9 computer with built-in Wifi.  Then soon after that appeared on Kickstarter, the Raspberry Pi Zero came out – a $5 Raspberry Pi.  Ok, so strictly speaking you need a few accessories to really get them going as fully fledged computers as most people would recognise the term, but in these days of cheap computers, it made me think, just how does this compare with other ‘everyday’ items?

So, taking the “list price” for the Pi Zero, as £4 … that is:

Of course, these days, $5 will get you  a whole range of goods and services, including, according to Dave Gormon, 5000 Twitter followers!

And of course, as per the tweet that started the thinking behind this ramble … just slightly more than a 10 minute bus trip in Cambridge!

Kevin

 

Permalink Leave a Comment

Next page »