Adafruit NFC shield - Page 3 - Netduino 2 (and Netduino 1) - Netduino Forums
   
Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Adafruit NFC shield


  • Please log in to reply
95 replies to this topic

#41 marcoe

marcoe

    New Member

  • Members
  • Pip
  • 8 posts
  • LocationBrazil

Posted 05 March 2013 - 08:49 PM

Any news on this?  I also bougth the nfc shield and was trying to find the drivers.

 

I took a look at the i2c driver that Stephan made for Adafruit RGB Display and compared it to Arduino's driver. I guess I could try to translate it, did you go any far with the i2c code ? Is SPI easier than i2c ? 



#42 gomore11

gomore11

    Advanced Member

  • Members
  • PipPipPip
  • 87 posts

Posted 06 March 2013 - 10:00 AM

Hi Marcoe.

 

I just received the logic analyzer today, but I can´t try it for some days.............I will try to do it as soon as I can, otherwise it would be a great new if you earn to get the shield running with Stephan´s i2c driver. I haven´t try with it..............



#43 MarkNic

MarkNic

    Member

  • Members
  • PipPip
  • 22 posts

Posted 18 March 2013 - 05:41 PM

Wanted to add some information to this thread. 

 

I have the Adafruit PN532 NFC card and have been attempting to get the Netduino Plus 2 card to talk to it using I2C since the NFC card comes configured for I2C.  I've tried isolating everything to figure out what is going on and cannot get the two to talk.  I've been able to trigger a reset of the card after installing a jumper on the card to connect pin D3 with reset but that doesn't help the communication.  I've even tried to run the NFC card with jumper wires from pins on the Netduino to the corresponding pins on the NFC card - this was just to make sure that no shorts on other pins were causing issues.

 

Every write transaction fails (returns 0 bytes written).  No interrupts are ever triggered.  I've made sure that the packet being sent is structured correctly although even a poorly constructed packet should write to the card it just wouldn't make the NFC do anything.  The problem here seems to be writing the bytes.  Reads are failing in a similar way.

 

Code I created to test is here: https://github.com/marknic/NetduinoNFC



#44 2Elemental

2Elemental

    Member

  • Members
  • PipPip
  • 29 posts

Posted 20 April 2013 - 06:01 PM

Crap, I just ordered this shield. Should have done some reading before doing so... What's the status on this now? Can we expect support from the netduino community to get this working? Thanks in advance...

#45 2Elemental

2Elemental

    Member

  • Members
  • PipPip
  • 29 posts

Posted 24 April 2013 - 08:05 PM

Hi MarkNic, I have received my board and have had a play with your code. I have edited my post for the second time now as after some more testing I believe your code is valid and indeed nothing gets written to nor read from the device. Arduino seems to work perfectly. Regards

#46 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 25 April 2013 - 01:47 PM

Hi gomore11, Did you have a chance to check the I2C traffic with a logic analyzer? If we can see the traffic, that'll help tremendously with diagnostics. BTW just to make sure--is everyone running the latest Netduino Plus 2 firmware? Early firmware had a bug or two in regards to I2C. Chris

#47 2Elemental

2Elemental

    Member

  • Members
  • PipPip
  • 29 posts

Posted 25 April 2013 - 07:09 PM

I'm running a regular Netduino Plus, does that require any specific updates? I have flashed 4.2.0.1

#48 2Elemental

2Elemental

    Member

  • Members
  • PipPip
  • 29 posts

Posted 27 April 2013 - 05:50 PM

Any other suggestions for those that don't have a logic analyzer? Since I have bought a netduino plus in the understanding that it

would be arduino compatible, I was hoping to get this board to run

with .NET. The code of MarkNic as well as Adafruit's code show that

there's not much but byte arrays being sent on and off, and the pin

layout for the arduino and netduino match. Any other things that might

be why reading/writing via I2C to this board fails?

 

When writing the I2C message (byte array of 9 bytes), I always get only

1 byte transferred, any thoughts on why that could be? I'm using MarkNic's code...



#49 2Elemental

2Elemental

    Member

  • Members
  • PipPip
  • 29 posts

Posted 30 April 2013 - 05:34 PM

I have just ordered a Ikalogic Scanalogic 2 which I should receive on Thursday. Hopefully this will shed some light on this matter...

#50 2Elemental

2Elemental

    Member

  • Members
  • PipPip
  • 29 posts

Posted 04 May 2013 - 08:56 PM

I have received my Scanalogic and at first sight Marknic's code matches the bytes that were captured. Tomorrow I will run MarkNic's code on my netduino and capture that logic as well to be able to compare output.
I have attached the traced logic for both the startup of the arduino with the PN532 attached as the logic for the reading of a card, and this both in the Scanastudio software format (*.sst) (which is freely downloadable from the ikalogic website at http://www.ikalogic....ts/scanastudio/) and in CSV format.

You can simply load the attached workspaces to see the traced logic, or you can use the traced data in the attached CSV formats. I hooked up the arduino with analog pin 4 SDA as channel 3 (red) in the logic analyzer and analog pin 5 (SCL) as channel 2 (yellow) in scanastudio. Digital pin 2 (IRQ) was traced with channel 4 (green).

The attached zip file also contained a photo of the setup in which I tested it.

References

#51 2Elemental

2Elemental

    Member

  • Members
  • PipPip
  • 29 posts

Posted 04 May 2013 - 10:19 PM

Ok people, I have a breakthrough here. Seems that the I2C Address we are using is simply wrong.

MarkNic's code states

 

const int I2CWriteAddress = 0x48;

 

 

but the logic analyzer sees a write on slave address 0x90 instead of 0x48.

 

I changed above to 

 

 

const int I2CWriteAddress = 0x48 >> 1;
const int I2CReadAddress = 0x49 >> 1;
 
and now both read and write work fine :P . I guess this has to do with the fact that the I2C Address is actually 7Bit?


#52 MarkNic

MarkNic

    Member

  • Members
  • PipPip
  • 22 posts

Posted 05 May 2013 - 04:08 PM

2Elemental,

 

First, nice job getting the card running.  That's awesome and I really appreciate all of your effort.

 

I've tried the change that you suggested and based on no other changes in my code I'm still getting the same no read/no write result.  Did you happen to change any other code?  If not then it may be my card that's failing rather than the code.

 

The bit shift fix suggests that the read and write addresses are the same since a single bit shift right would be a divide by 2 and the low order bit that made the address values different is gone.  Ultimately 0x48 and 0x49 end up in both of the constants as 0x24.  I guess it's possible that the board manages the difference internally but I didn't see anything in the documentation to suggest that.

 

Thanks again,

 

Mark



#53 2Elemental

2Elemental

    Member

  • Members
  • PipPip
  • 29 posts

Posted 05 May 2013 - 04:48 PM

Hi Mark,

 

I wasn't so sure about the shift right with 0x49 since it indeed gives the same result, but the board is working and I can see in the output of my logic analyzer that it does a perfect read and write. I actually ended up refactoring the code of one of the earlier posters in this thread, but I also ran your code against my logic analyzer and it works as well. I have attached my full project code now (a mix of your code, another poster's code and some refactoring) so maybe you can try it against your board. The code now does a full reset/write/read and ends by spitting out the board's version. I hope to get a card read running somewhere this week. I am very excited that the board finally works with the .net framework.

 

Edit: for the code attachment, keep on reading :)

 

Regards,

Andy



#54 2Elemental

2Elemental

    Member

  • Members
  • PipPip
  • 29 posts

Posted 05 May 2013 - 06:27 PM

Just noticed that the sample code from adafruit contains following constant in Adafruit_NFCShield_I2C.h

 

#define PN532_I2C_ADDRESS                   (0x48 >> 1)

 

It doesn't have a different constant for read/write so I guess it does handle that internally...



#55 2Elemental

2Elemental

    Member

  • Members
  • PipPip
  • 29 posts

Posted 05 May 2013 - 07:17 PM

I realize I am totally spamming this thread, but I promise it will be the last time for today :)

I have put a basic reading infrastructure in place, the read trigger is implemented, I just

need to parse the actual read bytes... Code is attached for anyone interested...

Attached Files



#56 haxburgen

haxburgen

    Member

  • Members
  • PipPip
  • 21 posts

Posted 05 May 2013 - 09:56 PM

Thanks @2Elemental,

 

I'm going to try it out right now.!



#57 haxburgen

haxburgen

    Member

  • Members
  • PipPip
  • 21 posts

Posted 05 May 2013 - 09:56 PM

Thanks @2Elemental,

 

I'm going to try it out right now.!



#58 MarkNic

MarkNic

    Member

  • Members
  • PipPip
  • 22 posts

Posted 06 May 2013 - 02:19 AM

[font="arial, helvetica, sans-serif;"]Nice work Andy.[/font]

 

[font="arial, helvetica, sans-serif;"]My board must be bad.  I tried your code as well as mine and get the same result.  OR, there's a difference with Netduino Plus and N+2.  From your code, you must be using the N+ and mine is the +2 and no read or write for me.[/font]

 

[font="arial, helvetica, sans-serif;"]Also, you mentioned that reset/read/write is working.  Is the reset pin on your NFC board actually connected to something.  I looked closely at mine and it doesn't appear to have a lead going anywhere.  The 'RST' connection is right next to pin 3 but no lead to connects them.  Either way I don't think that has anything to do with my boards inability to work.  Just thought it was strange since all sample code I've see has the 'reset' method.[/font]

 

[font="arial, helvetica, sans-serif;"]Anyway, thanks again for all the research and passing on the info,[/font]

 

[font="arial, helvetica, sans-serif;"]Mark[/font]



#59 2Elemental

2Elemental

    Member

  • Members
  • PipPip
  • 29 posts

Posted 06 May 2013 - 05:51 AM

Aw that's not good. I must say that I had an occasion yesterday where the board froze on me. At that moment I hooked it up to my arduino UNO to check if everything was okay and then retried and everything worked fine again. I'll have another look at the reset code with the logic analyzer, maybe something is still out of order there.

 

I am indeed running the N+. While running the logic analyzer, I had wired it up manually with analog pins 4 (SDA) and 5 (SCL) and digital pin 2 for the IRQ, so no reset pin indeed. When I wrote the card read code yesterday I didn't wire it up anymore so I just had it directly plugged into the N+, at which point I'm assuming it has pin 3 (RST) connected. Do you happen to have an arduino board to test it with?

 

I did read about some issues with I2C and the N+2, maybe you should take this up with one of the Staff members?

I am running the latest version of the firmware (4.2.0.1) at this moment...



#60 gomore11

gomore11

    Advanced Member

  • Members
  • PipPipPip
  • 87 posts

Posted 06 May 2013 - 08:26 AM

Ohh!! I´ve been some time without reading the forum and surprise!!!!!! :D  :D :D   

 

Thank you very mutch for your work 2Elemental!!!!! I couldn´t try with the logic analyzer but it´s the same that you used so I´m happy to see that it can be very usefull...........I have to try the code with the Netduino 2 with the last firmware and see what happens!! I´ll post the results.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.