Jolla and SailfishOS
The Other Half EEPROM emulated by a Cypress PRoC
Jolla The Other Half EEPROM
When connecting The Other Half (TOH) to the Jolla A phone the toh-demon looks for an I2C EEPROM on 0x50 (7bit address).
If an EEPROM is found on this address the toh-demon reads the data and presents them as files in the
/sys/devices/platform/toh-core.0/directory:
"The Other Half" Wiki on merproject.org has more information on the data structure, how to use it and how that is helpful.
The Project
Cypress's PRoC and PSoC chips have a build in block called EZI2C, that offeres an simple to use emulation of an I2C EEPROM.
For it's many other goodies, I'm planning on using one of the PRoC or PSoC BLE modules for the CompanionTOH project.
If we can get the emulation good enough for the Jolla A phone to accept it, we can get rid of the additional EEPROM in the CompanionTOH design.
Hardware
After having mastered writing and reading a ST24C16 I2C EEPROM in TOH EEPROM programming using Arduino, I now want to exchange the simple EEPROM for a Cypress PRoC chip, that (also) should be able to emulate the EEPROM.
For the experiments I'm using a CY5676 PRoC BLE 256KB Module on top of the CY8CKIT-042-BLE Pioneer Kit.
Since the CY8CKIT-042-BLE has Arduino compatible headers, the setup is straight forward. ü>
Don't mind the EEPROM, it is not needed and its VCC pin is not connected.
Having a closer look, we see the level shifter (blue board, Adafruit's "4-channel I2C-safe Bi-directional Logic Level Converter - BSS138") and the MCP1700 LDO for the 1.8V power supply (small green board on the left side).
The left side of the circuit has a signal level of 1.8V and gets connected to the Jolla A phone via TinkerTOH-2.
The right side of the circuit hase a signal level of 3.3V and gets connected to the Arduino compatible headers of the CY8CKIT-042-BLE:
- SCL on P3.5
- SDA on P3.4
- GND wherever you find it
Software
For this project we only need the EZI2C component in PSoC Creator. So we drop one on our TopDesign.cysch
.
Remeber to set the I2C parameters to the value the Jolla phone expects (0x50, 400kHz).
In our projects *.cydwr
file, we have to select the pins we want to connect the I2C bus to:
- P3.5 for SCL
- P3.4 for SDA
The only things left to do are:
- Define the EEPROM content (lines 44 .. 60,
main.c
) - Tell the EZI2C subsystem what buffer to use (line 64,
main.c
) - Start the EZI2C subsystem (line 65,
main.c
) - Enable global interrupts (line 67,
main.c
)
I don't think it can be any easier than that.
Experiment
Lets see if it works.
- Open a terminal on your Jolla phone.
devel-su
cd /sys/devices/platform/
- Clip-On TOH to make toh-demon read the "EEPROM".
ll
andcat
the files incd /sys/devices/platform/
should show a result like this:
Excellent!
Now have a look at https://wiki.merproject.org/wiki/The_other_half to see what you can do with it.