General Stuff(tm)

Blogs & guides and tales of woo by forum members.
User avatar
stephen_usher
Site sponsor
Site sponsor
Posts: 7376
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

Re: General Stuff(tm)

Post by stephen_usher »

Lots of USB-C phone chargers are > 15W, so that's not a major issue.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Site sponsor
Site sponsor
Posts: 7376
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

Re: General Stuff(tm)

Post by stephen_usher »

And... another bodge... Pull-ups on the SD card data, clock and chip select lines:

IMG_2881.jpeg

The Raspberry Pi 400 has arrived and I picked up a power supply and cable this morning from Curry's. Only problem, I don't have a microHDMI cable. I thought it was the same as the Nano's HDMI port, but that's only a miniHDMI. Darn!

The wonderful thing about standards is that there are so many to choose from.
You do not have the required permissions to view the files attached to this post.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Site sponsor
Site sponsor
Posts: 7376
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

Re: General Stuff(tm)

Post by stephen_usher »

After checking the Argos web site I saw that they had a 3m microHDMI-HDMI cable at a store about 15 miles away so drove over there, through traffic jams.

I got to the touch screen terminal, found the item "Available to collect now" it said. I then touched on the item's image and the item came onto the screen. "Not available". I go back to the first screen and it's still available, back to the item and yes it's unavailable. So, it's obviously a Schroedinger's cable, both in stock and out of stock at the same time. *sigh*

So, back home I go and the RPi400 and my Pico coding will have to wait.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Site sponsor
Site sponsor
Posts: 7376
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

Re: General Stuff(tm)

Post by stephen_usher »

Finally got a usable development system set up on the Pi 400 last night so at last I can start writing the C version of the code for the Pico. I'm going to have to try to get my head around CMake configuration files. Blurgh!
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Site sponsor
Site sponsor
Posts: 7376
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

Re: General Stuff(tm)

Post by stephen_usher »

Completely shattered tonight so just wrote the buffer operations code and stubs for the GPIO operations. I'll have to learn how to set up the GPIO stuff when I have more than one brain cell operating. Definitely going to have to have an early night.

I've decided to write this code in a very non-embedded programming sort of way, at least to begin with, abstracting functionality into function calls which adds to latency. However, it does mean that I can modify things underneath more easily, such as possibly using programmed I/O for reading the bus etc. as optimisations in future without any of the main code logic noticing.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Site sponsor
Site sponsor
Posts: 7376
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

Re: General Stuff(tm)

Post by stephen_usher »

GPIO functions written tonight. Less painful than I thought. Having said that counting out the GPIO pin masks for the bulk setting of pins is so error prone that I've probably messed it up.

Here's my header file, maybe someone else can sanity check it (the masks are bit masks for GPIO 0-29):

Code: Select all

#define PIN_D0 0
#define PIN_D1 1
#define PIN_D2 2
#define PIN_D3 3
#define PIN_D4 4
#define PIN_D5 5
#define PIN_D6 6
#define PIN_D7 7

#define PIN_SELECTED 14
#define PIN_READ_WRITE 15

#define PIN_A1 18
#define PIN_A2 19
#define PIN_A3 20
#define PIN_A4 21
#define PIN_A8 22

#define PIN_IOWAIT 28
#define PIN_INT2 27

#define BUS_GPIO_MASK   0b0000000000000000000000011111111
#define CTRL_GPIO_MASK  0b0000000000000000110000000000000
#define ADDR_GPIO_MASK  0b0000000001111100000000000000000
#define OUT_GPIO_MASK   0b0001100000000000000000000000000
The bulk setting etc. is quite elegant though, e.g.

Code: Select all

#include <stdio.h>

#include "pico/stdlib.h"
#include "hardware/gpio.h"

#include "apricot-hd.h"
#include "pin_defs.h"

void init_bus()
{
        gpio_init_mask(BUS_GPIO_MASK + CTRL_GPIO_MASK + ADDR_GPIO_MASK + OUT_GPIO_MASK);
        gpio_set_dir_in_masked(BUS_GPIO_MASK + CTRL_GPIO_MASK + ADDR_GPIO_MASK);
        gpio_set_dir_masked(OUT_GPIO_MASK, OUT_GPIO_MASK);
}
So, this initialises the pins in each of the masks, sets the inward (read) direction for most of the pin and then sets the last two to being output.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Site sponsor
Site sponsor
Posts: 7376
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

Re: General Stuff(tm)

Post by stephen_usher »

Well, I think that I have the skeleton of the code finished. It just needs all the functions which do things to be more than empty '{}'. :lol:

I think the first priority will be the latch setting/reading and the buffer read/write. Once that is done I should be able to test and see if the F1 thinks that it has a drive interface attached.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Site sponsor
Site sponsor
Posts: 7376
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

Re: General Stuff(tm)

Post by stephen_usher »

OK, first test of my code on the hardware and... USB tty (for debugging) doesn't initialise.

After much faffing disabling my code I discover that I need to give it a 5 second wait after calling init_stdio_all() before running the rest of my code. Nothing in the documentation about that.

Anyway, I now know that the Pico can access the SD card, mount the drive and open the hard drive image.

Next will be adding loads of debugging printf() statements wrapped in #ifdef APRIDEBUG preprocessor directives. I can then test it in the machine to see if it sees the bus.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Site sponsor
Site sponsor
Posts: 7376
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

Re: General Stuff(tm)

Post by stephen_usher »

Oh dear. The bus reading isn't working properly, so I think the GPIO stuff is messed up. I thought that the masked stuff was being too ambitious, so I'll have to rewrite using discrete calls.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Site sponsor
Site sponsor
Posts: 7376
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

Re: General Stuff(tm)

Post by stephen_usher »

Oh my goodness, I'm going down GPIO rabbit holes now.

I know the hardware works as the micropython does all the right things but I'm having problems consistently reading from and writing to the GPIO pins and hence bus.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.

Return to “MEMBER BLOGS”

Who is online

Users browsing this forum: ClaudeBot, Google [Bot], semrush [bot] and 10 guests