I want to move the project to ATMega328 from PDIP to TQFP packaging.
TQFP packaging has several pins more. How do I work with non-used pins?
I'm grateful for every help.
The TQFP package has 32 pins, while the DIP package has 28.
2 of the additional pins are power and ground - they should be connected to the corresponding rails, with an additional 0.1uF decoupling cap between them (each power pin ought to have it's own cap - though one can sometimes get away without this, as evidenced by the cheap pro mini and nano clones with only a single 0.1uF cap for decoupling. This is not good design practice, though).
The other two pins are A6 and A7 - additional analog-only input pins which you can use if you wish, or else treated like any other unused I/O pin.
See the abundant pinout charts or the one in the datasheet to see which pin is which.
For maximum compatibility with the standard Arduino IDE, in this case you probably want a ATMEGA328P-AU