DuPAL: Difference between revisions

From Proghq
Jump to navigation Jump to search
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Quick start ==
==Quick start==
You will need:
You will need:


* Ubuntu 20.04
*Ubuntu 20.04
* Assembled DuPAL 2.0 w/ 20 pin ZIF installed
*Assembled DuPAL 2.0 w/ 20 pin ZIF installed
** ATMEGA328P blank / in any state
**ATMEGA328P blank / in any state
* DuPAL power supply and USB serial
*DuPAL power supply and USB serial
* avrdude compatible programmer
*avrdude compatible programmer
** I used avrispmkII
**I used avrispmkII
* PAL16L8
*PAL16L8
* Optional: tool to flash PAL16L8
*Optional: tool to flash PAL16L8
** TL866 won't work :(
**TL866 won't work :(


===Quick flash===
===Quick flash===
Line 65: Line 65:
A healthy board should have a steady red power LED and a brief green blink at power on
A healthy board should have a steady red power LED and a brief green blink at power on


=== Quick test ===
===Quick test===


For more information see the [https://github.com/DuPAL-PAL-DUmper/DuPAL_Analyzer main page]
For more information see the [https://github.com/DuPAL-PAL-DUmper/DuPAL_Analyzer main page]


  cd ~/dupal
  cd ~/dupal
  wget https://proghq.org/media/dupal/dupal-analyzer-0.1.4-5430dab-jar-with-dependencies.jar
  wget https://proghq.org/media/dupal/dupal-analyzer-0.1.4-5430dab.jar
  java -jar dupal-analyzer-0.1.4-5430dab-jar-with-dependencies.jar
  java -jar dupal-analyzer-0.1.4-5430dab.jar


Example output:
Example output:
Line 120: Line 120:


Sample output:
Sample output:




Line 137: Line 136:
==Building==
==Building==


=== MCU ===
===MCU===


Optiboot
Optiboot
Line 169: Line 168:
  make program
  make program


=== Analyzer ===
===Analyzer===


  sudo apt install maven
  sudo apt install maven
  nvm compile
  mvn compile
  sudo nvm install
  sudo mvn install


You should now see something like
You should now see something like
Line 195: Line 194:
  20R6
  20R6
  20R8
  20R8
== Logic minimization ==
The recommended flow is to use espresso. Unfortunately this program is a bit old and crusty
java -jar target/espresso-converter-0.0.3-jar-with-dependencies.jar ~/doc/ext/dupal/u33.json out.esp
found this but it crashes under most usage scenarios...I had to work to find something that didn't
git clone <nowiki>https://github.com/JackHack96/logic-synthesis.git</nowiki>
<br />

Latest revision as of 21:45, 28 May 2022

Quick start

You will need:

  • Ubuntu 20.04
  • Assembled DuPAL 2.0 w/ 20 pin ZIF installed
    • ATMEGA328P blank / in any state
  • DuPAL power supply and USB serial
  • avrdude compatible programmer
    • I used avrispmkII
  • PAL16L8
  • Optional: tool to flash PAL16L8
    • TL866 won't work :(

Quick flash

For more information see the main page

Pre-compiled hex files: https://proghq.org/media/dupal/

mkdir ~/dupal
cd ~/dupal
sudo apt-get install -y avrdude minicom
wget https://proghq.org/media/dupal/optiboot_v8.0_atmega328_57600.hex
wget https://proghq.org/media/dupal/dupal_v0.1.2.hex

ISP connection:

 * Pin 1 (red stripe in cable) towards crystal
 * Notch faces towards ATMEGA

You need an avrdude compatible programmer. To see the list of compatible programmers type

avrdude -c help

Once you know the flag you need, here's an example assuming avrispmkII:

avrdude -v -c avrispmkII -P usb -p atmega328p -e -u \
    -U efuse:w:0xFD:m \
    -U hfuse:w:0xDE:m \
    -U lfuse:w:0xFF:m \
    -U flash:w:optiboot_v8.0_atmega328_57600.hex

You should see a green blinky LED

avrdude -v -c avrispmkII -P usb -p atmega328p -u -D \
    -U flash:w:dupal_v0.1.2.hex

The green blinky might stop. Hit the reset button and it should blink again

Start up a serial port at 57600 baud using your favorite terminal emulator such as:

minicom -b 57600 -D /dev/ttyUSB0

Hit "reset" and you should see:

(blinky for a few seconds)

Then:

DuPAL - 0.1.2

REMOTE_CONTROL_ENABLED

If you see this, congrats! your DuPAL is flashed and ready to go! Press ^A and then x to exit minicom

A healthy board should have a steady red power LED and a brief green blink at power on

Quick test

For more information see the main page

cd ~/dupal
wget https://proghq.org/media/dupal/dupal-analyzer-0.1.4-5430dab.jar
java -jar dupal-analyzer-0.1.4-5430dab.jar

Example output:

$ java -jar dupal-analyzer-0.1.4-5430dab-jar-with-dependencies.jar -h
[main] INFO info.hkzlab.dupal.analyzer.App - DuPAL Analyzer 0.1.4
[main] ERROR info.hkzlab.dupal.analyzer.App - Wrong number of arguments passed.
dupal_analyzer <serial_port> <pal_type> [<output_file> hex_output_mask]
Where <pal_type> can be:
	10L8
	12H6
	16L8
	20L8
	16R4
	16R6
	16R8
	20R4
	20R6
	20R8

Burn trackstar128_u33_pal16l8a2nc.jed (FIXME: instructions)

wget https://proghq.org/media/dupal/trackstar128_u33_pal16l8a2nc.jed

Testing:

Turn off DuPAL
Insert PAL into 20 pin socket
Turn on DuPAL
java -jar dupal-analyzer-0.1.4-5430dab-jar-with-dependencies.jar /dev/ttyUSB0 16L8 out.json
Both the activity green light and the "20 pin active" LED should turn on
Let run. Took just over a minute on my setup
Note: .json file will not be produced

Sample output:

$ java -jar dupal-analyzer-0.1.4-5430dab-jar-with-dependencies.jar /dev/ttyUSB0 16L8 out.json
[main] INFO info.hkzlab.dupal.analyzer.App - DuPAL Analyzer 0.1.4
[main] INFO info.hkzlab.dupal.analyzer.board.boardio.DuPALAnalyzer - detectIOTypeMask -> Starting IO type detection... This could take a while.
[main] INFO info.hkzlab.dupal.analyzer.board.boardio.DuPALAnalyzer - detectIOTypeMask -> Currently detected mask is 07
[main] INFO info.hkzlab.dupal.analyzer.board.boardio.DuPALAnalyzer - Detected the following IO as Outputs mask: 07
[main] INFO info.hkzlab.dupal.analyzer.board.boardio.DuPALAnalyzer - Now, turn OFF and ON again the DuPAL to reset the PAL and run this tool again by specifying the mask 
and output file.

Now re-run with the suggested mask option:

java -jar dupal-analyzer-0.1.4-5430dab-jar-with-dependencies.jar /dev/ttyUSB0 16L8 out.json 07

Sample output:


Testing

With no chip in it takes about 9 minutes and gives a mask of 00. Be suspicious if you see this

[main] INFO info.hkzlab.dupal.analyzer.App - DuPAL Analyzer 0.1.4
[main] INFO info.hkzlab.dupal.analyzer.board.boardio.DuPALAnalyzer - detectIOTypeMask -> Starting IO type detection... This could take a while.
[main] INFO info.hkzlab.dupal.analyzer.board.boardio.DuPALAnalyzer - detectIOTypeMask -> Currently detected mask is 00
[main] INFO info.hkzlab.dupal.analyzer.board.boardio.DuPALAnalyzer - Detected the following IO as Outputs mask: 00
[main] INFO info.hkzlab.dupal.analyzer.board.boardio.DuPALAnalyzer - Now, turn OFF and ON again the DuPAL to reset the PAL and run this tool again by specifying the mask 
and output file.


Building

MCU

Optiboot

# https://github.com/Optiboot/optiboot

# 328P uses 115200?
# a few use 57600 but not the one we need :(
# wget https://github.com/Optiboot/optiboot/releases/download/v8.0/Optiboot-8.0.zip

git clone https://github.com/Optiboot/optiboot.git
cd optiboot
git checkout -b v8.0 v8.0
cd bootloaders/optiboot
make atmega328 AVR_FREQ=20000000L LED_START_FLASHES=8 BAUD_RATE=57600
# sha1sum optiboot_atmega328.hex
# 8a16ce8d98d7bf002c54c7aa911bfd124d9e1961  optiboot_atmega328.hex

Flash optiboot. Example CLI to use ISP header, but can also put into tl866 etc

Sample command line:

Sample output

Originally I tried using BP Microsystems but didn't work (fuses not set right?). I then flashed using avrdude / header and worked (green LED blinking).

TODO: dump end flash so can program using bp

cd DuPAL_Firmware
make
make program

Analyzer

sudo apt install maven
mvn compile
sudo mvn install

You should now see something like

$ ls -lah ./target/*.jar
-rw-r--r-- 1 root root  51K May 21 14:34 ./target/dupal-analyzer-0.1.4.jar
-rw-r--r-- 1 root root 536K May 21 14:35 ./target/dupal-analyzer-0.1.4-jar-with-dependencies.jar
$ java -jar ./target/dupal-analyzer-0.1.4-jar-with-dependencies.jar -h
[main] INFO info.hkzlab.dupal.analyzer.App - DuPAL Analyzer 0.1.4
[main] ERROR info.hkzlab.dupal.analyzer.App - Wrong number of arguments passed.
dupal_analyzer <serial_port> <pal_type> [<output_file> hex_output_mask]
Where <pal_type> can be:
	10L8
	12H6
	16L8
	20L8
	16R4
	16R6
	16R8
	20R4
	20R6
	20R8

Logic minimization

The recommended flow is to use espresso. Unfortunately this program is a bit old and crusty

java -jar target/espresso-converter-0.0.3-jar-with-dependencies.jar ~/doc/ext/dupal/u33.json out.esp


found this but it crashes under most usage scenarios...I had to work to find something that didn't

git clone https://github.com/JackHack96/logic-synthesis.git