Hello,
As will be noticed further, I am new in the exciting Arduino world, so please forgive possible common knowledge gaps extensive reading in the last several months haven't been able to fill.
Hardware setup:
Arduino Mega ATmega2560 (micro USB) - https://www.aliexpress.com/item/32850843888.html
3.2" 240X400TFT LCD Touch Screen Expansion Shield (note the exact chip model is ILI9327, not HX8352B as shown on picture; pins out is identical) - 3.2" 3.2 Inch 240x400 Tft Lcd Touch Screen Expansion Shield Led Display Module 5v / 3.3v With Touch Pen For Arduino - Lcd Modules - AliExpress
PN532 NFC RFID Wireless Module - 1set Pn532 Nfc Rfid Wireless Module V3 User Kits Reader Writer Mode Ic S50 Card Pcb Attenna I2c Iic Spi Hsu - Integrated Circuits - AliExpress
Screen Expansion Shield connected directly on top of the Arduino Mega leaving uncovered only digital pins from 23 to 53 (+5V and GND).
Screen and touch functionality don’t use SPI neither for data transfer nor management according specification. The shield however is connected to SPI pins on ICSP for SD card communication support. SD card is not used (SPI pins on ICSP) and not needed.
PN532 connected on SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support SPI communication using the SPI library. Setup of those pins is made in the test sketch.
Used libraries:
HCDisplay.h // HCDisplay specific ILI9327 library from HCDisplay Arduino library for Hobby Components Displays - forum.hobbycomponents.com - attached
Adafruit_PN532.h //standard
SPI.h //standard
Test sketch:
TestReadMifare.ino - attached
Problem:
Screen and touch function work very well when connected alone to Arduino Mega.
PN532 works very well when connected alone to Arduino Mega.
When connected in the same time to Arduino and the attached sketch is uploaded the PN532 can’t be found by the board even with screen setup is commented out in the code.
Goal:
Get screen, touch and PN532 working together.
I believe there is a SPI communication mismanagement although SD card in not used. Maybe a conflict between hardware and software SPI pins… guidance would be highly appreciated.
Thank you in advance,
Lara
TestReadMifare.ino (7.81 KB)
HCDisplay_V0_2.zip (344 KB)