[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Writing To An IO FPGA Register
From: |
Ben Perry |
Subject: |
Re: [Discuss-gnuradio] Writing To An IO FPGA Register |
Date: |
Mon, 9 Feb 2009 21:56:43 -0500 |
So I am using higher-level interfaces to write to these registers.
Namely I am concerned with writing to the output enable register for
RxA. From my understanding of what I have to do I set up my source_c
and then I am able to write_oe/io with a value to either 0 for a? and
1 for b?. My code is below:
result = u._read_fpga_reg(usrp.FR_OE_1)
print result
result = (result | 0xFC<<8)
print u._write_oe(0,result,result)
print u._read_fpga_reg(usrp.FR_OE_1)
This is for an RFX2400 d'board so I should have access to the 8-topmost bits.
When I read the initial value in FR_OE_1 (RxA) I get 31 and after I
write the desired write_oe and read it back I get 32. All return
values are obviously in decimal. Any help would be appreciated.
Ben
On Mon, Feb 9, 2009 at 10:53 AM, Eric Blossom <address@hidden> wrote:
> On Mon, Feb 09, 2009 at 01:06:36AM -0500, Ben Perry wrote:
>> I am trying to write to an IO register on my FPGA to open the lines of
>> communication. Right now I am just using benchmark_tx.py as my test
>> case.
>>
>> In transmit_path.py I added the following
>>
>> self.u._write_fpga_reg(usrp.FR_OE_1,4227922944)
>> self.u._write_fpga_reg(usrp.FR_IO_1,4227922944)
>>
>> I based this off of code I saw in other places, however I am getting
>> an error. My error is below:
>>
>> Traceback (most recent call last):
>> File "./benchmark_tx.py", line 138, in <module>
>> main()
>> File "./benchmark_tx.py", line 102, in main
>> tb = my_top_block(mods[options.modulation], options)
>> File "./benchmark_tx.py", line 42, in __init__
>> self.txpath = transmit_path(modulator, options)
>> File
>> "/home/ben/Desktop/gnuradio/gnuradio-examples/python/digital/transmit_path.py",
>> line 68, in __init__
>> self._setup_usrp_sink()
>> File
>> "/home/ben/Desktop/gnuradio/gnuradio-examples/python/digital/transmit_path.py",
>> line 119, in _setup_usrp_sink
>> self.u._write_fpga_reg(usrp.FR_OE_1,4227922944)
>> File "/usr/local/lib/python2.5/site-packages/gnuradio/usrp/usrp_swig.py",
>> line 2254, in _write_fpga_reg
>> return _usrp_swig.usrp_sink_c_sptr__write_fpga_reg(*args, **kwargs)
>> TypeError: in method 'usrp_sink_c_sptr__write_fpga_reg', argument 3 of
>> type 'int'
>>
>> Any help with this would be appreciated.
>>
>> Also, I am new to Python. Is 0xFC00FC00 also correct for the register value?
>
> Uhh, why are you trying to directly write these particular low-level
> registers? There's a high-level interface to write these.
> Take a look at usrp_basic.h (and while you're at it, usrp_standard.h).
>
> Independent of that, your problem is that 4227922944 is too big to fit
> in a signed int. Try gru.hexint(0xfc00fc00).
>
>
--
Benjamin Perry
Georgia Tech, Undergraduate Computer Engineering
Vice President Scuba Tech
CS1371 TA
518.578.6207