Serial port driver multi-WTF


  • Discourse touched me in a no-no place

    I'm currently on a really cool embedded project (Windows XP Embedded, so not TOO embedded...)  where we get to play with GPS and accelerometers and gyroscopes and solid-state magnetic compasses and radio receivers and etc. etc. etc.

     

    I'm in charge of mocking up the initial libraries and test app for the GPS functionality. Since our actual GPS receivers are $60 a piece, I don't get one of those yet - the hardware team has the only one for the prototype phase and I can't touch it until Prototype Unit #0 comes out of that shop (#0 is turning out to be a hilarious pile of parts, too. Imagine, for a moment, a teeny tiny small form factor computer motherboard with a HUGE heatsink sitting on top of it, 4 sticks of RAM with HUGE heatsinks on it, a FREAKING GIGANTIC gamer-class video card with a massive heatsink hanging off of it, a heavily hacked up PC power supply (the entire AC side of the power supply was removed and has been replaced with DC/DC conversion) with a number of gigantic heatsinks, and attached to the tops of the heatsinks (with double-sided tape) are a number of smaller evaluation boards (each housing a GPS unit, accelerometer, etc.) plugged into each other and into the PC board with a whole bunch of far-too-long serial cables, which are in turn bundled up with zip ties to prevent ratsnesting.)

     

    Instead, I got a $20 cheapo alternative, which actually consists of two parts in one unit - a shit GPS receiver with an antiquated chipset (that wasn't even any good when it was new) and a serial to USB bridge chip.

     

    The GPS chip is fine for this initial test - it does  the limited functions I need it to do. However, the serial to USB bridge chip is an utter terror. My main development box runs Vista. The bridge chip manufacturer's website proudly states "We will not be providing Vista drivers. Contact the manufacturer of your USB to Serial cable, they may offer support on their own." So I hunt and hunt and hunt, and eventually find one company that makes cables based off this chip - good 'ol Belkin. They have Vista drivers. I download and install them - miraculously, they work.

    I pull up a terminal and just listen to the raw serial data. Everything is fine. I hack together a program that echos the raw serial data. That's great. However, as things start getting more and more complex programmatically, I start getting BSoD's. It's particularly reproducible whenever execution is halted by the debugger because of an exception... Or because I'm trying to fucking debug something. I persevere, and work around my inability to use the debugger (and spend about 2 hours of billable time simply waiting for reboots).

     And then I start putting together the UI. Obvious design is the main thread being the UI itself, another thread tight-spinning to pull down and interpret new data over the serial port, and another thread taking that data and shoving it into the UI. Not a big deal. At this point, BSoDs become absolutely random and unbearable. After a bit of investigatory work (and a lot of annoying reboots that fill most of my day), I discover that if I block the thread that reads the serial data (or it sleeps for too long, or doesn't get scheduled often enough), I get the BSoD.

    This sets off alarm bells in my mind - "surely Vista's new driver framework should make that impossible" I say to myself; "Surely it should terminate and reload any driver that does that".

     One last test to confirm that it's not just .net's threading engine doing horrible things - I load up Hyperterminal, stream the port output directly, set the process priority to lowest and background it. Death within seconds.

    THE BLOODY DRIVER HAS A GODDAMNED BUFFER OVERFLOW.

     

     So, it's obviously this third party Vista driver. Good thing I have this other workstation to develop on - it runs Windows Server 2003. The XP drivers install fine... Hell, the installer's filename (but not the documentation or anything else) even mentions Win2k3. But if you think that means it actually works - HELL NO. It doesn't even detect.

     And this is why I'm now nonproductive and awaiting delivery of a third workstation (this time with XP) and approval for a third VS2008 license (which is a damn lot more expensive than a $60 GPS board and $10 antenna) - and at least the GPS board could be reused in producing another prototype hardware kit later on in the process.



  • You missed the exit to the Daily Rant, you're on the Daily WTF here.


  • Discourse touched me in a no-no place

    Nah, there's a couple of WTF moments in there. Chief among them being that Vista's highly-hyped and back-compatability-breaking new driver model appears to offer no benefits over the one that we had before.



  • You need more WTF. 🙂

    I'm half-surprised you didn't wire up your own serial interface from another serial-usb interface cable (that has drivers you know work), and then hacked it in to the $20 cheapo box.

    If you got a reprimand for doing that, you'd hit a hat trick of WTF.



  • @Benanov said:

    I'm half-surprised you didn't wire up your own serial interface from another serial-usb interface cable (that has drivers you know work)

    Quirk objection!  You assume that there are serial-USB interface cables that have drivers that are known to work!  



  • Don't you dare!

    @DaveK said:

    Quirk objection!  You assume that there are serial-USB interface cables that have drivers that are known to work!  

    Hey...my sanity depends on that assumption!

    The walls...they're...spinning...



  • TRWTF is that you're attempting to develop a Windows XP Embedded application on a Vista machine.



  • @Benanov said:

    @DaveK said:

    Quirk objection!  You assume that there are serial-USB interface cables that have drivers that are known to work!  

    Hey...my sanity depends on that assumption!

    Then you're in a lot of trouble... 

    @Benanov said:

    The walls...they're...spinning...

    Let me introduce you to FTDIchip.  See how the spinning sensation graudally fades away...

    ... to be replaced by an ominous sense of dread and nausea....

     



  • @DaveK said:

    Let me introduce you to FTDIchip.  See how the spinning sensation graudally fades away...

    ... to be replaced by an ominous sense of dread and nausea....

     

    FTDI gets my vote; we do a lot of serial interface stuff here,  and I can't recall a single BSOD. That's developing in Delphi or Java under XP (stop sniggering !), and deploying on XP and Vista.

    The 'smarter' devices have some quirks, but the basic serial chips 'just work'.



  • @Weng said:

    Instead, I got a $20 cheapo alternative, which actually consists of two parts in one unit - a shit GPS receiver with an antiquated chipset (that wasn't even any good when it was new) and a serial to USB bridge chip.

    And this is why I'm now nonproductive and awaiting delivery of a third workstation (this time with XP) and approval for a third VS2008 license (which is a damn lot more expensive than a $60 GPS board and $10 antenna) - and at least the GPS board could be reused in producing another prototype hardware kit later on in the process.

     

    Ah, management and their false economies...

    One of our smaller legacy projects (single cheap 8-bit micro) has been picked up by a colleague with an EE background and some basic C/assembler programming experience. We already knew that the not-quite-C compiler was a POS; new versions nearly every week, a fully tested release build broke after a compiler update, etc. This thing had been on the shelf long enough that the latest debugger version (necessary for other reasons) no longer fully supported the last known-good compiler version. The poor guy spent weeks trying to get a stable debug environment, including several days of my time; it's still not right, but it sort-of works. To-day, he added an innocuous one-line 32-bit multiply. An unrelated area of the application broke, but only in the debug build !!

    Estimated engineering cost so far about £5000 with probably more to come, and no confidence in the build. Cost of the latest version of the POS compiler (which stands a chance of working with the debugger) about £400, or of a good compiler about £1500. Oh, and we never get enough time to test anything properly.

    </rant> 

    (Can anybody guess which micro, debugger and 'compiler' we're using ?)



  • @SenTree said:

    the not-quite-C compiler

    @SenTree said:

    (Can anybody guess which 'compiler' we're using ?)

    [url=http://en.wikipedia.org/wiki/Not_Quite_C]Not Quite C[/url]?



  • @SenTree said:

    (Can anybody guess which micro, debugger and 'compiler' we're using ?)
    LEGO?



  • @Spectre said:

    Not Quite C?

    @danixdefcon5 said:

    LEGO?

    Good guess, but worse than that (I forgot it was actually a real language, rather than a term of abuse). At least Lego uses decent processors (from my brief experiments with the ARM7).

     

    It's past midnight here in the UK, so I'm off to bed.

     


  • Discourse touched me in a no-no place

     @Benanov said:

    I'm half-surprised you didn't wire up your own serial interface from another serial-usb interface cable (that has drivers you know work), and then hacked it in to the $20 cheapo box.

    I've considered breaking the thing open and soldering on a direct serial connector, because my PC is awesome enough to still actually have a serial port - except that no amount of prying will open the thing (it has no screws and is in fact watertight - apparently by virtue of slathering the interior of the friction-fit joint in half a gallon of adhesive) and smashing it is not high on my priorities list. 

     

     @X-Cubed said:

    TRWTF is that you're attempting to develop a Windows XP Embedded application on a Vista machine.

     I have it on "authority" that XP Embedded supports both .NET 3.5 AND DirectX 9. I don't believe it myself, so I suspect that whatever wank wrote "XP Embedded" down actually meant "XP Pro" (because that's what's going onto the prototype)

     



  • @Weng said:

    This sets off alarm bells in my mind - "surely Vista's new driver framework should make that impossible" I say to myself; "Surely it should terminate and reload any driver that does that".

    Why don't you just use in-box usbser.sys? Slap an INF file together, and you're good to go. Or just edit the registry to replace the binary name to usbser.sys.

    Though reportedly usbser.sys is not an example of a perfect  driver.


  • Discourse touched me in a no-no place

     Whee. Just got my new workstation. VS2008 is still pending, and this PC is a bundle of joy.

    1) It's an old ex-DoD contract box. No hard drive, so they tossed a 20 gig drive that's been sitting in a filing cabinet for like 8 years in and called it a day. It makes all kinds of lovely noises.

    2) I can actually HEAR EMI in audible frequencies from the USB lines when data hits them. I actually had to turn up the bitrate the GPS transmits so I can get beeps every second, rather than a continuous tone.

     

    We'll find out shortly if the XP version of the driver is any less shit than the Vista version... Just as soon as I figure out why the fuck I can't even run my executables on this machine.



  • @Weng said:

    as soon as I figure out why the fuck I can't even run my executables on this machine.

     

    Install VC2008 CRTL runtime. Or use static linking.

     



  •  I bet you clicked a "bypass the fact that this driver isn't signed and hasn't passed WHQL" dialog on the way to install, didn't you?

    Shame.



  • @SenTree said:

    @Weng said:

    Instead, I got a $20 cheapo alternative, which actually consists of two parts in one unit - a shit GPS receiver with an antiquated chipset (that wasn't even any good when it was new) and a serial to USB bridge chip.

    And this is why I'm now nonproductive and awaiting delivery of a third workstation (this time with XP) and approval for a third VS2008 license (which is a damn lot more expensive than a $60 GPS board and $10 antenna) - and at least the GPS board could be reused in producing another prototype hardware kit later on in the process.

     

    Ah, management and their false economies...

    One of our smaller legacy projects (single cheap 8-bit micro) has been picked up by a colleague with an EE background and some basic C/assembler programming experience. We already knew that the not-quite-C compiler was a POS; new versions nearly every week, a fully tested release build broke after a compiler update, etc. This thing had been on the shelf long enough that the latest debugger version (necessary for other reasons) no longer fully supported the last known-good compiler version. The poor guy spent weeks trying to get a stable debug environment, including several days of my time; it's still not right, but it sort-of works. To-day, he added an innocuous one-line 32-bit multiply. An unrelated area of the application broke, but only in the debug build !!

    Estimated engineering cost so far about £5000 with probably more to come, and no confidence in the build. Cost of the latest version of the POS compiler (which stands a chance of working with the debugger) about £400, or of a good compiler about £1500. Oh, and we never get enough time to test anything properly.

    </rant> 

    (Can anybody guess which micro, debugger and 'compiler' we're using ?)

     

     

    Sounds like PIC? I hear this story everyday.  I work for an Embedded vendor.


  • Discourse touched me in a no-no place

    @Fister said:

     I bet you clicked a "bypass the fact that this driver isn't signed and hasn't passed WHQL" dialog on the way to install, didn't you?

    Shame.

    No, I didn't.

    In fact, I've never actually encountered a situation where Vista would FUCKING LET ME click through that dialog (I saw it about 11ty trillion times when Vista first came out. I'd click the "Yes, install it anyway" button and it'd come back "ALL DRIVERS MUST BE WHQL SIGNED. I DON'T CARE WHAT YOU SAID BEFORE!")


  • Discourse touched me in a no-no place

    @alegr said:

    @Weng said:

    as soon as I figure out why the fuck I can't even run my executables on this machine.

     

    Install VC2008 CRTL runtime. Or use static linking.

     

    Or try running the x86 executable instead of x64


  • @Helix said:

    Sounds like PIC? I hear this story everyday.
    You've got it ! The compiler is of course C C S. For simple (read 'hobbyist' or 'door opener') projects, the combination is probably adequate. For industrial-strength requirements, the processor architecture is horrible - and very easy to overlook the fact that you need to set a flag in some unrelated peripheral B register to get peripheral A working. Using C C S compounds the problem since it makes basic operations very easy (I'll give praise where it's due) but breaks horribly on various common C techniques. Breaking working code with a compiler update, or by adding an unrelated simple statement, is just unforgiveable.

    Unfortunately the powers that be wouldn't authorise the time to migrate the project to a proper compiler, even after these issues were noted. And to compound the problem, we still use PICs on new projects - but with a 'proper' compiler that also doesn't work (if I said lager-powered you might guess it's not IAR).

     

    @Helix said:

    I work for an Embedded vendor.
    Hopefully not selling PICs and duff compilers ?



  • Discourse touched me in a no-no place

    This makes me rather glad to have done all my embedded learning on Freescale chips.



  • @Weng said:

    This makes me rather glad to have done all my embedded learning on Freescale chips.
     

    See, it could be worse 😉  - and you get to play with this century's toys, even if you get the cheap versions. Our sensors are very primitive, very industrial; our bleeding edge comms is Modbus !

     



  • @Fister said:

     I bet you clicked a "bypass the fact that this driver isn't signed and hasn't passed WHQL" dialog on the way to install, didn't you?

    Shame.

    I am sure I am not the first to notice this, but we have a Windows XP CD at work that contains a Broadcom NIC driver that's not guaranteed compatible with Windows. It's quite amusing to be setting up Windows and be told that the NIC driver is not guaranteed to be compatible with Windows.


  • Discourse touched me in a no-no place

    Another WTF about this GPS unit:

    It has a magnet built into it so you can slap it up on the roof of your car. It said so on the box.

     We just completed an integration test with all 5 primary component developers jammed into the car with laptops and antennas/etc. mounted onto the exterior of the car (we did this in the middle of the night because it's going to fucking snow tommorrow and we'd like to actually get work done) - this all went great until we discovered that the GPS unit breaks away from its magnetic mount at about 60 mph. We discovered this when we heard a smack against the roof, followed by an exploding capacitor accompanied by a complete loss of signal from an HF receiver (the only piece of kit on the roof with an unprotected PCB), followed by the GPS proudly crashing against the passenger side window and hanging there, red LED smiling at us like a small child who just broke a museum's vase.

    Some other pieces of kit were secured with repurposed refrigerator magnets and didn't come loose AT ALL, but this thing came loose readily at a very low speed. The hardware team is now assessing the damage done to the HF unit - it's either a 50 cent fix or a total writeoff.



  • @SenTree said:

    @Helix said:

    Sounds like PIC? I hear this story everyday.
    You've got it ! The compiler is of course C C S. For simple (read 'hobbyist' or 'door opener') projects, the combination is probably adequate. For industrial-strength requirements, the processor architecture is horrible - and very easy to overlook the fact that you need to set a flag in some unrelated peripheral B register to get peripheral A working. Using C C S compounds the problem since it makes basic operations very easy (I'll give praise where it's due) but breaks horribly on various common C techniques. Breaking working code with a compiler update, or by adding an unrelated simple statement, is just unforgiveable.

    Unfortunately the powers that be wouldn't authorise the time to migrate the project to a proper compiler, even after these issues were noted. And to compound the problem, we still use PICs on new projects - but with a 'proper' compiler that also doesn't work (if I said lager-powered you might guess it's not IAR).

     

    @Helix said:

    I work for an Embedded vendor.
    Hopefully not selling PICs and duff compilers ?


     

     

    Nope not so much PICs used in real development

    Which lager-powered compiler?



  • @Helix said:

    Nope not so much PICs used in real development
    I know 😕 Most of our stuff doesn't really come under the current meaning of 'embedded', it's mainly sensors with a bit of intelligence. Our earlier basic models used an op-amp, a comparator and a relay; they were a lot more reliable and adequate to the task. At least in our higher-end (non-sensor) products I've managed to specifiy half-decent devices like H8s or ARM7s.@Helix said:
    Which lager-powered compiler?
    Lager as in Australia. It's Hi-Tech; we've had cases where it doesn't understand nested structures, or it's missed resetting the PIC bank select registers when exiting a switch block - but only for one case (meaning all subsequent variables are fetched from the wrong addresses).

     



  • @Weng said:

    It has a magnet built into it so you can slap it up on the roof of your car. It said so on the box.

    All I can say is: don't trust the box (which was cheaply made in China, just like the antenna and the glue). The magnets are to be used inside the car, preferably on some exposed metal part near one of the windows.

    I worked for a while at a GPS device manufacturer and we never put the antenna outside the car, because of these kinds of problems. If the antenna doesn't fall off at speed, it will either slowly rot away in the rain and sun or the cable will break where it's passed through the door and/or window. Just slap it on the dashboard somewhere with some double-sided tape (the high quality kind) and it will never bother you again.



  •  The real wtf is that your hardware people decided to build a 12 volt psu

     

    These guys:

    http://www.opussolutions.com/

    build primo equipment.



  • @Weng said:

    I'm currently on a really cool embedded project (Windows XP Embedded, so not TOO embedded...)  where we get to play with GPS and accelerometers and gyroscopes and solid-state magnetic compasses and radio receivers and etc. etc. etc.
    So what's this thing actually meant to do anyway?



  • TRWTF is that you don't have MSDN subscriptions, which are licensed per developer rather than per machine.

     Are you sure Visual Studio isn't licensed per developer rather than per machine as well?



  • eula.txt from VS2008 (this is from an MSDN disc, but it does not in fact say anything about MSDN in this file).

    MICROSOFT SOFTWARE LICENSE TERMS

    MICROSOFT VISUAL STUDIO 2008 PROFESSIONAL EDITION AND TRIAL EDITION
    ...

    1.    OVERVIEW.

    a.    Software.  The software includes development tools, software programs and documentation.

    b.    License Model.  The software is licensed on a per user basis.

    2.    INSTALLATION AND USE RIGHTS.

    a.    General.  One user may install and use copies of the software to design, develop, test and demonstrate your programs.  Testing does not include staging on a server in a production environment, such as loading content prior to production use.

    b.    Included Microsoft Programs.  These license terms apply to all Microsoft programs included with the software.  If the license terms with any of those programs give you other rights that do not expressly conflict with these license terms, you also have those rights.

    You don't need another copy of VS on each machine.



  • @Weng said:

    Another WTF about this GPS unit:

    It has a magnet built into it so you can slap it up on the roof of your car. It said so on the box.

     We just completed an integration test with all 5 primary component developers jammed into the car with laptops and antennas/etc. mounted onto the exterior of the car (we did this in the middle of the night because it's going to fucking snow tommorrow and we'd like to actually get work done) - this all went great until we discovered that the GPS unit breaks away from its magnetic mount at about 60 mph. We discovered this when we heard a smack against the roof, followed by an exploding capacitor accompanied by a complete loss of signal from an HF receiver (the only piece of kit on the roof with an unprotected PCB), followed by the GPS proudly crashing against the passenger side window and hanging there, red LED smiling at us like a small child who just broke a museum's vase.

    Some other pieces of kit were secured with repurposed refrigerator magnets and didn't come loose AT ALL, but this thing came loose readily at a very low speed. The hardware team is now assessing the damage done to the HF unit - it's either a 50 cent fix or a total writeoff.

     

    The box was right. It did stick to the roof of your car. The box never said anything about how fast you could go with it.


  • Discourse touched me in a no-no place

     Interesting. I should actually try reading an EULA sometime. (Well actually someone ELSE should read it and Just Fucking Install It. Or maybe they're just pocketing the cash. Who knows.)



  • @SenTree said:

    At least in our higher-end (non-sensor) products I've managed to specifiy half-decent devices like H8s or ARM7s.

    I'm shopping for MCUs to practice embedded programming (after many years), so I got the free Renesas H8 kit (I love the SH-4 as an MPU), plus some ARM chips... Are those okay? Any recommendations on top of the line chips I could buy just for fun?

    Thanx! 😃



  • There are some embedded PPC chips that are nice (just look inside your nearby Xbox 360 🙂

    The ARM9 has more oomph than the 7, 'cause it has floating point.

    If you're a DSP guy, then there's the 64-bit SHARC chips; very nice for synths and stuff.

    And at the very top end of "embedded" you have the Intel Atom with the NVIDIA Ion chipset. I fully expect that kind of thing to show up in fancy conference room remote controls and the likes in the next few years, complete with animated 3D graphics and whatnots.

     


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.