Error in transplant the st25r3911b device
Recently, I am working on a project. I need to use the nrf52832 driver st25r3911b chip to read the card. The current progress is that I can use the st25r3911 driver to initialize, and the initialization has been successful, but it seems that there is no response to the nfcv card. Then I compared the situation of using the development board and found that the st25r3911 did not generate interruption during operation, (When I use the stm32L476 development board to drive the NFC05A1 development board, I can see that the interrupt pin of the NFC05A1 always generates interrupt signals), but I don't know what causes this. Since I have just started this chip, the code used is basically the same as demo's code. What I want to know is, what should I pay attention to when porting the st25r3911b sdk? There is also the reason that may lead to the above problem. I hope someone can give me a solution. Thank you very much.
Below is part of the code
void spi_event_handler(nrf_drv_spi_evt_t const *p_event, void *p_context)
{
spi_xfer_done = true;
}
static void hal_spi_init(void)
{
nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
spi_config.ss_pin = SPIM0_SS_PIN;
spi_config.miso_pin = SPIM0_MISO_PIN;
spi_config.mosi_pin = SPIM0_MOSI_PIN;
spi_config.sck_pin = SPIM0_SCK_PIN;
spi_config.mode = NRF_DRV_SPI_MODE_1;
spi_config.frequency = NRF_DRV_SPI_FREQ_2M;
APP_ERROR_CHECK(nrf_drv_spi_init(&m_spi, &spi_config, spi_event_handler, NULL));
}
uint8_t nrf_spi_tx_rx(const uint8_t *txData, uint8_t *rxData, uint8_t len)
{
if (txData != NULL)
{
memcpy(tx, txData, len);
}
else
{
memset(tx, 0x00, len);
}
spi_xfer_done = false;
APP_ERROR_CHECK(nrf_drv_spi_transfer(&m_spi, tx, len, (rxData != NULL) ? rxData : rx, len));
while (!spi_xfer_done)
{
__WFE();
}
nrf_delay_ms(1);
return 0;
}
int main(void)
{
bool erase_bonds;
// Initialize.
log_init();
timers_init();
lfclk_config();
rtc_config();
hal_spi_init();
gpio_init();
buttons_leds_init(&erase_bonds);
power_management_init();
ble_stack_init();
gap_params_init();
gatt_init();
advertising_init();
services_init();
conn_params_init();
peer_manager_init();
// Start execution.
NRF_LOG_INFO("miaomiao3 device started.");
application_timers_start();
advertising_start(erase_bonds);
rfalAnalogConfigInitialize();
if (rfalInitialize() != ERR_NONE)
{
platformLog("RFAL initialization failed..\r\n");
}
else
{
platformLog("RFAL initialization succeeded..\r\n");
}
// Enter main loop.
for (;;)
{
idle_state_handle();
rfalWorker();
workCycle();
}
}
void workCycle(void)
{
bool found = false;
switch (stateArray[state])
{
case FIELD_OFF:
rfalFieldOff();
rfalWakeUpModeStop();
platformDelay(300);
/* If WakeUp is to be executed, enable Wake-Up mode */
if (doWakeUp)
{
platformLog("Going to Wakeup mode.\r\n");
rfalWakeUpModeStart(NULL);
state = WAIT_WAKEUP;
break;
}
NEXT_STATE();
break;
case POLL_ACTIVE_TECH:
demoPollAP2P();
platformDelay(40);
NEXT_STATE();
break;
case POLL_PASSIV_TECH:
found |= PollNFCV();
platformDelay(300);
state = FIELD_OFF;
break;
case WAIT_WAKEUP:
/* Check if Wake-Up Mode has been awaked */
if (rfalWakeUpModeHasWoke())
{
platformLog("start poll\r\n");
/* If awake, go directly to Poll */
rfalWakeUpModeStop();
state = POLL_ACTIVE_TECH;
}
break;
default:
break;
}
}
