PlutoSDR, The Making Of An Ultra Low Cost, High .

Transcription

PlutoSDR, the Making of an Ultra Low Cost,High Performance Linux Based SoftwareDefined RadioMichael HennerichAnalog Devices GmbH#lfelc

ADALM-PLUTO Active Learning Module (PlutoSDR)RF DesignSkills roduce the fundamentals of––––––– DigitalHardwareSoftware-Defined Radio (SDR)Radio Frequency (RF)Wireless communicationsEmbedded LinuxFPGA HDL developmentOpen Source SoftwareOpen Source Hardware to everyoneDesigned for users at all levelsand all backgroundsStudent affordable#lfelc #plutosdr

Requirements Low-cost HardwareZero-cost EcosystemOpenReliableFail Safe / Brick-freeHigh PerformanceFast IntuitiveEase of useSupportableExtensibleFlexibleCross Plattform#lfelc #plutosdr

ADALM-PLUTO aka PlutoSDR – What’s inside?That‘sme AD9363Xilinx Zynq-7010512 MB DDR332 MB SPI NORUSB 2.0 OTGCaptures I/Q Samples–12-bits–65.1 kSPS to 61.44 MSPSTuning range: 325 MHz to 3.8 GHz Guaranteed performance70 MHz to 6.0 GHz 2 LEDs1 ButtonUnknown specs#lfelc #plutosdr

ADALM-PLUTO – Software stack Runs Linux inside the deviceUses Linux’s IIO framework toexpose I/Q data and controlMulti-Function USB Device––Native IIO over USB (FunctionFS)Serial over USB (CDC ACM) ––– Cross Platform– Windows– Linux– MACKernel consoleCOMx, ttyACMxEthernet over USB (RNDIS)Mass Storage (MSD)Device Firmware Update (DFU)USB Host–USB devices Ethernet, WIFI, Audio, HID, MSD#lfelc #plutosdr

Software, Programmable Logic & HardwareSoftwareIIO SubsystemDMASubsystemKernelAD9361-PHYIIO PS7SPIFPGASPIGPIOAXI-ADCRXTransport LayerIIO DriverAXI-DAC-DDSTXTransport LayerIIO KSubsystemDMAAXI-AD9361 HDL CoreCMOSHardwareAD9363 TRX#lfelc #plutosdr

What is IIO? Linux kernel Industrial Input / Outputsubsystem Not really just for Industrial IO– All non-HID IO– ADC, DAC, light, accelerometer, gyro,magnetometer, humidity, temperature,pressure, rotation, angular momentum,chemical, health, proximity, counters, etc. In the upstream Linux kernel for 10 years. Mailing list:– c/html/latest/driver-api/iio/index.html#lfelc #plutosdr

Why use IIO for SDR? Kernel drivers have low-level &low-latency access to hardware–––– Provides hardware abstraction layer– Allows sharing of infrastructure– Allows developers to focus on thesolution– Allows application re-useMMIOInterruptsDMAMemoryIIO provides fast and efficientdata transport– From device to application– From application to device– From device to network/storage#lfelc #plutosdr

Fast and efficient data transport a SDR requirement ? Nyquist sampling 20 MHz of RF bandwidth e.g FM Radio from88 108 MHz produces a constant data stream of 80 MBytes/s@ 16bits !– PlutoSDR max sample rate 61.44 MSPS - 245.76 MBytes/s This is way to fast for USB2.0 Efficient low latency, zero copy data transfers are required#lfelc #plutosdr

IIO – DMA buffer DMA is used to copy data fromdevice to memorymmap() is used to make dataavailable in the applicationAllows low overhead high-speeddata captureData is grouped into chunks(called DMA blocks) to manageownership– Either application ordriver/hardware owns a block– Samples per block areconfigurable– Number of blocks areconfigurableIncoming queue User spaceKernel spaceDMA ControlerApplication Outgoing queue#lfelc #plutosdr

Fast Boot optimizations Many good recipes – no one size fits all! Less is more– Slim down kernel size Remove unnecessary kernel options– Slim down root file system Use BusyBox Lightweight init system– /etc/inittab– /etc/init.d/rcS mdev– Use silent bootMany more things canbe done but this was enoughto get down to 3 seconds Kernel cmd line: quiet loglevel 4 u-boot: set stdout nulldev– Use the initial RAM disk (initrd)– u-boot: set bootdelay 0#lfelc #plutosdr

Dealing with an embedded Linux system while users consider hotplug/removal Use ramfs (initramfs)Restrict flash memory write access–––Allow Firmware UpgradesAllow u-boot env storageLatest firmware enables JFFS2 onpartition@qspi-nvmfs Persistent ssh keys and passwordFlash block protection onpartition@qspi-fsbl-ubootWrite ProtectedFail-SafeMeachanismFail-Safe mechanism––Enter DFU mode if uImage.FIT failsU-boot use compiled in environment –Not EssentialBad CRCButton pressedJFFS2 files have MD5 #lfelc #plutosdr

Flash Block Protection (Locking) Block Protection feature– TOP/BOTTOM Protect0x0Block 0TOPProtect1MBlock 1Block 2 SoC SPI boot mode– Vendor specific– Nonvolotile control bits– drivers/mtd/spi-norpreserves these bits– Block Protection enabled in u-bootduring factory programmingBOTTOMProtect2M4M4M2MBlock N1M#lfelc #plutosdr

Reboot bootloader actions Kernel instruct bootloader to enter anondefault boot mode after RESET–––– DFU modeDFU RAM modeBreak in u-bootStart system verboseNormally use fw setenv in the kerneland check the variable in u-boot.On Pluto we want to restrict flash writeaccess to the bare minimum.– Use general purpose R/W field in asystem level control register that persiststhrough all resets except a POR reset.(Not assigned or written by the BootROMor hardware)#lfelc #plutosdr

Kernel - u-boot messaging Back in u-boot use itest command on thepersistent register and execute appropriateboot mode.#lfelc #plutosdr

Failsafe boot: u-boot env corrupted?#ossummit #lfelc

Control and Interaction Concept How to control, configure and interact with ablack box device that only has a hiddenbutton, two LEDs and a USB OTG EDs for sign of life and state indicationSerial console, SSH (expert users)Morse code with button? Special USB function with GUI? What else?#lfelc #plutosdr

Video HERE Video HERE#ossummit #lfelc

USB Mass Storage Gadget (MSG) Allows your device to act as a USB massstorage device just like a pendrive. Requires a Backing storage– Block device or regular file.– Requires full sized file, with partition table andfilesystem.– For cross platform use FAT partition and filesystem.– This file can’t be accessed (loop mounted, etc.)while attached to the MSG, unless it’s read onlyfrom both sides.#lfelc #plutosdr

Time sharing the MSD backing storage (is possible)losetup /dev/loopX fat.img -o 512mount /dev/loopX /mnt/img/sys/kernel/config/usb gadget/composite gadget/functions/mass storage.0/lun.0/file fat.imgUSB MSDAttached /lun.0/file fat.imgIdle/mnt/img /lun.0/file {}mountedSCSI Ejectumount /mnt/imglosetup -d c #plutosdr

LED class Allows control of LEDs from userspaceLEDs are controlled via files in/sys/class/leds/Brightness will set the brightness of theLED– The minimum brightness is 0, and themaximum is 255 (max brightness)– For GPIO controlled LEDs any valuegreater than 0 will turn the LED on LEDs class has an optional concept ofLED triggers– Triggers are kernel based source of ledevents heartbeattimeretc.#lfelc #plutosdr

gpio-keys gpio-keys driver translatesGPIO interrupts into Linuxinput events BusyBox input eventdaemon can be used toinvoke certain commandsbased on input events#ossummit #lfelc

Tips & Tricks: Multifuction USB gadget via configFS USB Gadget seen as a set of configurations– Each configuration has a number of interfaces alsorefered as functions.– Sometimes the order of interfaces matters! Windows hosts requires RNDIS on Interface 0 https://www.kernel.org/doc/html/latest/usb/gadget configfs.html#osseu

Tips & Tricks: Gadget USB Serial Number In order to distinguish betweendifferent devices, the serialnumber stored in the devicedescriptor must be unique. Assigning unique and persistentIDs can be expensiveKernel messagesUSB Gadget ConfigFS– Use SPI flash Unique ID code(UID) Read SPI NOR identificationsequence. Behind the JEDEC Manufactureand Device Indentification oftenthere is a 16 byte UID present.#lfelc #plutosdr

USB OTG HOST The Pluto will automount any USB mass storage device such asthumb drive or Hard Drives (ext4, msdos, vfat) Kernel hotplug:–– The automounter will then look for some special file names:––– runme[0-9].sh which it will run as a shell scriptrunme[0-9] which it will run as a binary file.See: /lib/mdev/automounter.shPressing the button while a mass storage device is mounted willsafely unmout it.– echo /sbin/mdev /proc/sys/kernel/hotplugsd[a-z][0-9] root:root 660 onfSwitching from the slim down PlutoSDR buildroot rootfs to a fullblown ARM HF ubuntu root filesystem is easy–Using busybox switch root command chroot into a new filesystem and exec a new init process out of the newfilesystem1.Provide power to right USB2.Plug OTG USB drive into left USB port3.Left LED will become solid4.Script runs#lfelc #plutosdr

Managing HW revisions and boot configurations There are always HW revisions––––Can we handle those transparent to the user?Single firmware file who rules them all?Image integrity lc #plutosdr

Flattened Image Trees (FIT Images) Multi-component imageformat Support for multipleconfigurations Support for FDToverlays Hashing/Signatures Verified bootbootm [ addr1 ]# conf [# extra-conf[#.]]– not needed here Device tree ee/master/doc/uImage.FIT#lfelc #plutosdr

Pluto.its (source image fw/blob/master/scripts/pluto.its#lfelc #plutosdr

Managing Configurations / HW Revisions Custom pluto hwref u-boot command––– Read board revision set by voltage dividerusing a SoC ADC.Populate env varibale with thecorresponiding config variable. (config@X)X {0,1,2, , 10}bootm {fit load address}# {fit config}bootm 0x2080000#config@X#lfelc #plutosdr

Is it working? Yes, we have shipped nearly 40,000 devices sincerelease in 2017 Many users in Education and Academia, but alsoin the HAM Radio community Adopted in many Open Source projects by thecommunity Customer feedback is always very positive – “itjust works” Making things work on VM (via RNDIS) is supereasy Libiio is very stable, and cross platform#lfelc #plutosdr

Links and PointersAnalog Devices Active Learning Modules and UniversityEngagements[1] agement.html[2] torials/activelearning-module.htmlWiki Documentation[3] https://wiki.analog.com/university/tools/plutoThe source code:[4] e books on SDR[5] http://www.analog.com/sdrforengineers[6] http://pysdr.org/#lfelc #plutosdr

Q&AAhhh, technology. We can't find that page.ThanksQ&A 2019 Analog Devices, Inc. All rights reserve.#lfelc #plutosdr

– Software-Defined Radio (SDR) – Radio Frequency (RF) – Wireless communications – Embedded Linux – FPGA HDL development – Open Source Software – Open Source Hardware