Peaberry SDR kits

From Note to self
Revision as of 22:50, 18 September 2013 by Hansvi (Talk | contribs) (Created page with "= Informatie = * [http://ae9rb.com/index.php?main_page=product_info&cPath=1&products_id=1 Webpage] * [http://ae9rb.com/forum/viewforum.php?f=2 Forum] * [http://silly/peaberry...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Informatie

Notities

Stap 1

40m -30m - 20m geselecteerd.

Spoelen wikkelen

Nog niet gebeurd.

Stap 10, 11, 12

  • De bypass capaciteiten zijn geplaatst.
  • Voeding opgebouwd en getest.
  • 5V: 5.001V gemeten
  • 3.3V: 3.326V gemeten
  • Geen stroomverbruik volgens de lab supply

Stap 13

Q3, een MMBT3904 heeft de volgende pinout:

   C
   |
#######
 |   |
 B   E

Colector meet 2.446V, ok.

Stap 14

  • Niet heel duidelijk wat pin 1 is van U3. Ik zie een heel klein wit driehoekje op 1 hoekpunt, dus dat zal het wel zijn.
  • U4: Pin 1 is wat breder

Stap 15

Die Connectoren niet onderschatten, Zie na of ze niet scheef zitten!

Stap 16

  • P1 (SWD debug connector) is lastig te plaatsen met U11 reeds in plaats.
  • Eens componenten geplaatst, heb ik de print aangesloten op mijn portable.
[  512.620327] usb 2-3.1: new full-speed USB device number 5 using ehci_hcd
[  512.863649] usbcore: registered new interface driver snd-usb-audio
[  513.200693] retire_capture_urb: 30 callbacks suppressed
[  518.204684] retire_capture_urb: 4994 callbacks suppressed
  • USB connector uitgetrokken en weer ingestoken.
[  557.910438] usb 2-3.1: USB disconnect, device number 5
[  578.976392] usb 2-3.1: new full-speed USB device number 6 using ehci_hcd

(2e keer geen snd-usb-audio melding? - omdat module reeds is geladen misschien?)

Stap 17

  • U9 (Si570) heeft geen pootjes. Solderen ging vlotjes tot ik merkte dat ik de chip 180° gedraaid aan het plaatsen was. Met 2 soldeerbouten heb ik die weer losgekregen en uiteindelijk heb ik hem toch juist op de print kunnen zetten.
  • U10 was al geplaatst

Stap 18

Op pin 2 en 14 van U6 meet ik 2.5V, ok.

Test audio met earbuds:

hans@Aspire:~$ cat /proc/asound/modules 
 0 snd_hda_intel
 1 snd_usb_audio
hans@Aspire:~$ cat /proc/asound/cards
 0 [Intel          ]: HDA-Intel - HDA Intel
                      HDA Intel at 0xd4500000 irq 46
 1 [SDR            ]: USB-Audio - Peaberry SDR
                      AE9RB Peaberry SDR at usb-0000:00:1d.7-3.1, full speed
hans@Aspire:~$

Ik kan de USB geluidskaart selecteren, maar ik hoor geen muziek.

Deze thread gaat over Peaberry via Linux.

Onder Windows werkt het geluid wel.

Het is makkelijk een aansluiting van een component over te slaan. Ik had er zelf 2 gemist.

Stap 3-7 (eerste batch)

Enkel de spoelen die nodig zijn voor stap 20 gewikkeld (L1-5, T1, T2).

Inch 2 cm conversion is handig.

Stap 19, 20

Het lijkt me dat De spoelen best worden gewikkeld met de wijzers mee (volgens de print), als je de draad van onder naar boven door de kern haalt. Dit is echter niet zo belangrijk, maakt motage ietsiepietse natuurlijker.

Even moeten zoeken hoe de transformators worden aangesloten. T1 is eenvoudig, 1 spoel hangt aan de antenne-ingang.

T2 is iets lastiger. Volgens VE2PKE:

Transformer goes like this. The ensemble doc have lot of detail.
The two pins with the bar is where the primary goes.
The first secondary then goes in the next two pins beside the line.
The second secondary goes in the next two pins.

Hiermee is de ontvanger af.

Software

De Peaberry is een kloon van een andere SDR, de usbsoftrock. De peaberry heeft een eigen USB geluidskaart, de usbsoftrock niet.

Enkele handige utils:

  • pasuspender
  • speaker-test
  • pavucontrol

Usbsoftrock

apt-get install libusb-dev libncurses5-dev
cd /tmp/
tar xvfz /home/freddy/Downloads/usbsoftrock-1.0.2.tar.gz
cd usbsoftrock-1.0.2/
# you will have to change #define VENDOR_NAME to "AE9RB" and #define PRODUCT_NAME to "Peaberry SDR" in usbsoftrock.c.
./configure
make
make install

Dit installeert de tool om de radio aan te sturen. Test met:

usbsoftrock getfreq
Version     : 0.0
Frequency   : 14.085181 (x 4.00)
usbsoftrock set freq 7.04
Version     : 0.0

Quisk

Dependency voor quisk die niet automatisch gebeurt:

apt-get install python-wxgtk2.8
root@seven:/tmp/usbsoftrock-1.0.2# apt-get install quisk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  python-serial
Suggested packages:
  python-wxgtk2.8 python-wxgtk2.6 python-wxgtk
The following NEW packages will be installed:
  python-serial quisk
0 upgraded, 2 newly installed, 0 to remove and 39 not upgraded.
Need to get 422 kB of archives.
After this operation, 1,623 kB of additional disk space will be used.
Do you want to continue [Y/n]?

Permissies juist zetten:

vi /etc/udev/rules.d/99-softrock.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="16c0", ATTR{idProduct}=="05dc", MODE="0660", GROUP="freddy"
:wq

Deze file aangemaakt: .quisk_conf.py

si570_direct_control = True
si570_xtal_freq = 114211833

sample_rate = 48000
playback_rate = 48000
name_of_sound_capt = "plughw:1,0"
name_of_sound_play = "plughw:0,0"
channel_i = 0
channel_q = 1

usb_vendor_id = 0x16c0
usb_product_id = 0x05dc

Vreemd genoeg werkt het enkel met plughw, niet met hw..... Anyway, met deze config krijg ik ontvangst met een kleine storing die mogelijk het gevolg is van de power supply. Na meerdere minuten trad er een grotere storing op (een paar kHz breed), geen idee waar dat vandaan kwam.

Wanneer ik de volgende dag weer de radio opzet, zie ik bijna geen signaal. Pas na een tijd dringt het door dat ik niet kan tunen. Quisk toont hoe de frequentie verandert, maar alle signalen blijven op dezelfde plek staan. Als ik manueel "usbsoftrock set freq 7.04" uitvoer onvang ik plots weer vanalles.

2 lijnen toegevoegd in config, geeft nu de fout "No module named backend.libusb10".

from softrock import hardware_usb as quisk_hardware

from softrock import widgets_tx as quisk_widgets

Ik heb dan de development-versie van pyusb geinstalleerd, eerst de .zip gedownload, dan

root@seven:~# cd /tmp
root@seven:/tmp# unzip /home/freddy/Downloads/pyusb-master.zip 
root@seven:/tmp# cd pyusb-master/
root@seven:/tmp/pyusb-master# python setup.py install
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/usb
copying usb/legacy.py -> build/lib.linux-x86_64-2.7/usb
copying usb/_interop.py -> build/lib.linux-x86_64-2.7/usb
copying usb/_debug.py -> build/lib.linux-x86_64-2.7/usb
copying usb/util.py -> build/lib.linux-x86_64-2.7/usb
copying usb/__init__.py -> build/lib.linux-x86_64-2.7/usb
copying usb/core.py -> build/lib.linux-x86_64-2.7/usb
copying usb/control.py -> build/lib.linux-x86_64-2.7/usb
creating build/lib.linux-x86_64-2.7/usb/backend
copying usb/backend/libusb1.py -> build/lib.linux-x86_64-2.7/usb/backend
copying usb/backend/libusb0.py -> build/lib.linux-x86_64-2.7/usb/backend
copying usb/backend/__init__.py -> build/lib.linux-x86_64-2.7/usb/backend
copying usb/backend/openusb.py -> build/lib.linux-x86_64-2.7/usb/backend
running install_lib
creating /usr/local/lib/python2.7/dist-packages/usb
copying build/lib.linux-x86_64-2.7/usb/legacy.py -> /usr/local/lib/python2.7/dist-packages/usb
copying build/lib.linux-x86_64-2.7/usb/_interop.py -> /usr/local/lib/python2.7/dist-packages/usb
creating /usr/local/lib/python2.7/dist-packages/usb/backend
copying build/lib.linux-x86_64-2.7/usb/backend/libusb1.py -> /usr/local/lib/python2.7/dist-packages/usb/backend
copying build/lib.linux-x86_64-2.7/usb/backend/libusb0.py -> /usr/local/lib/python2.7/dist-packages/usb/backend
copying build/lib.linux-x86_64-2.7/usb/backend/__init__.py -> /usr/local/lib/python2.7/dist-packages/usb/backend
copying build/lib.linux-x86_64-2.7/usb/backend/openusb.py -> /usr/local/lib/python2.7/dist-packages/usb/backend
copying build/lib.linux-x86_64-2.7/usb/_debug.py -> /usr/local/lib/python2.7/dist-packages/usb
copying build/lib.linux-x86_64-2.7/usb/util.py -> /usr/local/lib/python2.7/dist-packages/usb
copying build/lib.linux-x86_64-2.7/usb/__init__.py -> /usr/local/lib/python2.7/dist-packages/usb
copying build/lib.linux-x86_64-2.7/usb/core.py -> /usr/local/lib/python2.7/dist-packages/usb
copying build/lib.linux-x86_64-2.7/usb/control.py -> /usr/local/lib/python2.7/dist-packages/usb
byte-compiling /usr/local/lib/python2.7/dist-packages/usb/legacy.py to legacy.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/usb/_interop.py to _interop.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py to libusb1.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/usb/backend/libusb0.py to libusb0.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/usb/backend/__init__.py to __init__.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/usb/backend/openusb.py to openusb.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/usb/_debug.py to _debug.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/usb/util.py to util.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/usb/__init__.py to __init__.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/usb/core.py to core.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/usb/control.py to control.pyc
running install_egg_info
Writing /usr/local/lib/python2.7/dist-packages/pyusb-1.0.0a3.egg-info
root@seven:/tmp/pyusb-master#

Geen resultaat. Dan dit (in het Duits) gevonden. Attachment gedownload en gecopieerd.

root@seven:/tmp# cd /usr/lib/python2.7/dist-packages/quisk/usb
root@seven:/usr/lib/python2.7/dist-packages/quisk/usb# unzip /home/freddy/Downloads/backend.zip 
Archive:  /home/freddy/Downloads/backend.zip
 inflating: backend/libusb01.py     
 inflating: backend/libusb10.py     
 inflating: backend/openusb.py      
 inflating: backend/__init__.py     

Nu start quisk wel op, maar geeft hij de fout dat hij de permissies niet heeft om het device te openen. Wat een klucht! Dit is het probleem zoals vermeld in het forum. De FiFi interface voor quisk kan je hier vinden.

Na analyse van zowel de quisk softrock, quisk FiFi als de usbsoftrock code kan ik het volgende besluiten:

  • Quisk softrock opent nergens een device maar gebruikt een functie van het device object voor communicatie
  • Quisk FiFi heeft een andere implementatie, die met een handle werkt.
  • usbsoftrock heeft ook een handle (zoals FiFi, maar in C ipv Python)
  • usbsoftrock heeft geen probleem om het device te openen.
  • Dus: De hardware layer van quisk moet aangepast worden.

Python shel gestart.

Python 2.7.3 (default, Jan  2 2013, 13:56:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import usb.core, usb.util
>>> pea = usb.core.find(idVendor=0x16c0, idProduct=0x5dc)
>>> pea
<usb.core.Device object at 0x2413350>
>>> pea.set_configuration()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 559, in set_configuration
    self._ctx.managed_set_configuration(self, configuration)
  File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 92, in managed_set_configuration
    self.backend.set_configuration(self.handle, cfg.bConfigurationValue)
  File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 512, in set_configuration
    _check(_lib.libusb_set_configuration(dev_handle, config_value))
  File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 407, in _check
    raise USBError(_str_error[ret], ret, _libusb_errno[ret])
usb.core.USBError: [Errno 16] Resource busy
>>> handle = pea.open()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Device' object has no attribute 'open'

Deze melding verschijnt in /var/log/syslog:

[ 3669.143935] usb 4-2: usbfs: interface 1 claimed by snd-usb-audio while 'python' sets config #1


Deze fout is perfect logisch, gezien de beschrijving van de falende functie libusb_set_configuration.

Set the active configuration for a device.

The operating system may or may not have already set an active configuration on the device. It is up to your application to ensure the correct configuration is selected before you attempt to claim interfaces and perform other operations.

If you call this function on a device already configured with the selected configuration, then this function will act as a lightweight device reset: it will issue a SET_CONFIGURATION request using the current configuration, causing most USB-related device state to be reset (altsetting reset to zero, endpoint halts cleared, toggles reset).

You cannot change/reset configuration if your application has claimed interfaces - you should free them with libusb_release_interface() first. You cannot change/reset configuration if other applications or drivers have claimed interfaces.

A configuration value of -1 will put the device in unconfigured state. The USB specifications state that a configuration value of 0 does this, however buggy devices exist which actually have a configuration 0.

You should always use this function rather than formulating your own SET_CONFIGURATION control request. This is because the underlying operating system needs to know when such changes happen.

This is a blocking function.

Parameters:

   dev	a device handle
   configuration	the bConfigurationValue of the configuration you wish to activate, or -1 if you wish to put the device in unconfigured state

Returns:

   0 on success 
   LIBUSB_ERROR_NOT_FOUND if the requested configuration does not exist 
   LIBUSB_ERROR_BUSY if interfaces are currently claimed 
   LIBUSB_ERROR_NO_DEVICE if the device has been disconnected 
   another LIBUSB_ERROR code on other failure

Toont cards/devices:


Sound device troubleshooting

freddy@seven:~$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC889 Analog [ALC889 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 2: ALC889 Analog [ALC889 Analog]
  Subdevices: 2/2
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
card 1: SDR [Peaberry SDR], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: SDR [Peaberry SDR], device 1: USB Audio [USB Audio #1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
freddy@seven:~$ aplay -Dhw:1,1 test.wav 
Playing WAVE 'test.wav' : Signed 24 bit Little Endian in 3bytes, Rate 48000 Hz, Stereo
freddy@seven:~$ arecord -L
default
    Playback/recording through the PulseAudio sound server
sysdefault:CARD=Intel
    HDA Intel, ALC889 Analog
    Default Audio Device
front:CARD=Intel,DEV=0
    HDA Intel, ALC889 Analog
    Front speakers
surround40:CARD=Intel,DEV=0
    HDA Intel, ALC889 Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Intel,DEV=0
    HDA Intel, ALC889 Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Intel,DEV=0
    HDA Intel, ALC889 Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Intel,DEV=0
    HDA Intel, ALC889 Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Intel,DEV=0
    HDA Intel, ALC889 Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
sysdefault:CARD=SDR
    Peaberry SDR, USB Audio
    Default Audio Device
front:CARD=SDR,DEV=0
    Peaberry SDR, USB Audio
    Front speakers
surround40:CARD=SDR,DEV=0
    Peaberry SDR, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=SDR,DEV=0
    Peaberry SDR, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=SDR,DEV=0
    Peaberry SDR, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=SDR,DEV=0
    Peaberry SDR, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=SDR,DEV=0
    Peaberry SDR, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=SDR,DEV=0
    Peaberry SDR, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
freddy@seven:~$ 

alsamixer ok,

Om in 24bit 3LE op te nemen:

arecord -Dplughw:0 -fS24_3LE -r48000 -c2 /tmp/test.wav

gnuradio ondersteunt dit formaat niet, vrij veel software niet, trouwens. Maar dat is het enige formaat ondersteund door de kaart

$ aplay -Dhw:1,0 test.wav
Playing WAVE 'test.wav' : Signed 24 bit Little Endian in 3bytes, Rate 48000 Hz, Stereo

Zelfs zo is er geen data op de PCM3060

Maar zo wel:

aplay -Dhw:1,1 test.wav

USB bus sniffing

apt-get install wireshark tcpdump
mount -t debugfs none_debugs /sys/kernel/debug
modprobe usbmon
mount -t usbfs none /proc/bus/usb
cat /proc/bus/usb/devices
This outputs:
...
T:  Bus=04 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  2 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=16c0 ProdID=05dc Rev= 0.02
S:  Manufacturer=AE9RB
S:  Product=Peaberry SDR
S:  SerialNumber=110C0C3E03122400
C:* #Ifs= 7 Cfg#= 1 Atr=c0 MxPwr=  4mA
I:* If#= 0 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
I:* If#= 1 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=snd-usb-audio
I:* If#= 2 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
I:  If#= 2 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
E:  Ad=82(I) Atr=2d(Isoc) MxPS= 288 Ivl=1ms
I:* If#= 3 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
I:  If#= 3 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
E:  Ad=03(O) Atr=2d(Isoc) MxPS= 288 Ivl=1ms
I:* If#= 4 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=snd-usb-audio
I:* If#= 5 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
I:  If#= 5 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
E:  Ad=84(I) Atr=2d(Isoc) MxPS=  96 Ivl=1ms
I:* If#= 6 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
I:  If#= 6 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
E:  Ad=05(O) Atr=2d(Isoc) MxPS= 288 Ivl=1ms
...

(as root) tcpdump -i usbmon4 -w /tmp/usbmon.out
(CTRL-C to stop)
wireshark /tmp/usbmon.out