Open source Atari ST/STE video switch for sale

List your Atari wares and wants here.
Post Reply
JoeFloyd
Posts: 28
Joined: Fri May 08, 2020 11:08 pm

Open source Atari ST/STE video switch for sale

Post by JoeFloyd »

The last I heard Exxos does not plan on producing any more UBESwitch semi-intelligent Atari ST/STE video port adapter.

I ordered the PCB and parts required to produce about 50 UBESwitch devices.

I currently have 5 up for sale on a popular auction site and will add more as I build and test them.

I have modified the firmware to fix errors and remove some features that don't seem to work quite as expected.

The main changes are:

* Enabled serial output on pins 2 and 3 (TTL) for debug and status
* Disabled a command mode only accessible upon power up.
* Disabled the pulse mode monitoring which was being used for software control over video mode. This feature appeared to have some problems related to spurious pulse detection
* Modified the behavior of the button to always change and save mode upon button press. This results in a machine reboot, but the video mode will be toggled after reboot and will be persistent afterwards.

If software control over video mode is really needed I can track down the control program and re-enable that feature. I will have to play around with the firmware to try to prevent spurious pulse events.

I suppose the main improvement over a standard video cable with switch is that the UBESwitch has trimmer pots which can be used to lower the RGB signal level and balance the color output. I found that some attenuation of the RGB signals significantly improved the video output.
User avatar
exxos
Site Admin
Site Admin
Posts: 23491
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: UBESwitch Mk6 for sale

Post by exxos »

JoeFloyd wrote: Tue Jan 05, 2021 12:19 am The last I heard Exxos does not plan on producing any more UBESwitch semi-intelligent Atari ST/STE video port adapter.
I have never made them. I buy them direct from Urban who designed the UBE adapter. I've not had the funds to buy them recently and @ube has been working on some other stuff for me as well meanwhile. So he hasn't had time to even build any more up yet.
https://www.exxosforum.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxosforum.co.uk/atari/store2/ - All my hardware mods for sale - Please help support by making a purchase.
viewtopic.php?f=17&t=1585 Have you done the Mandatory Fixes ?
Just because a lot of people agree on something, doesn't make it a fact. ~exxos ~
People should find solutions to problems, not find problems with solutions.
ube
Posts: 138
Joined: Mon Aug 21, 2017 11:34 am

Re: UBESwitch Mk6 for sale

Post by ube »

Cool. Even cooler would be if you’d share your fixes in the spirit of open source.

But if I understand things correctly you’ve:

Removed three lines of code in setup().
Defined DEBUG.
Removed the check for which mode is run. (I haven’t seen/heard about spurious pulse events, a bug report would have been nice. :) )

Correct? If so, why not just replace the push button with a rocker and use Oliviers design without an attiny since the main feature of it is removed.
master of the bare pcb
czietz
Posts: 548
Joined: Sun Jan 14, 2018 1:02 pm

Re: UBESwitch Mk6 for sale

Post by czietz »

JoeFloyd wrote: Tue Jan 05, 2021 12:19 am I ordered the PCB and parts required to produce about 50 UBESwitch devices.
I currently have 5 up for sale on a popular auction site and will add more as I build and test them.
I have modified the firmware to fix errors and remove some features that don't seem to work quite as expected.
Isn't this a violation of the license, though? "However, the name ubeswitch can not be used if the design is altered from checked in versions on GitHub without the explicit permission from the author (Urban Jonsson/Planeturban/ube)."
https://github.com/planeturban/ubeswitc ... er/LICENSE
(Also check the requirements for commercial use of the design.)
ube
Posts: 138
Joined: Mon Aug 21, 2017 11:34 am

Re: UBESwitch Mk6 for sale

Post by ube »

That’s up for discussion, what ‘design’ actually is.

I can’t remember if I had firmware in mind when writing the license. One could argue that it is since it doesn’t explicitly mentions the physical design.

But then again one could argue that the software isn’t a part since the end user could add whatever themselves. However I remember a case in Sweden (where I’m from) where the warranty didn’t cover a laptop being bricked after installing Linux, even though the laptop was x86 compatible. This according to the Swedish consumer agency.

@JoeFloyd you are paying the commercial license right? And can produce receipts for this?

Edit: found the listing. Yes. It is a violation of the license without a doubt. @JoeFloyd please remove the listing from ebay and remove “ubeswitch” from the PCB.
master of the bare pcb
JoeFloyd
Posts: 28
Joined: Fri May 08, 2020 11:08 pm

Re: UBESwitch Mk6 for sale

Post by JoeFloyd »

Hi,

I'll create a branch of the github project and check in the code changes. There was a bit of confusion on my part with respect to GitHub. There are two related projects:

https://github.com/planeturban/ubeswitch

and

https://github.com/planeturban/ubeswitchmk6 (No license in this project tree, which I just noticed)

I based my work off of the Mk6 project tree since I assumed that it is the most up to date.

In truth I can't say that I was aware of the commercial license terms, but my intention isn't to infringe on Ube's rights under the license terms. I'll update the terms of sale to include a donation of ~2 euro to a charity of your choice.

The listing for the device is:

https://www.ebay.com/itm/Open-Source-In ... 3835086994

Ebay won't allow an automatic donation of exactly 2 euro if the sale is conducted in US dollars and the donation amount is specified in percentage of sales price. If the choice of charity is up to me I would likely split the donation amount between the EFF (Electronic Frontier Foundation) and Saint Jude Children's Research Hospital. Both are US based charities that are highly regarded.

The background for this project is that I wanted to buy the UBESwitch, but the only place I could find the adapter for sale is Exxos and atarisales.co.uk. Exxos out of stock and the atarisales.co.uk price was too high for my liking so seeing that the design was available on GitHub I ordered the PCB and parts. Economies of scale kick in with parts quantities and shipping costs so I scaled the order up so that if the project is worth the effort I can share the result with a limited number of people. Selling 20 or so switches for ~$32 US (that includes US shipping) generates a little extra cash that I intended to use to offset the expense of the project. This is pretty much a hobby and learning opportunity, not a commercial project.

Using the name UBESwitch is intended as a part of Open Source credit attribution, but I can remove the use of the UBESwitch from the listing since I did change the firmware source since the version that I found in GitHub appeared to be a WIP and didn't work with the Board library I'm using in the Arduino IDE.

Code: Select all


/*
   Compiled with MicroCore: 980 bytes. (Not working..)
   Compiled for Attiny85: 956 bytes.
                          5244 bytes with debug.
How to read this code:
1. Don't. It's ugly.
2. When "pin" is referred in code (or text) it's the Atari side of things. The ATtiny's pins are always referred to as PBX. 

*/

#define LEGACY // Uncomment this if your device does not have a ISP header.
//#define ALT_DETECT

#define DEBUG

// Timings.
#define switchTime 250000
#define saveTime 2000000
#define bootWait 4000 // Wait for computer to stabilize, 3-4s seems ok.
#define pulseThreshold 50000
#define SELECT_PORT PORTB
//#define SELECT_PORT DDRB

#define SAVE_LOCATION 0x1830  //6192

#include <util/delay.h>
#include <EEPROM.h>

#ifdef LEGACY
#define buttonPin PB0       // Connected to switch
#define selectPin PB1     // TS5V330 pin 1
#define pulsePin PB2       // VSync
#define serialRX PB3
#define serialTX PB4
#else
#defien serialRX PB0
#define serialTX PB1
#define pulsePin PB2       // VSync
#define selectPin PB3     // TS5V330 pin 1
#define buttonPin PB4       // Connected to switch
#endif

// Now that the pins are set, undefine LEGACY so that the ifdef's around the DEBUG statements are happy
#undef LEGACY

#if defined(DEBUG) 
#include <SoftwareSerial.h>
SoftwareSerial mySerial(serialRX, serialTX); // RX, TX
#endif

unsigned long buttonPressedTime;

byte state;
byte state_changed = 0;
byte tosState;

#ifdef DEBUG
bool done = false;
String buff;
char data;
int i = 0;
#endif

unsigned long pulse = 0;

void setup() {
// IDEA: check if a jumper is placed on the ISP header to enter some kind of other operations mode. 

  // Set state to an invalid value to make sure the read from flash works
  state = 3;

  // Do the hardware setup for the Atari before setting up the serial port.
  state = EEPROM.read(SAVE_LOCATION);
  PORTB |= bit(buttonPin); // Input pullup.
  // Instead of sending +5V to the Atari, let the pullup on pin4 handle the high part.
  bitWrite(SELECT_PORT, selectPin, state);  
  
#if defined (DEBUG) && !defined(LEGACY)
  mySerial.begin(9600);
  mySerial.println("Boot");
#endif

#if defined (DEBUG) && !defined(LEGACY)
  mySerial.print("Reading state from flash: Saved state ");
  mySerial.println(state);
#endif
  
// Instead of sending +5V to the Atari, let the pullup on pin4 handle the high part.
  bitWrite(DDRB, selectPin, state); 

#if defined (DEBUG) && !defined(LEGACY)
  mySerial.print("Waiting for ");
  mySerial.print(bootWait);
  mySerial.println(" milliseconds.");
#endif
  _delay_ms(bootWait);
  state_changed = 0;

#if defined (DEBUG) && !defined(LEGACY)
  mySerial.println("Loop.");
#endif
}




#ifdef DEBUG
void clearBuff() {
  buff = "";
  i = 0;
  mySerial.print("> ");
}



void printHelp() {
  mySerial.println("Help");
  mySerial.println("-----------");
  mySerial.println("b       - Simulate button press.");
  mySerial.println("p       - Print information.");
  mySerial.println("q       - Quit prompt.");
  mySerial.println("s <num> - Set pulse threashold.");

}
#endif

void toggle_state(void)
{
  if (state == 0)
  {
    state = 1;
  }
  else
  {
    state = 0;
  }
  state_changed = 1;
}

void loop() {

  byte save_now = 0;
  /*
     Detection..
  */
  pulse = 0;
#ifdef ALT_DETECT
  while ( pulse < 10000 ) // 10000 since sometimes you'd get 14 from getPulse();
    pulse = getPulse();
#else

// disable the pulse detection.
#ifdef foo

  // Check for pulsePin going high.  This is to allow for Atari ST program control over the video mode
  while ( ! pulse )
    pulse = pulseIn(pulsePin, HIGH, 1000000L);
#endif

  if ( 0 != pulse )
  { 
    if (pulse < pulseThreshold)
    {
       //mySerial.println("Pulse detected, but below pulse threshold");
       //mySerial.print("Pulse: ");
       //mySerial.println(pulse);
    }
    else
    {
#if defined (DEBUG) && !defined(LEGACY)
      mySerial.println("Pulse detected, and above pulse threshold");
      mySerial.print("Pulse: ");
      mySerial.println(pulse);
#endif
      save_now = 1;
      toggle_state();
    }

  }

  #endif

  // Check for button press.  This is to allow for manual user control over the video mode
  // Short press (> 0.25s and < 2.0s) change mode
  // Long press (>= 2.0s) save mode

  if ( !bitRead(PINB, buttonPin) ) 
  {
    buttonPressedTime = micros();
    while ( ! bitRead(PINB, buttonPin)); // Ugly debounce
    if ( micros() > saveTime  + buttonPressedTime ) 
    {
#if defined (DEBUG) && !defined(LEGACY)
      mySerial.println("Long Button Press");
#endif
      save_now = 1;
    } 
    else if ( micros() > buttonPressedTime + switchTime ) 
    {
#if defined (DEBUG) && !defined(LEGACY)
      mySerial.println("Short Button Press");
#endif
    // Toggle the state
    save_now = 1;
    toggle_state();
    }
  }

  // Check to see if the state should be saved due to a long button press
  if ( 1 == save_now )
  {
 #if defined (DEBUG) && !defined(LEGACY)
      mySerial.println("Save");
      mySerial.print("Value: ");
      mySerial.println(state);
#endif
      save_now = 0;
      EEPROM.write(SAVE_LOCATION, state);
  }

  // If the state has changed, update the state of the selectPin
  if ( 1 == state_changed ) 
  {
#if defined (DEBUG) && !defined(LEGACY)
    //mySerial.println("State change");
    //mySerial.print("New state: ");
    //mySerial.println(state);
#endif
    bitWrite(SELECT_PORT, selectPin, state);
    // Reset the state_changed flag.
    state_changed = 0;
    _delay_ms(1000); // Wait for computer to change video modes
  }
   
}

unsigned long getPulse() {
  pulse = bitRead(PINB, pulsePin);
  while ( bitRead(PINB, pulsePin) == pulse);
  unsigned long pstart = micros();
  while ( bitRead(PINB, pulsePin) != pulse);
  return ( micros() - pstart);
}

This code is also a work in progress.

The use of DDRB when doing the bitWrite() failed to enable 5V output on the select pin, so I changed that to PORTB. That was the major operational defect I noticed. Enabling debug output on the MK6 LEAGACY board type was an attempt to figure out why the switch wasn't working. The debug output looked like things were working, but the select pin was not behaving as expected.

As a secondary issue I noticed the pulse detect logic seeing lots of spurious pulse events. I tried using a pulldown resistor on this line and that did suppress most of the spurious pulses, but for some reason that broke the button detection. I need to read the ATTINY85 documentation to figure out what is going on with internal pullups / pulldowns.
JoeFloyd
Posts: 28
Joined: Fri May 08, 2020 11:08 pm

Re: Open source Atari ST/STE video switch for sale

Post by JoeFloyd »

10 switches have been sold and I'm going to make donations to St. Jude Children's Hospital and the Electronic Frontier Foundation. I'm gong to make the charitable donation today in compliance with the License terms.

20 Euro is about $25, but I'll double the donation amount in thanks to Ube for making the project open source.

I'll post a merge request to the MK6 project with details of the donation.
JoeFloyd
Posts: 28
Joined: Fri May 08, 2020 11:08 pm

Re: Open source Atari ST/STE video switch for sale

Post by JoeFloyd »

Another $25 donation is being made in compliance with License terms. Similar to last time, I'll double the donation to $50 and split the donation between St. Jude Children's Hospital and the Electronic Frontier Foundation.

Pull request has been updated on ghihub.
Post Reply

Return to “ATARI FOR SALE & WANTED”