my Gigatron RAM and IO expansion does not work

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
at67
Posts: 486
Joined: 14 May 2018, 08:29

Re: my Gigatron RAM and IO expansion does not work

Post by at67 »

gfernval wrote: 05 May 2022, 00:23 the visible difference is that the ROM version has an SDcard menu
instead having to press CTRL-F1 in pluggy reloaded no ROM version. Are there other differences?
That is the only difference, SDCARD.ROM contains the actual vCPU loading code and a menu entry to access it. Whereas the older ROM's have to bootstrap the vCPU loader through Pluggy's CTRL + F1 mechanism.
gfernval wrote: 05 May 2022, 00:23 - how to use the file https://github.com/kervinck/gigatron-ro ... endFile.py in a real Gigatron to transfer files between the
Gigatron and a PC? Using the pluggy reloaded board and connecting an USB cable to the Arduino Sparkfun Pro micro and the USB port of a PC?
(this creates a virtual serial port in the PC)
sendFile.py is really simple to use and works on any of the compatible Arduino solutions, (not just Pluggy Reloaded), here's Marcel's comments lifted straight out of sendFile.py

Code: Select all

# Examples:
#
#   Utils/sendFile.py Apps/Overworld/Overworld.gt1 # Reset and starts Loader
#   Utils/sendFile.py BASIC/FastLines.gtb          # Also loads BASIC
#   Utils/sendFile.py foo.bas                      # Only send text lines
#   Utils/sendFile.py < foo.txt                    # Same...
#
# Notes:
#
#  - Needs Python 3.x: Python 2.7 isn't supported any longer
#  - Systems: macOS, Linux and Windows
#  - Devices: Arduino Uno/Micro/Nano, SparkFun Pro Micro
#  - Arduino (-compatible) must run BabelFish.ino
Under the hood all it basically does is send the following string of one letter commands to BabelFish.
'R' = Sends the Reset command, BabelFish resets the Gigatron HW, (by simulating a start button press for ~2 seconds).
'L' = Sends the Loader command, BabelFish moves the cursor down 10 vertical menu positions and then presses button A, (all simulated presses).
'U' = Sends the Transfer command, BableFish now enters a state machine or protocol for receiving data from the PC and then massaging the data into the Gigatron's internal Loader format, (all through the same controller input port that the buttons were simulated on).

After each command, sendFile.py waits for either a '?' or '!' response, '?' means success and '!' means error.

Given the above you can easily write your own sendFile.py from any language that has COM/Serial port access, (which is what I did for gtemuAT67, it can also control and download to real gigatron hardware through it's UI). Here's the basics of how I do it: (I use a multi-OS 3rd party header API for COM access and SDL2 for timer/timeout support)

Code: Select all

    int uploadToGiga(void)
    {
        if(!checkComPort()) return -1;

        std::string line;
        if(!sendCommandToGiga('R', line, true)) return -1;
        if(!sendCommandToGiga('L', line, true)) return -1;
        if(!sendCommandToGiga('U', line, true)) return -1;

        int index = 0;
        while(std::isdigit((unsigned char)line[0]))
        {
            int n = strtol(line.c_str(), nullptr, 10);
            comWrite(_currentComPort, &_gt1Buffer[index], n);
            index += n;

            if(!waitForPromptGiga(line)) return -1;
        }

        return 0;
    }
    
    bool sendCommandToGiga(char cmd, std::string& line, bool wait)
    {
        if(!checkComPort()) return false;

        char command[2] = {cmd, '\n'};
        comWrite(_currentComPort, command, 2);

        // Wait for ready prompt
        if(wait)
        {
            if(!waitForPromptGiga(line)) return false;
        }

        return true;
    }
    
    bool waitForPromptGiga(std::string& line)
    {
        if(!checkComPort()) return false;

        do
        {
            if(!readLineGiga(line)) return false;

            if(size_t e = line.find('!') != std::string::npos) return false;
            }
        }
        while(line.find("?") == std::string::npos);

        return true;
    }
    
    bool readLineGiga(std::string& line)
    {
        if(!checkComPort()) return false;

        line.clear();
        char buffer = 0;
        uint64_t prevFrameCounter = SDL_GetPerformanceCounter();

        while(buffer != '\n')
        {
            if(comRead(_currentComPort, &buffer, 1))
            {
                if((buffer >= 32  &&  buffer <= 126)  ||  buffer == '\n') line.push_back(buffer);
            }
            double frameTime = double(SDL_GetPerformanceCounter() - prevFrameCounter) / double(SDL_GetPerformanceFrequency());
            if(frameTime > _configTimeOut) return false;
        }

        // Replace '\n'
        line.back() = 0;

        return true;
    }
lb3361 wrote: 05 May 2022, 01:50 I cannot tell you about sendFile.py. I simply do not remember. These days I always use a SD card...
SDCARD functionality is great, especially for standalone operations, but when I am writing code and need to test it on real HW, nothing beats the BabelFish direct link. One click and a few seconds later I can see it running, (or not), on a real Gigatron.
gfernval
Posts: 40
Joined: 24 Jan 2022, 00:39

Re: my Gigatron RAM and IO expansion does not work

Post by gfernval »

I have tried to format a 128Mb SDcard with guiformat.exe using FAT32 with 512 bytes/sector and does not work (will try later to format a 2GB SDcard with guiformat.exe utility using FAT32 and 512 bytes/sector), maybe 4GB SDcards works because are more faster than 2GB SDcards?

I´m searching for a .gt1 program that tests all the RAM (writing all RAM locations $00 and $FF) of a Gigatron board (32K, 64K, 128K,..) exists one?

Would like to build the circuit in https://gigatron.io/?page_id=574 (a simple arduino uno connected to Gigatron) to test the sendFile.py, but where is the .ino sketch that must be programmed into the Arduino Uno in order to get sendFile.py work? The link of the sketch (https://github.com/kervinck/gigatron-ro ... LoaderTest) shows 404 error
gfernval
Posts: 40
Joined: 24 Jan 2022, 00:39

Re: my Gigatron RAM and IO expansion does not work

Post by gfernval »

https://gigatron.io/?page_id=1234 shows "Instead of typing them in, GTB programs can also be loaded into the Gigatron through an Arduino-compatible microcontroller and the sendFile.py program (Python 2.7) on a laptop or PC. More on that in https://gigatron.io/?page_id=574 section of the website."
What I´m missing is the sketch needed to program Arduino Uno
bmwtcu
Posts: 122
Joined: 01 Nov 2018, 12:02

Re: my Gigatron RAM and IO expansion does not work

Post by bmwtcu »

Maybe I'm misunderstanding your question, but you should be able to program any Babelfish version that includes Arduino Uno Loader support (which I suspect means all versions). You need python 3.x though. Marcel had updated Babelfish but didn't get the chance to update that page. Pluggy Reloaded should also support this if you connect your PC directly to the USB port on the Pro Micro. One word of caution if you go that route... The Pro Micro USB connector is somewhat fragile. I've personally ripped the traces off the PCB on 2 units when I foolishly set it on the floor and then tripped on the USB cable. TWICE!
Last edited by bmwtcu on 05 May 2022, 09:45, edited 1 time in total.
at67
Posts: 486
Joined: 14 May 2018, 08:29

Re: my Gigatron RAM and IO expansion does not work

Post by at67 »

gfernval wrote: 05 May 2022, 09:09 What I´m missing is the sketch needed to program Arduino Uno
https://github.com/kervinck/gigatron-ro ... /BabelFish

As bmwtcu said, you need Python3 installed for this to function.
gfernval
Posts: 40
Joined: 24 Jan 2022, 00:39

Re: my Gigatron RAM and IO expansion does not work

Post by gfernval »

So I have to simply program an Arduino Uno with the babelfish.ino sketch after of course selecting Arduino Uno instead ATTiny85, right? This babelfish.ino is the same used in the pluggy mcplugface keuboard adapter for the Gigatron?
at67
Posts: 486
Joined: 14 May 2018, 08:29

Re: my Gigatron RAM and IO expansion does not work

Post by at67 »

Yes and Yes.

P.S. The ATtiny85 doesn't support the PC COM/USB interface, it only supports the controller and PS2 keyboard. You need to use one of the beefier Arduino's to get access to a PC.
lb3361
Posts: 188
Joined: 17 Feb 2021, 23:07

Re: my Gigatron RAM and IO expansion does not work

Post by lb3361 »

gfernval wrote: 05 May 2022, 08:53 I have tried to format a 128Mb SDcard with guiformat.exe using FAT32 with 512 bytes/sector and does not work (will try later to format a 2GB SDcard with guiformat.exe utility using FAT32 and 512 bytes/sector), maybe 4GB SDcards works because are more faster than 2GB SDcards?
If you send me the first 2M of the 2GB SD card, then I can debug. Under Linux you would do something like

Code: Select all

$ dd if=/dev/SDCARDDEVICE of=myfile bs=2M count=1
Under Windows, no idea...

gfernval wrote: 05 May 2022, 08:53 I´m searching for a .gt1 program that tests all the RAM (writing all RAM locations $00 and $FF) of a Gigatron board (32K, 64K, 128K,..) exists one?
Here is one that is almost what you want. The main problem is to not write over the program itself. This is why the attached program does not test bank0 (the first 32K) but tests all other banks. Compile with 'glcc -map=32k TSTmem.c'.
Attachments
TSTmem.gt1
(5.73 KiB) Downloaded 15 times
TSTmem.c
(2.53 KiB) Downloaded 13 times
Last edited by lb3361 on 05 May 2022, 15:42, edited 1 time in total.
gfernval
Posts: 40
Joined: 24 Jan 2022, 00:39

Re: my Gigatron RAM and IO expansion does not work

Post by gfernval »

1gbsdcard.zip
(995.76 KiB) Downloaded 13 times
In https://github.com/lb3361/gigatron-os/tree/master/sys1 mentions "You must use other tools" and there is a link to guiformat.exe, I have used such tool to format with FAT32 a 1GB SDcard with 512 bytes/sector. In the attached .zip file (password of the .zip file is 1234) is a complete dd (used dd for windows) dump of an empty 1GB SDcard and the utility I have used. Try to dd this file to a 4GB SDcard and see if it works (the 4GB SDcard will have 1GB of usable space after the dd) and then do a dd to a 2GB SDcard (don´t have at hand one 2GB SDcard, hence I used 1 1GB SDcard)
gfernval
Posts: 40
Joined: 24 Jan 2022, 00:39

Re: my Gigatron RAM and IO expansion does not work

Post by gfernval »

If you succeed in formatting a 2GB SDcard that works with Gigatron IO, send me an empty dd image of such 2GB SDcard. This image compressed with .zip will be under 2Mb in size, can be attached
Post Reply