fw_update not working in linux or OS X

USB infrared remote control receiver/transmitter. Get one for $20, including worldwide shipping.

fw_update not working in linux or OS X

Postby JessH » Sun Feb 26, 2012 10:44 am

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
JessH
Newbie
Newbie
 
Posts: 18
Joined: Tue Jan 17, 2012 8:56 pm

Re: fw_update not working in linux or OS X

Postby robots » Sun Feb 26, 2012 1:31 pm

How about permissions ? Did you try to sudo ?
User avatar
robots
Hero Member
Hero Member
 
Posts: 569
Joined: Sat Dec 05, 2009 11:19 am
Location: CZ/Prague

Re: fw_update not working in linux or OS X

Postby JessH » Sun Feb 26, 2012 1:38 pm

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
JessH
Newbie
Newbie
 
Posts: 18
Joined: Tue Jan 17, 2012 8:56 pm

Re: fw_update not working in linux or OS X

Postby JessH » Sun Feb 26, 2012 1:38 pm

Yes I am running as root so that there wont be permission problems.
JessH
Newbie
Newbie
 
Posts: 18
Joined: Tue Jan 17, 2012 8:56 pm

Re: fw_update not working in linux or OS X

Postby robots » Sun Feb 26, 2012 2:40 pm

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 all
#if OLS_PAGE_SIZE == 2

to
Code: Select all
#if OLS_PAGE_SIZE <= 32
User avatar
robots
Hero Member
Hero Member
 
Posts: 569
Joined: Sat Dec 05, 2009 11:19 am
Location: CZ/Prague

Re: fw_update not working in linux or OS X

Postby JessH » Sun Feb 26, 2012 3:32 pm

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.
JessH
Newbie
Newbie
 
Posts: 18
Joined: Tue Jan 17, 2012 8:56 pm

Re: fw_update not working in linux or OS X

Postby robots » Sun Feb 26, 2012 4:20 pm

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.
User avatar
robots
Hero Member
Hero Member
 
Posts: 569
Joined: Sat Dec 05, 2009 11:19 am
Location: CZ/Prague

Re: fw_update not working in linux or OS X

Postby JessH » Mon Feb 27, 2012 2:01 am

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
JessH
Newbie
Newbie
 
Posts: 18
Joined: Tue Jan 17, 2012 8:56 pm

Re: fw_update not working in linux or OS X

Postby robots » Mon Feb 27, 2012 3:02 am

Did you try raising the Flash size ?
https://github.com/robots/ols-fwloader/ ... boot.h#L41
User avatar
robots
Hero Member
Hero Member
 
Posts: 569
Joined: Sat Dec 05, 2009 11:19 am
Location: CZ/Prague

Re: fw_update not working in linux or OS X

Postby JessH » Mon Feb 27, 2012 3:33 am

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.
JessH
Newbie
Newbie
 
Posts: 18
Joined: Tue Jan 17, 2012 8:56 pm

Re: fw_update not working in linux or OS X

Postby robots » Mon Feb 27, 2012 4:09 am

Can you try to read the whole flash ? And upload the "hex" you read, and the one you are trying to flash.
User avatar
robots
Hero Member
Hero Member
 
Posts: 569
Joined: Sat Dec 05, 2009 11:19 am
Location: CZ/Prague

Re: fw_update not working in linux or OS X

Postby JessH » Tue Feb 28, 2012 11:26 am

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
JessH
Newbie
Newbie
 
Posts: 18
Joined: Tue Jan 17, 2012 8:56 pm

Re: fw_update not working in linux or OS X

Postby ian » Wed Feb 29, 2012 3:06 am

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.
User avatar
ian
Crew
Crew
 
Posts: 10804
Joined: Mon Jul 06, 2009 6:14 am

Re: fw_update not working in linux or OS X

Postby JessH » Wed Feb 29, 2012 3:32 am

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.
JessH
Newbie
Newbie
 
Posts: 18
Joined: Tue Jan 17, 2012 8:56 pm

Re: fw_update not working in linux or OS X

Postby robots » Wed Feb 29, 2012 3:52 am

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).
User avatar
robots
Hero Member
Hero Member
 
Posts: 569
Joined: Sat Dec 05, 2009 11:19 am
Location: CZ/Prague

Next

Return to USB Infrared Toy