You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用FPGA(Verilog)驱动LED矩阵的故障排查求助

FPGA驱动LED矩阵显示异常调试求助

硬件配置:TinyFPGA BX 搭配 ICN2037驱动芯片的驱动板,对接对应LED显示屏。

此前用树莓派直接驱动过该矩阵,但刷新率不足,转而用FPGA驱动,代码基于树莓派版本开发,采用BCM方式驱动。目前屏幕显示随机左移的彩色线条,预期显示为棕色。

以下是当前的显示循环代码,完整项目可查看GitHub仓库(代码较杂乱):

integer _x = 0; // x is already used in verilog
integer y = 0;
integer bit = 0;
integer bcm_delay = 1;
integer bcm_counter = 1;
always @(posedge CLK) begin
    // TODO: colour depth

    if (bcm_counter >= (bcm_delay << bit)) begin
        ctrl_lat = 0; // Close latch to load in next data

        // Load colours
        col_buff[0] = colour[bit];                          // R1
        col_buff[1] = colour[bit];                          // R2
        col_buff[2] = colour[bit + bit_depth];              // G1
        col_buff[3] = colour[bit + bit_depth];              // G2
        col_buff[4] = colour[bit + bit_depth + bit_depth];  // B1
        col_buff[5] = colour[bit + bit_depth + bit_depth];  // B2
        
        ctrl_clk = 1;
        ctrl_clk = 0;

        _x = _x + 1;

        // Commit loaded colours
        if (_x >= width) begin
            _x = 0;

            ctrl_lat = 1; // Open latch to commit colours

            bit = bit + 1;
            bcm_counter = 1;
        end

        if (bit >= bit_depth) begin
            bit = 0;
            _address = _address + 1;
        end
        
        if (_address >= halfwidth) _address = 0;
    end

    bcm_counter = bcm_counter + 1;

    pwm_counter <= pwm_counter + 1; // PWM at clock frequency
end

我无法定位问题根源,猜测可能是BCM计数器递增错误,但认为这只会影响色深,不会导致线条左移。由于FPGA不支持综合for循环,所以用计数器和if语句实现逻辑,恳请协助调试。

内容的提问来源于stack exchange,提问作者dhodul

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 04:25:04