Hi expert,
After run demo NfcrdlibEx1_DiscoveryLoop on PN5190EVB kit (use mk82 mcu) success, i ported the demo to LPC55S16EVK, but without successful,
In phacDiscLoop_Run, after some interrupts from PN5190 and read/write via SPI, the MCU block on phOsal_Sleep, please take a look on the call stack and project file
Please show me next step check to find out the problem ?
Many thanks,
HaiHoang
Solved! Go to Solution.
Hi @haihoang ,
The issue is
in the phDriver_LPCOpen.c . You are calling phDriver_TimerStop() function in the phDriver_TimerStart(). So the timer is not working for the NFC reader library. Please remove it and add the CTIMER_StopTimer(PH_DRIVER_LPC_TIMER) in the phDriver_TimerStop (void) function.
Hi @haihoang ,
The issue is
in the phDriver_LPCOpen.c . You are calling phDriver_TimerStop() function in the phDriver_TimerStart(). So the timer is not working for the NFC reader library. Please remove it and add the CTIMER_StopTimer(PH_DRIVER_LPC_TIMER) in the phDriver_TimerStop (void) function.
Hi @LinnHT
For LPCOpen source, i used from example (for LPC55S69):
https://community.nxp.com/t5/NFC-Knowledge-Base/Using-NFC-Reader-Library-with-LPC55S69/ta-p/1117479
and ported to LPC55S16
So, it seem there are some miss take on this, let me try and update the result
Many thanks,
HaiHoang
Hi,
I have checked the block diagram of NFC PN5190, it appears that PN5190 connection with LPC55S16EVK is just 4 wires SPI port and one interrupt pin, can you post the hardware connection and clarify your issue? Do you means that the spi port does not work or external interrupt pin does not work?
I have LPC5516-EVK board but I do not have PN5190EVB kit.
BR
XiangJun Rong
Hi XiangJun Rong,
Thanks for your support
can you post the hardware connection and clarify your issue
LPC55S16EVK connect SPI8 with PN5190EVB with 8 pin: MISO, MOSI, SCK, NSS, IRQ, VEN, +5V and GND,
You can see detail on attached project in my previous message
Do you means that the spi port does not work or external interrupt pin does not work?
May be the external interrupt not work, because mcu call phApp_ConfigureLPCD successfull (please take a look on call stack in my previous message
I think there are some problem in NFC stack if work with cortex M33, any suggest for me in this case ?
Many thanks
HaiHoang
Hi,
I suppose that you use PINTx module to generate an interrupt, this is a snippet for PINTx module based on LPC5536, pls refer to it.
BTW, there is PINTx example in SDK package, pls refer to it.
You can download SDK package from the website:
https://mcuxpresso.nxp.com/en/welcome
Hope it can help you
BR
XiangJun Rong
//P0_13 Hall_sensor_A
//P0_14 Hall_sensor_B
//P1_11 Hall_snesor_C
void InitPINT(void)
{
//pin configuration:
//enable IOCON gated clock
//enable the IOCON gated clock
SYSCON->AHBCLKCTRL0|=1<<13;
IOCON->PIO[0][13] |=0x100;
IOCON->PIO[0][14] |=0x100;
IOCON->PIO[1][11] |=0x100;
//enable gated clock for GPIO0/GPIO1 for reading the GPIO pin logic
SYSCON->AHBCLKCTRLSET[0] |=1<<11;//enable INPUTMUX interface clock in SYSCON
SYSCON->AHBCLKCTRLSET[0] |=SYSCON_AHBCLKCTRL0_PINT_MASK;//enable PINT0 interface clock in SYSCON
SYSCON->PRESETCTRLSET[0] |=SYSCON_PRESETCTRL0_PINT_RST_MASK;
SYSCON->PRESETCTRLCLR[0] |=SYSCON_PRESETCTRL0_PINT_RST_MASK;
INPUTMUX->PINTSEL[0] =INPUTMUX_PINTSEL_INTPIN(0xD);//interrupt PINT0_0 from P0_13
INPUTMUX->PINTSEL[1] =INPUTMUX_PINTSEL_INTPIN(0xE);//interrupt PINT0_1 from P0_14
INPUTMUX->PINTSEL[2] =INPUTMUX_PINTSEL_INTPIN(0x2B);//interrupt PINT0_2 from P1_11
PINT->ISEL =0x00;//edge-sensitive interrupt
PINT->RISE |=PINT_RISE_RDET(0x07);//generate interrupt on rising edge
PINT->FALL |=PINT_FALL_FDET(0x07);//generate interrupt on falling edge
PINT->IST |=PINT_FALL_FDET(0x07);//clear rising edge and falling edge flag
PINT->SIENF |=PINT_IENF_ENAF(0x07);
PINT->SIENR |=PINT_IENF_ENAF(0x07);
EnableIRQ(PIN_INT0_IRQn);
EnableIRQ(PIN_INT1_IRQn);
EnableIRQ(PIN_INT2_IRQn);
}
//PIO0_13 pin generates interrupt
void PIN_INT0_IRQHandler(void)
{
/* period calculation between two HS_A edges */
uw16HSedge = 0x0000;
//uw16HSperiod = (uint16_t)MLIB_Sub_F16_FCi((uint16_t)uw16HSedge,(uint16_t)uw16HSedgeK_1);
uw16HSedgeK_1 = uw16HSedge;
/* define maximum period */
if(uw16HSperiod>32767)
uw16HSperiod = 32767;
commutationHS(f16DirectionOfRotation);
PINT->IST |= 0x00000001;//clear PINT0_0 flag
PINT->FALL |= 0x00000001;//clear PINT0_0 falling edge flag
PINT->RISE |= 0x00000001;//clear PINT0_0 rising edge flag
asm("nop");
temp=GPIO->PIN[0]; //GPIO_PortRead(GPIO, 0);
if(temp&(1<<13))
{
GPIO->SET[0]=1<<22;
}
else
{
GPIO->CLR[0]=1<<22;
}
M1_END_OF_ISR;
}
Hi,
It seems to be closely related to the communication between the MCU and the PN5190 according to the NFC stack, as I have seen it interrupt 15 times (meaning the pin interrupt setting was successful), but the 16th time from the PN5190 did not happen ( because the PN5190 does not pull this interrupt pin), possibly because the PN5190 has not been configured correctly
In this state the MCU is waiting at __WFE, so there is no way for it to exit this command without an interrupt from PN5190.
Do you have a NFCLIB port that works well with the cortex M33 series? Can I refer to it?
Hi,
I have LPC5516-EVK board, unfortunately, I have not NFC PN5190EVB kit, I am sorry, I can not have a test.
BR
XiangJun Rong