Falling back to earth... - Page 1
Forum section: electronics / general

author: TomS_
author_rank: Frequent Contributor
timestamp: March 19, 2020, 07:24:34 am
content: You know those times when you feel like youre on a roll, and everything is working out. Then it stops working out, and all of a sudden you cant even seem to do something simple?Ive hit a situation like that.Ive started learning Verilog, and playing around with a MAX V CPLD development board.First I made an LED blink using a clock divider module I wrote, which worked great.Then I made a few other modules, some muxes and shift registers, and the simulations/testbenches all said they were working.Then I got cocky and tried to string a bunch of them together into a larger design based on a discrete version that I have made, which of coursedidntwork.OK, back to basics and lets try to figure out which bit isnt working, so I decided to try and see if my pins were being toggled correctly by a microcontroller by mirroring some internal signals out to another pin and, well, I cant even get a simple buffer from one input pin to one output pin to work now...This is what I tried:Code:`timescale 1ns/1psmodule test_top(input loop_in,output reg led1);// mux_2_1 ds_data_mux (// .sel(loop_in),// .in0(1'b0),// .in1(1'b1),// .out(led1)// );always @(loop_in) beginled1 = ~loop_in;endendmoduleI also tried led1 as a simple "output" and used an assign to set the value of it to the inverse of loop_in.The code for the mux, which is one of the modules I wrote and the testbench said was working is:Code:`timescale 1ns/1psmodule mux_2_1(input wire in0,input wire in1,input wire sel,output out);assign out = sel ? in1 : in0;endmoduleCan someone slap me the right way and figure out what is going on?After all of this I went back to a simple LED blinky with my clock divider and that still works, so theres probably something fundamental that Im not understanding here.Thanks!

author: TomS_
author_rank: Frequent Contributor
timestamp: March 19, 2020, 09:43:48 am
content: Went away for a while, came back, started a new project and "tried again" and now my super simple buffer is working fine.Not sure what I did or what is up with the other project, but I'll start building up from here and see what happens.

author: TomS_
author_rank: Frequent Contributor
timestamp: March 22, 2020, 09:08:28 am
content: Quick update, it does help if you use the right pins on the headers of your development board.There were a couple of GND and VCCIO pins mixed in between the IOs which threw some of my signals off. Rookie mistake.So once I noticed that and sorted it out, actually, everything worked great. Beginners luck perhaps, but riding the clouds again. 😋

author: Psi
author_rank: Super Contributor
timestamp: March 22, 2020, 09:18:18 am
content: One of the hard things about being an engineer is pushing through the periods when...Your code/app/device isn't working, you have no idea why, your attempts to debug it seem to show conflicting causes and you just let the magic smoke out when slipping with the meter probe so have to rebuilt it before continuing.Combine that with learning a new technology or language and it can be hell. But it is always always always nice and bright once you exit the tunnel. The memory of all the tunnels you've been through in the past makes it easier and easier to get through the next one.99% of the time the problem is something stupid or simple and you just have to keep going back to basics and backtracking the unexpected behavior as many times as needed, often intermixed with some intuition and guess work to prevent getting to stuck in a loop all day. Until you finally see the problem.To be a good engineer you need to be happy coming up with an unlimited number of different ways to problem solve an issue until the solution or bug shows itself.

author: TomS_
author_rank: Frequent Contributor
timestamp: March 22, 2020, 09:39:03 am
content: Yep! If there is one thing I have discovered it's that if I pursue a problem long enough I will come to an answer.Sometimes you have to be creative, sometimes you have to get a bit medieval, but I'm yet to run into a problem that I have been unable to fix with a bit of perseverance and patience.Quite a lot of times I actually figure it out after asking for help, or while in the process of writing up a request for help because you sort of go through your troubleshooting process and then realise there was something you didn't try, or that you should try differently, or you just have that little light bulb moment.So I go into all problems knowing that I am yet to fail fantastically. Sometimes you just have those moments.