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

Not understand the methods of writing values to ADC_BASE register ?

ThangND
Beginner
893 Views

I'm learning with the ADC-SoC kit. Currently, I'm following the example of ADC_SoC_HIGH_SPEED_ADC using Nios II Eclipse. There are some lines in the code example that I quite don't understand.
In the system header file, the ADC_BASE of channel A is defined as:
#define TERASIC_AD9254_A_BASE 0x61034

In the main file, the register TERASIC_AD9254_A_BASE is written and read by using the functions IOWR and IORD:
int Control = 50000;
IOWR(TERASIC_AD9254_A_BASE, 0x00, Control); //write value to register

Then, print the result as follows:
status_A = IORD(TERASIC_AD9254_A_BASE,0x00); //read value from register
printf("Channel A status = 0x%xh\n",status_A);

At first, I've thought the result would be 0xC350h (as 50000 in decimal equals to C350 in hexadecimal). However, surprisingly the result is 0x1h.

Then, I've opened the Qsys file in the Quartus Prime software and the register is describes as Avalon Memory Mapped Slave.

 

Screenshot 2021-07-23 065345.png

Can somebody explain me why this configuration leads to the result above ?? Thank you.


Notes: All the code examples can be found from the ADC-SoC system CD, in the directory: \ADC-SoC_v.1.0.5_SystemCD\Demonstrations\FPGA\ADC_SoC_HIGH_SPEED_ADC_HPS_Nios

0 Kudos
2 Replies
ThangND
Beginner
840 Views

Can anybody help me please ?? 

0 Kudos
EricMunYew_C_Intel
Moderator
806 Views

50000 is the sampling rate, not the ADC result. The value is the actual result.


0 Kudos
Reply