Below is a short GNU Radio pipeline. Its purpose is to write an impulse response to a character device node representing an FPGA (which contains a 4-coefficient lowpass filter), read the FPGA's output, and store said output in a file.
#!/usr/bin/env python from gnuradio import gr, gru, eng_notation, optfir from gnuradio import blks from gnuradio.eng_option import eng_option import sys #import math class filter_impulse_test (gr.flow_graph): def __init__(self): gr.flow_graph.__init__(self) # build graph zeroes = [0 for i in range(20)] impulse = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0] impulse.extend(zeroes) src = gr.vector_source_f(impulse, 0) FPGA_OUT = gr.file_source(gr.sizeof_float, "/dev/MQP_Pipe") FPGA_IN = gr.file_sink(gr.sizeof_float, "/dev/MQP_Pipe") scale = gr.multiply_const_ff(1.0/65535.0) head = gr.head(gr.sizeof_float, 1016) # file as final sink file_sink = gr.file_sink(gr.sizeof_float, "./FPGA_impulse_test.dat") # now wire it all together # WILL NOT WORK SIMULTANEOUSLY. This is resolved in a later update with os.fork(). # This version is used for debugging reading from/writing to the FPGA individually. # Comment out the first self.connect() to read, and the second to write. self.connect (src, FPGA_IN) self.connect (FPGA_OUT, file_sink) #Removed 'scale' and 'head' blocks to ensure they were not #interfering with the file IO. if __name__ == '__main__': fg = filter_impulse_test() try: fg.run() except KeyboardInterrupt: pass ----------------------- The pipeline, however, just creates a file and doesn't write to it, leaving a file of 0 bytes. I can confirm that the FPGA is working properly, and that GNU Radio is writing properly and making requests to read properly given the FPGA driver debugger's output (screenshots included in this post). The data is just not getting from the FPGA to its final destination properly. The pipeline functioned properly with an earlier version of the driver (which did not support simultaneous read/write). While driver help isn't the primary focus of this mailing list, I'm fairly confident that portion of this demo is functioning properly. I was wondering if there were any limitations to the file_sink processing block that I'm unaware of... At least, it'd be appreciated if someone could point me to the code for gr.file_sink() itself. I get lost in the mass of processing blocks that make use of it when I try to search for it, and can't find the file_sink() block itself. ~ Francesco http://www.nabble.com/file/p22366939/writing.PNG writing.PNG http://www.nabble.com/file/p22366939/reading.PNG reading.PNG -- View this message in context: http://www.nabble.com/gr.file_sink%28%29-or-connect%28%29-limitations--tp22366939p22366939.html Sent from the GnuRadio mailing list archive at Nabble.com. _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio