In this paper we describe the procedure for the optical calibration of large size deformable mirrors, acting as wavefront correctors for adaptive optics systems. Adaptive optics compensate the disturbance due to the atmospheric turbulence to restore the telescope resolution. We will showcase in particular the activities performed for the Adaptive Secondary Mirror (ASM) of the Magellan Adaptive Optics system (MagAO), which is an instrument for the 6.5 m Magellan Clay Telescope, located at Las Campanas Observatory, in Chile. The MagAO ASM calibration is part of the MagAO-2K project, a major MagAO upgrade that started in 2016 with the goal of boosting adaptive optics (AO) correction at visible wavelengths to image exoplanets. For the first time, the optical quality of MagAO mirror is reported. We describe the procedures developed to achieve high SNR interferometric measurements of the ASM modes under the presence of dome convection noise and telescope vibrations. These measurements were required to produce an improved control matrix with up to 500 modes to close the AO loop on sky with enhanced performances. An updated slaving algorithm was developed to improve the control of actuators vignetted by the central obscuration. The calibrations yielded also a new ASM flattening command, updating the one in use since the MagAO commissioning in 2013. With the new flattening command, a 22 nm RMS surface error was achieved. Finally, we present on-sky results showing the MagAO performance achieved with the new calibrations.