Hello everybody,
I use the GrovePi+ with a Raspi 2, without problems for all the elements but the NFC tag reader…
I test it on the grovepi serial port without success.
The NFC element is revision 1.1, I found in the comments about it in the seedstudio site (seeedstudio.com/depot/Grove-NFC-p-1804.html ) that we need to cut 3 wires and set 3 others (basically p1-i2c, p2-scl p3-sca) to use the element with i2c port.
First, I try only set the p1-i2c wire, without success too.
Actually, the element have p1-i2c, p2-scl and p3-sca connect, and the 3 other ones are cut.
With i2cdetect, the element is at address 0x04, I use it instead of 0x53 from the github. If i use 0x53, there is an IO error…
My test code is :
import time,sys
import RPi.GPIO as GPIO
import smbus
NFC_ADDR = 0x04
# use the bus that matches your raspi version
rev = GPIO.RPI_REVISION
if rev == 2 or rev == 3:
bus = smbus.SMBus(1)
else:
bus = smbus.SMBus(0)
# read data from the NFC tag EEPROM (length bytes)
def readNFCData(addr,length):
bus.write_byte_data(NFC_ADDR,addr>>8,addr&0xff)
result=[]
for c in range(length):
result.append(bus.read_byte(NFC_ADDR))
return result
addr=0x00
while True:
bus.write_byte_data(NFC_ADDR,addr>>8,addr&0xff)
result=[]
for c in range(16):
result.append(bus.read_byte(NFC_ADDR))
print str(addr) + ' : '
print result
addr += 0x10
time.sleep (0.5)
If i change the addr with increments of 16, the result is always [0,0,0…0,0] and an error occurs at the end.
I tested that with two differents Mifare-One RFID Tag (3.56 MHz) and my french CB card which contains a NFC tag.
Is there an error in the test code ? Or is the element completely bugged ?
Thanks in advance for all informations…
Regards
Thierry