<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[RFID2 Unit and Core2 Processor]]></title><description><![CDATA[<p dir="auto">I've bought an RFID2 reader/writer unit which I connected to the M5 CORE2 processor.</p>
<p dir="auto">Using the web based UIFlow, I do not see a specific unit type RFID2 to add to the unit list. For this reason I've added the default RFID and the basic functions are OK and support functions like "card near", tag ID, read and write from address x, like 1. With few UIflow commands and a logic loop I was able to build a basic RFID Tag reader &amp; writer and also to get the UID information.</p>
<p dir="auto">Please clarify in some more depth the use of read from "addr" and write to “addr”.</p>
<p dir="auto">My guess is that "addr" means sector number, where we find 16 sectors each constructed with 4 blocks, as shown in the memory reader of the "Android NFC Tools – function Memory Hex".  There are 3 blocks of data, each 16 characters long, followed by one block of keys.<br />
Sector 0 is used for UID.</p>
<p dir="auto">Sector 0 → UID<br />
Sector 1 → Data1<br />
Sector 2 → Data2<br />
Sector 3 → Key<br />
Sector 4 → Data3, etc</p>
<p dir="auto">My doubt: By writing into "addr" 3, does it overwrite the key in sector 3, or does it write into sector 4 data field, by this preserving the key address? Overwriting a key field possibly would destroy the default RFID tag format. Hope there is code  example available for this topic. Below see a hardcopy of my code:   <img src="/assets/uploads/files/1665152598206-rfid_code_sample1.png" alt="0_1665152588676_rfid_code_sample1.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/topic/4688/rfid2-unit-and-core2-processor</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 23:11:08 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/4688.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 07 Oct 2022 14:24:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to RFID2 Unit and Core2 Processor on Fri, 14 Oct 2022 18:20:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/13183">@falbriard</a>  An attempt to write a logic with Blockly &amp; MicroPython code (via UIFlow), able to store up to 1000 characters on a RFID tag:</p>
<pre><code># by Claude Falbriard - QcLab Brazil
# RFID tag with RC522 layout    
from m5stack import *
from m5stack_ui import *
from uiflow import *
import time
import unit
        
screen = M5Screen()
screen.clean_screen()
screen.set_screen_bg_color(0x000000)
rfid_0 = unit.get(unit.RFID, unit.PORTA)
    
inputsrt2 = None
elecounter = None
alldata = None
inputstr1 = None
inputdata = None
inputstr4 = None
cardready = None
   

label0 = M5Label('RFID Reader', x=10, y=10, color=0xf5f2f2, font=FONT_MONT_14, 
parent=None)
text_2 = M5Label('text_2', x=10, y=113, color=0xb1ed94, font=FONT_MONT_14, 
parent=None)
text_4 = M5Label('text_4', x=10, y=138, color=0xccf1a6, font=FONT_MONT_14, 
parent=None)
debug1 = M5Label('Debug: ', x=10, y=226, color=0xf09a9a, font=FONT_MONT_14, 
parent=None)
alldata_label = M5Label('alldata', x=10, y=170, color=0xdff2d7, font=FONT_MONT_14, 
parent=None)
inputd1 = M5Label('input data', x=10, y=48, color=0xe8f081, font=FONT_MONT_14, 
parent=None)
text_1 = M5Label('text_1', x=10, y=88, color=0xcbeeb9, font=FONT_MONT_14, 
parent=None)
   

elecounter = 0
# constructing an RFID RC522 compliant data writer
# https://www.blindtextgenerator.com/lorem-ipsum
# generate a string with max length of 1000 characters
ipsumstr = """Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo 
ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient 
montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium 
quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, 
vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam 
dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum 
semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat 
vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. 
Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam 
ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. 
Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet 
adipiscing sem neque sed ipsum. N"""
# chop test data string to 256 bytes
ipsumstr = ipsumstr[:256]

# split a text into 16 bytes elements, max size = 1000
def split_by_n(seq, n):
    '''A generator to divide a sequence into chunks of n units.'''
    while seq:
        yield seq[:n]
        seq = seq[n:]

rc522list = list(split_by_n(ipsumstr, 16))
blkcount = len(rc522list)
# process list by RC522 element max 1000 char
validptr = [1,2,4,5,6,8,9,10,12,13,14,16,17,18,20,21,22,24,25,26,28,29,30,\
            32,33,34,36,37,38,40,41,42,44,45,46,48,49,50,52,53,54,56,57,58,\
            60,61,62,64,65,66,68,69,70,72,73,74,76,77,78,80,81,82,84,85,86]
keyptr =  [3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63,67,71,75,79,83]

while True:
  alldata = ''
  inputstr1 = ''
  inputsrt2 = ''
  inputdata = ''
  inputstr4 = ''
  cardready = False
  wait(1)
  debug1.set_text('start reading ...')
  if rfid_0.isCardOn():
    debug1.set_text('card found')
    inputdata = rfid_0.readUid()
    speaker.playTone(740, 1/2)
  inputd1.set_text(str(inputdata))
  elecounter = 0
  for ele in rc522list:
     blkdata = ele
     blkaddr = validptr[elecounter]
     rfid_0.writeBlock(blkaddr,blkdata)
     elecounter += 1
  wait_ms(400)
  # read data only for debug   
  inputstr1 = rfid_0.readBlockStr(1)
  inputsrt2 = rfid_0.readBlockStr(2)
  inputstr4 = rfid_0.readBlockStr(4)
  # all data stored on tag 
  for blkcount in range (0,elecounter):
      blkaddr = validptr[blkcount]
      record = rfid_0.readBlockStr(blkaddr)
      alldata += record
  if inputdata == '1e1cb67cc8':
    power.setVibrationIntensity(80)
    power.setVibrationEnable(True)
    wait(0.5)
    power.setVibrationEnable(False)
  # show data for debug and validation   
  text_1.set_text(str(inputstr1))
  text_2.set_text(str(inputsrt2))
  text_4.set_text(str(inputstr4))
  alldata_label.set_text(str(alldata))
  wait(2)
</code></pre>
]]></description><link>https://community.m5stack.com/post/18968</link><guid isPermaLink="true">https://community.m5stack.com/post/18968</guid><dc:creator><![CDATA[falbriard]]></dc:creator><pubDate>Fri, 14 Oct 2022 18:20:12 GMT</pubDate></item><item><title><![CDATA[Reply to RFID2 Unit and Core2 Processor on Wed, 12 Oct 2022 13:35:10 GMT]]></title><description><![CDATA[<p dir="auto">Using the UIflow code, I wrote data into the RFID addr 1, 2 and 4. Checking the result with Android "NFC Tools", function "Read Hex Memory" I see all the data written into the corresponding sectors in a hex format.</p>
<p dir="auto">"addr 1" is "sector 0, Block 1"<br />
"addr 2" is "sector 0, Block 2"<br />
"addr 4" is "sector 1, Block 0"<br />
...</p>
<p dir="auto">My guess is that the following write sequence will preserve the formatted key addresses<br />
and make good use of the available Mifare tag memory space, organized in 16 bytes blocks.<br />
The resulting addressing table for writing data is:</p>
<p dir="auto">Data addr: 1,2,4,5,6,8,9,10,12,13,14,16,17,18,20,21,22 .. etc<br />
reserved<br />
UID addr:  0<br />
Key addr:  3,7,11,15,19,23 .. etc</p>
<p dir="auto"><img src="/assets/uploads/files/1665581583998-write_into_block_4_small-resized.png" alt="0_1665581580009_write_into_block_4_small.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/post/18943</link><guid isPermaLink="true">https://community.m5stack.com/post/18943</guid><dc:creator><![CDATA[falbriard]]></dc:creator><pubDate>Wed, 12 Oct 2022 13:35:10 GMT</pubDate></item><item><title><![CDATA[Reply to RFID2 Unit and Core2 Processor on Mon, 10 Oct 2022 15:01:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/13183">@falbriard</a> <img src="/assets/uploads/files/1665413907810-rfid-mirafecard_layout.png" alt="0_1665413893147_rfid-mirafecard_layout.png" class=" img-fluid img-markdown" />  Might be useful to illustrate the topic, attached you find the RC522 Mifare tag memory layout.</p>
]]></description><link>https://community.m5stack.com/post/18924</link><guid isPermaLink="true">https://community.m5stack.com/post/18924</guid><dc:creator><![CDATA[falbriard]]></dc:creator><pubDate>Mon, 10 Oct 2022 15:01:02 GMT</pubDate></item></channel></rss>