User:Mgarcia6070/Arduino Uno to Papilio

Problem
The goal is to connect an Arduino Uno to a Papilio and send data from the Arduino to the Papilio.

Conceive
Build off from Xilinx VHDL UART Example

Design
Arduino Uno PINOUT

Papilio PINOUT

The transmit from the Arduino is connected to a pin that is originally used for a LED. The Arduino's ground is connected to the Papilio's. Follow the wire setup

library IEEE; use IEEE.STD_LOGIC_1164.ALL;

entity UARTExample is   Port ( segments : out STD_LOGIC_VECTOR (7 downto 0);			  anodes : out STD_LOGIC_VECTOR (3 downto 0);			  txard : in STD_LOGIC;           tx : out  STD_LOGIC;			  extclk : in STD_LOGIC			  ); end UARTExample;

architecture Behavioral of UARTExample is

component uart_tx is port (            data_in : in std_logic_vector(7 downto 0);                 write_buffer : in std_logic;                 reset_buffer : in std_logic;                 en_16_x_baud : in std_logic;                   serial_out : out std_logic;                  buffer_full : out std_logic;             buffer_half_full : out std_logic;                          clk : in std_logic); end component;

component uart_rx is port (      serial_in : in  STD_LOGIC;                   read_buffer : in  STD_LOGIC;           reset_buffer : in  STD_LOGIC;           en_16_x_baud : in  STD_LOGIC;                    clk : in  STD_LOGIC;                   data_out : out STD_LOGIC_VECTOR (7 downto 0);           buffer_data_present : out STD_LOGIC;			  buffer_half_full : out STD_LOGIC;            buffer_full : out STD_LOGIC); end component; COMPONENT dcm32to96 PORT(		CLKIN_IN : IN std_logic;         		CLKFX_OUT : OUT std_logic;		CLKIN_IBUFG_OUT : OUT std_logic;		CLK0_OUT : OUT std_logic		); END COMPONENT;

signal dout : STD_LOGIC_VECTOR (7 downto 0); signal data_present, en_16_x_baud, clk, clk32 : STD_LOGIC; signal baud_count : integer range 0 to 5 :=0; signal counter : STD_LOGIC_VECTOR (7 downto 0); signal ascii : STD_LOGIC_VECTOR (7 downto 0);

begin anodes <= "0000";

baud_timer: process(clk) begin if clk'event and clk='1' then if baud_count=1 then baud_count <= 0; en_16_x_baud <= '1'; else baud_count <= baud_count + 1; en_16_x_baud <= '0'; end if; end if;

-Seven Segment Display-- CASE dout(7 downto 0) IS	WHEN "01000001" => --A segments <= "10001000"; WHEN "01100001" => --a segments <= "10100011"; WHEN "01000010" => --B segments <= "00000000"; WHEN "01100010" => --b segments <= "10000011"; WHEN "01000011" => --C segments <= "11000110"; WHEN "01100011" => --c segments <= "10100111"; WHEN "01000100" => --D segments <= "11000000"; WHEN "01100100" => --d segments <= "10100001"; WHEN "01000101" => --E segments <= "10000110"; WHEN "01100101" => --e segments <= "10000100"; WHEN "01000110" => --F segments <= "10001110"; WHEN "01100110" => --f segments <= "10001110"; WHEN "01000111" => -- G		segments <= "10000010"; WHEN "01100111" => --g segments <= "10010000"; WHEN "01001000" => --H segments <= "10001001"; WHEN "01101000" => --h segments <= "10001011"; WHEN "01001001" => --I segments <= "10110110"; WHEN "01101001" => --i segments <= "11001111"; WHEN "01001010" => --J segments <= "11100001"; WHEN "01101010" => --j segments <= "11100001"; WHEN "01001011" => --k segments <= "11000110"; WHEN "01101011" => --k segments <= "10100111"; WHEN "01001100" => --L segments <= "11000111"; WHEN "01101100" => --l segments <= "11001111"; WHEN "01001101" => --M segments <= "10000110"; WHEN "01101101" => --m segments <= "10000110"; WHEN "01001110" => --N segments <= "11001000"; WHEN "01101110" => --n segments <= "10101011"; WHEN "01001111" => --O segments <= "01000000"; WHEN "01101111" => --o segments <= "00100011"; WHEN "01010000" => --P segments <= "10001100"; WHEN "01110000" => --p segments <= "10001100"; WHEN "01010001" => --Q segments <= "01000000"; WHEN "01110001" => --q segments <= "10011000"; WHEN "01010010" => --R segments <= "11001110"; WHEN "01110010" => --r segments <= "10101111"; WHEN "01010011" => --S segments <= "10010010"; WHEN "01110011" => --s segments <= "10010010"; WHEN "01010100" => --T segments <= "10000111"; WHEN "01110100" => --t segments <= "10000111"; WHEN "01010101" => --U segments <= "11000001"; WHEN "01110101" => --u segments <= "11100011"; WHEN "01010110" => --V segments <= "01000001"; WHEN "01110110" => --v segments <= "01100011"; WHEN "01010111" => --W segments <= "10110000"; WHEN "01110111" => --w segments <= "10110000"; WHEN "01011000" => --X segments <= "10001001"; WHEN "01111000" => --x segments <= "10001001"; WHEN "01011001" => --Y segments <= "10010001"; WHEN "01111001" => --y segments <= "10010001"; WHEN "01011010" => --Z segments <= "10100100"; WHEN "01111010" => --z segments <= "10100100"; WHEN "00110000" => --0 segments <= "11000000"; WHEN "00110001" => --1 segments <= "11111001"; WHEN "00110010" => --2 segments <= "10100100"; WHEN "00110011" => --3 segments <= "10110000"; WHEN "00110100" => --4 segments <= "10011001"; WHEN "00110101" => --5 segments <= "10010010"; WHEN "00110110" => --6 segments <= "10000010"; WHEN "00110111" => --7 segments <= "11111000"; WHEN "00111000" => --8 segments <= "10000000"; WHEN "00111001" => --9 segments <= "10010000"; WHEN OTHERS => segments <= "11111111"; -		end CASE;

end process baud_timer;

Inst_dcm32to96: dcm32to96 PORT MAP(		CLKIN_IN => extclk,		CLKFX_OUT => clk,		CLKIN_IBUFG_OUT => open,		CLK0_OUT => open	);

INST_UART_TX : uart_tx port map (  data_in => dout,    write_buffer => data_present,   reset_buffer => '0',   en_16_x_baud => en_16_x_baud,   clk => clk,   serial_out => tx,	buffer_half_full => open,   buffer_full => open );

INST_UART_RX : uart_rx port map (  serial_in => txard,   read_buffer => '1',   reset_buffer => '0',   en_16_x_baud => en_16_x_baud,   clk => clk,   data_out => dout,    buffer_data_present => data_present,	buffer_half_full => open,	buffer_full => open );

end Behavioral;

void setup { //Initialize serial and wait for port to open: Serial.begin(3000000); while (!Serial) { ; // wait for serial port to connect. } } // ASCII character 'A' is number 65: int thisByte = 65; void loop { // prints value unaltered, i.e. the raw binary version of the // byte. The serial monitor interprets all bytes as // ASCII, Serial.write(thisByte); delay(10); }

Implement
The transmit from the Arduino is connected to the serial in of the Papilio's receive. A signal bus will receive the data and that signal is connected to the data in of the transmit. Then the serial out is connected to the Papilio's transmit. To test if data is being sent and received properly, the data is implemented to a signal that drives the seven segment display. When the code is transmitted by Arduino, the Arduino's transmit led flashes as well as the Papilio's led in unison since the transmit of the Arduino is connected to a pin that corresponds with an led. The baud rate may be of or the whole code may be logically faulty.

Next Steps
Get the papilio to receive the data being transmitted by the arduino properly

Connect Ipod to Arduino, Send music from Arduino to Papilio, Connect the music to the VGA