Altera_Forum
Honored Contributor
14 years agoI2C core issue
Hello.
I want to use Wishbone I2C core from OpenCores in my Nios project. Trying to send a byte, i write 0xA2 byte to TxR and set STA and WR bits, the TIP flag asserts high and then never negates until reset. The problem as i see might be in custom Wishbone to Avalon-MM wrapper i use with the following assignments:
signal scl_i,scl_o,sda_i,sda_o,scl_oen,sda_oen:std_logic;
signal s_clock,s_reset_n,s_waitrequest_n,s_irq,s_chipselect,s_write,s_read:std_logic;
signal s_address:std_logic_vector(2 downto 0);
signal s_readdata,s_writedata:std_logic_vector(7 downto 0);
begin
SDA<=sda_o when sda_oen='0' else sda_i;
SCL<=scl_o when scl_oen='0' else scl_i;
s_clock<=clock;
s_reset_n<=reset_n;
waitrequest_n<=s_waitrequest_n;
s_chipselect<=chipselect;
irq<=s_irq;
s_write<=write;
s_read<=read;
s_address<=address;
readdata<=s_readdata;
s_writedata<=writedata;
l1:i2c_master_top
port map(
wb_clk_i=>s_clock,
wb_rst_i=>'0',
arst_i=>s_reset_n,
wb_adr_i=>s_address,
wb_dat_i=>s_writedata,
wb_dat_o=>s_readdata,
wb_we_i=>s_write and (not s_read),
wb_stb_i=>s_chipselect,
wb_cyc_i=>s_write or s_read,
wb_ack_o=>s_waitrequest_n,
wb_inta_o=>s_irq,
scl_pad_i=>scl_i,
scl_pad_o=>scl_o,
scl_padoen_o=>scl_oen,
sda_pad_i=>sda_i,
sda_pad_o=>sda_o,
sda_padoen_o=>sda_oen
);
end architecture; According to wikipedia http://en.wikipedia.org/wiki/wishbone_(computer_bus) it should be ok. Is that I2C core bug or me doing somthing wrong?