Papilio.ZPUinoUserGuide History

Hide minor edits - Show changes to output

July 19, 2013, at 11:49 AM by Hans Martin Schirmacher -
Changed line 328 from:
!!!SigmaDelta DAC Example
to:
!!!SigmaDelta DAC Instantiation Example
July 19, 2013, at 11:46 AM by Hans Martin Schirmacher - Changed Timer to SigmaDelta DAC
Changed line 328 from:
!!!Timer Instantiation Example
to:
!!!SigmaDelta DAC Example
June 07, 2013, at 03:21 PM by Jack Gassett -
Changed line 525 from:
http://youtu.be/E1PkdcALyz8
to:
(:youtube E1PkdcALyz8 width=560 height=315 scale=1 fs=1 hd=1 vq=hd1080 nocookie=1:)
June 07, 2013, at 03:20 PM by Jack Gassett -
Changed line 525 from:
(:youtube E1PkdcALyz8 width=560 height=315 scale=1 fs=1 hd=1 vq=hd720 nocookie=1:)
to:
http://youtu.be/E1PkdcALyz8
June 07, 2013, at 03:18 PM by Jack Gassett -
Changed line 525 from:
(:youtube E1PkdcALyz8 width=560 height=315 scale=1 fs=1 hd=1 nocookie=1:)
to:
(:youtube E1PkdcALyz8 width=560 height=315 scale=1 fs=1 hd=1 vq=hd720 nocookie=1:)
June 07, 2013, at 03:06 PM by Jack Gassett -
Changed line 525 from:
(:youtube E1PkdcALyz8 width=853 height=480 scale=1 fs=1 hd=1 nocookie=1:)
to:
(:youtube E1PkdcALyz8 width=560 height=315 scale=1 fs=1 hd=1 nocookie=1:)
June 07, 2013, at 03:04 PM by Jack Gassett -
Changed line 525 from:
http://youtu.be/E1PkdcALyz8
to:
(:youtube E1PkdcALyz8 width=853 height=480 scale=1 fs=1 hd=1 nocookie=1:)
June 07, 2013, at 02:57 PM by Jack Gassett -
Changed line 520 from:
>>round frame<<
to:
>>lrindent round frame<<
June 07, 2013, at 02:57 PM by Jack Gassett -
Added lines 523-524:

!!!Video
Changed lines 527-528 from:
'''Sketch used in the video'''
(:source:)
to:
!!!Sketch used in the video
(:source lang=c:)
June 07, 2013, at 02:56 PM by Jack Gassett -
Changed lines 523-524 from:
to:
http://youtu.be/E1PkdcALyz8

'''Sketch used in the video'''
(:source:)
//This sketch assumes a jumper wire between pin 0 and 1 on the Papilio

HardwareSerial mySerial1(8);
HardwareSerial mySerial2(9);

void setup() {

//Connect the tx pin of mySerial1 to pin 0 of the Papilio
pinMode(0, OUTPUT);
pinModePPS(0, HIGH);
outputPinForFunction(0,6);

//Connect the rx pin of mySerial2 to pin 1 of the Papilio
pinMode(1,INPUT);
inputPinForFunction(1,2);

Serial.begin(9600);
mySerial1.begin(9600);
mySerial2.begin(9600);
}

void loop() {

//Send a 1 out of mySerial1, read it on mySerial2, and send it out the USB serial port.
mySerial1.write(1);
if (mySerial2.available()) {
Serial.println(mySerial2.read());
}
delay(500);
}
(:sourceend:)

>><<
June 07, 2013, at 02:52 PM by Jack Gassett -
Changed line 27 from:
[[#ZAPTutorials|ZPUino Tutorials]][[<<]]
to:
[[#ZPUinoTutorials|ZPUino Tutorials]][[<<]]
Added lines 512-524:

----
[[#ZPUinoTutorials]]
!!!ZPUino Tutorials

[[#SynthTutorial]]
[[#UARTTutorial]]
!!!Adding extra serial ports and synthesizing a custom ZPUino SOC
>>round frame<<
!!!Links
* [[http://forum.gadgetfactory.net/index.php?/files/file/42-zpuino-hdl-source-code/|ZPUino HDL Source Code]]
June 07, 2013, at 02:47 PM by Jack Gassett -
Added lines 27-29:
[[#ZAPTutorials|ZPUino Tutorials]][[<<]]
->[[#SynthTutorial|Synthesize ZPUino Source]][[<<]]
->[[#UARTTutorial|Extra Serial Ports]][[<<]]
June 06, 2013, at 10:42 AM by Jack Gassett -
Changed line 223 from:
timers_inst: zpuino_timers
to:
timers2_inst: zpuino_timers
Changed line 281 from:
uart_inst: zpuino_uart
to:
uart2_inst: zpuino_uart
Changed line 337 from:
sigmadelta_inst: zpuino_sigmadelta
to:
sigmadelta2_inst: zpuino_sigmadelta
Changed line 384 from:
spi_inst: zpuino_spi
to:
spi2_inst: zpuino_spi
June 06, 2013, at 10:19 AM by Jack Gassett -
Added lines 324-364:
>>lrindent round frame<<
!!!Timer Instantiation Example
'''Signal Section''' -
Put this code in the signal section (search for #Signal)\\
(:source lang=vhdl :)
signal sigmadelta1_spp_en: std_logic_vector(1 downto 0);
signal sigmadelta1_spp_data: std_logic_vector(1 downto 0);
(:sourceend:)
->%red%These signal names need to be unique and match what you put in the Wishbone section.

'''Wishbone Section''' -
Put this code in the Wishbone component section (search for #Wishbone)\\
(:source lang=vhdl :)
sigmadelta_inst: zpuino_sigmadelta
port map (
wb_clk_i => wb_clk_i,
wb_rst_i => wb_rst_i,
wb_dat_o => slot_read(8),
wb_dat_i => slot_write(8),
wb_adr_i => slot_address(8),
wb_we_i => slot_we(8),
wb_cyc_i => slot_cyc(8),
wb_stb_i => slot_stb(8),
wb_ack_o => slot_ack(8),
wb_inta_o => slot_interrupt(8),

spp_data => sigmadelta1_spp_data,
spp_en => sigmadelta1_spp_en,
sync_in => '1'
);
(:sourceend:)
->%red%Be sure to change the slot numbers to match your design.

'''PPS Section''' -
Put this code in the PPS section (search for #PPS)\\
(:source lang=vhdl :)
gpio_spp_data(6) <= sigmadelta1_spp_data(0); -- PPS6 : SIGMADELTA DATA
gpio_spp_data(7) <= sigmadelta1_spp_data(1); -- PPS7 : SIGMADELTA DATA
(:sourceend:)
->%red%Be sure to change the PPS numbers to match your design.
>><<
June 06, 2013, at 10:16 AM by Jack Gassett -
Changed line 281 from:
slot11: zpuino_uart
to:
uart_inst: zpuino_uart
Added lines 328-372:
>>lrindent round frame<<
!!!SPI Instantiation Example
'''Signal Section''' -
Put this code in the signal section (search for #Signal)\\
(:source lang=vhdl :)
signal spi3_enabled: std_logic;
signal spi3_mosi: std_logic;
signal spi3_miso: std_logic;
signal spi3_sck: std_logic;
(:sourceend:)
->%red%These signal names need to be unique and match what you put in the Wishbone section.

'''Wishbone Section''' -
Put this code in the Wishbone component section (search for #Wishbone)\\
(:source lang=vhdl :)
spi_inst: zpuino_spi
port map (
wb_clk_i => wb_clk_i,
wb_rst_i => wb_rst_i,
wb_dat_o => slot_read(8),
wb_dat_i => slot_write(8),
wb_adr_i => slot_address(8),
wb_we_i => slot_we(8),
wb_cyc_i => slot_cyc(8),
wb_stb_i => slot_stb(8),
wb_ack_o => slot_ack(8),
wb_inta_o => slot_interrupt(8),

mosi => spi3_mosi,
miso => spi3_miso,
sck => spi3_sck,
enabled => open
);
(:sourceend:)
->%red%Be sure to change the slot numbers to match your design.

'''PPS Section''' -
Put this code in the PPS section (search for #PPS)\\
(:source lang=vhdl :)
gpio_spp_data(6) <= spi3_mosi; -- PPS6 : USPI MOSI
gpio_spp_data(7) <= spi3_sck; -- PPS7 : USPI SCK
spi3_miso <= gpio_spp_read(1); -- PPS1 : USPI MISO
(:sourceend:)
->%red%Be sure to change the PPS numbers to match your design.
>><<
June 06, 2013, at 10:09 AM by Jack Gassett -
Deleted line 208:
>>lrindent round frame<<
Changed lines 211-212 from:
!!!Instantiation Example
to:
>>lrindent round frame<<
!!!Timer
Instantiation Example
Deleted line 266:
>>lrindent round frame<<
Changed lines 269-270 from:
!!!Instantiation Example
to:
>>lrindent round frame<<
!!!UART
Instantiation Example
June 06, 2013, at 10:08 AM by Jack Gassett -
Changed lines 218-219 from:
%red%These signal names need to be unique and match what you put in the Wishbone section.
to:
->%red%These signal names need to be unique and match what you put in the Wishbone section.
Changed lines 254-255 from:
%red%Be sure to change the slot numbers to match your design.
to:
->%red%Be sure to change the slot numbers to match your design.
Changed line 262 from:
%red%Be sure to change the PPS numbers to match your design.
to:
->%red%Be sure to change the PPS numbers to match your design.
Changed lines 276-277 from:
%red%These signal names need to be unique and match what you put in the Wishbone section.
to:
->%red%These signal names need to be unique and match what you put in the Wishbone section.
Changed lines 302-303 from:
%red%Be sure to change the slot numbers to match your design.
to:
->%red%Be sure to change the slot numbers to match your design.
Changed line 310 from:
%red%Be sure to change the PPS numbers to match your design.
to:
->%red%Be sure to change the PPS numbers to match your design.
June 06, 2013, at 10:06 AM by Jack Gassett -
Changed line 213 from:
'''Signal Section'''
to:
'''Signal Section''' -
Changed line 220 from:
'''Wishbone Section'''
to:
'''Wishbone Section''' -
Changed line 256 from:
'''PPS Section'''
to:
'''PPS Section''' -
Added line 271:
'''Signal Section''' -
Deleted line 272:
%red%These signal names need to be unique and match what you put in the Wishbone section.
Changed lines 276-278 from:
to:
%red%These signal names need to be unique and match what you put in the Wishbone section.

'''Wishbone Section''' -
Deleted line 279:
%red%Be sure to change the slot numbers to match your design.
Changed lines 302-304 from:
to:
%red%Be sure to change the slot numbers to match your design.

'''PPS Section''' -
Deleted line 305:
%red%Be sure to change the PPS numbers to match your design.
Added line 310:
%red%Be sure to change the PPS numbers to match your design.
June 06, 2013, at 10:03 AM by Jack Gassett -
Changed lines 218-219 from:
These signal names need to be unique and match what you put in the Wishbone section.
to:
%red%These signal names need to be unique and match what you put in the Wishbone section.
Changed lines 254-255 from:
Be sure to change the slot numbers to match your design.
to:
%red%Be sure to change the slot numbers to match your design.
Changed line 262 from:
Be sure to change the PPS numbers to match your design.
to:
%red%Be sure to change the PPS numbers to match your design.
Changed line 272 from:
These signal names need to be unique and match what you put in the Wishbone section.
to:
%red%These signal names need to be unique and match what you put in the Wishbone section.
Changed line 278 from:
Be sure to change the slot numbers to match your design.
to:
%red%Be sure to change the slot numbers to match your design.
Changed line 303 from:
Be sure to change the PPS numbers to match your design.
to:
%red%Be sure to change the PPS numbers to match your design.
June 06, 2013, at 10:01 AM by Jack Gassett -
Changed lines 212-213 from:
'''Instantiation Example'''\\
to:
!!!Instantiation Example
'''Signal Section'''
Deleted line 214:
These signal names need to be unique and match what you put in the Wishbone section.
Changed lines 218-220 from:
to:
These signal names need to be unique and match what you put in the Wishbone section.

'''Wishbone Section'''
Deleted line 221:
Be sure to change the slot numbers to match your design.
Changed lines 254-256 from:
to:
Be sure to change the slot numbers to match your design.

'''PPS Section'''
Deleted line 257:
Be sure to change the PPS numbers to match your design.
Added line 262:
Be sure to change the PPS numbers to match your design.
Changed line 270 from:
'''Instantiation Example'''\\
to:
!!!Instantiation Example
June 06, 2013, at 09:58 AM by Jack Gassett -
Deleted lines 212-213:
Be sure to change the slot numbers and PPS locations to match your design. Lines to be changed are highlighted.
Deleted lines 267-268:
Be sure to change the slot numbers and PPS locations to match your design. Lines to be changed are highlighted.
June 06, 2013, at 09:58 AM by Jack Gassett -
Deleted lines 208-211:
->For more information refer to the [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf#section.4.2|Timers section of the ZPUino Technical Reference]].

[[#UART]]
!!!UARTs
Changed lines 210-211 from:
For more information refer to the [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf#section.4.3|UART section of the ZPUino Technical Reference]].
to:
For more information refer to the [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf#section.4.2|Timers section of the ZPUino Technical Reference]].
Changed line 218 from:
signal uart2_tx, uart2_rx: std_logic;
to:
signal timers_pwm1: std_logic_vector(1 downto 0);
Changed line 224 from:
slot11: zpuino_uart
to:
timers_inst: zpuino_timers
Changed lines 226-235 from:
bits => 4
to:
A_TSCENABLED => true,
A_PWMCOUNT => 1,
A_WIDTH => 16,
A_PRESCALER_ENABLED => true,
A_BUFFERS => true,
B_TSCENABLED => false,
B_PWMCOUNT => 1,
B_WIDTH => 24,
B_PRESCALER_ENABLED => false,
B_BUFFERS => false
Changed lines 239-252 from:
wb_rst_i => wb_rst_i,
wb_dat_o => slot_read(11),
wb_dat_i => slot_write(11),
wb_adr_i => slot_address(11),
wb_we_i => slot_we(11),
wb_cyc_i => slot_cyc(11),
wb_stb_i => slot_stb(11),
wb_ack_o => slot_ack(11),

wb_inta_o => slot_interrupt(11),

tx => uart2_tx,
rx => uart2_rx
);
to:
wb_rst_i => wb_rst_i,
wb_dat_o => slot_read(8),
wb_dat_i => slot_write(8),
wb_adr_i => slot_address(8),
wb_we_i => slot_we(8),
wb_cyc_i => slot_cyc(8),
wb_stb_i => slot_stb(8),
wb_ack_o => slot_ack(8),

wb_inta_o => slot_interrupt(8), -- We use two interrupt lines
wb_intb_o => slot_interrupt(9), -- so we borrow intr line from wishbone slot 9, do not use wishbone slot 9 for anything else

pwm_a_out => timers_pwm1(0 downto 0
),
pwm_b_out => timers_pwm1(1 downto 1)
)
;
(:sourceend:)

Put this code in the PPS section (search for #PPS)\\
Be sure to change the PPS numbers to match your design.
(:source lang=vhdl :)
gpio_spp_data(6) <= timers_pwm1(0); -- PPS6 : TIMER2
gpio_spp_data(7) <= timers_pwm1(1); -- PPS7 : TIMER3
(:sourceend:)
>><<

[[#UART]]
!!!UARTs
>>lrindent round frame<<
For more information refer to the [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf#section.4.3|UART section of the ZPUino Technical Reference]].

'''Instantiation Example'''\\
Be sure to change the slot numbers and PPS locations to match your design. Lines to be changed are highlighted.

Put this code in the signal section (search for #Signal)\\
These signal names need to be unique and match what you put in the Wishbone section.
(:source lang=vhdl :)
signal uart2_tx, uart2_rx: std_logic;
(:sourceend:)

Put this code in the Wishbone component section (search for #Wishbone)\\
Be sure to change the slot numbers to match your design.
(:source lang=vhdl :)
slot11: zpuino_uart
generic map (
bits => 4
)
port map (
wb_clk_i => wb_clk_i,
wb_rst_i => wb_rst_i,
wb_dat_o => slot_read(8),
wb_dat_i => slot_write(8),
wb_adr_i => slot_address(8),
wb_we_i => slot_we(8),
wb_cyc_i => slot_cyc(8),
wb_stb_i => slot_stb(8),
wb_ack_o => slot_ack(8),

wb_inta_o => slot_interrupt(8),
June 06, 2013, at 09:42 AM by Jack Gassett -
Changed lines 226-227 from:
Be sure to change the slot numbers to match your design. Lines to be changed are highlighted.
(:source lang=vhdl highlight=8,9,10,11
:)
to:
Be sure to change the slot numbers to match your design.
(:source lang=vhdl :)
June 06, 2013, at 09:41 AM by Jack Gassett -
Changed line 227 from:
(:source lang=vhdl highlight=8-12:)
to:
(:source lang=vhdl highlight=8,9,10,11:)
June 06, 2013, at 09:39 AM by Jack Gassett -
Changed lines 218-220 from:
(:source lang=vhdl highlight=10,11,12,13,14,15,16,18,24,25:)
signal uart2_tx, uart2_rx: std_logic;
to:
Put this code in the signal section (search for #Signal)\\
These signal names need to be unique and match what you put in the Wishbone section.
(:source lang=vhdl :)
signal uart2_tx, uart2_rx: std_logic;
(:sourceend:)

Put this code in the Wishbone component section (search for #Wishbone)\\
Be sure to change the slot numbers to match your design. Lines to be changed are highlighted.
(:source lang=vhdl highlight=8-12:)
Changed lines 247-248 from:
);
to:
);
(:sourceend:)

Put this code in the PPS section (search for #PPS)\\
Be sure to change the PPS numbers to match your design.
(:source lang=vhdl :)
Changed lines 254-255 from:
uart2_rx <= gpio_spp_read(1); -- PPS0 : USPI MISO
to:
uart2_rx <= gpio_spp_read(1); -- PPS0 : USPI MISO
June 06, 2013, at 09:27 AM by Jack Gassett -
Changed line 214 from:
->For more information refer to the [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf#section.4.3|UART section of the ZPUino Technical Reference]].
to:
For more information refer to the [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf#section.4.3|UART section of the ZPUino Technical Reference]].
June 06, 2013, at 09:27 AM by Jack Gassett -
Added line 213:
>>lrindent round frame<<
Added line 246:
>><<
June 06, 2013, at 09:25 AM by Jack Gassett -
Changed line 217 from:
(:source lang=vhdl highlight=10,11,12,13,14,15,16,17,18,24,25:)
to:
(:source lang=vhdl highlight=10,11,12,13,14,15,16,18,24,25:)
June 06, 2013, at 09:25 AM by Jack Gassett -
Changed line 217 from:
(:source lang=vhdl highlight=10,11,12,13,14,15,16,17,22,23:)
to:
(:source lang=vhdl highlight=10,11,12,13,14,15,16,17,18,24,25:)
June 06, 2013, at 09:24 AM by Jack Gassett -
Changed lines 215-217 from:
'''Instantiation Example'''
Be sure to change the slot numbers and PPS locations to match your design.
(:source lang=vhdl highlight=10,11,12,13:)
to:
'''Instantiation Example'''\\
Be sure to change the slot numbers and PPS locations to match your design. Lines to be changed are highlighted.
(:source lang
=vhdl highlight=10,11,12,13,14,15,16,17,22,23:)
June 06, 2013, at 09:23 AM by Jack Gassett -
Changed line 217 from:
(:source:)
to:
(:source lang=vhdl highlight=10,11,12,13:)
Changed line 226 from:
wb_rst_i => wb_rst_i,
to:
wb_rst_i => wb_rst_i,
June 06, 2013, at 09:20 AM by Jack Gassett -
Added lines 214-244:

'''Instantiation Example'''
Be sure to change the slot numbers and PPS locations to match your design.
(:source:)
signal uart2_tx, uart2_rx: std_logic;

slot11: zpuino_uart
generic map (
bits => 4
)
port map (
wb_clk_i => wb_clk_i,
wb_rst_i => wb_rst_i,
wb_dat_o => slot_read(11),
wb_dat_i => slot_write(11),
wb_adr_i => slot_address(11),
wb_we_i => slot_we(11),
wb_cyc_i => slot_cyc(11),
wb_stb_i => slot_stb(11),
wb_ack_o => slot_ack(11),

wb_inta_o => slot_interrupt(11),

tx => uart2_tx,
rx => uart2_rx
);

gpio_spp_data(6) <= uart2_tx; -- PPS6 : UART2 DATA
uart2_rx <= gpio_spp_read(1); -- PPS0 : USPI MISO

(:sourceend:)
May 31, 2013, at 05:07 PM by Jack Gassett -
Changed lines 136-137 from:
**[[http://arduino.cc/en/Reference/DigitalWrite|digitalWrite]]()
**[[http://arduino.cc/en/Reference/DigitalRead|digitalRead]]()
to:
**%newwin%[[http://arduino.cc/en/Reference/DigitalWrite|digitalWrite]]()
**%newwin%[[http://arduino.cc/en/Reference/DigitalRead|digitalRead]]()
May 31, 2013, at 05:04 PM by Jack Gassett -
Added lines 133-138:

->It uses the same Digital I/O functions that the Arduino does:
**%newwin%[[http://arduino.cc/en/Reference/PinMode|pinMode]]()
**[[http://arduino.cc/en/Reference/DigitalWrite|digitalWrite]]()
**[[http://arduino.cc/en/Reference/DigitalRead|digitalRead]]()
%%
May 31, 2013, at 04:58 PM by Jack Gassett -
Added line 135:
\\
May 31, 2013, at 04:58 PM by Jack Gassett -
Changed lines 134-135 from:
->For more information refer to the [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf#section.4.1|GPIO section of the ZPUino Technical Reference]].
to:
->For more information refer to the [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf#section.4.1|GPIO section of the ZPUino Technical Reference]].\\
May 31, 2013, at 04:55 PM by Jack Gassett -
Added lines 135-137:
>>lrindent round frame<<
(:include Papilio.Pinouts:)
>><<
May 31, 2013, at 10:42 AM by Jack Gassett -
Added lines 1-313:
>>rindent round frame float:right width:400px<<
'''Contents'''
[[<<]]
[[#Overview|Overview]][[<<]]
->[[#WhatIs|What is ZPUino?]][[<<]]
->[[#SystemOnChip|System On Chip]][[<<]]
->[[#Bootloader|Bootloader]][[<<]]
->[[#Variants|Variants]][[<<]]
->[[#UploadToRam|Upload to RAM]][[<<]]
[[#Reference|Reference]][[<<]]
->[[#GPIO|GPIO]][[<<]]
->[[#PPS|Peripheral Pin Select]][[<<]]
->[[#Timers|Timers]][[<<]]
->[[#UART|UARTs]][[<<]]
->[[#CRC16|CRC16]][[<<]]
->[[#Interrupts|Interrupts]][[<<]]
->[[#SigmaDelta|SigmaDelta DAC]][[<<]]
->[[#SPI|SPI]][[<<]]
[[#Libraries|Libraries]][[<<]]
->[[#SmallFS|SmallFS Library]][[<<]]
->[[#VGA|VGA Library]][[<<]]
->[[#VGALiquidCrystal|VGALiquidCrystal Library]][[<<]]
[[#ZAPUsage|ZAP IDE Usage]][[<<]]
->[[#Section1|Setup Environment]][[<<]]
->[[#Section2|Run Hello World]][[<<]]
->[[#Section3|VGA Hello World]][[<<]]
(:comment ->[[#PPSExample|Move PPS Pin]][[<<]] :)
(:comment ->[[#PPSExample|Connect to Wishbone IO]][[<<]] :)
(:comment [[#ISEUsage|VHDL Usage]][[<<]] :)
(:comment ->[[#Synthesize|Synthesize ZPUino]][[<<]] :)
(:comment ->[[#WBSlot|Connect to Wishbone Slot]][[<<]] :)
(:comment ->[[#WBSlot|Make Wishbone Peripheral]][[<<]] :)
>><<

[[#Overview]]
!!ZPUino User Guide
>>round frame<<
The [[http://www.alvie.com/zpuino/index.html|ZPUino]] is a 32 bit processor running at 100Mhz with a library of Wishbone peripherals. Everything is controlled by a sketch and easy Arduino style libraries. It is an Arduino compatible Soft Processor on steroids!

The [[http://www.alvie.com/zpuino/index.html|ZPUino]] is the [[http://opensource.zylin.com/zpu.htm|ZPU soft processor]] adapted for use with the Arduino IDE and it was conceived of and developed by [[http://www.gadgetfactory.net/gadgetforum/index.php?action=profile;u=16|Alvaro Lopes]].
>><<

>>round frame float:left width:100px bgcolor=#ffffff<<
%width=450%[[Attach:zpuino-logo.png|Attach:zpuino-logo.png]]
>><<
[[<<]]

>>round frame<<
!!!Quick Links
-> [[Papilio.ReferenceAll#ZPUinoVariants|ZPUino Variants]]
-> [[http://forum.gadgetfactory.net/index.php?/files/file/8-zap-zpuino-arduino-papilio-ide/|ZAP (ZPUino Arduino Papilio) IDE]]
-> [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf|ZPUino Technical Reference]]
-> [[http://www.alvie.com/zpuino/index.html|ZPUino Home Page]]

!!!Operating Systems
-> Windows Vista
-> Windows XP
-> Windows 7
-> WIndows 8

!!!Hardware this Guide Applies to:
-> [[http://store.gadgetfactory.net/papilio-one-250k/|Papilio One 250K]]
-> [[http://store.gadgetfactory.net/papilio-one-500k/|Papilio One 500K]]
-> [[http://store.gadgetfactory.net/papilio-pro/|Papilio Pro LX9]]
>><<

[[#WhatIs]]
!!!ZPUino Technical Overview
>>round frame border='1px solid #429ae0'<<
%rfloat height=200px% Attach:zpuino.png
'''What is ZPUino'''
*32 bit soft processor running at 96Mhz.
*Uses a modified version of the Arduino IDE to load sketches.
*Wishbone bus for connecting peripherals such as the following:
**Commodore 64 SID Audio Chip
**YM2149 Audio Chip
**POKEY Audion Chip
**AudioMixer
**ZX Spectrum VGA
**HQVGA with 8-bit color
**UART
**GPIO
**SPI
**I2C
**SigmaDelta DAC
*Actively maintained and developed by Alvaro Lopes.
*To learn more visit: http://www.alvie.com/zpuino or read the [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf|technical guide]].
[[<<]]
'''Block Diagram'''
%center width=600%[[Attach:zpuino_block.png|Attach:zpuino_block.png]]
[[<<]]
'''ZPUino System on Chip'''
%center width=600%[[Attach:zpuino-soc.png|Attach:zpuino-soc.png]]
[[<<]]
Learn more technical details about the ZPUino by reading the [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf|ZPUino Technical Reference]].
>><<

[[<<]]

[[#SystemOnChip]]
!!!ZPUino System On Chip
The ZPUino is intended to make it easy to make System on Chip FPGA designs by adding Wishbone Peripherals to the ZPUino Wishbone slots. The RetroCade Synth is an example of a ZPUino System on Chip design.
>>round frame border='1px solid #429ae0'<<
'''RetroCade Block Diagram'''
%center width=600%[[Attach:retrocade_block.png|Attach:retrocade_block.png]]

'''RetroCade Presentation'''\\
%rframe%http://youtu.be/6E-USsejc5o
Watch this presentation to learn the nitty gritty details of the RetroCade's internals.
[[<<]]
-------->%newwin%[[https://www.dropbox.com/s/gi2oa7ya9hew3ny/Retrocade%20Synth.pdf|Watch Presentation in PDF format]]
>><<

[[#Bootloader]]
!!!ZPUino Bootloader
->The ZPUino uses a bootloader that bootstraps code from SPI Flash into internal Block Ram for the Papilio One and external SDRAM for the Papilio Pro. Every ZPUino variant has a special mode that allows code to be programmed to SPI Flash to be run at the next reset. The ZAP IDE sends a special command at a specific baud rate to trigger the programming mode. After code is loaded to SPI Flash a reset is triggered and the bootloader shadows code from SPI FLash into the appropriate RAM location. This is why a ZPUino variant needs to be loaded to the Papilio board before a sketch is uploaded.

[[#Variants]]
!!!ZPUino Variants
->A ZPUino variant is a custom ZPUino System on Chip design that we have pre-synthesized for a specific purpose. It contains all of the Wishbone peripherals that will be useful for a specific task, such as VGA output. A ZPUino variant is normally named after a deity from Greek Mythology which roughly indicates what type of peripherals it includes. For example the Hyperion variant includes the VGA peripheral and is named after Hyperion the "Lord of Light". Check out the [[Papilio.ReferenceAll#ZPUinoVariants|ZPUino variant reference page]] to see all the pre-synthesized ZPUino variants that are currently available.

[[#UploadToRam]]
!!! Upload to RAM
->It is possible to speed up the process of writing sketches to the Papilio board by uploading to RAM instead of SPI Flash. To do this hold down the left shift button while pressing the Upload icon. SmallFS files will not be updated and the code changes will not persist after a power down.

----
[[#Reference]]
!!!ZPUino Reference
->The majority of the information in this section comes from the [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf|ZPUino Technical Reference]] written by Alvaro Lopes. For more in depth information please refer to the technical reference.
[[#GPIO]]
!!!GPIO
->GPIO provides the basic input and output capabilities for the ZPUino pins connected to the Papilio FPGA board.

->For more information refer to the [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf#section.4.1|GPIO section of the ZPUino Technical Reference]].

[[#PPS]]
!!!PPS (Peripheral Pin Select)
>>lrindent round frame<<
ZPUino includes a feature which is called Peripheral Pin Select (in short, PPS). PPS allows you to map every device input or output pin (such as SPI clock and SPI datalines) to each individual pin (GPIO), thus not requiring you to perform synthesis and P&R each time you want to use a device on a different IO pin.

To determine which PPS pins are available in your [[Papilio.ReferenceAll#ZPUinoVariants|ZPUino variant]], take a look at the PPS section for your variant. For example, here are all of the [[Papilio.Hyperion#PPS|PPS pins available for the Hyperion variant]].

To simplify things, three methods are supplied to manipulate PPS:
(:source lang=c :)
void pinModePPS ( int pin , int value );
void outputPinForFunction ( unsigned int pin , unsigned int function );
void inputPinForFunction ( unsigned int pin , unsigned int function );
(:sourceend:)

Three register blocks exist to configure how pin selection is done.
* GPIOPPSIN
* GPIOPPSOUT
* GPIOPPSMAP

!!!Redirecting Output
In order to direct any peripheral output to a GPIO pin, you have to:
* Configure the GPIO pin as output
* Enable PPS on selected GPIO pin
* Configure GPIOPPSOUT (outputPinForFunction) to the peripheral signal

'''Example'''\\
The following example maps Sigma Delta 1st channel into GPIO pin number 30:
(:source lang=c :)
void setup ( void )
{
// Configure pin as output
pinMode (30 , OUTPUT );
// enable PPS on this pin
pinModePPS (30 , HIGH );
// Map SigmaDelta channel 1 to pin 30
outputPinForFunction (30 , IOPIN_SIGMADELTA1 );
}
(:sourceend:)
Note that you can use GPIO aliases for your board instead of GPIO number. Refer to the [[#GPIO|GPIO]] section for more details.

!!!Redirecting Input
In order to direct GPIO input into any peripheral, you have to:
*Congure the GPIO pin as input;
*Congure GPIOPPSIN (inputPinForFunction) to the peripheral signal;
Note that for input you don't need to enable PPS on the pin using pinModePPS.

'''Example'''\\
The following example maps USPI MISO signal (Master-In Slave-out) to GPIO pin
number 10:
(:source lang=c :)
void setup ( void )
{
// Configure pin as input
pinMode (10 , INPUT );
// Map pin 30 to USPI MISO
inputPinForFunction (10 , IOPIN_USPI_MISO );
}
(:sourceend:)
>><<

[[#Timers]]
!!!Timers
->For more information refer to the [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf#section.4.2|Timers section of the ZPUino Technical Reference]].

[[#UART]]
!!!UARTs
->For more information refer to the [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf#section.4.3|UART section of the ZPUino Technical Reference]].

[[#CRC16]]
!!!CRC16
->For more information refer to the [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf#section.4.4|CRC16 section of the ZPUino Technical Reference]].

[[#Interrupts]]
!!!Interrupts
->For more information refer to the [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf#section.4.5|Interrupts section of the ZPUino Technical Reference]].

[[#SigmaDelta]]
!!!SigmaDelta DAC
->For more information refer to the [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf#section.4.6|SigmaDelta DAC section of the ZPUino Technical Reference]].

[[#SPI]]
!!!SPI
->For more information refer to the [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf#section.4.7|SPI section of the ZPUino Technical Reference]].


----
[[#Libraries]]
!!!Libraries
[[#SmallFS]]
!!!SmallFS Library
->For more information refer to the [[http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf#section.5.1|SmallFS Library section of the ZPUino Technical Reference]].

[[#VGA]]
!!!HQVGA Library
*[[VGA]]

[[#VGALiquidCrystal]]
!!!VGALiquidCrystal Library
*[[VGALiquidCrystal]]

----
[[#Usage]]
[[#Section1]]
!!!Setup ZPUino Environment
>>round frame<<
To write code for the ZPUino we have a specially modified version of the Arduino IDE called the ZAP IDE. ZAP is short for ZPUino Arduino Papilio Soft Processor IDE. Please visit the [[ZAPIDE|ZAP IDE QuickStart]] page to setup the ZPUino Environment.
>><<

[[#Section2]]
!!!Run Hello World Example
>>round frame<<
* Open the ZPUino IDE and start a new sketch.
* Select any ZPUino board type that matches the type of hardware you have.
* Burn the Bootloader to load the correct ZPUino bit file to your Papilio board.
* Paste the following code into the new sketch
'''Hello World Code Example'''
(:source lang=c :)
void setup() {
//Setup Serial port
Serial.begin(9600);
// prints Hello World
Serial.println("Hello World!");
}

void loop(){
// prints Hello World over and over
Serial.println("Hello World!");
}
(:sourcend:)


%rfloat% http://arcade.gadgetfactory.net/images/arcademegawing/image034.jpg
* Determine which port the second Papilio COM port is connected to. If you are not sure which serial port is associated with the Papilio One then take a look at the Device Management tool in the Control Panel. It should be marked as Serial Converter B in the properties.
[[<<]]
%rfloat% http://arcade.gadgetfactory.net/images/arcademegawing/image035.jpg
* Set the board type to match your hardware.
[[<<]]
%rfloat% http://arcade.gadgetfactory.net/images/arcademegawing/image036.jpg
* Set the serial port to the second serial port of the Papilio that you determined in the previous step.
[[<<]]
%rfloat% http://arcade.gadgetfactory.net/images/arcademegawing/image037.jpg
* Upload the sketch to the Papilio, you should see that the sketch was loaded successfully.
[[<<]]
%rfloat width=330px% [[Attach:serial_image.png|Attach:serial_image.png]]
* Press the "Serial Monitor" icon, ensure the baud rate is set to 9600, and you should see Hello World!
[[<<]]
>><<
----
[[#Section3]]
!!!Getting Started with Hello World VGA Sketch on the ZPUino.
>>round frame<<
%rframe% http://youtu.be/MocpV6b5FYs
Alvaro added a VGA controller to the ZPUino and wrote an easy to use [[Papilio.VGA|VGA Library]]. His amazing work makes it easy for anyone to output VGA graphics with the Papilio.
* Open the ZPUino IDE and start a new sketch, or select any of the VGA example sketches from the ZAP IDE.
* Select any [[Hyperion]] Board type that matches your hardware in the ZAP IDE.
* Burn the Bootloader to load the correct ZPUino bit file to your Papilio board.
[[<<]]
* Paste the following code into the new sketch
(:source lang=c :)
#include "VGA.h"

void setup() {

VGA.clear();
VGA.setBackgroundColor(BLACK);
VGA.setColor(RED);
VGA.printtext(30,0,"Papilio/ZPUino");
VGA.printtext(35,10,"Hello World");
}

void loop() {

}
(:sourcend:)
%rfloat% http://arcade.gadgetfactory.net/images/arcademegawing/image037.jpg
* Upload the sketch to the Papilio and you should see the Hello World message show up on your VGA monitor!
[[<<]]
>><<
  

Share |