Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

usleep Compiled out?

Altera_Forum
Honored Contributor II
1,182 Views

Hello,  

I have a Max 10 based project that is running into an interesting/confusing bug. 

My project is connected to an image sensor, and is using a Nios based I2C master to control the sensor. 

It makes a series of I2C writes to the sensors, where the first write is a reset/don't run command, followed by a 5ms break, then the rest of the register writes for settings. 

 

When I program my fpga, and then use the eclipse tool "Run as Nios Hardware" command, I can see these writes, spaced out by the 5ms pause, (and proper image data), on my logic probe. 

When I elf2hex the code, check the hex into the Onchip Memory module in QSYS, regenerate QSYS, recompile Quartus, and use the programmer to push the .pof file, I see these I2C writes, with no 5ms, (and resultantly, no proper image data).  

 

I have tried this process twice now, and cannot seem to get the 5ms pause I need. 

 

So, my question is, is there a possibility the hex file is being compiled without the usleep command, or some other Quartus compile flag I am not aware of, that would be preventing my 5ms sleep pause? 

 

 

Thank you for any advice (and let me know if you need more details).
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
407 Views

I don't think so. And as the usleep function uses a calibrated delay loop there is no need for an initialized timer for it to work properly. The only think I see is that the function alt_busy_sleep will skip the delay if compiled with ALT_SIM_OPTIMIZED to speed up the simulations, but there is no reason why this would be the case when you convert the code to hex. 

Can you make another change in your software and see if it is applied when you put it directly in the .pof file? One common mistake is to use a wrong name for the .hex file or put it in the wrong place and then Quartus just picks up an old version of your software when generating the .pof file instead of your new one.
0 Kudos
Reply