FUNcube Dongle controller progress

Some examples so far… Windows XP, Vista, 7, Ubuntu 10.10, Mac OS X 10.6…

In the end it was Qt that won the day for the cross platform development.

This entry was posted in Uncategorized. Bookmark the permalink.

37 Responses to FUNcube Dongle controller progress

  1. Mike says:

    Looks great!

    • Mike says:

      Typical Mac – has to be different on 70cms while everyone else is on VHF.

      Well done. Looks great – I must try and see if QT can replace Borland/Codegear/Embecadero/Whatevertheyarecalledthisweek for C++ development.

      Is this software going to be open source?

      • admin says:

        Hello Mike.

        Well as you can imagine I only just got to a stage where I was brave enough to try it across platforms and show you the results. Apart from XP, they’re all on VMs too so I will almost certainly have to build real physical machines to test too.

        In particular under VMs, when switching between normal and bootloader modes and vice-versa, the FCD pretends to unplug itself and plug itslef back in, thus forcing a re-enumeration. While this works fine on a real machine, on a VM it’s a bit kludgy and doesn’t work very well.

        As long as you are patient, QT isn’t too bad. I found the two books I purchased on it of little use for me I’m afraid. The problem for me was two fold. Firstly, I am using the QT Creator IDE and I haven’t found any books that step you through that. Secondly, I am trying to do some advanced non-GUI stuff on multiple platforms, some that I don’t have much (if any) recent experience of programing, so it’s taken two or three weeks of apparent random button pushing to get this far.

        Will the host software be open source? Yes.

        Probably not much point distributing the source right at this second as the FCDs aren’t being distributed for a week or so yet and it is in a rather bleeding edge state at the moment.

        Howard

        • admin says:

          Oh, one other thing, it appears that under Ubuntu 10.10 and possibly other Linux distributions, USB Plug and Play isn’t very, well, Plug and Play. I seem to have to explicitly authorise access to the /dev/bus/usb…. devices on each insertion. I’ve seen reference to some fiddling you can do with some udev rules files but it seems really, really messy. Or am I missing something?

          • Paul Sladen says:

            Please could you file a bug about the usb permission issue so that it can be tracked (please include the FCD USB ID, and details that other people can find it too, and paste the link back here). Generally permission for transient devices, such as the FCD, is allowed for the currently logged-in user.

            I have a FCD on order, and I’ll look into it when I have the device (it has apparently now arrived in the UK, but I’m in a different country right now!).

          • admin says:

            Hello Paul

            I am not sure about the USB permission bug you are referring to. I am aware of Linux needing to have the device permissions explicitly set by the user upon insertion, or you can update a text file to automate the process. Not sure that this is necessarily a bug, rather just the way Linux works?

            Many thanks, Howard

  2. admin says:

    For reference I am using Qt SDK 2010.05 (Qt 4.7.0/QT Creator 2.0.1) and Alan Ott’s HID API http://www.signal11.us/oss/hidapi/ with a couple of minor mods to make it compile with the Qt toolchain and across all the 32 bit and 64 bit platforms I’m trying to support. For Linux/Ubuntu 10.10 I am using LIBUSB-1.0 too. Under Linux the HID API can use either LIBUSB or HIDRAW but it looks like the HIDRAW implementation required for the HID API is yet to be released with a standard stable Ubuntu.

    Getting started hacking a GUI with Qt couldn’t be easier as long as you only want to stick to the tutorial examples. In particular I found the install painless compared to all my other sojourns into the Linux world as the toolchain is included for each platform with this SDK release.

    It gets a little more scary when you start trying to add in platform specific libraries. In addition, almost innevitably, getting your GUI to look right on all platforms is a time consuming iterative process. Also I haven’t figured out how I move the project between different platforms without having to fiddle the build settings each time.

    Howard

    • admin says:

      For Linux, to automatically allow access to the FCD as a non-root user, it is necessary to add a text file in the /etc/udev/rules.d directory. It can be called anything, as the directory is scanned for any files, but I used the filename “fcd.rules”.

      Within that file you need the following in a single line:

      SUBSYSTEMS=="usb" ATTRS{idVendor}=="04d8" ATTRS{idProduct}=="fb56" MODE:="0777" SYMLINK+="FUNcube Dongle"

      I’m not sure what the perceived best practice is for doing this in Linux, so if anyone has any simple suggestions for this other than placing this file, I’d be glad to hear.

      Howard

      • Mike says:

        But can you do this if not root? I suppose pretty much everyone has root access when an amateur but it might be very different in schools.

        You have set “0777” which allows read/write/execute for everyone. That might be a security risk. Does it have to be “0777” ?

        You can call it anything but there are conventions for execution order. Perhaps “99-fcd.rules” or some other more appropriate number?

        • admin says:

          As you know I’m not a Linux expert although I’ve used it on and off for fifteen years or so.

          The documentation how best to do this seems rather elusive and/or inconsistent on this. Not sure if it has to be 777 at all, I just went from an example I found online. 666 will probably work, although I don’t know what security risk I might be saving myself from if I switched it to this.

          I am also not sure how many Linux machines there are in the class room, I hadn’t really considered Linux being a target in that market. If it is, I would imgine they must have some clued up sysadmins to support such a setup.

          Is there a perceived way to do this kind of thing? ie, should we be considering some sort of packaging mechanism? If so, which one? I am still a bit from the old school on this one, no setup needed, just double click the .exe that you installed in the folder of your own choice.

          Howard

      • Andy Hart says:

        Howard;

        I am running 64 bit Ubuntu. I have put the rule in as you described, as before that I got the libussb error cannot ope.. permission denied.

        Now with the rule in udev I get a segmentation fault. If the FCD is not plugged in, the hid002 programme will start – but of course with the error “No FCD detected” followed by a warning on the command line again of segmentation fault.

        Any idea of a quick fix for the segmentation error problem yet? I see a couple of others have this error as well

  3. admin says:

    Hi Mike

    Thanks for your input. I think I’ll leave the packaging to someone else to do for now. My brief experience of trying to do any SDR under Linux suggests to me that you need some degree of technical experience already anyway. As you suggest it will take some time and effort for someone to do that packaging. Until a month or so ago I had no intention of providing anything other than making sure the operating systems recognised the device at a driver level, and to provide a Windows interface with source together with the HID interface documentation for the coders.

    However a small number of people complained that their OS wasn’t being properly supported, so I’ve now spent quite a lot of time on getting a cross platform front end going for them. Even now, it still needs some work, for example the integrated HID firmware bootloader part doesn’t work properly in Linux for some reason.

    Once I have it in a reasonably working state in the next week or two I’ll release the source for someone far better qualified than me to fancy it up! (The FUNcube team very well know that I am not a GUI guy!).

    Howard

  4. Mike says:

    Progress – After success with QT Creator I have managed, with some argument over wchar_t* vs char*, to get the HID class to compile under Borland C++ Builder – the fcd.c functions also compile with only a few warnings, so I am well on my way to an application. So far I have only got as far as setting the frequency and correcting for the crystal offset (mine is -106ppm) but the rest should be straightforward. There are various registers to deal with. I am looking forward to finer frequency resolution.

    Next task is to try and couple to Spectravue – some form of com port hijack maybe.

    Mike

    • admin says:

      Hi Mike

      Sounds excellent!

      I am in the process of adding in a new frequency set HID command that will allow you to specify frequency down to 1Hz, although the PLL isn’t that accurate.

      Its command code is, perhaps unsurprisingly, 101, and it takes a 32 bit rather than a 24 bit unsigned frequency and it also returns the 32 bit actual frequency set.

      Howard

      • Mike says:

        Excellent – we need that to get the offsets right.

        Why not just replace the 1kHz function – it is not really needed any more. Compatibility with older code perhaps? Save a byte in USB comms?

        The frequency word is 32 bit unsigned? That should be sufficient to 4GHz – except for those requesting sub-Hz resolution. Your current function definition uses int – which could be dangerous if any compilers still define ints as 16 bits.

        EXTERN FCD_API_EXPORT FCD_API_CALL FCDMODEENUM FCDAppSetFreqkHz(int nFreq)

        Incidentally, one of the things I had to do to make your code work was replace all the custom integer declarations with unsigned __int32 etc. I am sure there is a simpler way using typedef but I could not remember how at 11:30pm so global replace was used as a fast fix.

        Mike

        PS – This is probably not the right place to discuss software – must be boring to most readers.

  5. Matty MD0MAN says:

    Much of the SDR software seem to use a set of the ‘Kenwood’ commands for changing frequencies etc.

    It’s well beyond my abilities, but it would be awsome if someone could kludge something together to interpret the Kenwood commands into something that would work with the FCD.

    Matty

    • Mike says:

      Not so easy with Spectravue. Yes one can make a virtual com port connection and decode the Kenwood commands, but there ought to be a better way not requiring a com port.

      It is possible to control Spectravue from another program – Moe provides some source code, but unfortunately it is in Microsoft Visual C. Everyone uses a different version of C++ – that is one of the good things about standards, there is a lot of choice as there are so many of them, but in this case I don’t think it will be a simple job.

      Mike

    • Mike says:

      Came a bit late for me….

      I managed to get power SDR to set the frequency of the dongle, and I could scan up and down the band with the mouse, but it was a bit of a cludge. I managed to tune in Manchester Airport weather on 128.185MHz

      I am using a virtual com port utility called com0com to link com10 to com11. My FCD control software is listening on com10 for FAxxxxxxxxxxx; commands from powerSDR which thinks it has an SDR1000 attached is sending kenwood style commands on com11. When my application gets a valid frequency command it sets the frequency of the FCD to it. The 1kHz resolution is a problem as I can’t seem to work out how to make PowerSDR move its demodulation window relative to the passband – fine for FM but not SSB. Also, to get above 50MHz one has to tell PowerSDR it is using a transverter at 28MHz. PowerSDR also seems to be trying to apply USA band plans and refuses to run unless set to RX only. Why it applies these is another mystery, I can see why it does this on transmit but not on receive. There does not appear to be a country setup option to avoid it. It is all a bit fraught so I do not recommend PowerSDR and FCD just yet.

      Spectravue, my preferred platform, refuses to send or receive frequency commands when in Soundcard mode. I will Email Moe and ask him how it should be done as there is an API.

      The other SDR package WRplus – is frustrating as it insists on using the entire screen and so makes debugging impossible. I abandoned it. Why do people do this – it is obviously great software?

  6. Oscar says:

    Hi Mike,

    WRplus has one of the best AM (e.g. for Airband) and FM demodulators in any SDR software to date that I’ve tried…..

    I would still give it a try. Or use HDSDR (almost identical in terms of how to send/receive frequency commands via the EXTIO.DLL interface)….HDSDR can be scaled to my knowledge…..

    Otherwise the authors may provide you with a scaleable window version just for your debugging purposes.

    WRplus currently is my favourite SDR RX app….

    Oscar

  7. admin says:

    Folks

    I am delighted that some people are already writing software for the FCD!

    The fast rate of third party development wasn’t quite what I expected at all, but I guess you’re a bit like me, given a bit of code to run with, that beats a formal API specification any day.

    Thanks again, Howard

  8. ad says:

    rob, thanks for sending me to this post!
    i have tried creating the udev rules but this leads me to a segfault, i can only see the qtGUI when i ran it as user, but then i get the permissions to read and write error, if i change the user allowed to run the device or the permissions to the device i only get a segfault, yes this is latest ubuntu 10.10, please see:

    libusb couldn’t open USB device /dev/bus/usb/001/012: Permission denied.
    libusb requires write access to USB device nodes.
    can’t open device
    alejo@dspstv:~/Desktop/qthid002$ ls -lah /dev/bus/usb/001/012
    crw-rw-r– 1 root root 189, 11 2011-01-10 17:56 /dev/bus/usb/001/012
    alejo@dspstv:~/Desktop/qthid002$ sudo chown alejo:alejo /dev/bus/usb/001/012
    alejo@dspstv:~/Desktop/qthid002$ ./hid002
    Segmentation fault
    alejo@dspstv:~/Desktop/qthid002$ ls -lah /dev/bus/usb/001/012
    crw-rw-r– 1 alejo alejo 189, 11 2011-01-10 17:58 /dev/bus/usb/001/012

    i could generate a debian/ubuntu package if someone provides a makefile

    • Andy says:

      See my message on the Yahoo group:

      http://uk.groups.yahoo.com/group/funcube/message/525

      This seems to be (an almost correct) udev rule – n.b you have to be root to create the rule, and don’t plug in the FCD before running the app, or you will still seg fault.

      So I am now compiled and running on 64 bit Linuxmint; a Ubuntu 10.10 variant.

      • admin says:

        Hello Andy

        OK I will take a look when I get a moment on 64 bit. Trying to make this stuff work cross platform is proving to be a serious amount of work I’m afraid, and it was exactly what I was afraid of when I was coerced into doing cross platform application code a couple of months ago, something I never originally intended to provide. This does not apply to the driver: the FCD was always designed to work at the driver layer cross platform.

        My original intention was to let third parties do the application code given the HID specification, something that is being done successfully already on Windows and Linux by several others. After all, there are some great SDR programs out there already, why reinvent the wheel?

        Howard

  9. DO8MAR says:

    I have the same problem getting a segmentation fault on ubuntu 10.10 with the udev rules set.
    I there any solution yet?
    Martin

  10. Gerrit says:

    what are the plans and progress for the QT cross platform FCD controller?
    Currently it is useless since it can not set the filters an gains like FCHid.
    Since the gain and filter parameters are not persistent, I can not run the FCD on a mac right now.

    Gerrit.

    • admin says:

      Hello Gerrit

      Expanding QT is dependent on opening up the firmware.

      The plans are to open up the entire API so that the QT cross platform controller can use it. In fact, there is already a prerelease of that firmware on the FCDDevelopment Yahoo group with example source code that opens up everything. That was released on Sunday. We are currently welcoming feedback so that we get the firmware right first.

      Now I have a Mac that arrived last week it will of course be easier.

      It’s purely a matter of time! I had my first half day off since Christmas last week. If there are others who would like to have a go they are of course welcome.

      Howard

  11. I received the FUNCube Dongle April21st,and theFUNCube Dongle Controller reports
    No FCD detected.Can you please advise as to what to do to correct this?

    • admin says:

      Hello Derek

      Sorry you are experiencing difficulties. When you insert the FCD, does your PC correctly detect it? You can check this from the Device Manager: what OS are you using?

      Howard

  12. Derek L Barnes says:

    Hi Howard,
    The FCD has now been found,and I have downloaded Spectravue,Ver3.17.
    For the Input Device if I choose Sound Card I get Soundcard 1 shown,but
    still no sound!Any other inclusions ie SDR-14 Setup etc shows either USB
    or Network not connected!! Can you help please?
    Derek G6IVE

  13. Holger says:

    Hi,
    i use the WRplus software, but it’s hard to “scan” some frequencies, becaus i have to do this with the mouse-wheel.
    is there a way to scan a range of frequnencies automatically??

    thanks!

    Holger

    • admin says:

      Hello Holger

      I don’t know much detail about how WRPlus works as I mostly use Spectravue. I am aware that there was some discussion over on the Yahoo group recently, and I believe there is some code that somebody wrote to perform scanning, although this is not something I’ve tried myself.

      Many thanks, Howard

Leave a Reply

Your email address will not be published. Required fields are marked *


2 × = eighteen

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>