-
Notifications
You must be signed in to change notification settings - Fork 9
Add source files #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: fpr <[email protected]>
Signed-off-by: fpr <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First quick review.
General comment:
Please review indentation, sometimes tab, sometimes 2 spaces or more. Preferred 2 spaces instead of tab (same as core).
Review also indentation alignments.
Thanks
README.md
Outdated
The WriteURIMail sketch writes a Mail tag on the device. It records a mail with the recipient, the subject and the body of the message. | ||
the WriteText sketch writes a Text tag on the device. It records a simple text message. | ||
|
||
We can see on the monitor window the message "Sytstem init done!" when the NFC module is started and ready. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reword (please avoid use of "we"):
When the NFC module is started and ready, the message "Sytstem init done!" is displayed on the monitor window.
README.md
Outdated
You can't write tag with a total size (protocol + payload) greater than 246 bytes. | ||
This is the limitation one Iblock command on M24SR device. This limitation is also | ||
in the variant.h file, the I2C buffer have a limited size. | ||
This library was tested on DISCO_L475VG_IOT_board, it's may not work on other board. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should work with each board including M24SR? or using the NFC shield?
So?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course but we tested only on DISCO L475 IOT. The sentence will be removed.
examples/WriteAAR/WriteAAR.ino
Outdated
const uint8_t M24SR_ADDR=0xAC; | ||
const int DEFAULT_GPO_PIN=PE4; | ||
const int DEFAULT_RF_DISABLE_PIN=PE2; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All those parameters are dedicatedt toL4 disco IOT. Add a comment to mention that user have to update them according to the board tested and that those one are for L4 IOT
examples/WriteMime/WriteMime.ino
Outdated
* Choose the type, the data and the length of the Mime by changing | ||
* the content of mime_type and data, the length is automatic. | ||
* | ||
* We can see on the monitor window the message "Sytstem init done!" when the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reword
examples/WriteAAR/WriteAAR.ino
Outdated
* Check the pinout and the I2C interface used for communication. | ||
* Choose the name of the application by changing the content of text_write. | ||
* | ||
* We can see on the monitor window the message "Sytstem init done!" when the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reword
src/NDefNfcTagM24SR.h
Outdated
****************************************************************************** | ||
*/ | ||
|
||
#ifndef X_NUCLEO_NFC01A1_M24SR_NDEFNFCTAGM24SR_H_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove X_NUCLEO_NFC01A1_M24SR
src/NDefNfcTagM24SR.h
Outdated
|
||
}; | ||
|
||
#endif /* X_NUCLEO_NFC01A1_M24SR_NDEFNFCTAGM24SR_H_ */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
src/m24sr_def.h
Outdated
|
||
#endif /* __DRV_M24SR_H */ | ||
|
||
/******************* (C) COPYRIGHT 2013 STMicroelectronics *****END OF FILE****/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove date to avoid misalignment
examples/WriteAAR/WriteAAR.ino
Outdated
* You can also write an AAR tag with your smartphone. | ||
* On Android, donwload the NFC Tools. | ||
* Then start the app, check if NFC is activated on your smartphone. | ||
* Choose "ecrire" and then select the AAR tag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And for english smartphone?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caught ;)
README.md
Outdated
## Important note | ||
|
||
Before using this library, install the ArduinoSTL library. | ||
Make sure to include the patch number with commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems difficult to apply for non github user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree but we have no choice.
@cparata push a PR but we are waiting the merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, use this PR to test: stm32duino/Arduino_Core_STM32#129
This allow to use STL without Arduino STL.
Build ok by removing all ArduinoSTL.h
include in NFC sketches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
I made a first test with nfc and I have bad results. See my comments on examples/WriteText/WriteText.ino, they apply to all examples.
To test, I have :
* This PR
* stm32duino core + stm32duino/Arduino_Core_STM32#120
* ArduinoSTL lib + mike-matera/ArduinoSTL#12
examples/WriteText/WriteText.ino
Outdated
* If you want to read tag in RF mode (with smartphone) unplug the USB on the board. | ||
* The board should be power-off, or RF mode will not be available. | ||
* | ||
* You can write a Text tag with your smartphone. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description not clear. In this case, the sample will write a text on the chip, then, it will read it to check if it is OK. With a smartphone, we will be able to check that text has been updated.
The read / write functionality from the smartphone is not dependent of the Arduino sketche...
examples/WriteText/WriteText.ino
Outdated
|
||
void loop() { | ||
const char *text_write = "hello world welcome on earth"; // Text to write in the tag | ||
char text_read[255]; // Text read in the tag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be good to initialize this value. (in case we see something in case of error during reading)
examples/WriteText/WriteText.ino
Outdated
//read the txt message and print it | ||
nfcTag.readTxt(text_read); | ||
SerialPort.println("Message content :"); | ||
SerialPort.println(text_read); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need a strcmp to compare to the written message.
In my case, the read message is always empty... Perhaps I missed something in the way to test the NFC, but even in this case, we should get an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One other change, is to perform the test in the setup as it is done only one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a problem with the library. My release was ready since the last week before the PR of the I2C on IT. So it broke the library communication.
I must find a patch...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds strange that the I2C IT broke it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it is a mismatch between i2c working with IT now and i2c buffer size. There are still I2C_TXRX_BUFFER_SIZE defined to 32 for example...
(I have tried to set it to 255 but it is not working).
Then, as mentioned by @fpistm, it can be good to have something more flexible. (Avoid to use a big buffer if not needed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirm the problem is in the I2C layer. It is not the buffer size the problem.
From the datasheet of the module we can read:
A restart during a command and response exchange is not supported by the M24SR64-Y.
After a command, the I2C host can execute a Polling sequence to determine when the
response is available.
Polling sequence: Loop on START (S) + DeviceSelect with RW=0 + read NACK/ACK + STOP(P)
The response is available as soon as the M24SR64-Y sends an ACK ( host read will a '0').
That means the I2C goes in READY state but with AF (Acknowledge failure) error when it is waiting a response from the module because the module returns NACK. As the error code is not checked then the Wire library returns OK to the NFC driver but the module it is not ready yet!
The quick solution is to check the errorCode parameter in i2c_master_read()
. But I saw other problems in the twi.c file. I will open an issue to expose to you those problems. (And I know I validated the PR but too quickly I think).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My 2 cents:
I think it is ok to exit i2c_master_read as soon as I2C READY internal state is reached
To check whether device is ready before sending a new command, the below API shall be used:
i2c_status_e i2c_IsDeviceReady(i2c_t *obj, uint8_t devAddr, uint32_t trials)
It is up to the device driver to use this API when needed (as recommended by spec) before sending a new I2C command. I have seen EEPROM where is sometimes takes 5 or 6 checks before the device is actually ready ...
Signed-off-by: fpr <[email protected]>
Updated to work with I2C IT mode. |
Library updated with the last modification of the Wire library (PR). |
Signed-off-by: fpr <[email protected]>
Signed-off-by: fpr <[email protected]>
Signed-off-by: fpr <[email protected]>
Signed-off-by: fpr <[email protected]>
Signed-off-by: fpr <[email protected]>
Signed-off-by: fpr <[email protected]>
Signed-off-by: fpr <[email protected]>
Signed-off-by: fpr <[email protected]>
Signed-off-by: fpr <[email protected]>
Updated to match with the latest version of this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to add in the examples also the settings for X-NUCLEO-NFC01A1 as we did for SPBTLE-RF library, so we have a porting that works fine with both Discovery IoT Node and X-NUCLEO-NFC01A1.
I decided to create a dedicated package for X-NUCLEO-NFC01A1 derived from M24SR64-Y library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok for me. Wait merge of stm32duino/Arduino_Core_STM32#131 before merge this one
Add source files to M24SR64-Y library.
Examples available for Discovery L475VG IOT board.
This PR removed an issue in this library.