Active Topics

 


Reply
Thread Tools
kimmoli's Avatar
Posts: 562 | Thanked: 2,744 times | Joined on Dec 2013 @ Espoo, Finland
#11
Simple EEPROM data to try. (Maybe i have nothing else to do tonight)

Code:
000: 12 34 56 78 01 01 00 00 30 00 05 00 40 00 06 00
010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
030: 43 46 47 3F 00 00 00 00 00 00 00 00 00 00 00 00
040: 55 44 41 54 41 00 00 00 00 00 00 00 00 00 00 00
Should set following values; These should be then visible somewhere in sysfs
  • Vendor = 0x1234
  • Product = 0x5678
  • Rev = 0x01
  • EEPROM size = 0x0100 (256 bytes)
  • CFG address = 0x0030 (must be at least 0x30)
  • CFG Size = 0x0005 = 5 bytes (at address 0x0030)
  • Udata address = 0x0040
  • Udata size = 0x0006 = 6 bytes (at address 0x0040)
  • config = string "CFG?" (including NULL)
  • udata = string "UDATA"

Last edited by kimmoli; 2014-01-20 at 18:10.
 
kimmoli's Avatar
Posts: 562 | Thanked: 2,744 times | Joined on Dec 2013 @ Espoo, Finland
#12
ok. whats next?

Got it soldered there, programmed it with my i2ctool
and after faking TOH in place with takkatikku





i can see it in /sys/bus/i2c/devices/1-0050

Code:
[root@localhost 1-0050]# xxd eeprom
0000000: 1234 5678 0101 0000 3000 0500 4000 0600  .4Vx....0...@...
0000010: ffff ffff ffff ffff ffff ffff ffff ffff  ................
0000020: ffff ffff ffff ffff ffff ffff ffff ffff  ................
0000030: 4346 473f 00ff ffff ffff ffff ffff ffff  CFG?............
0000040: 5544 4154 4100 ffff ffff ffff ffff ffff  UDATA...........
0000050: ffff ffff ffff ffff ffff ffff ffff ffff  ................
0000060: ffff ffff ffff ffff ffff ffff ffff ffff  ................
0000070: ffff ffff ffff ffff ffff ffff ffff ffff  ................
0000080: ffff ffff ffff ffff ffff ffff ffff ffff  ................
0000090: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000a0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000b0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000c0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000d0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000e0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000f0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
It appeared in /sys/devices/platform/toh-core.0

And there are all data except 'udata' ?

Code:
[root@localhost toh-core.0]# ll
total 0
-r--r----- 1 root root 4096 Jan 20 20:30 cfg_addr
-r--r----- 1 root root 4096 Jan 20 20:30 cfg_size
-r--r----- 1 root root 4096 Jan 20 20:30 config_data
lrwxrwxrwx 1 root root    0 Jan 20 20:27 driver -> ../../../bus/platform/drivers/toh-core
-r--r----- 1 root root 4096 Jan 20 20:30 eeprom_size
-r--r--r-- 1 root root 4096 Jan 20 20:30 microamps_requested_toh-core.0-toh_vdd
-r--r--r-- 1 root root 4096 Jan 20 20:30 modalias
drwxr-xr-x 2 root root    0 Jan 20 20:30 power
-r--r----- 1 root root 4096 Jan 20 20:30 product
-r--r----- 1 root root 4096 Jan 20 20:30 rev
lrwxrwxrwx 1 root root    0 Jan 20 20:27 subsystem -> ../../../bus/platform
-r--r----- 1 root root 4096 Jan 20 20:30 udata_addr
-r--r----- 1 root root 4096 Jan 20 20:30 udata_size
-rw-r--r-- 1 root root 4096 Jan 20 20:27 uevent
-r--r----- 1 root root 4096 Jan 20 20:30 vendor
[root@localhost toh-core.0]# cat *
48
5
CFG?cat: driver: Is a directory
256
0
platform:toh-core
cat: power: Is a directory
22136
1
cat: subsystem: Is a directory
64
6
DRIVER=toh-core
MODALIAS=platform:toh-core
4660
[root@localhost toh-core.0]#

Last edited by kimmoli; 2014-01-20 at 18:46.
 

The Following 4 Users Say Thank You to kimmoli For This Useful Post:
Posts: 385 | Thanked: 426 times | Joined on Dec 2009 @ Gothenburg, Sweden
#13
Originally Posted by dirkvl View Post
So, I found this in my mailbox today:
An AT24C02 EEPROM with a wopping 256 bytes of data

Also, they are dirt-cheap.
You are actually a bit wrong on the size. It is 256KB of memory.

It costs $2.73 on dx.com (what did you pay? ).
http://dx.com/p/at24c256-i2c-eeprom-...9#.Ut1wNPQRlpU

Here's the specs on the EEPROM circuit:
http://www.atmel.com/Images/doc0670.pdf
 
kimmoli's Avatar
Posts: 562 | Thanked: 2,744 times | Joined on Dec 2013 @ Espoo, Finland
#14
Originally Posted by Larswad View Post
You are actually a bit wrong on the size. It is 256Kb of memory.
AT24C256 yes, but no...
We are speaking about AT24C02 which is 2Kbits (256 Bytes)

dirkvl original link was to some arduino page... with example of 256Kb eeprom. I dont know what he has purchased
Originally Posted by dirkvl View Post
Since EEPROMS are very very easy to program,...
Originally Posted by Larswad View Post
Here's the specs on the EEPROM circuit:
http://www.atmel.com/Images/doc0670.pdf
AT24C02 http://www.atmel.com/Images/doc0180.pdf

AT24C256 is not supported as it uses two-byte data-word-addressing mode.
Jolla toh seems (afaik) to support only one-byte data-word-addressing mode.

(EDIT: I paid 0,27€ each at digikey)
 

The Following User Says Thank You to kimmoli For This Useful Post:
Posts: 11 | Thanked: 35 times | Joined on Dec 2013
#15
Hi,

I just thought I post some of my personal notes here about the eeprom stuff in the toh driver (having written the driver).

The idea originally was to

1. Have some way to automatically instantiate devices to linux kernel (to allow true linux "device-driver" model hot plugging of devices)
2. Have system and application specific configurations provided for userspace (and to some extent kernel)

For system configurations we tried bitmasks and such, but finally converged to just a configuration string (CFG_DATA). Idea there was to have some pre-defined key-value pairs to initiate actions inside kernel and tohd. Simple exaple would be vdd=1, meaning "enable the VDD". Or have some other string for i2c device parameters that the toh-core driver would register onto the bus then (so that corresponding driver would automatically probe).

The user data was meant for any application running in userspace to just read and do anything they need to according to that.

But... At some point of development we shifted gears and went full speed for the NFC based identification and the EEPROM was left a bit unattended. I basically got the CFG_DATA exporting done, but none of the hotplugging things nor exporting user data.

I thought the EEPROM still could serve a purpose for hacker community, as you can (maybe) more easily (and independently of Jolla store or anything outside) do simple detection of your own custom cover. So the driver is still there, but it's not "officially" driven forward at the moment. But were not removing it either, so feel free to use in personal hacking

I'm very interested to see what kind of uses you guys come up with it. Maybe once the recovery options allow safe community kernel development on Jolla, something in form of quality kernel patches could arise that we could pick up into official release as well.
 

The Following 5 Users Say Thank You to kjokinie For This Useful Post:
kimmoli's Avatar
Posts: 562 | Thanked: 2,744 times | Joined on Dec 2013 @ Espoo, Finland
#16
Originally Posted by kjokinie View Post
Idea there was to have some pre-defined key-value pairs to initiate actions inside kernel and tohd. Simple exaple would be vdd=1, meaning "enable the VDD". Or have some other string for i2c device parameters that the toh-core driver would register onto the bus then (so that corresponding driver would automatically probe).
at dayjob, we use something like this to set additional Linux environment variables from external configuration memory.

Originally Posted by kjokinie View Post
The user data was meant for any application running in userspace to just read and do anything they need to according to that.
Is the UDATA somewhere accessible, could not find that the driver makes it visible in sysfs?

And atm to get the automatic rpm download/install, the NFC is the only way?

Originally Posted by kjokinie View Post
I'm very interested to see what kind of uses you guys come up with it.

I will anyway have a eeprom on my TOHs, maybe use to store some TOH identity or TOH dependent configurations, e.g. if oled toh would have different settings (brightness/font etc) this is stores on eeprom. or serial number, hw version information, sensor calibration data.
__________________
TOH ideas, concepts and creations since 2013 toholed tohuart toheink Heebo tohIRi i2ctool tohmm LeTOH FMTOH
 

The Following 2 Users Say Thank You to kimmoli For This Useful Post:
kimmoli's Avatar
Posts: 562 | Thanked: 2,744 times | Joined on Dec 2013 @ Espoo, Finland
#17
Example udev rule: /etc/udev/rules.d/95-toholed.rules
Code:
KERNEL=="toh-core.0", ATTR{vendor}=="19276", ATTR{product}=="2", ACTION=="add", RUN+="/bin/systemctl start harbour-toholed"
KERNEL=="toh-core.0", ACTION=="remove", RUN+="/bin/systemctl stop harbour-toholed"

udevadm info:
looking at device '/devices/platform/toh-core.0':
KERNEL=="toh-core.0"
SUBSYSTEM=="platform"
DRIVER=="toh-core"
ATTR{rev}=="1"
ATTR{cfg_addr}=="48"
ATTR{cfg_size}=="5"
ATTR{eeprom_size}=="256"
ATTR{microamps_requested_toh-core.0-toh_vdd}=="0"
ATTR{config_data}=="CFG?"
ATTR{vendor}=="19276"
ATTR{udata_addr}=="64"
ATTR{udata_size}=="6"
ATTR{product}=="1"
__________________
TOH ideas, concepts and creations since 2013 toholed tohuart toheink Heebo tohIRi i2ctool tohmm LeTOH FMTOH
 
kimmoli's Avatar
Posts: 562 | Thanked: 2,744 times | Joined on Dec 2013 @ Espoo, Finland
#18
Cross-linking:

vendor and product id's in TJC wiki https://together.jolla.com/question/...and-device-id/
__________________
TOH ideas, concepts and creations since 2013 toholed tohuart toheink Heebo tohIRi i2ctool tohmm LeTOH FMTOH
 
Reply

Tags
eeprom, otherhalf


 
Forum Jump


All times are GMT. The time now is 22:14.