Skip to main content
Visitor II
October 24, 2019
Solved

STM32CubeExpansion_NFC5 Software migration problem

  • October 24, 2019
  • 3 replies
  • 1187 views

After migrating to Nordic-nrf52832 platform with STM32CubeExpansion_NFC5_V2.0.0, I can initialize successfully (all initialization processes can succeed), and fail to Polling Tag Detect.

Refer to the example completely for program running process

int main(void)
{
 bsp_board_init(BSP_INIT_LEDS);
 bsp_board_init(BSP_INIT_BUTTONS);
 APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
 NRF_LOG_DEFAULT_BACKENDS_INIT();
 timers_init();
 
	 spiInit();
 NRF_LOG_INFO("SPI example started.");
 
	 if( true != demoIni() )
		{
			NRF_LOG_ERROR("************ rfal NG **************");
		}
	
 while (1)
 {
				demoCycle();
 
 NRF_LOG_FLUSH();
// bsp_board_led_invert(BSP_BOARD_LED_0);
 nrf_delay_ms(500);
 }
}

0690X00000AqnplQAB.png

0690X00000AqnpqQAB.png

​Debug Log

Democycle() didn't crash, just couldn't get the card searching result.

0690X00000AqnnVQAR.png

    This topic has been closed for replies.
    Best answer by Ulysses HERNIOSUS

    Hi,

    typically Saleae can be configured to sample much faster. If your device is really limited to 2MHz, then reduce SPI to 1MHz and send me the traces.

    Regards, Ulysses ​

    3 replies

    Technical Moderator
    October 24, 2019

    Hi,

    which voltage are you referring in the log output? How was it retrieved?

    Best if you could provide a logic analyzer trace of rfalInitialize().

    Regards, Ulysses

    BHuan.839Author
    Visitor II
    October 25, 2019

    The voltage is init RF power 5V

    rfalInitialize -> st25r3911Initialize -> st25r3911MeasureVoltage

    0690X00000AqrDCQAZ.png

    0690X00000AqrD2QAJ.png

    0690X00000AqrCsQAJ.png

    0690X00000AqrCnQAJ.png

    0690X00000AqrD7QAJ.png

    uint8_t spiTxRx(const uint8_t *txData, uint8_t *rxData, uint16_t length)
    {
    	uint8_t i=0;
    	if((NULL == txData) && (NULL == rxData))
    	{
    	 return i;
    	}
    	
    	if(length > 128)
    	{
    			return i;
    	}
    	struct rt_spi_message msg1, msg2;
    	if(txData != NULL)
    	{
    		if(rxData != NULL) // RX �?�空
    		{
    			msg1.send_buf = txData; // �?��?缓存
    			msg1.recv_buf = rx_buff;// 接收缓存
    			msg1.length = length;
    			msg1.cs_take = 1;
    			msg1.cs_release = 0;
    			msg1.next = &msg2;
     
    			msg2.send_buf = RT_NULL;
    			msg2.recv_buf = RT_NULL; 
    			msg2.length = 0;
    			msg2.cs_take = 0;
    			msg2.cs_release = 1;
    			msg2.next = RT_NULL;
    			rt_spi_transfer_message(spi_dev_st25r, &msg1);
    			memcpy(rxData, rx_buff, length);
    		}
    		else // RX NULL
    		{
    			msg1.send_buf = txData; // �?��?缓存
    			msg1.recv_buf = RT_NULL;
    			msg1.length = length; // �?��?长度
    			msg1.cs_take = 1;
    			msg1.cs_release = 0;
    			msg1.next = &msg2;
     
    			msg2.send_buf = RT_NULL;
    			msg2.recv_buf = RT_NULL;
    			msg2.length = 0;
    			msg2.cs_take = 0;
    			msg2.cs_release = 1;
    			msg2.next = RT_NULL;
    			rt_spi_transfer_message(spi_dev_st25r, &msg1);
    		}
    	}
    	else // TX NULL
    	{
    		if(rxData != NULL) // RX �?�空
    		{
    			msg1.send_buf = RT_NULL;
    			msg1.recv_buf = RT_NULL;
    			msg1.length = 0;
    			msg1.cs_take = 1;
    			msg1.cs_release = 0;
    			msg1.next = &msg2;
     
    			msg2.send_buf = RT_NULL;
    			msg2.recv_buf = rx_buff; // 接收缓存
    			msg2.length = length;
    			msg2.cs_take = 0;
    			msg2.cs_release = 1;
    			msg2.next = RT_NULL;
    			rt_spi_transfer_message(spi_dev_st25r, &msg1);
    			memcpy(rxData, rx_buff, length);
    		}
    	}
    	rt_thread_mdelay(5);
     return i;
    }

    Technical Moderator
    October 25, 2019

    Hi,

    • Your picture shows an ST Nucleo Board with your antenna. Can it read the tag?
    • On the picture the antenna seems to have some shielding on the bottom top. Better to turn it around
    • Did you adapt the matching for your antenna (inductance)? This is a necessary step for getting the antenna to work. Please refer to AN4974 Antenna matching for ST25R3911B/ST25R391x devices.
    • The sampling frequency of your Saleae is at 2MHz, this is not enough to sample a 2MHz SPI!
    • Please increase the sample frequency and provide the actual trace file of Saleae, not only screenshots. If you regard this as confidential you can also share through private message.
    • I still see above an rt_thread_mdelay(5) - all NFC action will considerably slow down!
    • The st25r3911MeasureVoltage() just gives the supply voltage. Please execute st25r3911MeasureAmplitude() and st25r3911MeasurePhase() to get the voltage and phase on RFI
    • Please provide result value of st25r3911CalibrateAntenna()

    Regards, Ulysses

    BHuan.839Author
    Visitor II
    October 25, 2019

    Under the same hardware platform, I can use STM32CubeExpansion_NFC5_V2.0.0 l476 example without any problem. The antenna matching is OK, and the SPI rate I have tried is useless. Delay time also tried all kinds of useless. Even if you know that the data of logic analyzer is wrong, what else can I do to improve it?

    Technical Moderator
    October 25, 2019

    Hi,

    typically Saleae can be configured to sample much faster. If your device is really limited to 2MHz, then reduce SPI to 1MHz and send me the traces.

    Regards, Ulysses ​