Problems with Babelfish (Arduino Nano?)

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice.
Post Reply
john.cook
Posts: 1
Joined: 26 Sep 2019, 21:12

Problems with Babelfish (Arduino Nano?)

Post by john.cook » 27 Sep 2019, 10:19

I'm trying to use Babelfish to send programs, but I'm having problems. :(

When I use the serial monitor and send the 'Z' (Button [A]) command, it doesn't work. Neither does sending the 'L' command (it moves down but doesn't select).

I've added a call to `doLoader()` into the `setup()` function and that starts the loader, but then sending the program doesn't work – the bar flashes showing that data is received but the code doesn't run (including blinky).

`sendFile.py` has a similar result. The Gigatron is reset, the loader starts, code is sent, but it doesn't run.

I'm using the most recent code from github and a V4 ROM.
I've tried both a Nano and a Mega 2560 (using the Uno configuration) and both have do the same thing.

Another issue is that the controller passthrough doesn't work (using the Nano). Push any button has no effect on the Gigatron.

I'm thinking that the bit stream is getting out of sync but I don't know how to test this (I don't have a signal analyser).

Any help would be appreciated.

John

UPDATE
Pluggy McPlugface works fine (even with my shoddy wiring). All the keystrokes are passed through fine and Ctl-F2 loads BASIC.

User avatar
marcelk
Posts: 349
Joined: 13 May 2018, 08:26

Re: Problems with Babelfish

Post by marcelk » 27 Sep 2019, 18:12

john.cook wrote: `sendFile.py` has a similar result. The Gigatron is reset, the loader starts, code is sent, but it doesn't run.
That's mysterious indeed. It smells like a timing issue with the Arduino, but it's weird that most stuff works ok. Let's start with the GT1 transfer: Could you test sending Utils/SerialTest.gt1 with sendFile.py and see what happens? Possibly film it. It's a test stream that draws the numbers 000..255 to the screen.

For completeness: There's one known minor bug that crept into Loader of ROMv4 (see GitHub issue #100): That causes some VGA monitors to black out for a few seconds after loading a program. The Gigaton is even unaware of this and still runs fine. What you describe is very different.

User avatar
marcelk
Posts: 349
Joined: 13 May 2018, 08:26

Re: Problems with Babelfish

Post by marcelk » 28 Sep 2019, 14:04

The microcontrollers I've personally ever tested BabelFish on:
  • Arduino Uno
  • Arduino Micro
  • ATTiny85
I have also tested with an Arduino Nano clone, and that never worked for me. I forgot the details, but there is some problem with clones that have the wrong USB chip.

The symptoms you describe point towards a timing issue. Some background: Bits are transferred with the horizontal sync pulse, and the vertical sync pulse provides synchronisation. At the beginning of the vertical sync pulse, the microcontroller must respond very quickly in order to catch the immediately following horizontal sync pulse (the first bit). To achieve this, BabelFish disables interrupts and momentarily halts the PS/2 keyboard (so it doesn't miss anything from there). Then it performs a busy wait on the Gigatron signals. In case of the ATtiny85, it must be fused to run at 8 MHz, otherwise its busy loop is too slow.

From sendFirstByte we see how tight this timing is:

Code: Select all

  // Wait for bit transfer at horizontal sync RISING edge. As this is at
  // the end of a short (3.8 us) pulse following VERY shortly (0.64us) after
  // vSync drop, this timing is tight. That is the reason that interrupts
  // must be disabled on the microcontroller (and why 1 MHz isn't enough).
If it misses the first bit in a frame, data gets clocked out of sync, checksums fail and nothing really loads. A correct frame with correct checksum appears as a green dot in Loader's "scanning" bar. Still it surprises me that you see stuff load. The only thing I can imagine is that sometimes the timing is ok, and sometimes it's off. If this theory is correct, I suspect that while loading the Utils/SerialTest.gt1 file, you don't see all the numbers count smoothly.

User avatar
marcelk
Posts: 349
Joined: 13 May 2018, 08:26

Re: Problems with Babelfish

Post by marcelk » Today, 18:39

Fyi, one VCFB visitor told me that:
  • His Arduino Nano worked fine when he was still on ROMv3, but
  • The Nano stopped working somewhere between ROMv3 and ROMv4 (he was following dev roms)
  • While his Arduino Uno is still operating fine
I don't know what to make of that yet. I suspect either a timing thingy in Babelfish (and therefore unrelated to the ROM edition), or a change in the Arduino libs? I didn't ask if it worked again if he switched back to ROMv3. It's hard to test without the hardware.

Post Reply