Xiaomi Smart Pen 2nd generation is supported on Xiaomi Pad 5 series, you need to upgrade your MIUI version to the latest one. In Settings - Stylus and Keyboard - Stylus - Firmware Update to check if there is a new Xiaomi Smart Pen firmware update, if there is, upgrade the pen's firmware to the latest version as well.