Skip to main content
Visitor II
March 28, 2024
Solved

Troubles entering WakeUp mode on ST25R3917

  • March 28, 2024
  • 3 replies
  • 1454 views

Hello,

I'm building a proprietary NFC reader based on ST25R3917 chip and STM32F070CBT6 MCU. I use Bare Metal approach without any HAL or RFAL which might complicate my query a bit but I'll try to ask anyway. So far I'm able to Poll Type A and Type B cards, carry APDU over higher protocol layer etc without any issues. What I'm struggling with is switching over to WakeUp mode to save power.

Below is a log of i2c communication from none-eabi-gdb. << represents a flow to the reader:

<< Direct Command: 0xc0
<< Address: 0x0, Data: {0x0, 0x80, 0x0}
<< Address: 0x16, Data: {0x6e, 0x9f, 0xff, 0xff}
<< Address: 0x10, Data: {0x7, 0x0}
<< Address: 0x13, Data: {0x21, 0x1b}
<< Address: 0x2, Data: {0x80}
<< Direct Command: 0xd3
<< Address: 0x34, Data: {0x63}
<< Address: 0x33, Data: {0x32, 0x30}
<< Address: 0x32, Data: {0x38, 0x34}
<< Address: 0x2, Data: {0x4}
<< Address: 0x16, Data: {0xff, 0xff, 0xfb, 0xff}

Basically I follow AN5320 wanting to implement Amplitude measurement. I turn on some basic settings, wait for the oscillator to stabilize, after I_osc interrupt happens I send Direct command: Measure amplitude which produces RF puls very similar to the one in Figure 12 in Application Note. Then I read the measured value from AD converter which hovers around 100 in decimal, save it to Amplitude measurement reference register 34h. After that I set up Wake Up parameters in registers 33h nad 32h (no averaging), turn off oscillator, set up wu bit in Operation control register 02h, disable every other IRQ but wam in 16h-19h. And then nothing happens. No other pulse is generated. No interrupt comes.

Out of curiosity I also tried to set up wto bit in Wake-up timer control register 32h and it's corresponding IRQ. That actually produced periodic interrupts so I believe that Low-power wake-up generator does it's magic. The RF part however seems to do nothing at all.

Any idea what I'm doing wrong? Thanks in advance!

    This topic has been closed for replies.
    Best answer by Brian TIDAL

    Hi,

    BrianTIDAL_0-1711643850698.png

    your second writing at address 0x32 seems to write 2 bytes (i.e. address 32h and 33h). This probably modifies the content of register 33h

    Regarding the content of register 32h: 0x38 means no amp/ph/cap measurement at all. 

    BrianTIDAL_1-1711644000336.png

    I guess you would like to enable the wam bit in order to have some measurements...

    I would suggest to have a look inside the rfalWakeUpModeStart  function of the RFAL to check your various register settings.

    Also, I can share a logic analyzer trace if you are still stuck.

    Rgds

    BT

     

    3 replies

    Technical Moderator
    March 28, 2024

    Hi,

    BrianTIDAL_0-1711643850698.png

    your second writing at address 0x32 seems to write 2 bytes (i.e. address 32h and 33h). This probably modifies the content of register 33h

    Regarding the content of register 32h: 0x38 means no amp/ph/cap measurement at all. 

    BrianTIDAL_1-1711644000336.png

    I guess you would like to enable the wam bit in order to have some measurements...

    I would suggest to have a look inside the rfalWakeUpModeStart  function of the RFAL to check your various register settings.

    Also, I can share a logic analyzer trace if you are still stuck.

    Rgds

    BT

     

    Visitor II
    March 29, 2024

    Hi,

    you're right! I don't now how could I overlook that. In my code I actually want to send something entirely different:

    void Nfcm::setWakeUpParameters(){
    next = &Nfcm::setWakeUpTimeout;
    writeToRegister(0x33, "20"_B); // delta = 2
    }

    void Nfcm::setWakeUpTimeout(){
    next = &Nfcm::enableWakeUpMode;
    writeToRegister(0x32, "84"_B); //wur = 1 wut = 0 => 10ms, wam
    }

    Looks like there's some issue in the writeToRegister wrapper. Or the logging script itself. I'll look into it. Thanks for noticing with another set of eyes. I'll let you know if that helped me.

    Oh and thanks for the tip on RFAL. I gave that a try already, but the amount of code seems confusing to me. If the wrapper thing will be a no go, I'll dive into the library deeper.
    Visitor II
    April 2, 2024

    Hi,

    the issue was rather dumb. I was missing hexadecimal modifier when writing to those two registers. Adding \x helped and now the wake up mode works like a charm. Thanks again for noticing it. I feel bit embarrassed for bringing it in here.