Hi,
I'm new developing NRF52 DK.
I try to do a simply proyect to read RFID tags with the chip MFRC522, but i cant find a example to do this.
Help me. I worked for more than 2 weeks but couldn't do nothing
Hi,
I'm new developing NRF52 DK.
I try to do a simply proyect to read RFID tags with the chip MFRC522, but i cant find a example to do this.
Help me. I worked for more than 2 weeks but couldn't do nothing
Hi,
Did you have a look at the code in this ticket?
We cannot provide examples for every sensor and peripheral that exists out there, we provide basic SPI/TWI/UART examples, which you need to modify to interface with the peripherals. The interface/protocol is described in the datasheet of the peripheral you want to connect.
If you have any specific issue with getting the communication working with the peripheral, please post you project and describe the problem in details. We will then try to help you resolve it.
Best regards,
Jørgen
Hi,
Thaks for your answer, I agree with you and let me tell you sorry. Anyway, I was trying to run the library MFRC522 and when I init the library, i only get the next answer: "<info> app: result:1"
Can someon help me?
The code is bellow, It is based on the SPI example and I added the MFRC522 library.
#include "nrf_drv_spi.h"
#include "app_util_platform.h"
#include "nrf_gpio.h"
#include "nrf_delay.h"
#include "boards.h"
#include "app_error.h"
#include <string.h>
#include "nrf_log.h"
#include "mfrc522.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
#define SPI_INSTANCE 0 /**< SPI instance index. */
static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE); /**< SPI instance. */
static volatile bool spi_xfer_done; /**< Flag used to indicate that SPI instance completed the transfer. */
#define TEST_STRING "Nordic"
static uint8_t m_tx_buf[] = TEST_STRING; /**< TX buffer. */
static uint8_t m_rx_buf[sizeof(TEST_STRING) + 1]; /**< RX buffer. */
static const uint8_t m_length = sizeof(m_tx_buf); /**< Transfer length. */
/**
* @brief SPI user event handler.
* @param event
*/
void spi_event_handler(nrf_drv_spi_evt_t const * p_event,
void * p_context)
{
}
int main(void)
{
bsp_board_init(BSP_INIT_LEDS);
APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
NRF_LOG_DEFAULT_BACKENDS_INIT();
mfrc522_init();
while (1)
{
if ( PICC_IsNewCardPresent())
NRF_LOG_INFO("detected");
}
}Hi,
Thaks for your answer, I agree with you and let me tell you sorry. Anyway, I was trying to run the library MFRC522 and when I init the library, i only get the next answer: "<info> app: result:1"
Can someon help me?
The code is bellow, It is based on the SPI example and I added the MFRC522 library.
#include "nrf_drv_spi.h"
#include "app_util_platform.h"
#include "nrf_gpio.h"
#include "nrf_delay.h"
#include "boards.h"
#include "app_error.h"
#include <string.h>
#include "nrf_log.h"
#include "mfrc522.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
#define SPI_INSTANCE 0 /**< SPI instance index. */
static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE); /**< SPI instance. */
static volatile bool spi_xfer_done; /**< Flag used to indicate that SPI instance completed the transfer. */
#define TEST_STRING "Nordic"
static uint8_t m_tx_buf[] = TEST_STRING; /**< TX buffer. */
static uint8_t m_rx_buf[sizeof(TEST_STRING) + 1]; /**< RX buffer. */
static const uint8_t m_length = sizeof(m_tx_buf); /**< Transfer length. */
/**
* @brief SPI user event handler.
* @param event
*/
void spi_event_handler(nrf_drv_spi_evt_t const * p_event,
void * p_context)
{
}
int main(void)
{
bsp_board_init(BSP_INIT_LEDS);
APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
NRF_LOG_DEFAULT_BACKENDS_INIT();
mfrc522_init();
while (1)
{
if ( PICC_IsNewCardPresent())
NRF_LOG_INFO("detected");
}
}