Scratch for .Net v2.0 released

I have published Scratch v2.0 to the web at http://www.scratch4.net. If you are running the 1.0 client, the deployment tool will update automatically the next time you run it. Otherwise, just visit the link above and click through the steps on the ‘Get Software’ page.

To take advantage of the new features, you must install the GHI 2016 R1 pre-release SDK in order to get the latest CDC (serial USB) drivers.

New Features:
[ul]Side-by-Side support for GHI 4.3.7 and 4.3.8 G30 firmware (you don’t have to update your BP until you want to)
Accessory UART card no longer needed - the new firmware supports serial over the USB port when using GHI 2016 R1 (4.3.8 ) G30 firmware
Support for the N18 display, including clear-display, lines, circles, rectangles and text (4.3.8 only)
Touch pads removed
New ‘ClassRoom’ version which can install from a CD, thumb drive, or network share and which does not require internet access (please contact me for a downloadable copy). This version will not automatically get bug fixes, so I want to keep track of who has it in case there are critical updates.
New ‘Settings’ page, with the ability to exclude certain COM ports from the Firmata discovery process (which can cause unwanted bytes to be emitted on serial ports). Use this if you have other serial devices that are getting annoyed by Scratch
Numerous bug fixes[/ul]
To upgrade or deploy to a BrainPad for the first time:
[ol]Install GHI SDK 2016 R1
Connect BrainPad and run FezConfig and update the tinybooter and and clr firmware per GHI instructions
Reboot BrainPad (you should see a black screen)
Run Scratch Gateway, select 4.3.8 firmware and hit deploy
Check the output window that appears for any error messages
Exit Scratch Gateway
Reboot BrainPad (it may reboot itself again to get into CDC mode)
Start Scratch Gateway - you should now see the second image (attached below) with a Scratch For .Net device detected
Be sure to create new projects using the BrainPad-438.s2e template to get all the new display goodness[/ol]
Known Issues
[ul]Rebooting the BrainPad, especially after a deployment or USB/serial mode change (LEFT button depressed) can confuse the gateway. I am working on fixing this, but for now, you may have to restart the gateway after a reboot.
If the Gateway fails to launch - check whether another copy is running and kill it
If the Gateway fails to launch after upgrading to the latest version, you may need to uninstall and reinstall.
There is (currently) no way to match up Scratch programs against the firmware you have installed, so if you run a program with 4.3.8 features against a board running 4.3.7, then the new blocks will simply be ignored.[/ul]
When in doubt:
[ol]Unplug BrainPad
Exit Gateway
Use task manager to make sure the Gateway has exited
Plug in BrainPad
Start Gateway[/ol]

If you run the new 4.3.8 firmware, your Brainpad will permanently be in serial-over-USB mode. To return to debug/deploy-over-usb mode, hold down the LEFT button on the BrainPad while rebooting it.

You can run this code at startup in any program to revert the changes made by Scratch:

if (GHI.Processor.DebugInterface.Type == DebugInterface.InterfaceType.Serial)
{
    GHI.Processor.DebugInterface.Type = DebugInterface.InterfaceType.Usb;
    GHI.Processor.DebugInterface.UseInTinyBooter = true;
    GHI.Processor.DebugInterface.Save();
    PowerState.RebootDevice(false);
}

What took so freakin long? Well, simple is hard. Martin’s law of the Conservation of Effort says that every effort you save your users has to be paid for in design and coding effort. A lot of work went into making CDC mode and deployment as easy as possible (and it still has rough edges that I am working on). This was also the first release where I tried to support multiple firmware versions, and that turned up some design shortcomings. I don’t want to force people to upgrade, so I needed to make sure that the gateway could adapt to multiple different firmware versions that might be found on a BrainPad. Also, the original design was for a click-once deployed program that gets its resources from the web, which is nice and all for some folks, but unworkable in some classroom settings. So a lot of work went into creating compile-time flexibility for building a ‘Classroom’ version that would use only firmware images and drivers that were built in at compile time. Anyway, I hope it proves to be worth the wait.

And of course, if you have any problems, please contact me as early on as possible and I will help you work through them. This has been a substantial face-lift and there’s all kind of potential for things to go wrong, so I am eager to help you work through problems. Chances are, someone else will hit it too.

16 Likes

@ mcalsyn - :clap:

1 Like

Wow, a top level contribution. Well done 8)

2 Likes

Great work Martin. Can’t wait to get my boy into it. :stuck_out_tongue:

1 Like

Thanks all - I’m having a lot of fun with it too!

1 Like

You are the man! Time to play! THANK YOU!

1 Like

What an exciting night! I’ve just written my first BrainPad program using Scratch! :smiley: Just a few things to mention…

Since your documentation page isn’t populated yet, it’s difficult to figure out where to go once you’ve installed the software. Posting your older video here for everyone’s convenience. You may want to put this on your documentation page until you have more formal docs created. Without this, no one will ever figure out how to get the blocks into Scratch.

Also, one small bug I found is that the “turn [red] traffic light [on]” block is listed twice.

This is just fantastic, @ mcalsyn. Can’t wait to show it to my kids tomorrow.

2 Likes

Also, the display on my BrainPad says “Using USB. Reset to deploy”. What does this mean? Everything seems to be working correctly. However, that message sounds like I’m supposed to do something…

Through the magic of cloud deployment, the duplication of the traffic-light block is now fixed. I just pushed it to the server and you will get a new copy the next time you restart the gateway.

Also, the attached image is an example of using messages so that the display commands run only when needed and not every time through the main loop. You can create messages with many different names. Think of it as a Scratch-flavored ‘gosub’ or method call.

Thanks much, Ian, for the bug report!

2 Likes

It’s hard to be helpful in 27 characters :slight_smile:

What that means is that the Firmata firmware is using the USB port. To deploy any new firmware (either new Scratch firmware or your own .net program), you are going to have to reboot into deply/debug mode. That means rebooting while holding down the LEFT button so that TinyBooter has access to the USB.

EDIT: Alternatively, if you have the Click UART, you can deploy over that and just plug it in when you want to update. But generally, holding down LEFT and rebooting is a lot more convenient. I used the Click UART while debugging firmata code.

2 Likes

Confirmed!

Makes sense but the message on the screen only confuses things. Maybe “MODE+RESET to exit Scratch.”?

Well, I definitely agree that the message needs changing. I will have to expand my status-message area to pull it off, but I’ll change it in the next day or two.

Ian - I am going to answer here instead of on the website thread.

The gateway looks for firmata traffic on any COM port - it doesn’t really care how the bits get there. So, theoretically (as in, I haven’t tried it) if you put the BP in ‘standard’ mode, with debug/deploy on the USB, then you can plug in (for instance) a bluetooth click module and use that, so long as it shows up as a COM port on your PC.

One big caveat though - I think the performance is going to be pretty bad. Even at 115200 baud, it’s not exactly spritely. And by 19200 or 9600, it’s positively unbearable, with lags of 10 seconds or more at 9600 baud. Firmata is essentially an implementation of MIDI, so it is constantly sending state information so slow or high-latency serial paths are going to be really painful.

Side note : One shortcoming in the current firmware is that it puts your BP into debug-on-COM1 mode, which is a persistent setting, and the current Scratch firmware offers no way to change back persistently. You can change back for any single boot cycle by holding down the LEFT button. I need to work out some way (probably something with the buttons at startup) to persistently put the board back into debug-on-USB mode, for applications like you mention above.

Just thinking about it now, in order to minimally disrupt the normal use case (Scratch on USB) and so as not to delay startup with some sort of countdown, I think that once the Scratch firmware has been initialized once and claimed the USB interface, if it determines that the current debug mode is different from the last debug mode, then it will make the current mode persistent until you reboot with the LEFT button again. So LEFT will act more like a toggle, than a one-time exception. The downside is that rebooting with LEFT held down will result in two reboots and that in itself might be confusing (esp if you kept your finger on LEFT through both reboots). Still not sure I have a good user experience to offer here.

@ mcalsyn - Ok. That makes sense. I’ll put that idea aside for the moment…

Now the next challenge. Using the events I understand how I could kick off a series of things using a button press from the device. However, this seems a little unnatural in the Scratch world. Is there possibly a way to have a second control block that is essentially like the standard “when [green flag] clicked]” block that only runs through the code one time? Behind the scenes this could be a continuous loop as it is currently is but add a flag that only allows one pass of the program to be executed? The key is that its started from the UI as normal Scratch programs are.

“Connect BrainPad and run FezConfig and update the tinybooter and and clr firmware per GHI instructions”

I am stuck here.

I have 4.3.7.10 on the brainpad.

I cant get FezConfig to update the tinybooter. I’ve yet to see “GHI Bootlader Interface” in device manager…

What is the process again?

On the BrainPad, hold down the “Up” (LDR0) button and hit the tiny reset button in the middle of the directional buttons. That will put it in loader mode and you should be able to update it using FEZ Config then.

1 Like

Okay… I did this. Thanks! I saw the GHI Bootlader interface, was able to use fezconfig, and updated the config/firmware to 4.3.8

The screen was blank on the brainpad, and I tried (edit: Successfully) to use the new scratch gateway to deploy 4.3.8 of the scratch firmware, but now I am in a state where the brainpad just says:

[b]Scratch4net Firmata Server
By Pervasive Digital LLC
Server 2.0.0.0
Protocol v2.4.3

http://www.scratch4.net

Using USB. Reset to Deploy[/b]

Pressing reset just causes it to come back to this screen. The scratch gateway (2.0.0.4) can’t see it.

And in device manager, I just see the GHI CDC interface (Com25)

The deployment log window said
[b]"Deploying BrainPad v4.3.8 to G30_G30

Deploying assemblies…
Incrementally deploying assemblies to device
Deploying assemblies for a total size of 106376 bytes
Assemblies successfully deployed to device.
Rebooting device…"
[/b]
But no no matter what I do I cant get the scratch gateway to see it again.

Did I do something wrong?

When I updated the tinybooter to 4.3.8, I used the G30 (FEZ LEMUR) as that was the only one that seemed appropriate. Was that the correct one?

Ugh. I can re-update the bootloader, get scratch gateway to see the brainpad, where it says “No scratch firmware deployed” and once I try to deploy 4.3.8 scratch firmware, I just get stuck in that same loop again. “Using usb, reset to deploy” and never being seen again from the gateway.

I must be missing a step.

Edit: Okay, if I hold the left button down again while I reboot, it does come back different, with “Using secondary serial port” instead of “using usb” - and the scratch gateway does see it now. So if there is a step to get it to work just over the micro usb port, I havent done that yet, apparently.

Edit #2: Spoke too soon. Yeah, if I hold the left button down and reset, the scratch gateway will see the brainpad… but only the “.net micro framework device”. It doesn’t see the “Scratch for .net micro framework device”. If I reset and dont hold a button down, the gateway sees nothing.

Edit #3: Ugh. I’ve spent 4 hours on this today. Still cant get the scratch gateway to see the scratch firmware on the brainpad :frowning: Maybe next weekend!

[quote=“mtylerjr”]Using USB. Reset to Deploy[/b]

Pressing reset just causes it to come back to this screen. The scratch gateway (2.0.0.4) can’t see it.[/quote]

Sorry, but I can’t help but laugh here… If you read up a couple posts, you’ll see where I reported to mcalsyn just last night that this message was going to be confusing. :slight_smile:

At that point (before you hit reset) I believe you were where you needed to be. That’s the message you will see when it is working properly. At that time, you should also see “Scratch for .Net Device” in the Scratch Gateway. In the latest version, you will not see two entries in the Gateway as you see in mcalsyn’s older video I posted above.

1 Like