首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何设置adv7513?

如何设置adv7513?
EN

Stack Overflow用户
提问于 2019-06-02 20:07:52
回答 1查看 204关注 0票数 0

我正在altera GX初学者工具包上设置adv7513。我在设置后从寄存器读取的数据与我发送的数据不同。

我尝试将写入划分到单个寄存器,而不是一个长事务,并更改写入和读取的顺序,但我总是从0x98读取0x03,从其余寄存器读取0x00。

我使用过这个i2c控制器:https://www.digikey.com/eewiki/pages/viewpage.action?pageId=10125324

我用vhdl实现了状态机的控制,并将存储在rom中的数据写入。

代码语言:javascript
复制
if rising_edge(clk) then

    case state is
    when idle =>
        if (beg='1') then
        state <= start;
        else
        state <= idle;
        end if;
    when start =>
        rom_addr <= count;
        state <= lut_addr_i2c;
    when lut_addr_i2c =>
        ena <= '1'; 
        rw <= '0';
        addr <= "0111001";
        data_wr <= lut_data(15 downto 8);
        state <= lut_data_i2c;
    when lut_data_i2c =>
        if (busy='1' and busy_prev='0') then
        data_wr <= lut_data(7 downto 0);
        state <= cleanup;
        count <= count+1;
        end if;
    when cleanup =>
        if (busy='1' and busy_prev='0') then
        state <= next_lut;
        end if;
    when next_lut =>
        if (count = 31) then
        state <= rd;
        ena <= '0';
        else 
        state <= start;
        end if;
    when rd =>
        ready <= '1';
        count <= 0;
        if (rd_delay = 10000) then
        state <= start_rd;
        else 
        rd_delay <= rd_delay+1;
        state <= rd;
        end if;
    when start_rd =>
        rom_addr <= count;
        if (next_rd = 20000) then
        state <= rd_lut_addr;
        next_rd <= 0;
        else 
        next_rd <= next_rd+1;
        state <= start_rd;
        end if;
    when rd_lut_addr =>
        ena <= '1'; 
        rw <= '0';
        addr <= "0111001";
        data_wr <= lut_data(15 downto 8);
        state <= rd_lut;
    when rd_lut =>
        if (busy='1' and busy_prev='0') then
        rw <= '1';
        count <= count+1;
        state <= rd_cleanup;
        end if;
    when rd_cleanup =>
        if (busy='1' and busy_prev='0') then
        state <= rd_next_lut;
        end if;
    when rd_next_lut => 
        if (count = 31) then
        state <= fin;
        ena <= '0';
        else 
        state <= start_rd;
        ena <= '0';
        end if;
    when fin =>
        state <= fin;
    end case;
    end if;

signal tap, what I write

signal tap, what I read

EN

回答 1

Stack Overflow用户

发布于 2019-06-02 23:04:59

我认为您的问题在于您只是使i2c从进程溢出。您应该在提供第二个数据字节之后等待处于清理状态的not busy

您的代码似乎根本不等待not busy

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56414858

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档