wannaknow
Junior Member level 2
Hi,
I have a Nios system with Qsys components such as Interval timer, UART, SDRAM and some PIOs. My system specifications are DE0 Nano, Quartus 12.1 sp1, Altera monitor program. Nios II system are interfacing with several VHDL blocks.
I am able to read data from FPGA to Nios processor, then transmit this data to Uart component created in Qsys using direct register method (IORD_ALTERA_AVALON_UART_STATUS (UART_BASE); IOWR_ALTERA_AVALON_UART_TXDATA(UART_BASE, txdata);etc).
I am using USB-to-Serial interface to the board FTDI UM245R module.
I am able to read serial port and plot the graph real time in Matlab. However, I am having the issue where there is aliasing when I tried to reconstruct a sinusoidal waveform. This is because the incoming signal is 50Hz and the serial port receive rate is just 8 Hz.
I added a timer in my C code and I am able to get a perfect sinusoidal waveform with no aliasing, but I can't explain why. I googled and I know that what I was doing is actually "Equivalent Time Sampling" (ETS) concept which is very common in sampling oscilloscope where incoming signal has a higher sampling frequency than oscilloscope's sampling rate and can only be used on repetitive signal such as sinusoidal waveform. Basically, the ETS requires a first trigger, take first sample, wait for for rearm time, second trigger, delay, take second sample... but i failed to find a way to calculate those rearm time and delay...
This is the timer code in C code where i can get a perfect sinusoidal after i added this timer as delay.
Thank you in advance
I have a Nios system with Qsys components such as Interval timer, UART, SDRAM and some PIOs. My system specifications are DE0 Nano, Quartus 12.1 sp1, Altera monitor program. Nios II system are interfacing with several VHDL blocks.
I am able to read data from FPGA to Nios processor, then transmit this data to Uart component created in Qsys using direct register method (IORD_ALTERA_AVALON_UART_STATUS (UART_BASE); IOWR_ALTERA_AVALON_UART_TXDATA(UART_BASE, txdata);etc).
I am using USB-to-Serial interface to the board FTDI UM245R module.
I am able to read serial port and plot the graph real time in Matlab. However, I am having the issue where there is aliasing when I tried to reconstruct a sinusoidal waveform. This is because the incoming signal is 50Hz and the serial port receive rate is just 8 Hz.
I added a timer in my C code and I am able to get a perfect sinusoidal waveform with no aliasing, but I can't explain why. I googled and I know that what I was doing is actually "Equivalent Time Sampling" (ETS) concept which is very common in sampling oscilloscope where incoming signal has a higher sampling frequency than oscilloscope's sampling rate and can only be used on repetitive signal such as sinusoidal waveform. Basically, the ETS requires a first trigger, take first sample, wait for for rearm time, second trigger, delay, take second sample... but i failed to find a way to calculate those rearm time and delay...
This is the timer code in C code where i can get a perfect sinusoidal after i added this timer as delay.
Code:
int counter = 0x305600;
IOWR_ALTERA_AVALON_TIMER_PERIODL( TIMER0_BASE, (counter & 0xFFFF) );//lower significant bits for start value
IOWR_ALTERA_AVALON_TIMER_PERIODH( TIMER0_BASE, ((counter>>16) & 0xFFFF) ); //higher significant bits for start value
IOWR_ALTERA_AVALON_TIMER_STATUS( TIMER0_BASE, 0 ); //clear timeout
IOWR_ALTERA_AVALON_TIMER_CONTROL( TIMER0_BASE, 0x4 );//start timer
while((IORD_ALTERA_AVALON_TIMER_STATUS( TIMER0_BASE ) & ALTERA_AVALON_TIMER_STATUS_TO_MSK) == 0 )
{
}
Thank you in advance