TFT and PN532 SPI Conflict

Hi Forum,

First time getting into Arduino this week. Trying to get a sumotoy TFT_ILI9163 working inconjunction with PN532 NFC. I am able to get both working fine using example projects over SPI. Each has a separate CS pin so hardware wise I think it all is good.

To simplify I tried adding TFT print functions to the standard Mifare NFC example. But only the device that I put first. ie nfc.begin() or tft.begin will work. It then seems to lock up, I assume that the first one is grabbing the SPI via its CS and not letting go. I couldn’t find any information about whether you need to manually toggle the CS for these drivers in between statements.

Unfortunately I don’t have an oscilloscope yet to analyse how the CS lines trigger for the drivers.

Thanks for any advice

Combo.ino (7.33 KB)

If you look at the comments in the Adafruit_PN532 header file, you'll see that the 4 argument constructor that you use does software SPI, not hardware SPI. You can't share the SPI bus doing hardware and software SPI on the hardware SPI pins.

There is a one argument constructor that does hardware SPI.

Thanks for the tip. Obvious once I re-read the comments properly that specified HW and SW options available for SPI. Works a treat now.