USRP on RedHawk - redhawksdr

I'm trying to use a USRP platform (B100,USRP1 or B2x0) on Redhawk.
I installed redhawk 1.9.0,uhd driver and usrp_uhd device on centOS6.5_x64, both virtual machine and native, and I made a node including USRP_UHD and GPP device, a simple component and waveform.
I would like to test simple waveform on my previous node but I got this error when the device manager run:
WARN:Device_impl - Unable to connect to IDM channel
INFO:DeviceManager_impl - Registering device USRP_UHD_1 on Device
Manager uhd_node
INFO:DeviceManager_impl - Initializing device USRP_UHD_1 on Device
Manager uhd_node
-- Opening a USRP1 device...
INFO:uhd_node:GPP_1:Registering Device
INFO:DeviceManager_impl - Registering device GPP_1 on Device Manager uhd_node
-- Using FPGA clock rate of 64.000000MHz...
ERROR:USRP_UHD_i - USRP COULD NOT BE INITIALIZED!
WARN:USRP_UHD_i - CAUGHT EXCEPTION WHEN INITIALIZING USRP. WAITING 1
SECOND AND TRYING AGAIN
ERROR:uhd_node:GPP_1:Could not register with DeviceManager: timeout
while attempting to register
ERROR:USRP_UHD_i - USRP COULD NOT BE INITIALIZED!
ERROR:USRP_UHD_i - Unable to initialize USRP!
ERROR:DeviceManager_impl - Device 'USRP_UHD' -
'DCE:631ec04b-1541-4992-b007-5d7c87874f5d' may not have been
configured correctly; Call to configure() resulted in
InvalidConfiguration exception
INFO:DeviceManager_impl - Registering device USRP_UHD_1 on Domain Manager
INFO:DeviceManager_impl - Initializing device GPP_1 on Device Manager uhd_node
INFO:DeviceManager_impl - Registering device GPP_1 on Domain Manager
Can anyone help me to find a solution to use a USRP on redhawk??Do anyone manage to use USRP on RedHawk?

Based on my experience, this usually means you didn't specify the ip address of the USRP when you put the USRP_UHD Device into the Device Manager. If you know the ip address, then simply set the USRP_ip_address property of the Device in your Device Manager and install the Device Manager into SDRROOT again. If you don't know the ip address of the USRP, you can try running the uhd_find_devices command. If that command doesn't return anything, you can find the MAC Address on the back of the USRP and use it to search for the USRP on your network. You should be able to run a command like this to find it:
sudo nmap -sP <Your Subnet e.g 192.168.1.*> | grep -B 3 -i <Your MAC Address with each octet separated by a colon e.g aa:bb:cc:dd:ee:ff>
Once you have that ip address, you should be able to run
uhd_usrp_probe --args="addr=<your USRP's ip>"
That should give you output pertaining to your USRP that will verify that you have the correct ip address. Then you should be able to use that ip address in the USRP_ip_address property of the USRP_UHD Device.
Also note that you may get some UHD Warnings pertaining to recv and send buffer sizes. These will suggest two commands to run that you should probably go ahead and execute.

Related

Is SCPI communication with a Chroma Power Supply possible?

First post! Full disclosure, I have a very limited programming / pi background.
I'm working on a project to communicate with a Chroma Bi-Directional power supply (Model #: 62180D-1200) using LXI / SCPI communication. There's more I hope to do in the future, but for the time being I'm simply trying to establish a working communication channel using the "*IDN?" identify command. I have a raspberry pi connected to the same network as the power supply, which I am using to communicate to the 62180D.
Before beginning any of this testing, I have been able to establish that I can communicate with the device via http (web browser). The web page for the device even includes an scpi query tool -- which works!
Successful HTTP communication
To query the device from the pi I have used PuTty to log in to my pi and issue the following command:
lxi scpi -a <device ip address> "*IDN?"
I am expecting to see the same result as shown in the image above (Model No. , Serial No., Firmware Version), but instead I'm receiving the following:
Error: Read error (timeout)
Error: Failed to receive message
I was under the impression that this protocol is fairly plug and play. I have other LXI enabled devices on the same network that I am able to communicate with them using this same approach. Is there some obvious thing I'm missing here?

linux usb gadgets traffic monitoring

I am using a BeagleBone Black board (kernel 4.14.108-ti-r104) to create USB gadget using configfs/functionfs. I compose my gadget (using gadgettool) providing details about device configuration (function, vendor id, product id and ton of other params), run my userspace program that writes descriptors and strings to ep0 and connect the device to host. All works fine, I get BIND (when binding device to UDC) and ENABLE (when actually host is connected) events and my device can read from ep2 and write to ep1. Using wireshark I see the communication looks good, device and configuration descriptors as well as strings are exchanged.
The problem starts when I connect the device to another host. Unfortunately I have almost no control over that host, in particular I cannot run wireshark there, I don't even know the OS. The only thing I can do is to plug/unplug device, optionally see a message that device was detected and optionally a restart. What I see on the gadget side is that following BIND and ENABLE events I immediately get SUSPEND event and read on ep2 fails with 108 (ESHUTDOWN). Now the question is how to track the problem down.
I tried usbmon, but it seems it does not listen to traffic when device is in gadget mode. I have also seen https://github.com/torvalds/linux/blob/master/drivers/usb/gadget/udc/trace.h file which seems to define some udc trace points, but I am not really sure how they can be used.
So the final question is simple: how do I get any information about traffic on USB bus having access only to gadget side? I don't need full trace, but al least some information which packets were exchanged would be super useful. Did it fail while exchanging device descriptors, configuration/interface/endpoint descriptors or strings or something totally different?
Small update:
The whole thing is about Android Open Accessory Protocol and I am trying to write a gadget that would connect to this accessory.
I have changed my gadget composition somewhat and now I know the gadget is being identified by host (it displays manufacturer/model) so I suppose the issue is not in device descriptor and strings. I have used two additional flags in descriptors (FUNCTIONFS_ALL_CTRL_RECIP | FUNCTIONFS_CONFIG0_SETUP) and when connecting to my computer I get setup event (request 51 as expected), but when connecting to my accessory I still get SUSPEND/ESHUTDOWN. This time though it looks like the time between ENABLE and SUSPEND is much greater (over 10 seconds) which looks to me as if the host send some message, but this message was not processed by my gadget and then the host timeout out and disabled usb device. Still don't know how to find out if the accessory sent anything to gadget and what it was...

Linux 2.6 on imx: Can't log sent CAN frames using candump

I have a custom build linux 2.6 running on a imx CPU. CAN communication with external nodes works like a charm, but the frames that I send to the nodes from my app is not printed when using "candump can0" in the terminal (when I run the same app on my host using a usb-CAN dongle this problem does not occur).
When extended CAN frames are sent they show up using candump.
I understand that it might be convenient that messages that is sent is filtered, but I should be possible to choose.
Any clues are welcome. I'm thinking that it might be some filtering in the driver that causes this.
The FLexCAN driver has the following config files:
abort br_propseg dump_rx_mb loopback state
wakeup bcc br_pseg1 dump_xmit_mb maxmb
std_msg xmit_maxmb bitrate br_pseg2
ext_msg modals subsystem boff_rec br_rjw
fifo power tsyn br_clksrc driver
listen smp uevent br_presdiv
dump_reg local_priority srx_dis wak_src
The can-utils package requires SocketCAN, which was integrated into the stock kernel 2.6.30.
If you are using SocketCAN, you should be able to turn on loopback to receive messages that are being transmitted from your interface (and they must actually be transmitted on the wires to be received via loopback).
From bash:
ifconfig can0 down
ip link set can0 type can loopback on
ifconfig can0 up
candump can0|grep C0FFEE
and in another terminal:
cansend can0 00C0FFEE#00112233445566
Alright, I have been at this issue many times but given up. But know I stumbled on the solution:
The setting file called srx_dis in the FlexCAN folder controls this behaviour.
So, if you want to be able to read the CAN frames you send on the imx53_loco, do the following:
ifconfig can0 down
echo 0 > /sys/bus/platform/devices/FlexCAN.0/srx_dis
ifconfig can0 up
The reason I want to do this is for creating a service tool on the same device which can log all CAN frames.

How to switch wifi channel without dropping connection?

We are developing small internet connected device that connects via wifi and does some work. It is controlled via mobile app.
For configuration purposes we use wi-fi module that can work in both STA + AP modes simultaneously via two interfaces wlan0 and wlan1. One of the interfaces works in Master mode. Phone connects to the device via wlan1 and sends command for the device to connect to another network and waits for result. Device in turn connects to another wi-fi network using wlan0 and notifies the phone if connection was successful or not.
But there is one issue. Both interfaces (wlan0 and wlan1) must work on the same channel as we have single hardware module. This causes channel of wlan1 to change in order to match of channel for wlan0.
Here comes the problem. When channel changes phone looses connection with the device. Is there a way to change wi-fi channel but keep connection between the device and mobile phone?
Our wi-fi module is rtl8723bu.
Linux 3.4.103.
Wifi daemons: hostapd v0.8.x_rtw_r7475.20130812_beta, wpa_supplicant v2.3.
UPDATE
Here is more clearly description what is going on on device.
Let's assume that the phone already connected to Device wlan1 interface with essid DeviceAp which is on channel 1. We have a Router with essid RouterAp which is on channel 6. Device interface wlan0 is not configured and not running.
(Step1 on image below).
Then the phone sends a request to the device to connect to RouterAp.
(Step2 on image below).
When wlan0 starts connecting to RouterAp it changes working channel. Because WiFi module can work only on one channel. The channel of wlan1 also changes (maybe in hard way). Therefore Phone lost DeviceAp and starts roaming.
(Step3 on image below).
SO the update question is:
Is there a way to tell the Phone (or other device) about network change? Or perhaps increase the likelihood that the phone is connected back to DeviceAP.
This behavior is very similar to the process of setting up Google Chromecast.
Chromecast also has two wireless interfaces and change the channel, but the Phone does not lose connection with it.
Image:
http://postimg.org/image/soh78vd17/

Connecting to BT LE device using org.bluez.Adapter.CreateDevice fails with org.bluez.Error.Failed: Operation canceled Error

I'm trying to set up a connection to a Bluetooth 4.0 LE device on Linux using the BlueZ 4.X DBus interface.
To test this I use the following command:
dbus-send --system --dest=org.bluez --print-reply /org/bluez/<PID of bluetoothd>/hci0 org.bluez.Adapter.CreateDevice string:<MAC of BT device>
This command seems to work most times, giving a result like:
method return sender=:1.238 -> dest=:1.262 reply_serial=2
object path "/org/bluez/9652/hci1/dev_BC_6A_29_26_C2_1C"
and enabling me to interact with the device DBus object.
However, starting from yesterday, this seems to fail very frequently returning the following error:
Error org.bluez.Error.Failed: Operation canceled
When debugging the bluetooth daemon, (using bluetoothd -n -d) I notice the following things when executing the method call:
bluetoothd[340]: src/adapter.c:create_device() BC:6A:29:26:C2:1C
bluetoothd[340]: src/adapter.c:adapter_create_device() BC:6A:29:26:C2:1C
bluetoothd[340]: src/device.c:device_create() Creating device /org/bluez/340/hci0/dev_BC_6A_29_26_C2_1C
bluetoothd[340]: src/device.c:btd_device_ref() 0xb7ad8: ref=1
bluetoothd[340]: src/device.c:device_set_temporary() temporary 1
bluetoothd[340]: src/device.c:btd_device_ref() 0xb7ad8: ref=2
bluetoothd[340]: plugins/mgmtops.c:mgmt_event() cond 1
bluetoothd[340]: plugins/mgmtops.c:mgmt_event() Received 14 bytes from management socket
bluetoothd[340]: plugins/mgmtops.c:mgmt_connect_failed() hci0 BC:6A:29:26:C2:1C status 4
bluetoothd[340]: src/event.c:btd_event_conn_failed() status 0x04
bluetoothd[340]: src/device.c:device_remove() Removing device /org/bluez/340/hci0/dev_BC_6A_29_26_C2_1C
bluetoothd[340]: src/device.c:device_set_temporary() temporary 1
bluetoothd[340]: src/device.c:btd_device_unref() 0xb7ad8: ref=1
bluetoothd[340]: src/device.c:btd_device_unref() 0xb7ad8: ref=0
bluetoothd[340]: src/device.c:device_free() 0xb7ad8
As far as I can see, my Bluetooth dongle sends me an error event (status 4) when I try to connect to the device.
However, when I use hcitool ot gatttool to connect to the device, everything works perfectly.
I found that this happens mostly after I try to connect to the device using a different program (i.e cinnamon-settings), and cancel the connection prematurely. I also noticed this with other programs like bluetooth-properties on Angstrom.
My guess is that Bluez sends the wrong HCI commands to my bluetooth dongle in certain conditions. I think this is because the gui programs try to pair with the device instead of just connecting to it, which may cause BlueZ to think my device is a Bluetooth 2.0 device.
Thus far I seemed to be able to resolve this problem by connecting to my BT device using a gui application, waiting till it fails, and restarting my computer. However, the problem seems to reoccur occasionally, making this very painful.
I have seen this problem on systems running both BlueZ version 4.99 and 4.101.
Does anyone know how I can solve this correctly?
It seems like my predictions where more or less correct. After many hours of debugging the Bluetooth daemon I discovered that connecting to BT LE devices without a preliminary scan causes the daemon to try to connect to the device as a BR/EDR device. This is because the daemon's "internal cache" is filled with the EIR information at the time the device is discovered. If this information is not available when connecting to a LE device the CreateDevice method will fail.
A simple solution is to always make sure to discover devices before connecting to them.
The BlueZ 5 API introduction and porting guide also describes this problem, and how it is solved in BlueZ 5:
Bluetooth Low Energy essentially extended Bluetooth addresses with one extra bit, requiring one to always know whether an address is “random” or “public”. This caused issues with the BlueZ 4 API where the address was given to BlueZ in the CreateDevice and CreatePairedDevice calls. Since the parameter didn’t contain any of this extra random/public information bluetoothd had to maintain an internal cache to look up the necessary info. Another complication to the matter is that the BlueZ D-Bus API doesn’t differentiate between traditional BR/EDR devices and LE devices so there are essentially three possible address types: BR/EDR, LE public and LE random.

Resources