Making TeleText/RustText pages

This is probably a bit premuture as I haven’t implemented HTTP yet in RustTex but I thought I’d do a short post on making pages for RustTex (you can also use the same pages with a teletext emulator).

I use a program called wxTED to create pages for RustTex. This is primarily designed for TeleText so the RustText file handler has to do a few things to make sure they display properly on a BBC micro/BeebEm.

wxTed presents a GUI which allows you to enter text. You can do line drawing by using ctrl-F? (F1-F9 for the colour). In graphics mode you can use q,a,z,w,s,x to change one of 6 blocks inside the character location. It also lets you set the background colour and do lots of other stuff. Check out it’s help pages Help->Special keys and have a play.

If the Internet had been become popular in the 80s.

Background

It’s 1985 in a parallel universe where Europeon telecoms companies have understood the need to bring down costs and install a new digital communications network based on ISDN.

In parallel Minicomputers and Mainframes are being joined together to better share information between companies and academic institutions using packet switch. They all agree on a information sharing agreemement that mirrors the current internet where costs are shared and the system is opened up to indviduals.

This is a small project to imagine what the reader would experience if this had happened and their newly purchased LOUCORP9000 ISDN modem arrives through the door ready to be connected to their BBC Microcomputer.

In order to connect a real PC to your local PAD (which is what RustTex does) you will need to run the tcpser program and the Beebem BBC micro emulator.

How to install

Download beebem from http://www.mkw.me.uk/beebem/ and install it on your PC. Versions are also available for Unix and I think mac.

You will then need to install tcpser to allow you to emulate a modem. You can download it from http://www.mkw.me.uk/beebem/tcpser.zip . Unpack the tcpser zip file and launch the GO.bat file.

Then run BeebEm. From the comms menu select RS232 destination and select localhost:25232 I’ve not had much luck connecting directly to RustTex yet so for now your have to use tcpser to connect to RustTex.

Then follow the instructions in the pamphlet below. Your phone no. is the IP address or hostname of the machine running RustTex (localhost if it’s the same PC as your running BeebEm).

Your LOUCORP9000 ISDN modem.

Congratulations on purchasing your LOUCORP9000 ISDN modem. Your ISDN modem provides the very latest technology which will allow you to connect to your local PAD (packet assembler/disassembler) and experience the internet at speeds of up to 9600 baud.

How to connect your ISDN modem to the Internet

Connect your modem to you ISDN line and connect it’s serial port to the back of the BBC micro. Once the modem is connected then you will need a terminal emulator running on your BBC micro. Below is a simple BBC basic terminal emulator your can type into your BBC micro.

10*FX2 2
20*FX7 4
30*FX8 4
40*FX229 1
50REPEAT
60  A%=138:X%=2
70  IF ADVAL(-1)>0 AND ADVAL(-3)>0 THEN Y%=GET:CALL&FFF4
80  *FX2 1
90  IF ADVAL(-2)>0 THEN VDUGET
100  *FX2 2
110UNTIL0   

Enter the code above and don’t forget to save it to a disc or tape using the SAVE “filename” command! You can now run the terminal emulator using the RUN command.

How to connect to your local PAD

In the terminal emulator type AT and press the return key. The ISDN modem should return with OK. To connect to your local pad type the following, where phone number is the phone number of your local PAD.

ATDT <phone number>

For example you could type ATDT localhost

This will connect to the PAD and you will get a screen similar to the one below.

From here you can get help by typing help! Refer to the documentation of the PAD you are dialing into for more information.

Rusty STM32

Introduction

So I’ve recently being have a play with building software in Rust for my Nucleo F7 dev board. As I didn’t really fancy writing USB drivers and wanted to have a play with ST’s STM32Cube drivers I thought the best course of action was to mix C and Rust together in one project.

Setup

For this project I decided that I would use the rust build system (Cargo) and link my C code via a static library. The Embedded rust book (https://docs.rust-embedded.org/book/) gives a good walkthrough on what is needed to build and link a project and get setup with something simple that can print ‘hello world’ via semihosting on the debugger and I did this before adding any of my C code.

As I’m using Visual Studio Code for development currently Cortex-Debug VS Code extension (https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug). This enables debugging using OpenOCD via ST-Link SWD board on the Nucleo development board. For this kind of project having a debugging capability makes life much easier.

Creating the C setup and drivers

The first thing that can make life a lot easier is to use the STMCubeMX program from ST to build an initial setup C code project that will initialise the clocks on the CPU so they are all running at the correct frequency. This utility has some templates for the Nucleo series boards that would also be a good starting point if you are using something else like the STM32F4 Black pill board or your own custom CPU.

I used this to build a initial project with a serial port and several integrated peripherals then renamed the main method to an init method (and made it return) that can be called from the main rust code.

I did find one gotcha in this in that it looks like the rust init routines do not clear the processors ram before running. This gave the symptom that the serial port would work when the ST-Link windows utility was run but not at any other time so it’s important to manually clear the gState vairable (and probably others) before you initialise the HAL drivers. I’m currently initialising each HAL driver from the C code but this could also be done in Rust (and in that case all initialisation has to be done explicitly).

Creating the Rust code

The Embedded Rust book (https://docs.rust-embedded.org/book/start/qemu.html) provides a good overview on how to setup the Rust side of things. I followed this and got a simple program to output ‘Hello World’ via Semihosting on the Debugger. One thing to note is that the debugger will hit a breakpoint when outputting each character if you don’t enable semihosting on OCD. Using hprintln is also recommended over itm as the later won’t work if you don’t have the SWO pin connected.

In order to link your C code to your rust code you will need to modify the build.rs I added the following lines to mine:

    println!("cargo:rustc-link-lib=static=<stm32-c-library>");
    println!("cargo:rustc-link-search=native=<src-dir>");

This will tell Cargo to link your C code with the rust code when building. For the above example I placed the C library .a file in the source root directory, though for less experminental projects it would be better to create a lib directory. You can then use an extern “C” directive to tell the rust compiler about your C functions. Here is a simple one below:

extern "C" {
pub fn c_main();
pub fn HAL_IncTick();
pub fn SystemInit();
}

As the Rust cortex libraries handle the Interrupt table it is very important that you define an interrupt handler for the SysTick interrupt. Not doing this will cause the board to get stuck in Rust’s DefaultHandler which will just loop forever. The SysTick interrupt is also very important for the STM32 Hal for tasks such as the delay function so the SysTick timer should at least have the following:

#[exception]
fn SysTick() {
    unsafe { HAL_IncTick();};
    //hprint!(".").unwrap();
}

My next steps

Now I have something that works I want to have a go at getting Futures working and changing over the STM32F4 black pill for the bulk of my coding. These STM32F4 boards are much cheaper and should have plenty of ram to run most the things I’m interested in.

A short introduction to UK legal gender for non-UK folks

Since this came up in regards to emigrating outside the UK and gender recognition I thought I’d write a small post about how gender works in the UK and is recorded. As the UK isn’t quite as organised as countries such as Germany it is possible and common for gender to be different depending on circumstances. This is probably best seperated into 2 sections. As always this is just a basic summary and it’s probably best to consult a lawyer.

Birth Certificate

Under UK law Legal Gender is defined as what’s on your Birth certificate. However for most practical purposes this is not actually legally significant as documentation such as driving licences and passports can be changed based on self ID.

The most important area where legal gender is important is getting married in the UK (as marriage vows in England/Wales may have to be recited in regards to legal gender), pension before the pension age was adjusted and if a person ended up in prison.

Eqality act and sex discrimination

Under the equality act it is illegal to descriminate due to trans status (perception or intent to transition) or sex. This would probably have the effect of covering a trans person in a sex discrimination case the same as a CIS person and there is also no need to disclose trans status in most cases (pretty much only for background checks when working with vulnerable people or working in a rape crisis centre). This is one area I’m not particuly well read up on so probably best to talk to a lawyer or trans organisation.

Other documentation

Apart from birth certificates all other documentation does not show legal gender but instead shows either the gender person identifies as or whatever they like (in the case of Ms/Mr/Mx as these have no legal standing).

In the case of ID documents such as passports/driving licences all that is required to change gender is a letter from a doctor or psychiatrist. It is also possibly to change your gender under the NHS using this method.

In the UK anyone can change name using either a deed poll (signed by witness’) or statutary declaration (signed by solicitor/judge). Both of these documents can be created using templates which are available free online.

Due to the equlity act and other provisions it is also easy to change documents such as exam certificates which are not normally changable by CIS people. For example changing your degree certificate is as simple as sending a certified copy of your statuatary declaration or deed poll and stating that you have undergone gender transition.

Toilets etc.

Access to single sex areas such as toilets is currently not controlled by law and is via convention. This means that you can use the one that match’s your gender identity. This is also backed up by case law around the Eqaulity act.

And update and maybe some hope for the UK

So it’s been awhile since we made the decision to move countries (Well technically since December). Things have been progressing slowly while we wait for the pandemic to subside and things to open up again.

While plans have been progressing it’s been a difficult month here in the UK and anxiety for not just me but most of the trans community has been through the roof. Earlier in the month we heard leaks from the government that the proposed reforms for our gender recognition laws were going to be shelved and our rights were going to be rolled back. This was rumoured to involve our access to ‘single-sex spaces’ being denied which would meen we potentially could even loose the right to use the toilet without harrasment (or arrest).

There has been a big push back from the community though and demonstrations have happened nationally. The push-back which has hopefully made the government realise that we are the small easily kicked minority that they hoped we would be. Surveys have also shown that there isn’t widespread support for rolling back our rights.

All of this has mean’t that the goverment has now announced that reform will be delayed again (first to this week and now to September). It means that we won’t get the prize of having self-ID for changing our birth-certificates but it also means that things atm won’t get worse either.

For now this feels like small victory. For me personally it gives me time so we can get ready to move. We still don’t trust that things won’t get worse over time and we still need to move somewhere where we can get away from the harm inflicted on us by the media and government. It also means that our friends and others that we care about also have a chance to be safe even though they don’t have the ability to move.

Lou’s future adventures beyond the UK

It’s been too long since I’ve blogged so due to some scary and exciting future life changes I’ve decided that it’s best to get writing again.

It’s been a difficult few years in the UK and things have been slowing getting worse here. The main stream media has become more hostile to trans people and we have a TERF for an equalities minister. The community is fighting back though and hopefully things will get better eventually. So hopefully one day the UK might be a better place for trans people.

We have decided though that this is not a country we wish to live in anymore when we could be happier elsewhere. I suspect one of the things that has really changed is me and my awareness of how England feels rotten to the core and although the younger generations here give me hope it’s not somewhere I feel comfortable anymore.

On a lighter note we are currently exploring a couple of options with help from the people over at https://twitter.com/TransEmigrate, Ireland and Germany.

Germany

Germany was our original plan before the coronavirus hit the world. We had been trying to rush preperations so we could leave before we would need to get visa’s to move there (1st January 2021).

We know a little more about Germany as I’ve been posted there for work and we have been on holiday in the Berlin and Cologne area. There are lots that sound good about Germany and a few things that are a little scary for our situation and we need to research to see what the situation is especially when it comes to things like gender recognition as we have both changed our names and gender on our passports but not birth certificates.

Ireland

Ireland is something we hadn’t thought about till recently. They have self-ID so that is a massive plus for us as we could both change our legal gender easily. This is a massive plus for me as changing birth certificates is costly and bauracratic here. In the UK it may also not be possible for me to change without starting the process again (probably privately) as I believe the people who signed off my transition are no longer practicing. The only downside with Ireland will be living in a smaller country and we already find it difficult to live in rural Cambridgeshire.

Further information

I’m creating a page which will be updated as I discover more here

Adding a custom USB socket to the STM32 NUCLEO-F746

I’m currently building a design on the STM32F7 which I want to later port to a F4-NUCLEO board and eventually my own design so I want to test the USB host without the supplied electronics.

In order to do this I built a small USB breakout adapter and tried directly connecting this to 5V (for power) and PA11/PA12 (for USB).  The breakout was made by simply soldering some header pins to a USB socket.

I then attached the USB socket to CN12 as shown below.

The complete pinout for CN12 can be found here https://developer.mbed.org/platforms/ST-Nucleo-F746ZG/.

You will need to connect the pins on the usb connector as shown below:

  1. VBUS (+5v)
  2. PA11
  3. PA12
  4. GND

STM32 Nucleo boards and blackmagic probe.

I recently purchased a STM32F7 Nucleo boards to play around with Chibios.  These boards feature a integrated STlink debugger, I however do most of my development using a custom built debugger based on the blackmagic probe.  This has the advantage of being easily connectable to GDB via emulating gdbserver on it’s virtual serial port.

Unfortunately there doesn’t look like there is a documented way of connecting a 3rd party debugger to the Nucleo board but reading the schematics showed an answer in the form of the CN4 jumper block.

In order to connect a the black magic probe to the Nucleo board simply remove the jumpers from CN4 on the ST-Link .  You can then access the SWDIO pins on the main MCU as shown in the list below.

  1. SWCLK/TCK
  2. NO-CONNECT
  3. SWDO/TMS
  4. NO-CONNECT

You will also need to connect the ground pin of the blackmagic probe to a ground pin on the Nucleo board (I used one of the ground pins which have jumpers on them which are used for feet on the board.

And here is a picture of the board.

Passive POE Raspberry PI

I’be been using a Raspberry PI with a DVB-T2 card so we can stream TV to our PCs and tablets around the house.  As the PI sometimes crashes I’ve wanted to make it work with passive POE, I’ve also wanted to put it in a box.

So I’ve built a box which has a barrel connector for my POE adaptor cables.  The box also has a DC/DC converter to convert the 12V-24V I’m using in my server cabinet to the 5V required for the Raspberry PI.

As there wasn’t room in the box to have a lead going from the USB power socket on the PI i decided to feed power in via the expansion connector (i also didn’t have many spare USB cables).  Unfortunately this has the disadvantage of bypassing the poly fuse which protects the PI so I will probably add my own at a later date.

A view inside showing the DC/DC converter module.