2pecshy / eeprom-ST25DV-linux-driver

eeprom-ST25DV-linux-driver
GNU General Public License v2.0
11 stars 12 forks source link

Data not written in proper page-sized chunks #7

Open scallopedllama opened 5 years ago

scallopedllama commented 5 years ago

Discovered at the same time as #6.

We use a dd command similar to the following to write some test data to the NFC:

dd if=testfile.data of=/sys/...../st25_user bs=$(wc -c testfile.data) count=1

testfile.data is the output of uname -a, 121B.

Capturing the i2c data on the bus while running this command, it appears that the driver writes data out to the device in 30B chunks. The datasheet says that it can handle sequential writes of up to 256B.

Additionally, between 30B chunks, it does not wait for the data to write to the device so there are a number of NAKs from the NFC device before it's ready to receive more data.

scallopedllama commented 5 years ago

Using the following command (note, I have /dev/nfc-user symlinked to /sys/.../st25_user):

echo "Hello world! Hello world! Hello world! Hello world! Hello world! Hello world!" | dd of=/dev/nfc-user bs=78 count=1; dd if=/dev/nfc-user bs=78 count=1

I see the 30B write chunks. But I'm also seeing it read data back 1B at a time.

Here is a capture that you can load up into Saleae Logic and have a look. You don't need one of their devices to use the software to look at a saved capture.

2pecshy commented 5 years ago

The 30Bytes chunks is a limitation in the linux kernel by the constant "I2C_SMBUS_BLOCK_MAX". The largest chunk supported is 32Bytes, but i think it possible to support lager chunk on imx7 but not sure.

scallopedllama commented 5 years ago

Ok that makes sense. What about the 1B at a time reading?