2024-03-28 08:55 AM
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!
Solved! Go to Solution.
2024-03-28 09:48 AM
Hi,
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.
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
2024-03-28 09:48 AM
Hi,
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.
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
2024-03-29 01:45 AM
Hi,
you're right! I don't now how could I overlook that. In my code I actually want to send something entirely different:
2024-04-02 01:33 AM
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.