Author Topic: [Closed:Faulty] Clock works intermittently - Cyclone IV board from Aliexpress  (Read 2627 times)

0 Members and 1 Guest are viewing this topic.

Offline plastygroveTopic starter

  • Contributor
  • Posts: 39
Hi all  - This may be a noob question.

I am using ALTERA Cyclone IV EP4CE6 FPGA board from Aliexpress and am running into strange issues with the clock. The board has a 50 MHz oscillator which is connected to pin 23 of the FPGA.

I have a simple blinking code that I'm trying to run and here is what is happening.

Day 1 - Blink doesn't work, no matter what I try. Things I tried:

  - Reduce the counter to 2 bits and use a push button switch as a fake clock. It works perfectly.
  - Change IOStandard of the pins from 2.5V (default) to 3.0V and 3.3V for both (LVTTL and LVCMOS).
  - Unplug the USB blaster and reconnect and re-flash. Turn the board off and on.
  - Program using active serial onto EEPROM and power the board off and on.
 
Day 2 - I just plug it in and it works. Dont' know why. I leave it on the whole day and even modify the code a bit and flash it again. It just works. I turn it off and go to bed.

Day 3 - Stops working again. Exact same code from yesterday. Tried everything from day 1 again and doesn't work.

Here is the verilog code.
Here is the constraints file.
Here is the schematic of the board.

Question - Is the clock or some connection damaged? Should I just throw this board and use a different one? Or am I doing something fundamentally wrong?

I'm using Quartus Prime 19.1 and the chip is FPGA Cyclone IV series EP4CE6E22C8N
« Last Edit: May 18, 2020, 08:48:04 am by plastygrove »
 

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2803
  • Country: nz
Re: Clock works intermittently - Cyclone IV board from Aliexpress
« Reply #1 on: May 16, 2020, 04:27:12 am »
Where's you pin mapping/binding? Can't see it in the constraint (but I am looking at this on my phone....)
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Offline plastygroveTopic starter

  • Contributor
  • Posts: 39
Re: Clock works intermittently - Cyclone IV board from Aliexpress
« Reply #2 on: May 16, 2020, 05:17:03 am »
Sorry, do I need to specify all the pins in the constraint file? I thought it was only needed for the clock.

I did the pin assignment using pin planner, here's the screenshot:

 

Offline Bassman59

  • Super Contributor
  • ***
  • Posts: 2501
  • Country: us
  • Yes, I do this for a living
Re: Clock works intermittently - Cyclone IV board from Aliexpress
« Reply #3 on: May 16, 2020, 06:14:56 am »
Sorry, do I need to specify all the pins in the constraint file? I thought it was only needed for the clock.

Yes, of course. Every pin in the design needs a placement constraint -- otherwise how would the tools know to choose the pins connected to your LEDs and which one is your clock?

The I/O standard must match the bank voltage supply. You can't just arbitrarily choose it. LVTTL vs CMOS sets the input logic thresholds but it should match the driving source or the output.

Use an oscilloscope to verify that the oscillator works and that the output pins are toggling. LEDs need to be toggled at a "slow" rate, otherwise you won't see them turn off and on.
 

Offline plastygroveTopic starter

  • Contributor
  • Posts: 39
Re: Clock works intermittently - Cyclone IV board from Aliexpress
« Reply #4 on: May 16, 2020, 06:31:22 am »
Yes, of course. Every pin in the design needs a placement constraint -- otherwise how would the tools know to choose the pins connected to your LEDs and which one is your clock?

My understanding was that in quartus that's done through the pin planner and the constraints file (Section 3 in this pdf) is only needed for the timing analyzer. Please correct me if I'm wrong. Previously, when it worked, I didn't even have the constraints file.

The I/O standard must match the bank voltage supply. You can't just arbitrarily choose it. LVTTL vs CMOS sets the input logic thresholds but it should match the driving source or the output.

Documentation is a bit sparse, so I'm not sure which one I should use here. The last time it worked was using 2.5V which is the default.

Use an oscilloscope to verify that the oscillator works and that the output pins are toggling. LEDs need to be toggled at a "slow" rate, otherwise you won't see them turn off and on.

That's not an option unfortunately with the lockdown. :(
 

Offline Bassman59

  • Super Contributor
  • ***
  • Posts: 2501
  • Country: us
  • Yes, I do this for a living
Re: Clock works intermittently - Cyclone IV board from Aliexpress
« Reply #5 on: May 16, 2020, 04:25:52 pm »
Yes, of course. Every pin in the design needs a placement constraint -- otherwise how would the tools know to choose the pins connected to your LEDs and which one is your clock?

My understanding was that in quartus that's done through the pin planner and the constraints file (Section 3 in this pdf) is only needed for the timing analyzer. Please correct me if I'm wrong. Previously, when it worked, I didn't even have the constraints file.

The pin planner ultimately writes a constraint file.

You need a placement constraint always, whether it’s done in the text file or through the planner shouldn’t matter.

You also need a timing (period) constraint to ensure that the design works at the intended frequency.  Which is to say, always.

The I/O standard must match the bank voltage supply. You can't just arbitrarily choose it. LVTTL vs CMOS sets the input logic thresholds but it should match the driving source or the output.

Documentation is a bit sparse, so I'm not sure which one I should use here. The last time it worked was using 2.5V which is the default.

The schematic tells you the bank voltage, and hence the pin voltage. Do you have the schematic? If not, bin the thing. As for LVTTL vs CMOS, if you are driving LEDs it should be CMOS.  In any case, the output pins swing to the rail subject to load current. And you need to set the output current in the pin planner.

Use an oscilloscope to verify that the oscillator works and that the output pins are toggling. LEDs need to be toggled at a "slow" rate, otherwise you won't see them turn off and on.

That's not an option unfortunately with the lockdown. :(

Then you’re blind. Sorry I can’t help with that.
« Last Edit: May 17, 2020, 03:38:14 am by Bassman59 »
 

Offline plastygroveTopic starter

  • Contributor
  • Posts: 39
Re: Clock works intermittently - Cyclone IV board from Aliexpress
« Reply #6 on: May 17, 2020, 01:37:35 am »

The schematic tells you the bank voltage, and hence the pin voltage. Do you have the schematic? If not, bin the thing. As for LVTTL vs CMOS, if you are driving LEDs it should be CMOS.  In any case, the output pins swing to the rail subject to load current. And you need to set the output current in the pin planner.


This is very helpful thanks. The schematic does have the bank voltage and it shows 3.3V. Unfortunately, that didn't change anything. At this point I'm ready to give up. The board has been in storage for 3 years at least and maybe moisture or something has rendered the oscillator unreliable. Or maybe I am doing something fundamentally wrong with the software stack that is causing this issue. I am hesitant to buy these cheap boards anymore, the possibility of something going wrong seems higher.



The reason I really wanted this board to work was because it has a built-in VGA and I was hoping to get some video output eventually. I have an iCEstick board as well which I was able to get up and running quite reliably quite fast. Downsides of this board though are that it only has 1K logic gates compared to the 6K in the aliexpress board and it only has a serial programmer (no JTAG) which is a bit slower.

Thanks much for your help though!
 

Offline Wiljan

  • Regular Contributor
  • *
  • Posts: 225
  • Country: dk
Re: Clock works intermittently - Cyclone IV board from Aliexpress
« Reply #7 on: May 17, 2020, 05:34:05 am »
How are you powering the board? Try with an externsl 5v psu instread of usb.
Also try making  some code reading input sw and some logic to drive leds without any clk and see it that is stable each time you program the board.
Next make counter to the leds wit a push button as clk and see if it counts. (It will count wrong due to noise / no debounce)
If the above works the osc might be faulty and a scope would be a next step but you could measure the 3v3 and see it is steady and also try to resolder the osc
« Last Edit: May 17, 2020, 07:11:43 am by Wiljan »
 

Offline ale500

  • Frequent Contributor
  • **
  • Posts: 415
Re: Clock works intermittently - Cyclone IV board from Aliexpress
« Reply #8 on: May 17, 2020, 06:59:47 am »
I think that some problems with that board are due to missing decoupling. At least my board, that looks very similar to yours, has one 100 nF on the 3v3 rail only.
 

Offline plastygroveTopic starter

  • Contributor
  • Posts: 39
Re: Clock works intermittently - Cyclone IV board from Aliexpress
« Reply #9 on: May 17, 2020, 07:18:13 am »
How ære you powering the board? Try with an externsl 5v psu instread of usb.
Thanks for the suggestion. I was powering it with USB. Just tried it with a standalone 5V phone charger and doesn't work.

Also try making  some code reading input sw and some logic to drive leds without any clk and see it that is stable each time you program the board.
Next make counter to the leds wit a push button as clk and see if it counts. (It will count wrong due to noise / no debounce)
If the above works the osc might be faulty and a scope would be a next step but you could measure the 3v3 and see it is steady and also try to resolder the osc

I tried both of these and they work just fine quite reliably. Simple combinational logic works perfectly fine. I even used a push button switch as the clk and it works perfectly fine too (with a 2 bit counter though). The only thing that doesn't work is the actual oscillator. :(

Resoldering will have to wait until the lockdown ends unfortunately. :(

I think that some problems with that board are due to missing decoupling. At least my board, that looks very similar to yours, has one 100 nF on the 3v3 rail only.

It's possible. I bought this board 3 years ago and never used it. Maybe the latest version of this board doesn't have this issue? Also, can an oscillator be so susceptible to decoupling? Esp if it's powered by the USB from my laptop?
 

Offline Wiljan

  • Regular Contributor
  • *
  • Posts: 225
  • Country: dk
Re: Clock works intermittently - Cyclone IV board from Aliexpress
« Reply #10 on: May 17, 2020, 07:53:32 am »
Great to hear the the board and not complete dead  :)

You could try to connect some external "clk" if you have any other board around steal a x Mhz and insert in on a i/o pin
or  sending 0x55 with a high baudrate to the serial port and use the data pin as clk in the FPGA
or connect a PS2 keyboard and keep a key pressed constant and grab the clk form the PS2

Guess they are many way you can have some fun even if the internal osc are broken...

Try to take a closeup picture of the osc solder joints to see if they do look good... you can try to press a little on the solder joint of the osc and see it it than starts to work (broken solder joint)

In the schematic for the board i found https://yadi.sk/d/WWPc2vLC3PWCRp there seems to be many cap's installed so I doubt that's problem, but sure you board might be a "ripped" clone to keep cost down
 

Offline ebclr

  • Super Contributor
  • ***
  • Posts: 2328
  • Country: 00
Re: Clock works intermittently - Cyclone IV board from Aliexpress
« Reply #11 on: May 17, 2020, 09:38:10 am »
95% probability that the problem, is in the person behind the board, This kind of board normally comes with some demos, try the demo they will check the board, It's a very basic board have very few things to fail

Demo code for your board

https://drive.google.com/file/d/0B1JMWID3C7KNa1RxM0NzeFIwdUk/view
« Last Edit: May 17, 2020, 09:43:53 am by ebclr »
 

Offline plastygroveTopic starter

  • Contributor
  • Posts: 39
Re: Clock works intermittently - Cyclone IV board from Aliexpress
« Reply #12 on: May 17, 2020, 10:54:17 am »
Great to hear the the board and not complete dead  :)

You could try to connect some external "clk" if you have any other board around steal a x Mhz and insert in on a i/o pin
or  sending 0x55 with a high baudrate to the serial port and use the data pin as clk in the FPGA
or connect a PS2 keyboard and keep a key pressed constant and grab the clk form the PS2

These are some excellent ideas. I never thought about hooking it up to an external oscillator! I'm sure I have an Arduino lying around somewhere, should at least give me a 16MHz clock (or thereabouts). Thanks for the suggestion.

Try to take a closeup picture of the osc solder joints to see if they do look good... you can try to press a little on the solder joint of the osc and see it it than starts to work (broken solder joint)

In the schematic for the board i found https://yadi.sk/d/WWPc2vLC3PWCRp there seems to be many cap's installed so I doubt that's problem, but sure you board might be a "ripped" clone to keep cost down

This is also a good idea - can't find anything wrong with my naked eye. Poked it around a few times, seems to be placed in quite firmly though. Maybe worth closer examination.

95% probability that the problem, is in the person behind the board, This kind of board normally comes with some demos, try the demo they will check the board, It's a very basic board have very few things to fail

Demo code for your board

https://drive.google.com/file/d/0B1JMWID3C7KNa1RxM0NzeFIwdUk/view

Definitely not ruling out the person behind the board :). Thanks so much for the demo code, having some difficulty downloading it though (keeps dying with NETWORK_FAILED). I'll get it eventually though and post back if it works! :)

Appreciate all the helpful suggestion!
 

Offline plastygroveTopic starter

  • Contributor
  • Posts: 39
Re: Clock works intermittently - Cyclone IV board from Aliexpress
« Reply #13 on: May 17, 2020, 11:30:14 am »
Tried the sample code and can confirm it doesn't work either. Code is a simple 4-Led blink program (led_twinkle) and uses the same pins that I used. LEDs don't change. Here's a video.

EDIT: Just a note, I'm using Quartus Lite 19.1 while the sample code uses Quartus 13. I'm assuming that shouldn't make a difference since it compiles fine, but if not please let me know and I'll download Quartus 13.

Also if it helps, here are the complete log messages when compiling.

« Last Edit: May 17, 2020, 11:38:00 am by plastygrove »
 

Offline plastygroveTopic starter

  • Contributor
  • Posts: 39
Re: Clock works intermittently - Cyclone IV board from Aliexpress
« Reply #14 on: May 18, 2020, 08:46:52 am »
I tried it with the Quartus 13 as well and didn't make a difference. I guess safe to say the clock isn't working and I'll just put it back in storage. Maybe can use it at some point with the trick WilJan suggested, but until then I'll just use the icestick. Thanks all for your help and suggestions! It is much appreciated! :)
 

Online Ice-Tea

  • Super Contributor
  • ***
  • Posts: 3064
  • Country: be
    • Freelance Hardware Engineer
If you have a working Icestick, you can always use an IO there to output a clock and feed it to the Cyclone board ;)

Offline plastygroveTopic starter

  • Contributor
  • Posts: 39
If you have a working Icestick, you can always use an IO there to output a clock and feed it to the Cyclone board ;)

Yup - the icestick has only 1K logic elements, I'm sure I'll run out pretty quickly if I implement a CPU with VGA controller. That's when I'll probably feed the 12MHz clock on the icestick to the cyclone board. Alternatively, I could also use an arduino board to drive the clock as well. :)
 

Offline ebclr

  • Super Contributor
  • ***
  • Posts: 2328
  • Country: 00
I believe that he suggested the ice stick only as a tool to generate the clock for test purposes
 

Offline plastygroveTopic starter

  • Contributor
  • Posts: 39
I believe that he suggested the ice stick only as a tool to generate the clock for test purposes

Fair enough. I tested it using the push button switch and it does work, so pretty confident that it will work with an external clock signal feeding into a pin :).
 

Offline asmi

  • Super Contributor
  • ***
  • Posts: 2728
  • Country: ca
Fair enough. I tested it using the push button switch and it does work, so pretty confident that it will work with an external clock signal feeding into a pin :).
I would desolder and replace the clock generator IC on that board. Though I have never seen them fail like that, but they are cheap so - why not?


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf