Page 1 of 1

Arduino interface - resolved problems with RMIR

Posted: Sat May 19, 2018 5:27 pm
by jeffs555
I haven't used JP1 since the old parallel port days but recently needed to add a new device to an old URC-8810. No more parallel ports, but did have some Arduinos and found the code in the files section to turn them into an interface for the old eeprom based controls. Had a lot of problems, but finally got it to work. Thought I would describe the problems in case anyone else tried this interface.

First problem was that I needed to add a 10k pull up to the SCL line. Most of the eeprom based remotes have a pull up on the SDA line, but not on the SCL line.

Next problem was that the current code sends out a 4 byte command for the JP2_4 that is not handled in the Arduino code. The first 3 bytes are invalid commands for the eeprom adapter, but the last byte is an "S" which is a write eeprom command. Patched the arduino code to ignore this 4 byte command.

After these fixes it found the control and identified it correctly as an 881x, however, it still didn't work. It showed the eeprom as all zeros. I am using win7 and was able to download and build jp12serial.dll and trace through and find the problem. The cause was that it was timing out on long eeprom reads (and also writes). JP12serial.dll was setting ReadTotalTimeoutMultiplier and WriteTotalTimeoutMultiplier to 10ms. Changing them to 20ms fixed the problem and I was able to successfully program the control with the new device.

Don't know if the arduino is just too slow on the I2C eeprom accesses or what. The default arduino I2C clock is supposedly 100kHz and could probably try changing it to 400kHz but don't know if eeproms in all controls would handle that. Changing the timeouts in JP12serial.dll worked fine for me and I am happy. The new Remote Master is a lot easier than the old spreadsheet stuff from when I used JP1 long ago.

Posted: Sun May 20, 2018 8:05 am
by The Robman
Thanks for that info Jeff, it may well help others at some point.

Posted: Sun May 20, 2018 9:16 am
by binky123
Can you post pointers to what files you used? I have a Raspberry Pi and URC-6131 EEPROM remotes and may be interested in making it work with the RPi.

I believe you are making the Arduino act like a EEPROM Protocol Adapter(UART on one side and SDA/SCL on the other side).

Thanks.

Posted: Sun May 20, 2018 10:55 am
by jeffs555
Here is link to the Arduino code.
http://www.hifi-remote.com/forums/dload ... e_id=11537

Yes, it does make the Arduino act like the serial to eeprom adapter and was based on the original PIC code here. http://www.compendiumarcana.com/jp1epa/

Don't know if you are planning to just run the RM/RMIR software on the Pi and drive an external serial adapter or if you want to run the Arduino code on the Pi and have a stand alone programmer. If you wanted to run it all on the Pi, you might be better off starting with the Linux parallel port driver which is still in the RM/RMIR code. Should be easy to modify the parallel port code to just bit bang the ports on the Pi.

OOPS: just looked and the parallel port driver is only in the 386 Linux version and not in the ARM Linux version. Don't know how hard it would be to modify the 386 code to run on the ARM.

Posted: Sun May 20, 2018 11:12 am
by binky123
Thanks for the pointers. There is a I2C driver on the Pi. It isn't difficult to bit bang things on the Pi. There is a wiringPi library with C, Python interfaces.

I think others have run RM/RMIR on the Pi itself but I haven't looked into it much.

Posted: Sun May 20, 2018 11:48 am
by Barf
RM[IR] already runs on the RPi, see this thread, supported in the current official release.

The current Linux parallel driver is brain damaged; it may be possible possible to write something saner using GPIO.

Posted: Sun May 20, 2018 12:06 pm
by Barf
There is one idea that I have been toying around with for some time:

Create an interface device, connected to the JP1 remote and to [W]LAN. There are very cheap Arduino-compatible (loosely speaking :wink:) devices with WLAN like the ESP8266.
Then we need to define an Ethernet based interface (e.g. TCP-sockets) between the interface and RMIR, should not be too hard. Thus (disregarding DecodeIR and hdiapi for a moment), RMIR will be pure Java, i.e. does not need any JNI-libraries any more.

Posted: Sun May 20, 2018 9:06 pm
by jeffs555
For anyone contemplating using the Arduino serial to eeprom adapter code, I looked at it again and see why it is timing out on long eeprom reads. Reading from an I2C eeprom requires 3-4 bytes of setup and address. Kevin's original PIC code does sequential reads where this setup and address is sent once then just continue to read bytes. The Arduino code is doing individual byte reads and sending the setup sequence for each byte. Sending 3 extra bytes for each byte read is slowing it way down.

Also, the Arduino code does not support larger than 2kbyte eeproms.

NOTE: Mathdon's continuation of this discussion is here:
http://www.hifi-remote.com/forums/viewt ... p?t=102890