Forum Discussion
4 Replies
- Altera_Forum
Honored Contributor
The pin-assignment for the ADC can be found on page 22 in the user manual (http://www.altera.com/literature/ug/de0_nano_user_manual_v1.9.pdf).
However, the ADC can be put into operation using altera's manual (ftp://ftp.altera.com/up/pub/altera_material/12.1/tutorials/de0-nano/using_de0-nano_adc.pdf). It didn't work for me on the first attempt, here is how it can be done using Nios II / Quartus II 14.1. Install the university program (http://www.altera.com/education/univ/software/upds/unv-upds.html) first! - Start Quartus - New Project - Choose a new folder named adc_example as the working directory and name the project my_adc - Empty project... Device family is cyclone iv e and the device is ep4ce22f17c6 - select Tools > Qsys, save the system as: de0_nano_sopc.qsys - rename the clock clk_50 - Add a Nios II (Classic) Processor and select Nios II/e, use F2 to rename the Processor cpu - Add 40960 Bytes of On-Chip Memory (RAM or ROM) and rename it to onchip_memory2 - Add JTAG-UART and rename it to jtag_uart - Add an output port (PIO) and name it pio_led - Add a System ID peripheral and name it sysid - Add the ADC which is found under University program / Generic IO / de0-nano adc controller - Change the number of channels used to 2 - Rename the adc adc - Export the connections for the LEDs and the ADC to led_pio and adc - Wire the components like in the attached screenshot. - Edit the cpu: Assign Reset and Exception vectors to onchip_memory2 - Click System > Assign Base Adresses, Refresh the System using F5, Save and generate - Altera_Forum
Honored Contributor
- Back in Qsys, the file DE0_NANO_SOPC.qip can be added (by right clicking on Files)
- Select File > New Block Diagram, right click in the blank space > insert symbol and select de0_nano_sopc - Insert the symbol, right click it and select generate pins for symbol ports - Save as my_adc.bdf - Start Compilation - Use the Pin Planner to Assign the pins (Attachment in above post) - Start Compilation - Open Nios II and select ADC_example as the workspace - Select new > nios ii application and bsp from template - Select the DE0_NANO_SOPC.sopcinfo - File, name the project hello, select the hello world small template and click finish. Right click Hello_bsp > Nios II > BSP Editor - In the BSP Editor hit enable_small_c_library and click generate - In Nios II right click Hello and select build project - Connect your board using a USB-cable that is not too long. Open Quartus II Programmer, add file my_adc.sof (if the USB Blaster doesn't work, look here http://www.alteraforum.com/forum/showthread.php?t=28514) - Click Start to be happy to see Progress: 100% (Successful) - In Nios, right click Hello and select run as > nios ii hardware - Be happy to see 'Hello from Nios II!' in your console! - Double click hello_world.c (under Hello). Insert the C code from page 11 of the manual (ftp://ftp.altera.com/up/pub/altera_material/12.1/tutorials/de0-nano/using_de0-nano_adc.pdf). - Open the project folder and open de0_nano_sopc.html (in the folder DE0_NANO_SOPC) in your browser and find the adresses of the SOPC components. - In the C-Code, change the defined adresses of adc_addr and led_addr accordingly. - Save hello_world.c and build the project - Setup the Hardware using a (100K) potentiometer like on page 135 of the DE0_NANO_User_Manual (or page 4f of 'Using_DE0-Nano_ADC') - In Nios right click Hello and run as > nios ii hardware to see that now the binary output register is assigned to the LEDs. - Back in Nios, edit the C-Code by inserting printf("Philipp is the boss!\n"); right under int main (void){. - Save, Build Project and run as > nios ii hardware to give me thanks ;) - Altera_Forum
Honored Contributor
- Back in Qsys, the file de0_nano_sopc.qip can be added (by right clicking on Files)
- Select File > New Block Diagram, right click in the blank space > insert symbol and select de0_nano_sopc - Insert the symbol, right click it and select generate pins for symbol ports - Save as my_adc.bdf - Start Compilation - Use the pin planner to Assign the pins (Attachment of above post) - Start Compilation - Open Nios II and select adc_example as the workspace - Select new > nios ii application and bsp from template - Select the DE0_NANO_SOPC.sopcinfo - File, name the project Hello, select the hello world small template and click finish. Right click Hello_bsp > nios ii > bsp editor - In the BSP Editor hit enable_small_c_library and click generate - In Nios II right click Hello and select build project - Connect your board using a USB-cable that is not too long. Open Quartus II Programmer, add file my_adc.sof (if the USB Blaster doesn't work, look here (http://www.alteraforum.com/forum/showthread.php?t=28514)) - Click Start to be happy to see Progress: 100% (Successful) - In Nios, right click Hello and select run as > nios ii hardware - Be happy to see 'Hello from Nios II!' in your console! - Double click hello_world.c (under Hello). Insert the C code from page 11 of the manual (ftp://ftp.altera.com/up/pub/altera_material/12.1/tutorials/de0-nano/using_de0-nano_adc.pdf). - Open the project folder and open de0_nano_sopc.html (in the folder DE0_NANO_SOPC) in your browser and find the adresses of the SOPC components. - In the C-Code, change the defined adresses of adc_addr and led_addr accordingly. - Save hello_world.c and build the Project - Setup the Hardware using a (100K) potentiometer like on page 135 of the DE0_NANO_User_Manual (or page 4f of 'Using_DE0-Nano_ADC') - In Nios right click Hello and run as > nios ii hardware to see the binary register output assigned to the LEDs. - Back in Nios, edit the C-Code by inserting printf("Philipp is the boss!\n"); right under int main (void){. - Save, Build Project and run as > nios ii hardware to give me thanks ;) - Altera_Forum
Honored Contributor
--- Quote Start --- Is it that there's an error in the Tutorial "Using the DE0-Nano ADC Controller"? Using the code on page 10, starting Analysis & Synthesis results in the error "top level design entity "adc_system" is undefined". First line of code is: module adc_demo... Using adc_system instead seems to work. --- Quote End --- yes there is, but is not the code, page 6 clearly states: "to make a new system with the adc controller, create a new project in quartus ii named adc_demo. the top-level module should also be adc_demo." the error is in page 8 when it states: "create a new verilog file and copy the code from figure 8 into it, or use the one provided in the “design files” subdirectory. save this file as adc_system.v" even the provided file is correctly named adc_demo.v best regards.