Closed benkli closed 6 years ago
Strange! When reading from memory 0xfc alone, an error does not occure. But the returned data is always 0.
Edit 1:
PyObject *Mifare_read_block(Mifare * self, PyObject * args)
{
uint8_t blockIdx;
uint8_t bDataBuffer[READ_BUFFER_LEN];
if (!PyArg_ParseTuple(args, "b", &blockIdx)) {
return NULL;
}
phStatus_t status = 0;
status = phalMful_Read(&(self->nfcData.salMfc), blockIdx, bDataBuffer);
if (handle_error(status, ReadError)) return NULL;
// The read command reads a full 16 bytes, but we only want to return 1 page worth of data for this command.
#if PY_MAJOR_VERSION >= 3
return Py_BuildValue("y#", bDataBuffer, MFC_BLOCK_DATA_SIZE);
#else
return Py_BuildValue("s#", bDataBuffer, MFC_BLOCK_DATA_SIZE);
#endif
}
Could changing "MFC_BLOCK_DATA_SIZE" to 16 in this area, solve the problem?
Edit 2:
Ok. I've found the problem for me. I have to change the "MFC_BLOCK_DATA_SIZE" to 16, for reading from this extended data area. Sorry for causing any inconveniences.
Yours Benjamin.
Was the MFC_BLOCK_DATA_SIZE
the only change you made? Any other side effects that you can tell? If not, I'd like to merge your changes into master. Mind filing a pull request?
Hi Scott! I copied the mifare_read(...) function and made a second one named mifare_read16(...). This one had the changed MFC_BLOCK_DATA_SIZE=16 in it. This solution enabled me to interface the AS3955’s buffer. I Couldn’t recognize any side effects.
Ah, no problem. I'll give it a try using your description and we can go from there. I'll ping you again when I need a guinea pig :). I'll reopen this issue since it is something that needs to be fixed.
Please answer these questions as part of your new issue.
Which version of Python are you using?
2.7.9
Which OS and version are you running?
Linux raspberrypi 4.4.38-v7+
Is SPI enabled?
yes
Are you trying to read/write a Mifare Classic card? (This is currently unsupported)
I'm trying to read an AMS AS3955 NFC interface tag. This tag acts as an NFC type 2 tag (mifare ultralight)
Hey there! I'm trying to read data from an AMS AS3955 NFC interface tag. When reading and writing from EEPROM data section 0 -> 127 everthing works fine. But when I'm trying to read from the AS3955 extendend memory section (0xfc -> 0xff), I'm getting:
According to the AS3955 datasheet, I can access this area via normal read and write commands. Writing to this section works, I can read the written data with the MCU attached to the AS3955. But I can not read the data from this section with nxppy. I've run out of ideas. Thank you in advance for your help!
Yours, Benjamin