A device includes a lead configured to for use in applying an atrioventricular delay (“AVD”), an acceleration sensor adapted to output an endocardial acceleration signal, and circuitry configured to receive and process said endocardial acceleration signal to provide ventricular pacing by varying, in a controlled manner, the AVD in a range having a plurality of AVD values. The circuitry derives from said endocardial acceleration signal a value of a parameter representative of an component of the endocardial acceleration signal corresponding to the first endocardial acceleration peak associated with an isovolumetric ventricular contraction (“EAX component”), and evaluates a degree of variation of said parameter values as a function of said plurality of AVD values to detect atrial and ventricular events.