ICE T65/Z80/6809

emulators, hardware and classic software for atom + system machines
User avatar
hoglet
Posts: 9297
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: ICE T65/Z80/6809

Post by hoglet » Fri Jan 31, 2020 8:21 pm

bprosman wrote:
Fri Jan 31, 2020 4:08 pm
The 6502 , if it is already there I might have overlooked it, I was looking in the Wiki and/or "Help".
I've updated the wiki to reflect the commands available in the latest firmware:

- Command Reference

Glad it's working for you.

bprosman
Posts: 432
Joined: Sun Mar 29, 2015 11:27 pm
Contact:

Re: ICE T65/Z80/6809

Post by bprosman » Sat Feb 01, 2020 10:11 am

Good morning Dave,

Last night I was playing with the AVR code and tried adding some "debug" code.
This unfortunately does not work (it breaks the SREC function).
My guess is that handling the serial output takes too much time corrupting the incoming stream is that correct ?
How do you debug this kind of code ? Or is yours always working immediately ? :-)

This was what I added :

Code: Select all

    // Process S1 record
    crc = 1;
    count = getHex() - 3;

//Added	
   logstr("Reading number of bytes -> ");
    loghex2(count);
    logc('\n');[/i]

    addr = (getHex() << 8) + getHex();
  
 //Added   
    logstr("Reading load address -> ");
    loghex4(addr);
    logc('\n');

User avatar
hoglet
Posts: 9297
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: ICE T65/Z80/6809

Post by hoglet » Sat Feb 01, 2020 11:58 am

bprosman wrote:
Sat Feb 01, 2020 10:11 am
Last night I was playing with the AVR code and tried adding some "debug" code.
This unfortunately does not work (it breaks the SREC function).
My guess is that handling the serial output takes too much time corrupting the incoming stream is that correct ?
How do you debug this kind of code ? Or is yours always working immediately ? :-)
There isn't an easy answer to how to debug this. The serial receive code is actually quite time sensitve, because the serial port is not interrupt driven. As you have found out, if you add any debugging output things will break horribly.

I would typically try three things in this case:

1. Check the code very carefully for mistakes.

2. If the error looks like data corruption, try reducing the baud rate. This may not be trivial to do.

3. Build a small test harness that will allow you to compile/run the code natively on Linux. This would need to include implementions of loadData, loadAddr and writeMemByteInc. These could just write to a 64KB byte array that is then dumped at the end.

If you post your code, I can take a look if you like.

Dave
Last edited by hoglet on Sat Feb 01, 2020 12:44 pm, edited 1 time in total.

bprosman
Posts: 432
Joined: Sun Mar 29, 2015 11:27 pm
Contact:

Re: ICE T65/Z80/6809

Post by bprosman » Sat Feb 01, 2020 12:32 pm

Hi Dave,

As English is not my 1st language : "This may not be trivial to do." , does that mean difficult or easy ? :-)
Isn't that a matter of changing the UART speed ?

The Array route was something I was thinking about, dump everything in an array and spit that out once the file is read.

Kind regards, Bram

User avatar
hoglet
Posts: 9297
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: ICE T65/Z80/6809

Post by hoglet » Sat Feb 01, 2020 12:43 pm

bprosman wrote:
Sat Feb 01, 2020 12:32 pm
As English is not my 1st language : "This may not be trivial to do." , does that mean difficult or easy ? :-)
Isn't that a matter of changing the UART speed ?
I did mean difficult, but I was wrong, it actually is easy!

All you need to do is to change BAUD in the project Makefile:

Code: Select all

# Default Baud Rate of serial interface
# Note: F_CPU / 16 / BAUD need to be close to an integer
BAUD       = 9600
Then do "make clean build" to recompile the firmware.

I just tested this at 9600 and it works.

Dave

bprosman
Posts: 432
Joined: Sun Mar 29, 2015 11:27 pm
Contact:

Re: ICE T65/Z80/6809

Post by bprosman » Sun Feb 02, 2020 12:00 am

9600 Baud as such does work but doesn't fix my timing issue.
Would reintroducing the LCD be an option or does that generate the same problem ?

User avatar
hoglet
Posts: 9297
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: ICE T65/Z80/6809

Post by hoglet » Sun Feb 02, 2020 8:32 am

bprosman wrote:
Sun Feb 02, 2020 12:00 am
9600 Baud as such does work but doesn't fix my timing issue.
What makes you think you have a timing issue then?

You haven't really explained whats "not working" or posted your current code, so it's hard to be of more help.
bprosman wrote:
Sun Feb 02, 2020 12:00 am
Would reintroducing the LCD be an option or does that generate the same problem ?
It will also slow things down slightly.

Dave

bprosman
Posts: 432
Joined: Sun Mar 29, 2015 11:27 pm
Contact:

Re: ICE T65/Z80/6809

Post by bprosman » Sun Feb 02, 2020 10:20 am

You haven't really explained whats "not working" or posted your current code, so it's hard to be of more help.
You are fully right :-) But also a bit of my nature :oops: :oops:

This is what I did in your SREC routine :

(I added the logstr bits), that makes it loose reading the file correctly..

Code: Select all

    // Process S1 record
    crc = 1;
    count = getHex() - 3;

    logstr("Reading number of bytes -> ");
    loghex2(count);
    logc('\n');

    addr = (getHex() << 8) + getHex();
    
    logstr("Reading load address -> ");
    loghex4(addr);
    logc('\n');

    while (count-- > 0) {
      data = getHex();
      if (addr < addrlo) {
        addrlo = addr;
      }
      if (addr > addrhi) {
        addrhi = addr;
      }
      loadData(data);
      loadAddr(addr++);
      writeMemByteInc();
      total++;
    }

This is my IHEX bit :
It reads/recognizes the ":" starter mark.
This is my code ... when i try to catch the number of bytes, as well as the address (i tried to split it later in 2 bytes), it seems to take so much time its looses the rest of the file.

Code: Select all

 while (1) {

    while (c != ':') {

      // Wait for a character to be received, while testing for a timeout
      timeout = 65535;
      while (timeout > 0 && !Serial_ByteRecieved0()) {
        timeout--;
      }

      // If we have timed out, then exit
      if (timeout == 0) {
        logstr("received ");
        logint(good_rec);
        logstr(" good records, ");
        logint(bad_rec);
        logstr(" bad records\n");
        logstr("transferred 0x");
        loghex4(total);
        logstr(" bytes to 0x");
        loghex4(addrlo);
        logstr(" - 0x");
        loghex4(addrhi);
        logc('\n');
        return;
      }

      // Read the next character
      c = Serial_RxByte0();
    }

    //logstr("Received start character -> :\n");
    
    // Read the S record type
    // In case of SREC this character should be a "1", in case of
    // Intel HEX the next 2 characters are the byte counter.
    //c = Serial_RxByte0();

    // Skip to the next line
    //if (c != '1') {
    //  logstr("skipping S");
    //  logc(c);
    //  logc('\n');
    //  continue;
    //}

    // Process Intel HEX record
    crc = 1;
    //count = getHex() - 3;
    // Phase 1, read the byte counter
    count = getHex();
    logstr("Reading number of bytes -> ");
    loghex2(count);
    logc('\n');

    // Skip to the next line
    if (count == 0) {
      logstr("Skipping line");
    //  logc(c);
      logc('\n');
      continue;
    }   


    // Phase 2, read the byte address
    addrhinibble = getHex();
    addrlownibble = getHex();

    logstr("Reading load address HI -> ");
    loghex2(addrhinibble);
    logc('\n');
    logstr("Reading load address LO -> ");
    loghex2(addrlownibble);
    logc('\n');
    
    //addr = (getHex() << 8) + getHex();
    addr = (addrhinibble << 8) + addrlownibble;

    logstr("Reading load address -> ");
    loghex4(addr);
    logc('\n');

    while (count-- > 0)
        {
        data = getHex();

        logstr("Data byte # ");
        logint(count);
        logstr(" = ");
        loghex2(data);
        logstr("\n");
        
        if (addr < addrlo)
            {
            addrlo = addr;
            }
        if (addr > addrhi)
            {
            addrhi = addr;
            }
        loadData(data);
        loadAddr(addr++);
        writeMemByteInc();
        total++;
        }
        
    // Read the crc byte
    getHex();

    // Read the terminator byte
    c = Serial_RxByte0();

    if (crc)
        {
        logstr("Bad record\n");
        bad_rec++;
        } 
    else
        {
        logstr("Bad record\n");
        good_rec++;
        }
  }
}
This is a screenshot and the data read (printed) doesnt make sense at all.
ihex_0001.JPG
HEX file + SREC file
Junior_Computer_Display.zip
(486 Bytes) Downloaded 15 times

User avatar
hoglet
Posts: 9297
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: ICE T65/Z80/6809

Post by hoglet » Sun Feb 02, 2020 11:12 am

Hi Bram,
bprosman wrote:
Sun Feb 02, 2020 10:20 am
This is a screenshot and the data read (printed) doesnt make sense at all.
I would suggest getting rid of all the additional debugging code, it's just going to introduce errors and make it hard to understand what's going on. The best way to debug is to fill memory with AA bytes, then run the ihex command. If it hangs, just reset the AVR (the button near the USB connector). Then you can inspect memory.

I've just reviewed the Intel Hex format spec here:
https://en.wikipedia.org/wiki/Intel_HEX ... _structure

I've spotted two issues with the current code:
1. The record type field is not being read, so everything is then off by one.
2. The crc should be initialized with 0 not 1.

I think if you fix these, you'll get a lot further.

Dave

JannievanZyl
Posts: 218
Joined: Sat Feb 11, 2017 8:56 pm
Location: Cape Town, South Africa
Contact:

Re: ICE T65/Z80/6809

Post by JannievanZyl » Sun Feb 09, 2020 4:04 pm

bprosman wrote:
Sun Feb 02, 2020 10:20 am
Junior_Computer_Display.zip
/Slightly off-topic :)

My eye just caught the "Junior Computer" bit. In any way related to the Elektor project?

bprosman
Posts: 432
Joined: Sun Mar 29, 2015 11:27 pm
Contact:

Re: ICE T65/Z80/6809

Post by bprosman » Sun Feb 09, 2020 4:13 pm

Yes , this is the "Junior Computer Revival" project I started a few years ago.
It's running now. Today I will finalize an alternative keyboard (with cheap switches) as the PCB is designed for the original (expensive) "Digitasten".
With the exception of 2 small design flaws (1 PCB trace error) it is fully working.

After the weekend I will publish a full update.

bprosman
Posts: 432
Joined: Sun Mar 29, 2015 11:27 pm
Contact:

Re: ICE T65/Z80/6809

Post by bprosman » Sun Feb 16, 2020 10:47 am

Hi Dave,

I'm almost there :-)
The IHEX file is being read, and correctly processed.
The only thing is that after the last record (:00000001FF) , the program does say it skips the record (as the byte count is 0) but the timeout does not occur making the routine to return.

My current code :

Code: Select all

//---------------------------------------------------------------------------------------------------------------------------------
// Simple IHex command
//
// Deals with the following format:
//    :10010000214601360121470136007EFE09D2190140
//    :<Count><Addr><Rectype><Data>...<Data><CRC>
//
//---------------------------------------------------------------------------------------------------------------------------------

void doCmdIHex(char *params) {
  
  char c;
  uint8_t count;
  data_t data;
  data_t rectype;
  addr_t good_rec = 0;
  addr_t bad_rec = 0;
  addr_t addr;
  addr_t total = 0;
  uint16_t timeout;

  addr_t addrlo = 0xFFFF;
  addr_t addrhi = 0x0000;

  log_send_file();

  // Special case reading the first record, with no timeout allowing the user to 
  // send the file.
  // In case of an Intel HEX record it is the ":" character

  c = Serial_RxByte0();

  while (1) {

    while (c != ':') {

      // Wait for a character to be received, while testing for a timeout
      timeout = 65535;
      while (timeout > 0 && !Serial_ByteRecieved0()) {
        timeout--;
      }

      // If we have timed out, then exit
      if (timeout == 0) {
        logstr("received ");
        logint(good_rec);
        logstr(" good records, ");
        logint(bad_rec);
        logstr(" bad records\n");
        logstr("transferred 0x");
        loghex4(total);
        logstr(" bytes to 0x");
        loghex4(addrlo);
        logstr(" - 0x");
        loghex4(addrhi);
        logc('\n');
        return;
      }

      // Read the next character
      c = Serial_RxByte0();
    }

    // Record start character (:) received
    // Process Intel HEX record
    
    // Initialize CRC
    crc = 0;
    // Get the number of bytes in this record
    count = getHex();

    // Skip to the next line if the record contains no data bytes
    if (count == 0) {
      logstr("Skipping line\n");
      continue;
    }   

    // Phase 2, read the byte address
    addr = (getHex() << 8) + getHex(); 

    // Get the record type 
    rectype = getHex();
    
    // Process the data bytes
    while (count-- > 0)
        {
        data = getHex();

        if (addr < addrlo)
            {
            addrlo = addr;
            }
        if (addr > addrhi)
            {
            addrhi = addr;
            }
        loadData(data);
        loadAddr(addr++);
        writeMemByteInc();
        total++;
        }
        
    // Read the crc byte
    getHex();

    // Read the terminator byte (CR/LF)
    c = Serial_RxByte0();

    if (crc)
        {
        bad_rec++;
        } 
    else
        {
        good_rec++;
        }
  }
}

User avatar
hoglet
Posts: 9297
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: ICE T65/Z80/6809

Post by hoglet » Sun Feb 16, 2020 4:26 pm

bprosman wrote:
Sun Feb 16, 2020 10:47 am
The only thing is that after the last record (:00000001FF) , the program does say it skips the record (as the byte count is 0) but the timeout does not occur making the routine to return.
Just a guess, but try commenting out the following line:
logstr("Skipping line\n");
Dave

Prime
Posts: 2866
Joined: Mon Jun 01, 2009 12:52 am
Contact:

Re: ICE T65/Z80/6809

Post by Prime » Sun Feb 16, 2020 5:56 pm

Hi all,

I'm still using the Godil (for the 6809) and the cheap Spartan board + Jason's adapter for the 6502. I know that Hoglet has a new set of interface boards for the various CPU cores, couuld you update me on what I need. Ideally I'd like to get the three interface boards + 3 of the FPGA boards so I can have one each of 6502, 6809 and Z80 without having to re-configure.

Cheers.

Phill.

User avatar
hoglet
Posts: 9297
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: ICE T65/Z80/6809

Post by hoglet » Sun Feb 16, 2020 6:20 pm

Prime wrote:
Sun Feb 16, 2020 5:56 pm
Ideally I'd like to get the three interface boards + 3 of the FPGA boards so I can have one each of 6502, 6809 and Z80 without having to re-configure.
You only need one FPGA board, as there is a now a multi-boot version of the FPGA design. This reads some "id" links on the CPU adapter board, and configures the FPGA appropriately. So one FPGA bitstream supports all the current targets.

I'll send you a PM.

Dave

bprosman
Posts: 432
Joined: Sun Mar 29, 2015 11:27 pm
Contact:

Re: ICE T65/Z80/6809

Post by bprosman » Sun Feb 16, 2020 6:36 pm

Is seem to be very overlooking something today :oops: :oops: :oops:
The ICE-T works fine but doesn't seem to keep it's config after power off :-(

User avatar
hoglet
Posts: 9297
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: ICE T65/Z80/6809

Post by hoglet » Sun Feb 16, 2020 6:40 pm

bprosman wrote:
Sun Feb 16, 2020 6:36 pm
Is seem to be very overlooking something today :oops: :oops: :oops:
The ICE-T works fine but doesn't seem to keep it's config after power off :-(
Do you mean it reverts to an earlier build after a power cycle?

Are you definitely programming the .mcs file into the FLASH?

Sounds like you might just be programming the .bit file into the FPGA, which is not persistent.

Dave

bprosman
Posts: 432
Joined: Sun Mar 29, 2015 11:27 pm
Contact:

Re: ICE T65/Z80/6809

Post by bprosman » Sun Feb 16, 2020 6:49 pm

Do you mean it reverts to an earlier build after a power cycle?
It doesnt seem to do anything after a power Cycle, let me retry.
Or leave it for today :D
//Edit Fixed.
For some reason it must have made a mistake somewhere.

bprosman
Posts: 432
Joined: Sun Mar 29, 2015 11:27 pm
Contact:

Re: ICE T65/Z80/6809

Post by bprosman » Wed Feb 19, 2020 2:04 pm

Maybe an alternative for the EEPizza.
19 Euro’s
9F182BC8-BB2B-412D-83C9-D5D23D9BEDB8.png

User avatar
hoglet
Posts: 9297
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: ICE T65/Z80/6809

Post by hoglet » Wed Feb 19, 2020 2:26 pm

bprosman wrote:
Wed Feb 19, 2020 2:04 pm
Maybe an alternative for the EEPizza.
It has different power supply pins.

I think we just have to be patient, given the current situation in China.

Dave

apprenticemart2
Posts: 8
Joined: Fri Feb 21, 2020 6:20 pm
Contact:

Re: ICE T65/Z80/6809

Post by apprenticemart2 » Fri Feb 21, 2020 6:58 pm

I bought a godil 2 years ago and have only just got round to using it. I'm hoping to clone most of the logic for the dynacord add drive. I got it programmed with the 6809 ice but it wont work.After many hours of troubleshooting i found out that if i put my finger over pins 5,6,7 and 8 of ic7 which generates the 2.5v rail it works. I can't seem to measure the 2.5 or 3.3 rail it's as if my multimeter is loading it down, unless i'm reading the schematics incorrectly. I presume my finger is adding some capacitance. Anyone got any ideas?

User avatar
hoglet
Posts: 9297
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: ICE T65/Z80/6809

Post by hoglet » Fri Feb 21, 2020 7:13 pm

apprenticemart2 wrote:
Fri Feb 21, 2020 6:58 pm
After many hours of troubleshooting i found out that if i put my finger over pins 5,6,7 and 8 of ic7 which generates the 2.5v rail it works. I can't seem to measure the 2.5 or 3.3 rail it's as if my multimeter is loading it down, unless i'm reading the schematics incorrectly. I presume my finger is adding some capacitance. Anyone got any ideas?
Something doesn't quite add up here....

If you can't measure the 2.5V or 3.3V supplies, then it does seem like the GODIL might be faulty.

Were you able to program the FLASH? That actually requires at least the 3.3V supply to be working.

How are you powering the GODIL for these tests?

How exactly are you measuring the 2.5V and 3.3V

Is anything getting hot?

Some photos might help....

Dave

apprenticemart2
Posts: 8
Joined: Fri Feb 21, 2020 6:20 pm
Contact:

Re: ICE T65/Z80/6809

Post by apprenticemart2 » Fri Feb 21, 2020 8:09 pm

Yes i was able to program the flash.When i put my multimeter to the locations I expect will have the voltages I want to measure I get a reading that almost inststantly drops off. I have an oscilloscope so i will try that instead.
The godil is in the socket that usually has the 6809 in it so it's getting 5v. I have tried to add extra capacitance to the power inputs just in case the supply was too noisy but that didn't fix anything. There is a disk acess button on the front of the add drive.The button does nothing unless i put my finger over the pins of ic 7, then i have no trouble loading floppies or anything. I will have to see if i can get the serial terminal working.

User avatar
hoglet
Posts: 9297
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: ICE T65/Z80/6809

Post by hoglet » Fri Feb 21, 2020 10:12 pm

Please do post a photo of the GODIL installed in the system, so I can see how the GODIL links are configured.

Is the processor a 6809 or a 6809E?

apprenticemart2
Posts: 8
Joined: Fri Feb 21, 2020 6:20 pm
Contact:

Re: ICE T65/Z80/6809

Post by apprenticemart2 » Fri Feb 21, 2020 10:46 pm

yes will do. thanks for your time. nice to get some replies. processor is 68b09p off the top of my head.

User avatar
hoglet
Posts: 9297
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: ICE T65/Z80/6809

Post by hoglet » Sat Feb 22, 2020 8:59 am

apprenticemart2 wrote:
Fri Feb 21, 2020 10:46 pm
yes will do. thanks for your time. nice to get some replies. processor is 68b09p off the top of my head.
Do you have a schematic?

The one original 6809 clocking configuration that won't work is a simple crystal connected directly across pins 38 and 39. There needs to be a 4x clock present on pin 38 for the ICE-6809 to function correctly.

Dave

apprenticemart2
Posts: 8
Joined: Fri Feb 21, 2020 6:20 pm
Contact:

Re: ICE T65/Z80/6809

Post by apprenticemart2 » Mon Feb 24, 2020 6:25 pm

It's an 8mhz xtal looking at the schematics buffered by a 7404. What type of serial cable do I need or is it just straight usb? Is it possible to get the terminal working with the godil out of circuit? The 6809 is connected to a 1772 floppy ic directly with no buffers I wonder if it can't sink enough current.
Thanks
Martin

User avatar
hoglet
Posts: 9297
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: ICE T65/Z80/6809

Post by hoglet » Mon Feb 24, 2020 6:47 pm

apprenticemart2 wrote:
Mon Feb 24, 2020 6:25 pm
It's an 8mhz xtal looking at the schematics buffered by a 7404.
OK, that should be fine.

Can you provide a link to the schematics please?
apprenticemart2 wrote:
Mon Feb 24, 2020 6:25 pm
What type of serial cable do I need or is it just straight usb?
I use a cable suitable for a Raspberry Pi, specifically one of these:
https://thepihut.com/products/adafruit- ... rial-cable

The cable needs to have 3.3V levels, not 5V levels.

Also, don't connect the red wire, or there will be sparks!

The connections are shown here:
https://github.com/hoglet67/AtomBusMon/wiki/ICE-6809
apprenticemart2 wrote:
Mon Feb 24, 2020 6:25 pm
Is it possible to get the terminal working with the godil out of circuit?
Yes it is.

You need to put the GODIL in a breadboard and feed it 5V through the appropriate pins for the CPU. It should then startup, and you should see some output at 57,600 baud.

You'll get errors saying "missing clock" but the UI should be responsive.

Hit return, then try typing HELP.
apprenticemart2 wrote:
Mon Feb 24, 2020 6:25 pm
The 6809 is connected to a 1772 floppy ic directly with no buffers I wonder if it can't sink enough current.
The ICE cores are compiled with limited slew rate, and reduced (8mA) drive, to try to reduce cross-talk and ground bounce. So far this hasn't been a problem. The databus in the BBC Model B has 18 TTL loads, and the ICE-6502 works find in there. I would be surprised if this was a problem.

I would suggest you get the serial console working, so you can single-step through the reset sequence and see if/when it goes awry.

Dave

apprenticemart2
Posts: 8
Joined: Fri Feb 21, 2020 6:20 pm
Contact:

Re: ICE T65/Z80/6809

Post by apprenticemart2 » Mon Feb 24, 2020 8:35 pm

https://ia800609.us.archive.org/18/item ... Manual.pdf

I have one of those little ftdi serial adaper thingies somewhere I pressume that will work?
Thanks for your help
Martin

User avatar
hoglet
Posts: 9297
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: ICE T65/Z80/6809

Post by hoglet » Mon Feb 24, 2020 8:46 pm

Thanks. I don't see anything on the schematic that looks problematic..
apprenticemart2 wrote:
Mon Feb 24, 2020 8:35 pm
I have one of those little ftdi serial adaper thingies somewhere I pressume that will work?
Yes, as long as it uses 3.3V levels, and will physically connect to the three header pins on the GODIL.

Dave

Post Reply

Return to “acorn atom and acorn system series”