Method of determining an overlay error between device layers of a multilayer semiconductor device (1-1,...,1-4, 26) using an atomic force microscopy system, wherein the semiconductor device comprises a stack of device layers comprising at least a first patterned layer and a second patterned layer, and wherein the atomic force microscopy system comprises at least one scan head, the scan head including a probe, the probe comprising a cantilever and a probe tip arranged on the cantilever, wherein the method comprises: moving the probe tip and the semiconductor device (1-1,...,1-4) relative to each other in one or more directions parallel to the surface for scanning of the surface with the probe tip; and monitoring motion of the probe tip relative to the scan head with a tip position detector during said scanning for obtaining an output signal; during said scanning, with the probe tip brought in contact with the surface of the sample, applying a first acoustic input signal comprising a signal component at a first frequency (f1, fc) to at least one of the probe or the semiconductor device (1-1,...,1-4, 26), wherein either according to a first option the first acoustic input signal is applied to the probe in absence of a further acoustic input signal, and wherein the first frequency is within a range of 0.01 megahertz to 100 megahertz, or wherein according to a second option during said scanning further a second acoustic input signal is applied to the semiconductor device that comprises a signal component at a second frequency; wherein the method further comprises: providing the output signal both to an analysis system and to a low pass filter; analyzing the output signal using the analysis system for mapping at least subsurface nanostructures (90,...,95) below the surface of the semiconductor device; filtering the output signal using the low-pass filter for providing a filtered output signal, providing the filtered output signal to a feedback controller, and analyzing a control signal of the feedback controller for mapping on-surface structures (80,...,85) on the surface; and determining the overlay error between the first patterned layer and the second patterned layer based on the mapped subsurface nanostructures (90,...,95) and the mapped on-surface structures (80,...,85). moving the probe tip and the semiconductor device (1-1,...,1-4) relative to each other in one or more directions parallel to the surface for scanning of the surface with the probe tip; and monitoring motion of the probe tip relative to the scan head with a tip position detector during said scanning for obtaining an output signal; during said scanning, with the probe tip brought in contact with the surface of the sample, applying a first acoustic input signal comprising a signal component at a first frequency (f1, fc) to at least one of the probe or the semiconductor device (1-1,...,1-4, 26), wherein either according to a first option the first acoustic input signal is applied to the probe in absence of a further acoustic input signal, and wherein the first frequency is within a range of 0.01 megahertz to 100 megahertz, or wherein according to a second option during said scanning further a second acoustic input signal is applied to the semiconductor device that comprises a signal component at a second frequency; providing the output signal both to an analysis system and to a low pass filter; analyzing the output signal using the analysis system for mapping at least subsurface nanostructures (90,...,95) below the surface of the semiconductor device; filtering the output signal using the low-pass filter for providing a filtered output signal, providing the filtered output signal to a feedback controller, and analyzing a control signal of the feedback controller for mapping on-surface structures (80,...,85) on the surface; and determining the overlay error between the first patterned layer and the second patterned layer based on the mapped subsurface nanostructures (90,...,95) and the mapped on-surface structures (80,...,85).