[NFC Hacking] satanashammer:
Hello!

I need to make an app that sends an image via NFC to an NFC module to be displayed on an e-paper display. I made basically the whole app but can't get the NFC communication to work and need your help. I got the commands and user manuals from the manufacturer but nothing I tried works. I am using Good Display DENFC-M01 module and GDEQ042Z21 display This is my latest code:

var data_DB = "F0DB000069";//10 Î²ÊýÊÇºóÃæËùÓÐÊý¾ÝºÍµÄÒ»°ë¡£
var start = "A00603300190012C";//16 4.2´çµ¥É«400x300
var RST = "A4010C" + "A502000A" + "A40108" + "A502000A" + "A4010C" + "A502000A" + "A40108" + "A502000A" + "A4010C" + "A502000A" + "A40108" + "A502000A" + "A4010C" + "A502000A" + "A40103"; // 48 +56 ¸´Î»Èý´Î
var set_wf = "A102000F";//8 //0x00 0F
var set_power = "A10104" + "A40103";//12 //0x04 busy
var set_resolution = "A105610190012C";//14 //0x61 01 90 01 2C
var set_border = "A1025097";//8 //0x50 97
var write_BW = "A3021013"; //6 //0x10
var write_BWR = "A3021013"; //8 //0x13
var update = "A20112" + "A502000A" + "A40103";//20 //0x12 delay busy
var sleep = "A20102" + "A40103" + "A20207A5"; //20 //0x02 busy 07 A5
val epd_init: Array<String> = arrayOf(
data_DB + start + RST + set_wf + set_resolution + set_border + set_power + write_BWR + update + sleep, //16+104+8+12+14+8+8+20+20=152 210/2=0x69 //ÇÐÆÁ
"F0DA000003F00330" //10 ÆÁÄ»²ÎÊý0000 Êý¾Ý³¤¶È03 ×Ô¶¨ÒåÆÁÄ»F0 ÆÁÄ»³ß´ç·Ö±æÂÊ12 ÆÁÄ»ÑÕÉ«20 £¨ÆÁÄ»·Ö±æÂÊºÍÑÕÉ«ºÍA0ÃüÁîÒ»ÖÂ£©
)

override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
val p: Parcelable = intent?.getParcelableExtra(NfcAdapter.EXTRA_TAG) ?: return

val tag = p as Tag
val nfcA = NfcA.get(tag)
if(nfcA != null) {
try {
Log.e("debug", "intent")

nfcA.connect()
var cmd: ByteArray
var response: ByteArray
nfcA.timeout = 60000

cmd = hexStringToBytes(epd_init[0])
response = nfcA.transceive(cmd)
Log.e("epdinit_state", HexToString(response))

cmd = hexStringToBytes(epd_init[1])
response = nfcA.transceive(cmd)
Log.e("epdinit_state", HexToString(response))

//image_buffer is set to half white half black 400x300 image
val datas = width0 * height0 / 8
for (i in 0 until datas / 250) {
cmd = byteArrayOf(0xF0.toByte(), 0xD2.toByte(), 0x00, i.toByte(), 0xFA.toByte())
for (j in 0 until 250) {
cmd[j + 5] = image_buffer[j + 250 * i]
}
response = nfcA.transceive(cmd) // Send black and white data
Log.e("${i + 1} sendData_state:", HexToString(response)) // Feedback data display, 9000 is Ok

// Data mantissa sending
if (i == datas / 250 - 1 && datas % 250 != 0) {
cmd = byteArrayOf(0xF0.toByte(), 0xD2.toByte(), 0x00, (i + 1).toByte(), 0xFA.toByte())
for (j in 0 until 250) {
cmd[j + 5] = image_buffer[j + 250 * (datas / 250)]
}
response = nfcA.transceive(cmd) // Send black and white data
}
Log.e("${i + 1} sendData_state:", HexToString(response)) // Feedback data display, 9000 is Ok
}

val refreshCmd = byteArrayOf(0xF0.toByte(), 0xD4.toByte(), 0x05, 0x80.toByte(), 0x00)
response = nfcA.transceive(refreshCmd) // Send e-paper refresh command
Log.e("RefreshData1_state:", HexToString(response)) // Feedback data display, 9000 is Ok
if (response[0] != 0x90.toByte()) {
response = nfcA.transceive(refreshCmd) // Send black and white refresh command
Log.e("RefreshData2_state:", HexToString(response))
}
} catch (e: Exception) {
e.printStackTrace()
Log.e("debug", "Exception in onNewIntent: $e")
} finally {
nfcA.close()
}
}
}

I looked into the manuals of both the module and the display and the instructions seem to be correct but I keep getting TagLostException. Do any of you have any experience with this module or generally sending images to be displayed on an e-paper. Also any advice on how to get this to work or any other information about this would be very appreciated. Thanks!

Here is the link for the user manuals and everything I got from the manufacturers: https://www.dropbox.com/scl/fo/3186s7dey02t0ec8hqhd6/h?rlkey=tit9jvp95hvt4mys9byhi1rq8&dl=0