[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss-gnuradio] help with _write_spi() and _read_spi() for daughterbo
[Discuss-gnuradio] help with _write_spi() and _read_spi() for daughterboard driver
Sat, 03 Oct 2009 13:20:44 -0400
Thunderbird 22.214.171.124 (Windows/20090812)
I am writing a driver for a daughterboard and using the methods
_write_spi() and _read_spi() to write and read on to the daughterboard
registers. The write operation is as follows.
usrp()->_write_spi(hdr, spi_enable, spi_format,s)
hdr : 16 bits (15th bit - r/w, bits 1-14 - register address, 0th bit-
auto increment) //This format is specified in the daughterboard document.
s : Data to be written on the selected register. Data type is std:: string
Reading the data from the daugherboard is as follows.
1) Whichever is the last register on which data is written, data can be
read off starting from that particular address using the following.
r = usrp()->_read_spi(hdr,enables, format, length) //I take the hdr as
0 here(equivalent to no header since it is not needed)
Now the size of the register is 1 byte.
SO I PREPARE THE STRING IN THE FOLLOWING WAY.
c = (char)(dat & 0xff) // dat is the value that needs to be written
to the resister. Values are between 0 and 255
std::string s(c,1); //I send this value of s to the write_spi function
that I have mentioned above/
So here is the summary of what I do to check if the register is being
written correctly or not.
1) Write register number 5 say
2) Write register 0
3) Read the first 10 bits say in string r.
But I am get an empty string. Is my preparation of string s correct?
Also can somebody tell me if whether I am making a mistake with the
read or the write?
Description: S/MIME Cryptographic Signature
|[Prev in Thread]
||[Next in Thread]|
- [Discuss-gnuradio] help with _write_spi() and _read_spi() for daughterboard driver,
Sriram Krishnan <=