Skip to main content
Topic: fw_update not working in linux or OS X (Read 14124 times) previous topic - next topic

fw_update not working in linux or OS X

I compiled fw_update in both linux and Mac OS X. In both cases it can't find the ir toy and this is all I get:
# fw_update -e -w -v -m flash -vid 0x04d8 -pid 0xfd0b -ix USBIRToy.v22.hex
U2IO flash erasing: FAILED.
Device is not found.
Operation aborted.

I put the ir toy in to update mode with $ and the light is on. Linux does see the device. This is my current dmesg:
[31831.451058] usb 3-1: new full-speed USB device number 4 using ohci_hcd
[31831.651078] usb 3-1: New USB device found, idVendor=04d8, idProduct=fd0b
[31831.651089] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[31831.651098] usb 3-1: Product: Diolan
[31831.651103] usb 3-1: Manufacturer: Diolan
[31831.664076] generic-usb 0003:04D8:FD0B.0003: claimed by neither input, hiddev nor hidraw

I originally had hidraw enabled in the kernel and the message was slightly different and /dev/hidraw0 (or something like that) was created. It didn't see the device so I thought maybe the driver was conflicting with libusb. removing it didn't fix it.

I am currently stuck in update mode and my brand new ir toy is useless. Any ideas?

~Jess

Re: fw_update not working in linux or OS X

Reply #1
How about permissions ? Did you try to sudo ?

Re: fw_update not working in linux or OS X

Reply #2
I tried the ols-fw-update binary from the latest open logic sniffer package and it finds the device, erases and writes the firmware but then fails at the verify step. I took away the -v option and it erased, wrote and rebooted but the irtoys serial device never shows up.So looks like the diolan's firmware_update utility linked from the irtoy docs is broken(atleast with modern linux and gcc) and the ols-fw-update doesn't work properly with the irtoy.

Ideas?

-Jess

Re: fw_update not working in linux or OS X

Reply #3
Yes I am running as root so that there wont be permission problems.

Re: fw_update not working in linux or OS X

Reply #4
ols-fw-update is to OLS bootloader. Main difference is the size of page.
You will need to alter this line and compile yourself:

https://github.com/robots/ols-fwloader/ ... boot.h#L38

I think it should be 32 for IR Toy, but i am not sure. :-)

You will also need to change line:
https://github.com/robots/ols-fwloader/ ... oot.c#L355
from
Code: [Select]
#if OLS_PAGE_SIZE == 2
to
Code: [Select]
#if OLS_PAGE_SIZE <= 32

Re: fw_update not working in linux or OS X

Reply #5
I knew it wasn't intended for the irtoy but it seemed to be based on the same source and more up to date so I figured that I would see if it could find it. It did. Was planning on diffing the sources but your pointers most likely just saved me a whole lot of time.

Re: fw_update not working in linux or OS X

Reply #6
Since i am the author of the ols-fwloader, I know the internals :-).

I would like to know how it went. I could then add another target to the build process, so it would create another "flashing" binary for USB ir toy.

Re: fw_update not working in linux or OS X

Reply #7
Based on the source of the other loader looks like 32 should be the right number:
size_t PicBootloader::page_size(PicBootloader::MemoryType memory)
{
        switch (memory)
        {
                case MEM_FLASH:
                        return 32;
                case MEM_EEPROM:
                        return 8;
                case MEM_ID:
                        return BOOT_ID_LEN;
                default:
                        return 8;
        }
}

Made those changes but I am getting the following error:
~user/Downloads/robots-ols-fwloader-fb4a14a/src/ols_fwloader -d -f BOOT -W -w ~user/Downloads/IRToy/firmware/USBIRToy.v22.hexBootloader version 0.2.2
Bootloader version 0.2.2
Reading file '/home/user/Downloads/IRToy/firmware/USBIRToy.v22.hex'
Data won't fit into buffer (size= 4000 want 4010)
Error reading file - skipping write


Re: fw_update not working in linux or OS X

Reply #9
Yes. I changes it to 6000 as in the origional diolan fw_updater. Didn't fix the problem. Changing  OLS_FLASH_TOTSIZE to an arbitrarily large value bypasses the error but things don't work properly. Verify gives me lots of lines like this:
Diff @0x3d7d (Is 0xff should be 0xec)
Diff @0x3d7e (Is 0xff should be 0x17)
Diff @0x3d7f (Is 0xff should be 0xf0)
Diff @0x3d80 (Is 0xff should be 0xfb)

And I still don't have a working device.

Re: fw_update not working in linux or OS X

Reply #10
Can you try to read the whole flash ? And upload the "hex" you read, and the one you are trying to flash.

Re: fw_update not working in linux or OS X

Reply #11
I got fw_update working by taking the fixes from the version of it from the logic sniffer git tree. This means that it now compiles with newer versions of gcc and can actually find the ir toy in linux. The source is available here: http://jesshaas.com/software/IRToy-fw_update.tar.gz This really should be put in the irtoy package and the docs should be updated.

robots-Would love to get your loader working as it would be nice if there was one loader for the various devices. Unfortunately I don't really have any more time to futz with it right now. Maybe if I get some more time later on I will try to get it working.

-Jess

Re: fw_update not working in linux or OS X

Reply #12
Thanks Jess,

I was going to add this to SVN, but the source seems to have a lot of intermediate files. Any suggestions on what I can clean up? I am not a desktop programmer.
Got a question? Please ask in the forum for the fastest answers.

Re: fw_update not working in linux or OS X

Reply #13
Sorry about that. Did a make clean and make distclean but didn't do a proper check of what all might be hanging around. Not a lot of free time these days so I just have a few minutes here and there to work on stuff. I will try to clean it up tomorrow and will post a new link when I do.

Re: fw_update not working in linux or OS X

Reply #14
What would really help, is dump of flash memory when flashed correctly, dump of memory when flashed wrong. (dump made by fw_update). And probably dump of flash memory when flashed correctly (done with ols-fwloader).