Skip to main content
Topic: Firmware improvements (Read 4026 times) previous topic - next topic

Firmware improvements

I got this great info on the USB IR Toy via email, I wanted to share it with everyone:

Quote
I haven't tested the functionality of the USB IR Toy yet, but I did plug it in to look at the USB Descriptors.  They indicate that the device is self-powered when it's really bus-powered.  I suppose there really isn't any extreme harm, since both the self-powered and low-power bus-powered functions are limited to 100 mA, but it would seem prudent to correct this.

I looked at the source and see that this is because the CDC usb_descriptors.c starts with this value as default.  I think you should remove the _SELF from future builds.  Certainly not a critical priority, though.

Also, there's no need to pad the Product String out to 25 characters.  You can simply change the string array size to 18, or less if you want a shorter string - e.g. "USBIRtoy" would only need 8.  On the other hand, leaving the trailing spaces does allow hackers to easily change the text without recompiling, and that has its benefits.  I note that you did change the Vendor to 23 characters, so I guess you already know how this part of the Microchip USB Stack works.


One other comment is that the Diolan bootloader seems a bit overkill, at least their XTEA encoder/decoder.  I don't quite see the need to encrypt open source firmware.  Then again, I've tried working with various bootloaders for the PIC, and none of them are perfect, not even the one I wrote myself.  Since I have the PICkit2 and www.pic16.com clone, I'll just ignore the bootloader.
Got a question? Please ask in the forum for the fastest answers.

Re: Firmware improvements

Reply #1
My reply:

I'll get the descriptor updated ASAP. Long term I plan to replace the Microchip CDC stack entirely. I'm working on a complete replacement USB stack for all the Microchip CDC projects I do. I'll release it under MIT license because I really feel like there should be an open alternative to Microchip's stack. It should be ready in a week or so (hopefully).

The diolan bootloader is the only open source USB bootloader I know of, so I used it by default. I actually stripped out all the encoding stuff and made a few other enhancements. I also ported it to the Open Logic Sniffer's PIC18F24j50 with those enhancements.
Got a question? Please ask in the forum for the fastest answers.

Re: Firmware improvements

Reply #2
I implemented these changes and uploaded new code (with updated headers) to the SVN. This is untested. Once tested I'll make a new package with updated PCB files. For now, use this at your own risk (preferably if you have a PIC programmer and can fix it if something goes wrong):
http://code.google.com/p/dangerous-prot ... BIRToy.hex
Got a question? Please ask in the forum for the fastest answers.

Re: Firmware improvements

Reply #3
Thanks for the update!  I see that you've released all the revised files on the main DP page.

I am temporarily without an XP box - has anyone successfully Flashed the USB IR Toy from OSX? I guess I'm being lazy, since I've already downloaded the Microchip tool for OSX that works with the PICkit2, but I am wondering if anyone else has beat me to it. I've Flashed PIC chips from OSX before, but it's been a while.

Re: Firmware improvements

Reply #4
Hey Ian,

Just wondering how your open USB Stack project was coming along? I am looking for a USB bootloader for a 18F14K50, and think that the stuff you are working on might be helpful.

A quick introduction: I am with RechargeCar Inc. developing products that make it easier for people to make better electric cars. Specifically, this project (we are calling it AutoBlock AMP) will be used to measure Current flow up to 1000 AMPs (!) in both directions and communicate to a USB host via our OpenAPI EV packet structure.

Thanks for your help, keep the cool projects rolling in.

Josh
www.rechargecar.com

Re: Firmware improvements

Reply #5
Hey josh - there is a GPL'd USB bootloader that I've been using (included in the IR Toy). You can find the source in the Dangerous Prototypes SVN and probably the USB IR Toy source package archive. I also ported it to the 18f24j50 for the open logic sniffer, you can find the source in the gadget factory SVN.

The stack is coming, but it is a long slow process.
Got a question? Please ask in the forum for the fastest answers.

Re: Firmware improvements

Reply #6
[quote author="ian"]
The stack is coming, but it is a long slow process.
[/quote]

Hi,

If you want an easy, open-source, BSD licensed USB stack, then have a look at
http://code.google.com/p/jallib/ and
http://groups.google.com/group/jallib

Jallib is an open source (complete) library for JAL language and JALv2 compiler released under BSD license. It include an USB bootloader, and have libraries for USB CDC full speed.
The language is like pascal and very easy (and pleasant) to work with it. The JALv2 compiler is very efficient.
Ok, enough with the advertising.

Your fw_update is working great for Windows but we don't have an alternative for Linux. You included in package the original sources and they don't work with your striped down bootloader :( . I would like to have fw_update working also in Linux. Thank you!

Regards,
Vasi

Re: Firmware improvements

Reply #7
Quote
Your fw_update is working great for Windows but we don't have an alternative for Linux. You included in package the original sources and they don't work with your striped down bootloader :( . I would like to have fw_update working also in Linux. Thank you!

The IR Toy uses a stripped-down firmware, but it works with the original Diolan utilities. Diolan has versions available for Linux, BSD, Darwin, OSX their download page:
http://www.diolan.com/pic/bootloader_dwn.html
Got a question? Please ask in the forum for the fastest answers.

Re: Firmware improvements

Reply #8
Thank you for the reply. I tried it few months ago (I think) and didn't worked on linux and Mac. Maybe it was my fault... I will try it again.

Regards,
Vasi

Re: Firmware improvements

Reply #9
I am using the dialon bootloader on ubuntu karmic / lucid. I had to include some headers in a couple of c files to get it compiled. But not a big deal. I even started with the original bootloader firmware from dialon. It took me quite a long time to find out that it is configured to use extended instruction set. USB Toy does not!

2 important steps on Linux:
- If any other device driver is bound to the device, unbind it. The bootloader pretends to be a HID device, thus most likely the HID driver binds to the device as soon you plug it in.
- Run fw update in super user mode or define a udev rule and change permissions on the device.

//Rainer

Re: Firmware improvements

Reply #10
Has anyone gotten diolan to compile on macos?  Although I have libusb, the configure refuses to acknowledge it so I thought I would ask the question before I plow into it.

Re: Firmware improvements

Reply #11
I can't help compile on MacOSX yourself, but if you're just looking for a precompiled version Diolan has them for just about every operating system here:
http://www.diolan.com/pic/bootloader_dwn.html
Got a question? Please ask in the forum for the fastest answers.

Re: Firmware improvements

Reply #12
FYI I figured out my issue.  safari downloaded this and unpacked in a directory with a ' ' (Space) character in it.  The libtool script it makes in the build process can not handle this.  Also I went to that site Ian and all the had for mac os was the sources, but as long as the path to where it is being built does not have spaces in it it will build.