SPI: add 1ms sleep in wakeup()

Without this delay I had troubles with a Raspberry-Pi:
With debug enabled I could go as high as 7.8MHz but without debug I had to go lower than 500kHz otherwise I got following error:
  errorlibnfc.driver.pn532_spiUnable to wait for SPI data. (RX)
  pn53x_check_communication: Timeout
It could work occassionally faster but very unreliable.
So the delay introduced by printf() was enough to "fix" the problem, therefore this little extra sleep() in wakeup().
This commit is contained in:
Philippe Teuwen 2013-03-28 00:11:56 +01:00
parent c8e50b6852
commit f9bd5d79d2

View file

@ -307,6 +307,7 @@ pn532_spi_wakeup(nfc_device *pnd)
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "Got %x byte from SPI line before wakeup", spi_byte);
CHIP_DATA(pnd)->power_mode = NORMAL; // PN532 will be awake soon
msleep(1);
if (spi_byte == 0xff) {
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%s", "Wakeup is needed");