u/Immediate_Try_8631

▲ 8 r/FPGA

Struggling to Write I2C RTL Code — Need Guidance

I’m currently learning I2C protocol and I understand the theoretical concepts like start/stop condition, ACK/NACK, addressing, read/write operations, etc.

But when it comes to writing the actual Verilog/VHDL code for an I2C controller, I’m getting stuck and confused about how to properly design the FSM and handle timing/control logic.

I’ve been trying to implement it on my own but I’m struggling to move forward.

Can anyone share guidance, resources, sample RTL structure, or explain how you approached coding an I2C master/slave design?

Any help would be really appreciated.

reddit.com
u/Immediate_Try_8631 — 13 hours ago
▲ 3 r/ECE

what is the best temperature control method for a small heating chamber ?

Hi everyone,

i am confused about an industrial temperature control project .

we have a small dome / chamber and we want to maintain the inside temperature at a constant room temperature, no matter what the outside temperature is ,

we can use any Microcontroller for this project, but the solution should also be cost effective

what would be the best approach for stable temperatures control ?

reddit.com
u/Immediate_Try_8631 — 8 days ago
▲ 2 r/AskElectronics+1 crossposts

what should i learn in Matlab for an image processing project ?

Hi Everyone ,

I have an image processing project in a few days and need to use MATLAB .

What are the most imp. topices I should learn first ? Any quick tips or resources would help.

reddit.com
u/Immediate_Try_8631 — 8 days ago
▲ 2 r/AskElectronics+1 crossposts

What is the best temperature control method for a large heating chamber ?

Hi Everyone ,

I am confused about a industrial heating chamber control project .

we have a large heating chamber , and the logic is:

  1. if temperature goes below 90 degree -> heater turns ON
  2. if temperature goes above 100 degree -> heater turns OFF

we can use any microcontroller for this project .

is this use any microcontroller for this project. but the solution also needs to be cost-effective.

is this a good approach for stable temperature control in a big chamber , or should we use something better like PID control ?

Would suggestions from experienced people .

reddit.com
u/Immediate_Try_8631 — 8 days ago
▲ 8 r/FPGA

module fifo_top #(

parameter DEPTH =16,

parameter DATA_WIDTH =8,

parameter ADDR_WIDTH = 4

)(

input clk,

input wr_en,

input rd_en,

input rst,

output full,

output empty,

input [DATA_WIDTH-1:0]wr_data,

output reg [DATA_WIDTH-1:0]rd_data

);

reg [DATA_WIDTH -1:0] mem [0:DEPTH-1];

reg [ADDR_WIDTH-1:0] rd_ptr;

reg [ADDR_WIDTH-1:0] wr_ptr;

//write opertion

always @(posedge clk or posedge rst) begin

if(rst)

wr_ptr <= 0;

else if (wr_en && !full)begin

mem[wr_ptr[ADDR_WIDTH-1:0]] <= wr_data;

wr_ptr <= wr_ptr +1;

end

end

//read opertion

always @(posedge clk or posedge rst) begin

if(rst) begin

rd_ptr <= 0;

rd_data <= 0;

end

else if(rd_en && !empty) begin

rd_data <= mem[rd_ptr[ADDR_WIDTH-1:0]];

end

end

// flag condition

assign empty = (wr_ptr == rd_ptr);

assign full = ((wr_ptr +1) == rd_ptr);

endmodule

Main confusion:
If both pointers become equal (like 0), how do I know if FIFO is FULL or EMPTY? Right now it always looks like EMPTY.

Also, I feel like my FULL condition might not be correct for all cases (especially wrap-around).

Code snippet (simplified):

assign empty = (wr_ptr == rd_ptr);
assign full  = ((wr_ptr + 1) == rd_ptr);

Am I missing something like an extra bit or counter? What’s the correct way to handle FULL detection in this design?

reddit.com
u/Immediate_Try_8631 — 21 days ago