Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

pulse generation with de0 nano

hi, there,

i just received the nano board for my lab work. this is my first time touching this fancy board. what i wanna is a output 500ms pulse whose duty cycle is 1/60 (30s per cycle). i am totally no idea from where to get a start. the pulse amplitude i need is above 3V.

could any one give me any instruction for my task?

Thanks.

16 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    You could always take the empirical approach; put a software delay (loop) in for the low and high time of the pulse, probe the pin with a scope, and then adjust the loop times accordingly.

    Cheers,

    Dave

    --- Quote End ---

    btw, i did not find the pwm component coming with de0 nano board:(
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    i am confused on the def of software and hardware solution. do you mean i could use the tools like sopc to mod the components or what ever else?

    --- Quote End ---

    Sorry, its all very confusing if you are new to FPGAs :)

    You can use tools like SOPC Builder and Qsys to construct systems. Those systems can include a soft-core processor like the NIOS processor. Assuming you know how to program a processor, it might be simpler to start with FPGAs by using a processor based solution. Once you have designed an SOPC System, eg., like the "My First NIOS" tutorial, you can use the Eclipse development tools to change the software that runs on that processor. The tutorial shows you how to blink LEDs, and write messages to the JTAG-UART console.

    It sounds like you got as far as getting the tutorial to work, now go and change the design; add a new PIO component to the SOPC design. This will be your toggling pin. Then regenerate the system and connect it to pins at the top-level of your hardware design (much the same as the tutorial told you to do for the LEDs). Now you will have a way of controlling your pulse. Now go back to the Eclipse software, import the new sopc system, so that you get the address of your new PIO component, and you can use software to toggle that, eg., add a couple of loops to toggle the I/O high or low.

    Hopefully that is clearer.

    Once you get that working, we can talk about how to create a PWM component.

    Cheers,

    Dave
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Sorry, its all very confusing if you are new to FPGAs :)

    You can use tools like SOPC Builder and Qsys to construct systems. Those systems can include a soft-core processor like the NIOS processor. Assuming you know how to program a processor, it might be simpler to start with FPGAs by using a processor based solution. Once you have designed an SOPC System, eg., like the "My First NIOS" tutorial, you can use the Eclipse development tools to change the software that runs on that processor. The tutorial shows you how to blink LEDs, and write messages to the JTAG-UART console.

    It sounds like you got as far as getting the tutorial to work, now go and change the design; add a new PIO component to the SOPC design. This will be your toggling pin. Then regenerate the system and connect it to pins at the top-level of your hardware design (much the same as the tutorial told you to do for the LEDs). Now you will have a way of controlling your pulse. Now go back to the Eclipse software, import the new sopc system, so that you get the address of your new PIO component, and you can use software to toggle that, eg., add a couple of loops to toggle the I/O high or low.

    Hopefully that is clearer.

    Once you get that working, we can talk about how to create a PWM component.

    Cheers,

    Dave

    --- Quote End ---

    thanks Dave. as i said, i am totally new, so plz assume i do know nothing. :oops:

    here is what i did. i add a pio component named pio_pin in sopc builder. and add ".out port from the pio pin" in the vhdl file and recompile. when i try to build a new nois program like "hello world 0" in the tutorial, it says no template found in a specific folder.... i install quartus ii from the cd rom and download nois ii from the web.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Sorry, its all very confusing if you are new to FPGAs :)

    You can use tools like SOPC Builder and Qsys to construct systems. Those systems can include a soft-core processor like the NIOS processor. Assuming you know how to program a processor, it might be simpler to start with FPGAs by using a processor based solution. Once you have designed an SOPC System, eg., like the "My First NIOS" tutorial, you can use the Eclipse development tools to change the software that runs on that processor. The tutorial shows you how to blink LEDs, and write messages to the JTAG-UART console.

    It sounds like you got as far as getting the tutorial to work, now go and change the design; add a new PIO component to the SOPC design. This will be your toggling pin. Then regenerate the system and connect it to pins at the top-level of your hardware design (much the same as the tutorial told you to do for the LEDs). Now you will have a way of controlling your pulse. Now go back to the Eclipse software, import the new sopc system, so that you get the address of your new PIO component, and you can use software to toggle that, eg., add a couple of loops to toggle the I/O high or low.

    Hopefully that is clearer.

    Once you get that working, we can talk about how to create a PWM component.

    Cheers,

    Dave

    --- Quote End ---

    i update the version of quartus. and the problem in my last post has been solved. but the new trouble is when i build the project on the tutorial. i right click on the project name, but did not find system library properties.

    thanks.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    thanks Dave. as i said, i am totally new, so plz assume i do know nothing. :oops:

    --- Quote End ---

    Ok :)

    I haven't used the NIOS tools very much, so I don't have any advice to offer. However, since I started you down that track, I will make amends by providing you with the hardware-only solution.

    Download the attached zip file and unzip it. Start Modelsim and change to the directory you just unzipped; make sure you are in the top-level folder, the one containing src/, scripts/, and test/. At the modelsim command line type 'source scripts/sim.tcl', and then when that finishes, type 'pulse_generator_tb'.

    What you have there is a parameterized component that generates pulses with the high and low time you specify via generics. The test shows a 10ms period signal with 1ms pulses. You can change the parameters to whatever you like.

    I'll leave it as an exercise to the student for you to put it into your DE0-nano board.

    Cheers,

    Dave
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi everyone,

    As I'm completely new to FPGAs, could someone help me in generating PWMs using Sine PWM technique on my newly ordered DE0-Nano Development kit with Quartus II v13 (64 bit) tool.

    I've done the following steps, correct me if i'm wrong.

    1. Created a new block diagram/schematic file in Quartus II.

    2. Added basic functional blocks like 'sine-cos' and 'compare' from mega functions. But, I couldn't find the option to enter the required frequency parameters in 'sine-cos' and 'compare' blocks (Like we normally do in MATLAB simulation)

    3. Only floating point format in bits selection option is available.

    Hence, I couldn't proceed further. Pls help.

    Thanks in advance,

    Babloo.