Getting Sidetracked by Interesting Protocols

Today, I lost a lot of time.

Actually, I didn’t lose any time, I just didn’t use it for what I had intended in the first place. I hoped to finish the assignment within the deadline, that is today; instead I learned a little about USB and standard libs.

I started by trying to use the serial-over-usb module of ChibiOS, but faced with the complexity of the USB protocol, I ended up adapting the demo code rather than reconstructing it. To my surprise, it didn’t work ! That is, even when only compiling the demo code, it would compile fine, but never actually expose a recognizable device to my computer . Instead, I would be getting confusing “device descriptor read error” messages in my dmesg, and packet inspection via wireshark/usbmon indicated that the packets were malformed. After some fiddling about and dirty “switch the usb off and on again until it works” hacks, I could see the device descriptor, but not its configuration, so still far from a serial-over-usb communication.

After a few hours of hair pulling, I switched workstations, and it worked on the first try, with the exact same code, only a different compiler ! I guess I’ll be sticking with the official ARM toolchain from now on, to avoid any unpleasant surprises like this.

In the end I still learned some basics about the USB protocol, and I also tried to make ChibiOS compile with clang. I have no more compilation errors, but it’s still not linking unfortunately. I guess this little side-project will have to wait, though, because I still didn’t finish the assignment in the end…

Anatole Denis

3 comments to Getting Sidetracked by Interesting Protocols

  • Just curious, did you try plugging it in the faulty computer after it worked?

    PS: learning is all about digressions: http://en.wiktionary.org/wiki/yak_shaving

    • Natolumin

      Yes, obviously 🙂

      In fact, I took the same compiler I use in the second machine to use in the first, and I can switch between “broken usb” build and “working usb” build by only changing the symlink to the compiler on the first machine, and it ends up working/not working on both computers, every time.

      Now my second computer has a very similar setup, but not the exact same, and also has its own compiler with the same version as the faulty one, so I should probably try to confirm whether it is only this build of gcc that causes this or the whole version/environment.

  • That’s painful, I had a similar problem a couple of years ago…
    Can you give any details about these compilers?