Skip to main content
Topic: IR Toy crashes during transmission (Read 1900 times) previous topic - next topic

IR Toy crashes during transmission

Hi,

I'm using the IR toy from Java through the rxtx serial library - so part of the problem may be in there, but I still think something goes wrong in the IR toy. Here is my problem:

First of all, I can't get IR transmission to work at all - the IR toy LED is flashing during transmission and I am pretty sure I'm sending exactly the same data that I recorded (also using rxtx from Java, which works fine), but the IR receiver does not respond. I've tried two different receivers and different commands and with the IRToy from 15 to 2cm from the "eye" of the receiver, and nothing works.

But this is not really the problem I want to trouble you guys with.

The really annoying thing is that when testing (to try out different distances and angles), I set up a thread that just flooded the IRToy with the same command over and over again, and after a few seconds of abuse, the IR Toy just goes dead. Even if I stop transmitting it stays dead. I have to disconnect and reconnect it physically to get it running again.

The sequence I use is

1. 's' to enter sample mode (I get S01 back)
2. 0x03, to transmit
3. hi-lo of pulse/blank burst pairs as I received them earlier
4. 0xff 0xff to terminate
5 repeat from 2.

Also, whenever this happens, the COM mapping dies and I have to uninstall and re-install the driver to get the IRToy to work again (This may be an rxtx issue though).

Re: IR Toy crashes during transmission

Reply #1
Never mind... Immediately after posting I realized I had a scaling factor problem in my data conversion, so now transmission works. Oddly, this also fixed the crash. Could it be that I accidentally send a bunch of very long pulses (e.g. 0xE123), and this somehow caused a crash?

Re: IR Toy crashes during transmission

Reply #2
Have you modified your IR Toy hardware in any way?

Re: IR Toy crashes during transmission

Reply #3
Nope... It's really weird - I convert the data I read from IRToy format to PRONTO format (which uses a 0.0000241246s resolution instead of the IRToy's 0.0000213333s), but forgot to convert it back again, which is why it did not work.

This conversion factor is the only change I made to my code to make it work, and now it no longer hangs the IRToy, no matter how long I let it sit and transmit.

I should really change it back to test if I can crash it again, but it's late so it'll have to wait to tomorrow...

Re: IR Toy crashes during transmission

Reply #4
It might be helpful if you undid your fix, recreate the bug, then save the IRToy commands which cause the crash.  Then, if someone has time to debug the firmware, there might be a fix.

Of course, sending complete garbage to an 8-bit firmware might be the sort of thing that isn't supported, but there's no harm in making things more robust if possible.

Re: IR Toy crashes during transmission

Reply #5
My guess would be that the scaling hit (or wrapped?) to 0xff 0xff early, then random characters exited sampling mode and reset/jumped to bootloader, etc. It's also possible that there was a buffer overflow from too much data or something. I'd recommend a slight pause between sending data, but it looks like you didn't need that to fix the issue.
Got a question? Please ask in the forum for the fastest answers.