Pages: [1]   Go Down
Author Topic: NFC Shield V2.0b Power Down  (Read 55 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everyone,

Here is my problem: I'm trying to implement a new function in the PN532 libraries which would give me the possibility to shut down the PN532 module in order to reduce power consumption and heat production and then waking up from my code.
Here is the power down function in PN532 I wrote :

bool PN532::shutDown(){
pn532_packetbuffer[0] = PN532_COMMAND_POWERDOWN;
pn532_packetbuffer[1] = PN532_SPI_SOUCE; //Autorized wake up source.
DMSG("Shutting down RF module");

if(HAL(writeCommand)(pn532_packetbuffer, 2))
return pn532_packetbuffer[1];

delay(2); //Delay to make sure the module is off.
return (0 < HAL(readResponse)(pn532_packetbuffer, sizeof(pn532_packetbuffer)));

This part seems to work (the module is not found and stop to heat).

But now to wake up... even when calling begin() (which call wakeup defined in PN532_SPI, nothing happen and I'm oblige to Hard reset (and plug out & plugin) to recover the board.

I know in SPI mode the NSS line must be LOW as already done in PN532_SPI before sending command in order to wake up:

void PN532_SPI::begin()
    pinMode(_ss, OUTPUT);

    _spi->setDataMode(SPI_MODE0);  // PN532 only supports mode0
#ifndef __SAM3X8E__
    _spi->setClockDivider(SPI_CLOCK_DIV8); // set clock 2MHz(max: 5MHz)
    /** DUE spi library does not support SPI_CLOCK_DIV8 macro */
    _spi->setClockDivider(42);             // set clock 2MHz(max: 5MHz)


void PN532_SPI::wakeup()
    digitalWrite(_ss, LOW);
    digitalWrite(_ss, HIGH);

Documentation : (from p.98)

Any idea?

Thanks in advance!

Pages: [1]   Go Up
Jump to: