微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > FPGA,CPLD和ASIC > FPGA串口接收死机

FPGA串口接收死机

时间:10-02 整理:3721RD 点击:
上位机使用labview与下位机FPGA进行双向通讯,波特率128000。程序运行十来秒后,上位机可以正常接收下位机发来的信号,但是下位机无法接收到上位机发来的信号,用示波器测了一下,串口线路中是有信号,所以本人分析是下位机串口接受程序出现了问题,或者有其他解决方法,求大神指点!
附下位机串口接受程序(借鉴的):
library IEEE;
use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity reciever is
--generic(framlenr:integer:=8);        --传送的数据位为8位   
   Port ( bclkr,rxdr:in std_logic;   --定义输入输出信号  
           r_ready:out std_logic;
            rbuf:out std_logic_vector(7 downto 0) );
end;
architecture Behavioral of reciever is
type states is (r_start,r_center,r_wait,r_sample,r_stop);--定义各子状态        
signal state:states:=r_start;
signal rxd_sync:std_logic;    -- rxd_sync内部信号,接受rxd输入
signal resetr:std_logic:='0';
begin
pro1:process(rxdr)      
begin
    if rxdr='0' then rxd_sync                    --状态1,等待起始位                  
              if rxd_sync='0' then
                 state                 --状态2,求出每位的中点
              if rxd_sync='0' then       --每个数据位被分为16等分,中点为8  
                 if count="0110" then
                    state                   --状态3,等待状态                  
              if count>="1110" then        
                 if rcnt=8 then
                    state rbufs(rcnt):=rxd_sync;  --状态4,数据位采样检测         
              rcnt:=rcnt+1;         
              state r_ready state<=r_start;         
       end case;        
     end if;   
  end process;
end Behavioral;

我用led显示r_ready端口,正常时是闪烁的,异样后就保持不变了

vhdl不懂,看着费劲。

只能建议lz用signaltap来观察相关的信号了。

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top